Exemplo n.º 1
0
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;
*/
$args = array('pagetitle' => 'Homepage', 'pageurl' => $_SERVER['REQUEST_URI'], 'course' => array('title' => $gtitle, 'code' => $gcourse_code, 'descr' => $gdescr), 'courses' => CourseDefn::ListAll(), 'searchresults' => $search_results, 'actions' => $ACTIONS);
if ($CONFIG['debug']) {
    $args['pageurl'] .= ' - Debugging Mode';
}
eval("?>" . file_get_contents("views/index.view.php"));
database_close();
Exemplo n.º 2
0
                                                         switch ($action) {
                                                             case 'search':
                                                             case 'list':
                                                             case 'contact':
                                                             case 'privacy':
                                                             case 'terms':
                                                             case 'about':
                                                                 include "views/{$action}.view.php";
                                                                 break;
                                                             default:
                                                                 Error::generate('suspicious', "Invalid action {$action} in /course/ : {$_SERVER['REQUEST_URI']}");
                                                                 redirect_raw($PAGE_REL_URL);
                                                                 break;
                                                         }
                                                     } else {
                                                         $args = array('pagetitle' => 'Welcome', 'pageurl' => $_SERVER['REQUEST_URI'], 'courses' => CourseDefn::ListAll(), 'actions' => $ACTIONS);
                                                         include "views/index.view.php";
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
<?php

@(include "{$ROOT}/includes/tags.inc");
@(include "dataacquisition/google.util.php");
@(include "dataacquisition/youtube.util.php");
@(include "dataacquisition/itunesu.util.php");
@(include "dataacquisition/khanacad.util.php");
@(include "{$ROOT}/includes/subjects.inc");
@(include "{$ROOT}/includes/universities.inc");
@(include "{$ROOT}/includes/geography.inc");
db_connect();
Error::showSeparator();
Error::generate('debug', 'Starting preload process');
Error::showSeparator();
foreach (CourseDefn::ListAll() as $crs) {
    Error::showSeparator();
    Error::generate('debug', 'Preloading ' . $crs->university . ': ' . $crs->code);
    // TODO: preload
    Error::showSeparator();
}
Error::showSeparator();
Error::generate('debug', 'Ending preload process');
Error::showSeparator();