Instead of adding this to the functions.inc.php file, this should be a new method in the Course model (`library/Models/Course.php` and called like `Models_Course::getMyCourses($proxy_id)`.

```
public static getMyCourses($proxy_id = 0) {
// Contents of your function.
}
```