public function executeGetCourses(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     global $CFG;
     $CFG->current_app->requireMahara();
     $params = array();
     foreach (GcrCourseList::getParameterList() as $key => $value) {
         $params[$key] = $request->getParameter($key);
     }
     if (!$params['include_closed']) {
         if ($CFG->current_app->hasPrivilege('EschoolStaff')) {
             $params['include_closed'] = true;
         }
     }
     $course_list = new GcrCourseList($params, $CFG->current_app);
     $course_list_array = $course_list->toArray();
     $this->getResponse()->setHttpHeader('Content-type', 'application/json');
     return $this->renderText(json_encode($course_list_array));
 }