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


PHP completion_info::inform_grade_changed方法代码示例

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


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

示例1: notify_changed

 /**
  * Used to notify the completion system (if necessary) that a user's grade
  * has changed, and clear up a possible score cache.
  *
  * @param bool $deleted True if grade was actually deleted
  */
 protected function notify_changed($deleted)
 {
     global $CFG;
     // Condition code may cache the grades for conditional availability of
     // modules or sections. (This code should use a hook for communication
     // with plugin, but hooks are not implemented at time of writing.)
     if (!empty($CFG->enableavailability) && class_exists('\\availability_grade\\callbacks')) {
         \availability_grade\callbacks::grade_changed($this->userid);
     }
     require_once $CFG->libdir . '/completionlib.php';
     // Bail out immediately if completion is not enabled for site (saves loading
     // grade item & requiring the restore stuff).
     if (!completion_info::is_enabled_for_site()) {
         return;
     }
     // Ignore during restore, as completion data will be updated anyway and
     // doing it now will result in incorrect dates (it will say they got the
     // grade completion now, instead of the correct time).
     if (class_exists('restore_controller', false) && restore_controller::is_executing()) {
         return;
     }
     // Load information about grade item
     $this->load_grade_item();
     // Only course-modules have completion data
     if ($this->grade_item->itemtype != 'mod') {
         return;
     }
     // Use $COURSE if available otherwise get it via item fields
     $course = get_course($this->grade_item->courseid, false);
     // Bail out if completion is not enabled for course
     $completion = new completion_info($course);
     if (!$completion->is_enabled()) {
         return;
     }
     // Get course-module
     $cm = get_coursemodule_from_instance($this->grade_item->itemmodule, $this->grade_item->iteminstance, $this->grade_item->courseid);
     // If the course-module doesn't exist, display a warning...
     if (!$cm) {
         // ...unless the grade is being deleted in which case it's likely
         // that the course-module was just deleted too, so that's okay.
         if (!$deleted) {
             debugging("Couldn't find course-module for module '" . $this->grade_item->itemmodule . "', instance '" . $this->grade_item->iteminstance . "', course '" . $this->grade_item->courseid . "'");
         }
         return;
     }
     // Pass information on to completion system
     $completion->inform_grade_changed($cm, $this->grade_item, $this, $deleted);
 }
开发者ID:sriysk,项目名称:moodle-integration,代码行数:54,代码来源:grade_grade.php

