Exemplo n.º 1
0
     $arr = Area::ListAllMatching(isset($params['country']) ? $params['country'] : false, $val);
     foreach ($arr as $k => $v) {
         $arr[$k] = array($v['id'], $v['name'], "{$v['country_name']}");
     }
     break;
 case 'universities':
     $arr = University::ListAllMatching(isset($params['area']) ? $params['area'] : false, isset($params['country']) ? $params['country'] : false, $val);
     foreach ($arr as $k => $v) {
         $arr[$k] = array($v['id'], $v['name'], "{$v['area_name']}, {$v['country_name']}");
     }
     break;
 case 'courses':
     // TODO: This is not safe for multiple universities.
     $arr = array();
     //$lst = CourseDefn::ListAllStartingWithTitle($val);
     $lst = CourseDefn::ListAllContainingTitle($val);
     foreach ($lst as $elem) {
         // id, code, title, descr, university
         $arr[] = array($elem['id'], $elem['title'], $elem['code']);
     }
     $lst = CourseDefn::ListAllStartingWithCode($val);
     foreach ($lst as $elem) {
         // id, code, title, descr, university
         $arr[] = array($elem['id'], $elem['code'], $elem['title']);
     }
     break;
     // TODO: decide if it's okay to do this, especially without auth
 // TODO: decide if it's okay to do this, especially without auth
 case 'users':
     $lst = User::ListAllStartingWithName($val);
     $arr = array();