当前位置: 首页>>代码示例>>PHP>>正文


PHP lesson_set_message函数代码示例

本文整理汇总了PHP中lesson_set_message函数的典型用法代码示例。如果您正苦于以下问题:PHP lesson_set_message函数的具体用法?PHP lesson_set_message怎么用?PHP lesson_set_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了lesson_set_message函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_string

$newpage->prevpageid = $pageid;
if ($pageid != 0) {
    $newpage->nextpageid = $page->nextpageid;
} else {
    $newpage->nextpageid = $page->id;
}
$newpage->qtype = LESSON_CLUSTER;
$newpage->timecreated = $timenow;
$newpage->title = get_string("clustertitle", "lesson");
$newpage->contents = get_string("clustertitle", "lesson");
$newpageid = $DB->insert_record("lesson_pages", $newpage);
// update the linked list...
if ($pageid != 0) {
    $DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid));
}
if ($pageid == 0) {
    $page->nextpageid = $page->id;
}
if ($page->nextpageid) {
    // the new page is not the last page
    $DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid));
}
// ..and the single "answer"
$newanswer = new stdClass();
$newanswer->lessonid = $lesson->id;
$newanswer->pageid = $newpageid;
$newanswer->timecreated = $timenow;
$newanswer->jumpto = LESSON_CLUSTERJUMP;
$newanswerid = $DB->insert_record("lesson_answers", $newanswer);
lesson_set_message(get_string('addedcluster', 'lesson'), 'notifysuccess');
redirect("{$CFG->wwwroot}/mod/lesson/edit.php?id={$cm->id}");
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:addcluster.php

示例2: array

                            if ($highscore->grade == $lowscore) {
                                $DB->delete_records('lesson_high_scores', array('id' => $highscore->id));
                            }
                        }
                    }
                }
            }
            $newhighscore = new stdClass();
            $newhighscore->lessonid = $lesson->id;
            $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 . '" />
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:highscores.php

示例3: get_string

    $newpage->qtype = LESSON_ENDOFBRANCH;
    $newpage->timecreated = $timenow;
    $newpage->title = get_string("endofbranch", "lesson");
    $newpage->contents = get_string("endofbranch", "lesson");
    if (!($newpageid = insert_record("lesson_pages", $newpage))) {
        error("Insert page: new page not inserted");
    }
    // update the linked list...
    if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
        error("Add end of branch: unable to update link");
    }
    if ($page->nextpageid) {
        // the new page is not the last page
        if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
            error("Insert page: unable to update previous link");
        }
    }
    // ..and the single "answer"
    $newanswer = new stdClass();
    $newanswer->lessonid = $lesson->id;
    $newanswer->pageid = $newpageid;
    $newanswer->timecreated = $timenow;
    $newanswer->jumpto = $btpageid;
    if (!($newanswerid = insert_record("lesson_answers", $newanswer))) {
        error("Add end of branch: answer record not inserted");
    }
    lesson_set_message(get_string('addedanendofbranch', 'lesson'), 'notifysuccess');
} else {
    lesson_set_message(get_string('nobranchtablefound', 'lesson'));
}
redirect("{$CFG->wwwroot}/mod/lesson/edit.php?id={$cm->id}");
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:addendofbranch.php

