本文整理汇总了PHP中Course::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::fetch方法的具体用法?PHP Course::fetch怎么用?PHP Course::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::fetch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchcourse
function fetchcourse($code)
{
$code = Course::code_normalize($code);
if (isset($coursecache[$code])) {
return $coursecache[$code];
}
return $coursecache[$code] = Course::fetch($code);
}
示例2: array_push
Goal is to find 5 courses that they haven't taken, and for which they have satisfied the prerequisites
Electives count as one course found, these are added to a list of electives but not scheduled
Courses for which the prerequisites are satisfied but are not immediately considered for scheduling are added to a list of alternatives
This algorithm also attempts to schedule concurrent prerequisites together
*/
for ($i = 0; $i < count($pattern); $i++) {
if ($found == 5) {
break;
}
if ($pattern[$i][1] != '0') {
array_push($electives, $pattern[$i]);
$found++;
continue;
}
$course = Course::fetch($pattern[$i][0]);
if (count($course->unsatisfied_prerequisites($completed_as_courses, $scheduling)) == 0) {
array_push($scheduling, $course);
$found++;
} else {
array_push($discarded, $course);
continue;
}
//Check and see if we can fit the discarded courses in now
foreach ($discarded as $key => $tryagain) {
if (isset($tryagain)) {
if (count($tryagain->unsatisfied_prerequisites($completed_as_courses, $scheduling)) == 0) {
array_push($scheduling, $tryagain);
$found++;
unset($discarded[$key]);
}
示例3: WebPage
<?php
session_start();
define("CONST_FILE_PATH", "../includes/constants.php");
include '../classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage();
//Create new instance of webPage class
$dbObj = new Database();
//Instantiate database
$courseObj = new Course($dbObj);
// Create an object of Course class
$errorArr = array();
//Array of errors
//fetch all courses
header('Content-type: application/json');
echo $courseObj->fetch();