Exemplo n.º 1
0
 if (isset($params['id']) && $params['id']) {
     $p = (int) $params['id'];
     $icrs = new CourseDefn($p);
     $success = $icrs->load();
 } else {
     if (isset($params['terms'])) {
         $p = $params['terms'];
         $uni = 1;
         if (isset($params['university']) && $params['university']) {
             $uni = $params['university'];
         } else {
             if (isset($_SESSION['university']) && $_SESSION['university']) {
                 $uni = $_SESSION['university']['id'];
             }
         }
         $res = CourseDefn::ListAllStartingWithCode($p, 'code', $uni);
         if ($res && count($res) > 0) {
             $icrs = new CourseDefn(intval($res[0]['id']));
             $success = $icrs->load();
         }
     }
 }
 if (!$success) {
     Error::generate(Error::$PRIORITY['warn'], 'Course not found.');
     if (isset($_SESSION) && $_SESSION['last_rendered_page']) {
         redirect_raw($_SESSION['last_rendered_page']);
     } else {
         redirect();
     }
 } else {
     profiling_start('process description and/or get topics from db');