示例4: get_string

                $message = get_string('essayemailmessage', 'lesson', $a);
                $plaintxt = format_text_email($message, FORMAT_HTML);
                // Subject
                $subject = get_string('essayemailsubject', 'lesson', format_string($pages[$attempt->pageid]->title, true));
                if (email_to_user($users[$attempt->userid], $USER, $subject, $plaintxt, $message)) {
                    $essayinfo->sent = 1;
                    $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
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:essay.php

示例5: stdClass

                } else {
                    $oldanswer = new stdClass();
                    $oldanswer->id = clean_param($form->answerid[$i], PARAM_INT);
                    if (!isset($form->answereditor[$i])) {
                        $form->answereditor[$i] = 0;
                    }
                    if (!isset($form->responseeditor[$i])) {
                        $form->responseeditor[$i] = 0;
                    }
                    $oldanswer->flags = $form->answereditor[$i] * LESSON_ANSWER_EDITOR + $form->responseeditor[$i] * LESSON_RESPONSE_EDITOR;
                    $oldanswer->timemodified = $timenow;
                    $oldanswer->answer = NULL;
                    $DB->update_record("lesson_answers", $oldanswer);
                }
            } elseif (!empty($form->answerid[$i])) {
                // need to delete blanked out answer
                $DB->delete_records("lesson_answers", array("id" => clean_param($form->answerid[$i], PARAM_INT)));
            }
        }
    }
}
if ($form->redisplay) {
    redirect("{$CFG->wwwroot}/mod/lesson/lesson.php?id={$cm->id}&amp;action=editpage&amp;pageid={$page->id}&amp;redirect={$redirect}");
}
lesson_set_message(get_string('updatedpage', 'lesson') . ': ' . format_string($page->title, true), 'notifysuccess');
if ($redirect == 'navigation') {
    // takes us back to viewing the page
    redirect("{$CFG->wwwroot}/mod/lesson/view.php?id={$cm->id}&amp;pageid={$page->id}");
} else {
    redirect("{$CFG->wwwroot}/mod/lesson/edit.php?id={$cm->id}");
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:updatepage.php

示例6: redirect

if ($nodefaultresponse) {
    // Don't display feedback
    redirect("{$CFG->wwwroot}/mod/lesson/view.php?id={$cm->id}&amp;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 = page_create_object('mod-lesson-view', $lesson->id);
$PAGE->set_lessonpageid($page->id);
$pageblocks = blocks_setup($PAGE);
$leftcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
$rightcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
/// Print the header, heading and tabs
$PAGE->print_header();
include dirname(__FILE__) . '/continue.html';
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:continue.php

示例7: error

    error("Moveit: unable to update link");
}
// fourth step. insert page to be moved in new place...
if (!($nextpageid = get_field("lesson_pages", "nextpageid", "id", $after))) {
    error("Movit: nextpageid not found");
}
if (!set_field("lesson_pages", "nextpageid", $pageid, "id", $after)) {
    error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "prevpageid", $pageid, "id", $nextpageid)) {
    error("Moveit: unable to update link");
}
// ...and set the links in the moved page
if (!set_field("lesson_pages", "prevpageid", $after, "id", $pageid)) {
    error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "nextpageid", $nextpageid, "id", $pageid)) {
    error("Moveit: unable to update link");
}
// fifth step. break the ring
if (!($newlastpageid = get_field("lesson_pages", "prevpageid", "id", $newfirstpageid))) {
    error("Moveit: newlastpageid not found");
}
if (!set_field("lesson_pages", "prevpageid", 0, "id", $newfirstpageid)) {
    error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "nextpageid", 0, "id", $newlastpageid)) {
    error("Moveit: unable to update link");
}
lesson_set_message(get_string('movedpage', 'lesson'), 'notifysuccess');
redirect("{$CFG->wwwroot}/mod/lesson/edit.php?id={$cm->id}");
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:31,代码来源:moveit.php

示例8: get_field_sql

                /// Remove the grade from the grades and high_scores tables
                $gradeid = get_field_sql("SELECT id FROM {$CFG->prefix}lesson_grades \n                                              WHERE userid = {$userid} AND lessonid = {$lesson->id} \n                                              ORDER BY completed", $try, 1);
                delete_records('lesson_grades', 'id', $gradeid);
                delete_records('lesson_high_scores', 'gradeid', $gradeid, 'lessonid', $lesson->id, 'userid', $userid);
                /// Remove attempts and update the retry number
                delete_records('lesson_attempts', 'userid', $userid, 'lessonid', $lesson->id, 'retry', $try);
                execute_sql("UPDATE {$CFG->prefix}lesson_attempts SET retry = retry - 1 WHERE userid = {$userid} AND lessonid = {$lesson->id} AND retry > {$try}", false);
                /// Remove seen branches and update the retry number
                delete_records('lesson_branch', 'userid', $userid, 'lessonid', $lesson->id, 'retry', $try);
                execute_sql("UPDATE {$CFG->prefix}lesson_branch SET retry = retry - 1 WHERE userid = {$userid} AND lessonid = {$lesson->id} AND retry > {$try}", false);
                /// update central gradebook
                lesson_update_grades($lesson, $userid);
                $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);
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:report.php

示例9: count_records

     if ($lesson->minquestions and !has_capability('mod/lesson:manage', $context)) {
         // tell student how many questions they have seen, how many are required and their grade
         $ntries = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id);
         $gradeinfo = lesson_grade($lesson, $ntries);
         if ($gradeinfo->attempts) {
             if ($gradeinfo->nquestions < $lesson->minquestions) {
                 $a = new stdClass();
                 $a->nquestions = $gradeinfo->nquestions;
                 $a->minquestions = $lesson->minquestions;
                 lesson_set_message(get_string('numberofpagesviewednotice', 'lesson', $a));
             }
             lesson_set_message(get_string("numberofcorrectanswers", "lesson", $gradeinfo->earned), 'notify');
             $a = new stdClass();
             $a->grade = number_format($gradeinfo->grade * $lesson->grade / 100, 1);
             $a->total = $lesson->grade;
             lesson_set_message(get_string('yourcurrentgradeisoutof', 'lesson', $a), 'notify');
         }
     }
 }
 $PAGE = page_create_instance($lesson->id);
 $PAGE->set_lessonpageid($page->id);
 $pageblocks = blocks_setup($PAGE);
 $leftcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
 $rightcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
 if ($edit != -1 and $PAGE->user_allowed_editing()) {
     $USER->editing = $edit;
 }
 /// Print the page header, heading and tabs
 $PAGE->print_header();
 if ($attemptflag) {
     print_heading(get_string('attempt', 'lesson', $retries + 1));
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:view.php


注:本文中的lesson_set_message函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。