示例2: unset

 /**
  * Used to notify the completion system (if necessary) that a user's grade
  * has changed, and clear up a possible score cache.
  *
  * @param bool $deleted True if grade was actually deleted
  */
 function notify_changed($deleted)
 {
     global $USER, $SESSION, $CFG, $COURSE, $DB;
     // Grades may be cached in user session
     if ($USER->id == $this->userid) {
         unset($SESSION->gradescorecache[$this->itemid]);
     }
     require_once $CFG->libdir . '/completionlib.php';
     // Bail out immediately if completion is not enabled for site (saves loading
     // grade item & requiring the restore stuff).
     if (!completion_info::is_enabled_for_site()) {
         return;
     }
     // Ignore during restore, as completion data will be updated anyway and
     // doing it now will result in incorrect dates (it will say they got the
     // grade completion now, instead of the correct time).
     if (class_exists('restore_controller', false) && restore_controller::is_executing()) {
         return;
     }
     // Load information about grade item
     $this->load_grade_item();
     // Only course-modules have completion data
     if ($this->grade_item->itemtype != 'mod') {
         return;
     }
     // Use $COURSE if available otherwise get it via item fields
     if (!empty($COURSE) && $COURSE->id == $this->grade_item->courseid) {
         $course = $COURSE;
     } else {
         $course = $DB->get_record('course', array('id' => $this->grade_item->courseid));
     }
     // Bail out if completion is not enabled for course
     $completion = new completion_info($course);
     if (!$completion->is_enabled()) {
         return;
     }
     // Get course-module
     $cm = get_coursemodule_from_instance($this->grade_item->itemmodule, $this->grade_item->iteminstance, $this->grade_item->courseid);
     // If the course-module doesn't exist, display a warning...
     if (!$cm) {
         // ...unless the grade is being deleted in which case it's likely
         // that the course-module was just deleted too, so that's okay.
         if (!$deleted) {
             debugging("Couldn't find course-module for module '" . $this->grade_item->itemmodule . "', instance '" . $this->grade_item->iteminstance . "', course '" . $this->grade_item->courseid . "'");
         }
         return;
     }
     // Pass information on to completion system
     $completion->inform_grade_changed($cm, $this->grade_item, $this, $deleted);
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:56,代码来源:grade_grade.php

示例3: unset

 /**
  * Used to notify the completion system (if necessary) that a user's grade
  * has changed, and clear up a possible score cache.
  * @param bool deleted True if grade was actually deleted
  */
 function notify_changed($deleted)
 {
     global $USER, $SESSION, $CFG, $COURSE, $DB;
     // Grades may be cached in user session
     if ($USER->id == $this->userid) {
         unset($SESSION->gradescorecache[$this->itemid]);
     }
     // Ignore during restore
     // TODO There should be a proper way to determine when we are in restore
     // so that this hack looking for a $restore global is not needed.
     global $restore;
     if (!empty($restore->backup_unique_code)) {
         return;
     }
     require_once $CFG->libdir . '/completionlib.php';
     // Bail out immediately if completion is not enabled for site (saves loading
     // grade item below)
     if (!completion_info::is_enabled_for_site()) {
         return;
     }
     // Load information about grade item
     $this->load_grade_item();
     // Only course-modules have completion data
     if ($this->grade_item->itemtype != 'mod') {
         return;
     }
     // Use $COURSE if available otherwise get it via item fields
     if (!empty($COURSE) && $COURSE->id == $this->grade_item->courseid) {
         $course = $COURSE;
     } else {
         $course = $DB->get_record('course', array('id' => $this->grade_item->courseid));
     }
     // Bail out if completion is not enabled for course
     $completion = new completion_info($course);
     if (!$completion->is_enabled()) {
         return;
     }
     // Get course-module
     $cm = get_coursemodule_from_instance($this->grade_item->itemmodule, $this->grade_item->iteminstance, $this->grade_item->courseid);
     if (!$cm) {
         debugging("Couldn't find course-module for module\n                '{$this->grade_item->itemmodule}', instance '{$this->grade_item->iteminstance}',\n                course '{$this->grade_item->courseid}'");
         return;
     }
     // Pass information on to completion system
     $completion->inform_grade_changed($cm, $this->grade_item, $this, $deleted);
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:51,代码来源:grade_grade.php

示例4: debugging

 /**
  * Used to notify the completion system (if necessary) that a user's grade
  * has changed, and clear up a possible score cache.
  *
  * @param bool $deleted True if grade was actually deleted
  */
 function notify_changed($deleted)
 {
     global $CFG;
     // Ignore during restore
     // TODO There should be a proper way to determine when we are in restore
     // so that this hack looking for a $restore global is not needed.
     global $restore;
     if (!empty($restore->backup_unique_code)) {
         return;
     }
     // Inform conditionlib since it may cache the grades for conditional availability of modules or sections.
     if (!empty($CFG->enableavailability)) {
         require_once $CFG->libdir . '/conditionlib.php';
         condition_info_base::inform_grade_changed($this, $deleted);
     }
     require_once $CFG->libdir . '/completionlib.php';
     // Bail out immediately if completion is not enabled for site (saves loading
     // grade item below)
     if (!completion_info::is_enabled_for_site()) {
         return;
     }
     // Load information about grade item
     $this->load_grade_item();
     // Only course-modules have completion data
     if ($this->grade_item->itemtype != 'mod') {
         return;
     }
     // Use $COURSE if available otherwise get it via item fields
     $course = get_course($this->grade_item->courseid, false);
     // Bail out if completion is not enabled for course
     $completion = new completion_info($course);
     if (!$completion->is_enabled()) {
         return;
     }
     // Get course-module
     $cm = get_coursemodule_from_instance($this->grade_item->itemmodule, $this->grade_item->iteminstance, $this->grade_item->courseid);
     // If the course-module doesn't exist, display a warning...
     if (!$cm) {
         // ...unless the grade is being deleted in which case it's likely
         // that the course-module was just deleted too, so that's okay.
         if (!$deleted) {
             debugging("Couldn't find course-module for module '" . $this->grade_item->itemmodule . "', instance '" . $this->grade_item->iteminstance . "', course '" . $this->grade_item->courseid . "'");
         }
         return;
     }
     // Pass information on to completion system
     $completion->inform_grade_changed($cm, $this->grade_item, $this, $deleted);
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:54,代码来源:grade_grade.php


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