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


PHP assign_reset_gradebook函数代码示例

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


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

示例1: reset_userdata

 /**
  * Actual implementation of the reset course functionality, delete all the
  * assignment submissions for course $data->courseid.
  *
  * @param stdClass $data the data submitted from the reset course.
  * @return array status array
  */
 public function reset_userdata($data)
 {
     global $CFG, $DB;
     $componentstr = get_string('modulenameplural', 'assign');
     $status = array();
     $fs = get_file_storage();
     if (!empty($data->reset_assign_submissions)) {
         // Delete files associated with this assignment.
         foreach ($this->submissionplugins as $plugin) {
             $fileareas = array();
             $plugincomponent = $plugin->get_subtype() . '_' . $plugin->get_type();
             $fileareas = $plugin->get_file_areas();
             foreach ($fileareas as $filearea) {
                 $fs->delete_area_files($this->context->id, $plugincomponent, $filearea);
             }
             if (!$plugin->delete_instance()) {
                 $status[] = array('component' => $componentstr, 'item' => get_string('deleteallsubmissions', 'assign'), 'error' => $plugin->get_error());
             }
         }
         foreach ($this->feedbackplugins as $plugin) {
             $fileareas = array();
             $plugincomponent = $plugin->get_subtype() . '_' . $plugin->get_type();
             $fileareas = $plugin->get_file_areas();
             foreach ($fileareas as $filearea) {
                 $fs->delete_area_files($this->context->id, $plugincomponent, $filearea);
             }
             if (!$plugin->delete_instance()) {
                 $status[] = array('component' => $componentstr, 'item' => get_string('deleteallsubmissions', 'assign'), 'error' => $plugin->get_error());
             }
         }
         $assignssql = 'SELECT a.id
                          FROM {assign} a
                        WHERE a.course=:course';
         $params = array('course' => $data->courseid);
         $DB->delete_records_select('assign_submission', "assignment IN ({$assignssql})", $params);
         $status[] = array('component' => $componentstr, 'item' => get_string('deleteallsubmissions', 'assign'), 'error' => false);
         if (!empty($data->reset_gradebook_grades)) {
             $DB->delete_records_select('assign_grades', "assignment IN ({$assignssql})", $params);
             // Remove all grades from gradebook.
             require_once $CFG->dirroot . '/mod/assign/lib.php';
             assign_reset_gradebook($data->courseid);
         }
     }
     // Updating dates - shift may be negative too.
     if ($data->timeshift) {
         shift_course_mod_dates('assign', array('duedate', 'allowsubmissionsfromdate', 'cutoffdate'), $data->timeshift, $data->courseid, $this->get_instance()->id);
         $status[] = array('component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false);
     }
     return $status;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:57,代码来源:locallib.php

示例2: reset_userdata

 /**
  * Actual implementation of the reset course functionality, delete all the
  * assignment submissions for course $data->courseid.
  *
  * @param stdClass $data the data submitted from the reset course.
  * @return array status array
  */
 public function reset_userdata($data)
 {
     global $CFG, $DB;
     $componentstr = get_string('modulenameplural', 'assign');
     $status = array();
     $fs = get_file_storage();
     if (!empty($data->reset_assign_submissions)) {
         // Delete files associated with this assignment.
         foreach ($this->submissionplugins as $plugin) {
             $fileareas = array();
             $plugincomponent = $plugin->get_subtype() . '_' . $plugin->get_type();
             $fileareas = $plugin->get_file_areas();
             foreach ($fileareas as $filearea => $notused) {
                 $fs->delete_area_files($this->context->id, $plugincomponent, $filearea);
             }
             if (!$plugin->delete_instance()) {
                 $status[] = array('component' => $componentstr, 'item' => get_string('deleteallsubmissions', 'assign'), 'error' => $plugin->get_error());
             }
         }
         foreach ($this->feedbackplugins as $plugin) {
             $fileareas = array();
             $plugincomponent = $plugin->get_subtype() . '_' . $plugin->get_type();
             $fileareas = $plugin->get_file_areas();
             foreach ($fileareas as $filearea => $notused) {
                 $fs->delete_area_files($this->context->id, $plugincomponent, $filearea);
             }
             if (!$plugin->delete_instance()) {
                 $status[] = array('component' => $componentstr, 'item' => get_string('deleteallsubmissions', 'assign'), 'error' => $plugin->get_error());
             }
         }
         $assignids = $DB->get_records('assign', array('course' => $data->courseid), '', 'id');
         list($sql, $params) = $DB->get_in_or_equal(array_keys($assignids));
         $DB->delete_records_select('assign_submission', "assignment {$sql}", $params);
         $DB->delete_records_select('assign_user_flags', "assignment {$sql}", $params);
         $status[] = array('component' => $componentstr, 'item' => get_string('deleteallsubmissions', 'assign'), 'error' => false);
         if (!empty($data->reset_gradebook_grades)) {
             $DB->delete_records_select('assign_grades', "assignment {$sql}", $params);
             // Remove all grades from gradebook.
             require_once $CFG->dirroot . '/mod/assign/lib.php';
             assign_reset_gradebook($data->courseid);
             // Reset revealidentities if both submissions and grades have been reset.
             if ($this->get_instance()->blindmarking && $this->get_instance()->revealidentities) {
                 $DB->set_field('assign', 'revealidentities', 0, array('id' => $this->get_instance()->id));
             }
         }
     }
     // Updating dates - shift may be negative too.
     if ($data->timeshift) {
         shift_course_mod_dates('assign', array('duedate', 'allowsubmissionsfromdate', 'cutoffdate'), $data->timeshift, $data->courseid, $this->get_instance()->id);
         $status[] = array('component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false);
     }
     return $status;
 }
开发者ID:mercysmart,项目名称:naikelas,代码行数:60,代码来源:locallib.php


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