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


PHP lesson::load_page方法代码示例

本文整理汇总了PHP中lesson::load_page方法的典型用法代码示例。如果您正苦于以下问题:PHP lesson::load_page方法的具体用法?PHP lesson::load_page怎么用?PHP lesson::load_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lesson的用法示例。


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

示例1: delete

 /**
  * Deletes a lesson_page from the database as well as any associated records.
  * @final
  * @return bool
  */
 public final function delete()
 {
     global $DB;
     // first delete all the associated records...
     $DB->delete_records("lesson_attempts", array("pageid" => $this->properties->id));
     // ...now delete the answers...
     $DB->delete_records("lesson_answers", array("pageid" => $this->properties->id));
     // ..and the page itself
     $DB->delete_records("lesson_pages", array("id" => $this->properties->id));
     // Delete files associated with this page.
     $cm = get_coursemodule_from_instance('lesson', $this->lesson->id, $this->lesson->course);
     $context = context_module::instance($cm->id);
     $fs = get_file_storage();
     $fs->delete_area_files($context->id, 'mod_lesson', 'page_contents', $this->properties->id);
     $fs->delete_area_files($context->id, 'mod_lesson', 'page_answers', $this->properties->id);
     $fs->delete_area_files($context->id, 'mod_lesson', 'page_responses', $this->properties->id);
     // repair the hole in the linkage
     if (!$this->properties->prevpageid && !$this->properties->nextpageid) {
         //This is the only page, no repair needed
     } elseif (!$this->properties->prevpageid) {
         // this is the first page...
         $page = $this->lesson->load_page($this->properties->nextpageid);
         $page->move(null, 0);
     } elseif (!$this->properties->nextpageid) {
         // this is the last page...
         $page = $this->lesson->load_page($this->properties->prevpageid);
         $page->move(0);
     } else {
         // page is in the middle...
         $prevpage = $this->lesson->load_page($this->properties->prevpageid);
         $nextpage = $this->lesson->load_page($this->properties->nextpageid);
         $prevpage->move($nextpage->id);
         $nextpage->move(null, $prevpage->id);
     }
     return true;
 }
开发者ID:nikitskynikita,项目名称:moodle,代码行数:41,代码来源:locallib.php

