Esempio n. 1
0
<?php
$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require_once WEBROOT . "page_builder/page_header.php";
require_once LIBDIR . "StellarData.php";
require_once WEBROOT . "stellar/stellar_lib.php";

$class_id = $_REQUEST['id'];
$class = StellarData::get_subject_info($class_id);
$term = StellarData::get_term_text();
$term_id = StellarData::get_term();

$tabs = new Tabs(selfURL(), 'tab', array('News', 'Info', 'Staff'));

$back = $_REQUEST['back'];

/* My Stellar actions */
$mystellar = getMyStellar()->allTags;
$class_data = $class_id . " " . $term_id;

if(in_array($class_data, $mystellar)) { 
  $toggle = "ms_on";
  $mystellar_img = 'mystellar-on';
  $action = 'remove';
} elseif (!in_array($class_data, $mystellar)) {
  $toggle = "ms_off";
  $mystellar_img = 'mystellar-off';
  $action = 'add';
}
      $info['term'] = StellarData::get_term();
      $data[] = $info;
    }
    if(isset($_REQUEST['checksum'])) {
      $checksum = md5(json_encode($data));
      if(isset($_REQUEST['full'])) {
        $data = array('checksum' => $checksum, 'classes' => $data);
      } else {
        $data = array('checksum' => $checksum);
      }
    }
    break;

  case 'subjectInfo':
    $subjectId = urldecode($_REQUEST['id']);
    $data = StellarData::get_subject_info($subjectId);
    if($data) {
      $data['announcements'] = StellarData::get_announcements($subjectId);
      
      // some classes dont have stellar announcements
      if($data['announcements'] === False) {
	unset($data['announcements']);
      }

      $data['term'] = StellarData::get_term();
    } else {
      $data = array('error' => 'SubjectNotFound', 'message' => 'Stellar could not find this subject'); 
    }
    break;

  case 'search':