本文整理汇总了PHP中Course::refresh方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::refresh方法的具体用法?PHP Course::refresh怎么用?PHP Course::refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::refresh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_course
/**
* @brief create course
* @param type $public_code
* @param type $lang
* @param type $title
* @param string $description
* @param array $departments
* @param type $vis
* @param type $prof
* @param type $password
* @return boolean
*/
function create_course($public_code, $lang, $title, $description, $departments, $vis, $prof, $password = '') {
$code = strtoupper(new_code($departments[0]));
if (!create_course_dirs($code)) {
return false;
}
if (!$public_code) {
$public_code = $code;
}
$q = Database::get()->query("INSERT INTO course
SET code = ?s,
lang = ?s,
title = ?s,
keywords = '',
description = ?s,
visible = ?d,
prof_names = ?s,
public_code = ?s,
created = " . DBHelper::timeAfter() . ",
password = ?s,
glossary_expand = 0,
glossary_index = 1", $code, $lang, $title, $description, $vis, $prof, $public_code, $password);
if ($q) {
$course_id = $q->lastInsertID;
} else {
return false;
}
require_once 'include/lib/course.class.php';
$course = new Course();
$course->refresh($course_id, $departments);
return array($code, $course_id);
}
示例2: intval
status = 1,
tutor = 1,
reg_date = " . DBHelper::timeAfter() . ",
document_timestamp = " . DBHelper::timeAfter() . "",
intval($new_course_id), intval($uid));
Database::get()->query("INSERT INTO group_properties SET
course_id = ?d,
self_registration = 1,
multiple_registration = 0,
forum = 1,
private_forum = 0,
documents = 1,
wiki = 0,
agenda = 0", intval($new_course_id));
$course->refresh($new_course_id, $departments);
// create courses/<CODE>/index.php
course_index($code);
// add a default forum category
Database::get()->query("INSERT INTO forum_category
SET cat_title = ?s,
course_id = ?d", $langForumDefaultCat, $new_course_id);
$_SESSION['courses'][$code] = USER_TEACHER;
$tool_content .= "<div class='alert alert-success'><b>$langJustCreated:</b> " . q($title) . "<br>
<span class='smaller'>$langEnterMetadata</span></div>";
$tool_content .= action_bar(array(
array('title' => $langEnter,
示例3: foreach
if (isDepartmentAdmin()) {
$olddeps = $course->getDepartmentIds($cId);
foreach ($departments as $depId) {
if (!in_array($depId, $olddeps)) {
validateNode(intval($depId), true);
}
}
foreach ($olddeps as $depId) {
if (!in_array($depId, $departments)) {
validateNode($depId, true);
}
}
}
// Update query
Database::get()->query("UPDATE course SET title = ?s,\n prof_names = ?s\n WHERE code = ?s", $_POST['title'], $_POST['titulary'], $_GET['c']);
$course->refresh($cId, $departments);
$tool_content .= "<div class='alert alert-success'>{$langModifDone}</div>";
} else {
$row = Database::get()->querySingle("SELECT course.code AS code, course.title AS title, course.prof_names AS prof_name, course.id AS id\n FROM course\n WHERE course.code = ?s", $_GET['c']);
$tool_content .= "<div class='form-wrapper'>\n\t<form role='form' class='form-horizontal' action='" . $_SERVER['SCRIPT_NAME'] . "?c=" . q($_GET['c']) . "' method='post' onsubmit='return validateNodePickerForm();'>\n\t<fieldset>\n <div class='form-group'>\n\t <label for='Faculty' class='col-sm-2 control-label'>{$langFaculty}:</label>\n <div class='col-sm-10'>";
if (isDepartmentAdmin()) {
list($js, $html) = $tree->buildCourseNodePicker(array('defaults' => $course->getDepartmentIds($row->id), 'allowables' => $user->getDepartmentIds($uid)));
} else {
list($js, $html) = $tree->buildCourseNodePicker(array('defaults' => $course->getDepartmentIds($row->id)));
}
$head_content .= $js;
$tool_content .= $html;
$tool_content .= "</div></div>";
$tool_content .= "<div class='form-group'>\n <label for='fcode' class='col-sm-2 control-label'>{$langCode}</label>\n <div class='col-sm-10'>\n <input type='text' class='form-control' name='fcode' id='fcode' value='{$row->code}' size='60' />\n </div>\n </div>\n <div class='form-group'>\n <label for='title' class='col-sm-2 control-label'>{$langCourseTitle}:</label>\n <div class='col-sm-10'>\n\t\t<input type='text' class='form-control' name='title' id='title' value='" . q($row->title) . "' size='60' />\n\t </div>\n </div>\n <div class='form-group'>\n <label for='titulary' class='col-sm-2 control-label'>{$langTeachers}:</label>\n <div class='col-sm-10'>\n\t\t<input type='text' class='form-control' name='titulary' id='titulary' value='" . q($row->prof_name) . "' size='60' />\n\t </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-10 col-sm-offset-4'>\n <input class='btn btn-primary' type='submit' name='submit' value='{$langModify}'>\n </div>\n </div>\n </fieldset>\n\t</form>\n </div>";
}
draw($tool_content, 3, null, $head_content);