示例2: delete

    /**
     * Deletes a lesson_page from the database as well as any associated records.
     * @final
     * @return bool
     */
    final public function delete() {
        global $DB;
        // first delete all the associated records...
        $DB->delete_records("lesson_attempts", array("pageid" => $this->properties->id));
        // ...now delete the answers...
        $DB->delete_records("lesson_answers", array("pageid" => $this->properties->id));
        // ..and the page itself
        $DB->delete_records("lesson_pages", array("id" => $this->properties->id));

        // repair the hole in the linkage
        if (!$this->properties->prevpageid && !$this->properties->nextpageid) {
            //This is the only page, no repair needed
        } elseif (!$this->properties->prevpageid) {
            // this is the first page...
            $page = $this->lesson->load_page($this->properties->nextpageid);
            $page->move(null, 0);
        } elseif (!$this->properties->nextpageid) {
            // this is the last page...
            $page = $this->lesson->load_page($this->properties->prevpageid);
            $page->move(0);
        } else {
            // page is in the middle...
            $prevpage = $this->lesson->load_page($this->properties->prevpageid);
            $nextpage = $this->lesson->load_page($this->properties->nextpageid);

            $prevpage->move($nextpage->id);
            $nextpage->move(null, $prevpage->id);
        }
        return true;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:35,代码来源:locallib.php

示例3: delete

 /**
  * Deletes a lesson_page from the database as well as any associated records.
  * @final
  * @return bool
  */
 public final function delete()
 {
     global $DB;
     $cm = get_coursemodule_from_instance('lesson', $this->lesson->id, $this->lesson->course);
     $context = context_module::instance($cm->id);
     // Delete files associated with attempts.
     $fs = get_file_storage();
     if ($attempts = $DB->get_records('lesson_attempts', array("pageid" => $this->properties->id))) {
         foreach ($attempts as $attempt) {
             $fs->delete_area_files($context->id, 'mod_lesson', 'essay_responses', $attempt->id);
         }
     }
     // Then delete all the associated records...
     $DB->delete_records("lesson_attempts", array("pageid" => $this->properties->id));
     $DB->delete_records("lesson_branch", array("pageid" => $this->properties->id));
     // ...now delete the answers...
     $DB->delete_records("lesson_answers", array("pageid" => $this->properties->id));
     // ..and the page itself
     $DB->delete_records("lesson_pages", array("id" => $this->properties->id));
     // Trigger an event: page deleted.
     $eventparams = array('context' => $context, 'objectid' => $this->properties->id, 'other' => array('pagetype' => $this->get_typestring()));
     $event = \mod_lesson\event\page_deleted::create($eventparams);
     $event->add_record_snapshot('lesson_pages', $this->properties);
     $event->trigger();
     // Delete files associated with this page.
     $fs->delete_area_files($context->id, 'mod_lesson', 'page_contents', $this->properties->id);
     $fs->delete_area_files($context->id, 'mod_lesson', 'page_answers', $this->properties->id);
     $fs->delete_area_files($context->id, 'mod_lesson', 'page_responses', $this->properties->id);
     // repair the hole in the linkage
     if (!$this->properties->prevpageid && !$this->properties->nextpageid) {
         //This is the only page, no repair needed
     } elseif (!$this->properties->prevpageid) {
         // this is the first page...
         $page = $this->lesson->load_page($this->properties->nextpageid);
         $page->move(null, 0);
     } elseif (!$this->properties->nextpageid) {
         // this is the last page...
         $page = $this->lesson->load_page($this->properties->prevpageid);
         $page->move(0);
     } else {
         // page is in the middle...
         $prevpage = $this->lesson->load_page($this->properties->prevpageid);
         $nextpage = $this->lesson->load_page($this->properties->nextpageid);
         $prevpage->move($nextpage->id);
         $nextpage->move(null, $prevpage->id);
     }
     return true;
 }
开发者ID:mongo0se,项目名称:moodle,代码行数:53,代码来源:locallib.php

示例4: array

$url = new moodle_url('/mod/lesson/lesson.php', array('id'=>$id,'action'=>$action));
$PAGE->set_url($url);

$context = context_module::instance($cm->id);
require_capability('mod/lesson:edit', $context);
require_sesskey();

$lessonoutput = $PAGE->get_renderer('mod_lesson');

/// Process the action
switch ($action) {
    case 'confirmdelete':
        $PAGE->navbar->add(get_string($action, 'lesson'));

        $thispage = $lesson->load_page($pageid);

        echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('deletingpage', 'lesson', format_string($thispage->title)));
        echo $OUTPUT->heading(get_string("deletingpage", "lesson", format_string($thispage->title)));
        // print the jumps to this page
        $params = array("lessonid" => $lesson->id, "pageid" => $pageid);
        if ($answers = $DB->get_records_select("lesson_answers", "lessonid = :lessonid AND jumpto = :pageid + 1", $params)) {
            echo $OUTPUT->heading(get_string("thefollowingpagesjumptothispage", "lesson"));
            echo "<p align=\"center\">\n";
            foreach ($answers as $answer) {
                if (!$title = $DB->get_field("lesson_pages", "title", array("id" => $answer->pageid))) {
                    print_error('cannotfindpagetitle', 'lesson');
                }
                echo $title."<br />\n";
            }
        }
开发者ID:JP-Git,项目名称:moodle,代码行数:30,代码来源:lesson.php

示例5: redirect

    $url->param('mode', $mode);
}
$PAGE->set_url($url);

/// Handle any preprocessing before header is printed - based on $mode
switch ($mode) {
    case 'grade':
        // Grading form - get the necessary data
        require_sesskey();

        $attemptid = required_param('attemptid', PARAM_INT);

        if (!$attempt = $DB->get_record('lesson_attempts', array('id' => $attemptid))) {
            print_error('cannotfindattempt', 'lesson');
        }
        $page = $lesson->load_page($attempt->pageid);
        if (!$user = $DB->get_record('user', array('id' => $attempt->userid))) {
            print_error('cannotfinduser', 'lesson');
        }
        if (!$answer = $DB->get_record('lesson_answers', array('lessonid' => $lesson->id, 'pageid' => $page->id))) {
            print_error('cannotfindanswer', 'lesson');
        }
        break;

    case 'update':
        require_sesskey();
        $mform = new essay_grading_form();
        if ($form = $mform->get_data()) {

            if (optional_param('cancel', false, PARAM_RAW)) {
                redirect("$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id");
开发者ID:nuckey,项目名称:moodle,代码行数:31,代码来源:essay.php


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