コード例 #1
0
ファイル: index.php プロジェクト: ritthai/LMS
     echo $contents;
     flush();
     session_write_close();
     // this will spinlock if the course is locked
     $job_taken = db_start_transaction("comments", $icrs->cid);
     $lock_acquired = true;
 } else {
     $lock_acquired = false;
 }
 if (!$exists && $job_taken) {
     // course not cached
     async_cache_connect(1);
     async_cache_connect(2);
     async_cache_connect(3);
     //Comment::enableInitMode();
     $procd_descr = process_description($icrs->descr);
     if (count($procd_descr) == 0) {
         $procd_descr[] = 'N/A';
     }
     $ids = $desicrs = $tagss = array();
     foreach ($procd_descr as $key => $topic) {
         // Cache topic
         $id = Comment::Create(array('subject' => $topic, 'type' => 2, 'id' => $icrs->cid));
         if ($topic == 'N/A') {
             // placeholder to indicate that there are no topics
             continue;
         }
         $procd_descr[$key] = array($id, $topic);
         // Cache topic result
         $tags = split('[,]', get_tags($icrs));
         $descr = $topic;
コード例 #2
0
ファイル: index.php プロジェクト: ritthai/LMS
/*foreach($ACTIONS as $key => $val)
	if($val->wasCalled())
		$action = $key;*/
/**	
	Identify course, populate fields
*/
if ($ACTIONS['search']->wasCalled()) {
    $params = $ACTIONS['search']->getParams();
    $gcourse_code = $gtitle = $params[0];
    $crs = new CourseDefn($gtitle);
    if (!$crs->load()) {
        Error::generate(Error::$PRIORITY['warn'], 'Course not found.');
    }
    $gdescr = $crs->descr;
    $tags = split('[,]', $gtags);
    $procd_descr = process_description($gdescr);
    foreach ($procd_descr as $descr) {
        array_push($search_results, array('subject' => $descr, 'google' => google_search($descr), 'youtube' => youtube_search($descr, $tags), 'itunesu' => itunesu_search($descr), 'khanacad' => khanacad_search($descr)));
    }
}
/* else if(isset($_POST['save_name'])) {
	$crs = new Course(	urlencode($_POST['save_name']), urlencode($_POST['course_prof']),
						$_SESSION['google'], $_SESSION['youtube']);
	$crs->save();
} else if(isset($_GET['course'])) {
	$crs = new Course($_GET['course'], $_GET['prof'], null, null);
	$crs->load();
	$_SESSION['google'] = $crs->goog_res;
	$_SESSION['youtube'] = $crs->youtube_res;
} else $first_load = true;
*/