本文整理匯總了PHP中lesson_print_header函數的典型用法代碼示例。如果您正苦於以下問題:PHP lesson_print_header函數的具體用法?PHP lesson_print_header怎麽用?PHP lesson_print_header使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了lesson_print_header函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add_to_log
$newhighscore->userid = $USER->id;
$newhighscore->gradeid = $newgrade->id;
$newhighscore->nickname = $name;
$DB->insert_record('lesson_high_scores', $newhighscore);
// Log it
add_to_log($course->id, 'lesson', 'update highscores', "highscores.php?id={$cm->id}", $name, $cm->id);
lesson_set_message(get_string('postsuccess', 'lesson'), 'notifysuccess');
redirect("{$CFG->wwwroot}/mod/lesson/highscores.php?id={$cm->id}&link=1");
} else {
print_error('invalidformdata');
}
break;
}
// Log it
add_to_log($course->id, 'lesson', 'view highscores', "highscores.php?id={$cm->id}", $lesson->name, $cm->id);
lesson_print_header($cm, $course, $lesson, 'highscores');
switch ($mode) {
case 'add':
print_simple_box_start('center');
echo '<div class="mdl-align">
<form id="nickname" method ="post" action="' . $CFG->wwwroot . '/mod/lesson/highscores.php" autocomplete="off">
<input type="hidden" name="id" value="' . $cm->id . '" />
<input type="hidden" name="mode" value="save" />
<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo get_string("entername", "lesson") . ": <input type=\"text\" name=\"name\" size=\"7\" maxlength=\"5\" />\n<p>\n";
lesson_print_submit_link(get_string("submitname", "lesson"), 'nickname');
echo "</p>\n</form>\n</div>\n";
print_simple_box_end();
break;
default:
$params = array("lessonid" => $lesson->id);
示例2: addslashes
$attempt->useranswer = addslashes(serialize($essayinfo));
update_record('lesson_attempts', $attempt);
// Log it
add_to_log($course->id, 'lesson', 'update email essay grade', "essay.php?id={$cm->id}", format_string($pages[$attempt->pageid]->title, true) . ': ' . fullname($users[$attempt->userid]), $cm->id);
} else {
error('Emailing Failed');
}
}
}
lesson_set_message(get_string('emailsuccess', 'lesson'), 'notifysuccess');
redirect("{$CFG->wwwroot}/mod/lesson/essay.php?id={$cm->id}");
break;
}
// Log it
add_to_log($course->id, 'lesson', 'view grade', "essay.php?id={$cm->id}", get_string('manualgrading', 'lesson'), $cm->id);
lesson_print_header($cm, $course, $lesson, 'essay');
switch ($mode) {
case 'display':
// Expects $user, $essayattempts and $pages to be set already
// Group all the essays by userid
$studentessays = array();
foreach ($essayattempts as $essay) {
// Not very nice :) but basically
// this organizes the essays so we know how many
// times a student answered an essay per try and per page
$studentessays[$essay->userid][$essay->pageid][$essay->retry][] = $essay;
}
// Setup table
$table = new stdClass();
$table->head = array($course->students, get_string('essays', 'lesson'), get_string('email', 'lesson'));
$table->align = array('left', 'left', 'left');
示例3: list
}
list($cm, $course, $lesson) = lesson_get_basics($id);
if ($firstpage = get_record('lesson_pages', 'lessonid', $lesson->id, 'prevpageid', 0)) {
if (!($pages = get_records('lesson_pages', 'lessonid', $lesson->id))) {
error('Could not find lesson pages');
}
}
if ($pageid) {
if (!($singlepage = get_record('lesson_pages', 'id', $pageid))) {
error('Could not find page ID: ' . $pageid);
}
}
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/lesson:manage', $context);
lesson_print_header($cm, $course, $lesson, $mode);
if (empty($firstpage)) {
// There are no pages; give teacher some options
if (has_capability('mod/lesson:edit', $context)) {
print_simple_box("<table cellpadding=\"5\" border=\"0\">\n<tr><th scope=\"col\">" . get_string("whatdofirst", "lesson") . "</th></tr><tr><td>" . "<a href=\"import.php?id={$cm->id}&pageid=0\">" . get_string("importquestions", "lesson") . "</a></td></tr><tr><td>" . "<a href=\"importppt.php?id={$cm->id}&pageid=0\">" . get_string("importppt", "lesson") . "</a></td></tr><tr><td>" . "<a href=\"lesson.php?id={$cm->id}&action=addbranchtable&pageid=0&firstpage=1\">" . get_string("addabranchtable", "lesson") . "</a></td></tr><tr><td>" . "<a href=\"lesson.php?id={$cm->id}&action=addpage&pageid=0&firstpage=1\">" . get_string("addaquestionpage", "lesson") . "</a></td></tr></table>\n", 'center', '20%');
}
} else {
// Set some standard variables
$pageid = $firstpage->id;
$prevpageid = 0;
$npages = count($pages);
switch ($mode) {
case 'collapsed':
$table = new stdClass();
$table->head = array(get_string('pagetitle', 'lesson'), get_string('qtype', 'lesson'), get_string('jumps', 'lesson'), get_string('actions', 'lesson'));
$table->align = array('left', 'left', 'left', 'center');
示例4: lesson_set_message
$modifier++;
}
}
lesson_set_message(get_string('attemptsdeleted', 'lesson'), 'notifysuccess');
}
}
if (!($attempts = get_records('lesson_attempts', 'lessonid', $lesson->id, 'timeseen'))) {
$nothingtodisplay = true;
}
if (!($grades = get_records('lesson_grades', 'lessonid', $lesson->id, 'completed'))) {
$grades = array();
}
if (!($times = get_records('lesson_timer', 'lessonid', $lesson->id, 'starttime'))) {
$times = array();
}
lesson_print_header($cm, $course, $lesson, $action);
if ($nothingtodisplay) {
notify(get_string('nolessonattempts', 'lesson'));
print_footer($course);
exit;
}
/**************************************************************************
this action is for default view and overview view
**************************************************************************/
if ($action == 'reportoverview') {
$studentdata = array();
// build an array for output
foreach ($attempts as $attempt) {
// if the user is not in the array or if the retry number is not in the sub array, add the data for that try.
if (!array_key_exists($attempt->userid, $studentdata) || !array_key_exists($attempt->retry, $studentdata[$attempt->userid])) {
// restore/setup defaults
示例5: unset
// Update the clock / get time information for this user
if (!has_capability('mod/lesson:manage', $context)) {
unset($USER->startlesson[$lesson->id]);
if (!($timer = get_records_select('lesson_timer', "lessonid = {$lesson->id} AND userid = {$USER->id}", 'starttime'))) {
error('Error: could not find records');
} else {
$timer = array_pop($timer);
// this will get the latest start time record
}
$timer->lessontime = time();
if (!update_record("lesson_timer", $timer)) {
error("Error: could not update lesson_timer table");
}
}
add_to_log($course->id, "lesson", "end", "view.php?id={$cm->id}", "{$lesson->id}", $cm->id);
lesson_print_header($cm, $course, $lesson, 'view');
print_heading(get_string("congratulations", "lesson"));
print_simple_box_start("center");
$ntries = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id);
if (isset($USER->modattempts[$lesson->id])) {
$ntries--;
// need to look at the old attempts :)
}
if (!has_capability('mod/lesson:manage', $context)) {
$gradeinfo = lesson_grade($lesson, $ntries);
if ($gradeinfo->attempts) {
if (!$lesson->custom) {
echo "<p style=\"text-align:center;\">" . get_string("numberofpagesviewed", "lesson", $gradeinfo->nquestions) . "</p>\n";
if ($lesson->minquestions) {
if ($gradeinfo->nquestions < $lesson->minquestions) {
// print a warning and set nviewed to minquestions
示例6: redirect
}
}
if ($nodefaultresponse) {
// Don't display feedback
redirect("{$CFG->wwwroot}/mod/lesson/view.php?id={$cm->id}&pageid={$newpageid}");
}
/// Set Messages
// This is the warning msg for teachers to inform them that cluster and unseen does not work while logged in as a teacher
if (has_capability('mod/lesson:manage', $context) and lesson_display_teacher_warning($lesson->id)) {
$warningvars->cluster = get_string("clusterjump", "lesson");
$warningvars->unseen = get_string("unseenpageinbranch", "lesson");
lesson_set_message(get_string("teacherjumpwarning", "lesson", $warningvars));
}
// Inform teacher that s/he will not see the timer
if ($lesson->timed and has_capability('mod/lesson:manage', $context)) {
lesson_set_message(get_string("teachertimerwarning", "lesson"));
}
// Report attempts remaining
if ($attemptsremaining != 0) {
lesson_set_message(get_string('attemptsremaining', 'lesson', $attemptsremaining));
}
// Report if max attempts reached
if ($maxattemptsreached != 0) {
lesson_set_message('(' . get_string("maximumnumberofattemptsreached", "lesson") . ')');
}
$PAGE->set_url('mod/lesson/view.php', array('id' => $cm->id, 'pageid' => $page->id));
$PAGE->set_subpage($page->id);
/// Print the header, heading and tabs
lesson_add_pretend_blocks($PAGE, $cm, $lesson, $timer);
lesson_print_header($cm, $course, $lesson, 'view', true, $page->id);
include dirname(__FILE__) . '/continue.html';