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


PHP grade_object::delete方法代码示例

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


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

示例1: delete

 /**
  * If parent::delete() is successful, send force_regrading message to parent category.
  *
  * @param string $source from where was the object deleted (mod/forum, manual, etc.)
  * @return bool success
  */
 public function delete($source = null)
 {
     $grade_item = $this->load_grade_item();
     if ($this->is_course_category()) {
         if ($categories = grade_category::fetch_all(array('courseid' => $this->courseid))) {
             foreach ($categories as $category) {
                 if ($category->id == $this->id) {
                     continue;
                     // do not delete course category yet
                 }
                 $category->delete($source);
             }
         }
         if ($items = grade_item::fetch_all(array('courseid' => $this->courseid))) {
             foreach ($items as $item) {
                 if ($item->id == $grade_item->id) {
                     continue;
                     // do not delete course item yet
                 }
                 $item->delete($source);
             }
         }
     } else {
         $this->force_regrading();
         $parent = $this->load_parent_category();
         // Update children's categoryid/parent field first
         if ($children = grade_item::fetch_all(array('categoryid' => $this->id))) {
             foreach ($children as $child) {
                 $child->set_parent($parent->id);
             }
         }
         if ($children = grade_category::fetch_all(array('parent' => $this->id))) {
             foreach ($children as $child) {
                 $child->set_parent($parent->id);
             }
         }
     }
     // first delete the attached grade item and grades
     $grade_item->delete($source);
     // delete category itself
     return parent::delete($source);
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:48,代码来源:grade_category.php

示例2: delete

 /**
  * Delete all grades and force_regrading of parent category.
  * @param string $source from where was the object deleted (mod/forum, manual, etc.)
  * @return boolean success
  */
 function delete($source = null)
 {
     $this->delete_all_grades($source);
     return parent::delete($source);
 }
开发者ID:r007,项目名称:PMoodle,代码行数:10,代码来源:grade_item.php

示例3: delete

 /**
  * Deletes this outcome from the database.
  * @param string $source from where was the object deleted (mod/forum, manual, etc.)
  * @return boolean success
  */
 function delete($source = null)
 {
     if (!empty($this->courseid)) {
         delete_records('grade_outcomes_courses', 'outcomeid', $this->id, 'courseid', $this->courseid);
     }
     return parent::delete($source);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:12,代码来源:grade_outcome.php

示例4: delete

 /**
  * Deletes the grade_grade instance from the database.
  *
  * @param string $source The location the deletion occurred (mod/forum, manual, etc.).
  * @return bool Returns true if the deletion was successful, false otherwise.
  */
 public function delete($source = null)
 {
     $success = parent::delete($source);
     // If the grade was deleted successfully trigger a grade_deleted event.
     if ($success) {
         $this->load_grade_item();
         \core\event\grade_deleted::create_from_grade($this)->trigger();
     }
     return $success;
 }
开发者ID:sriysk,项目名称:moodle-integration,代码行数:16,代码来源:grade_grade.php

示例5: delete

 /**
  * Deletes this outcome from the database.
  *
  * @param string $source from where was the object deleted (mod/forum, manual, etc.)
  * @return bool success
  */
 public function delete($source = null)
 {
     global $DB;
     if (!empty($this->courseid)) {
         $DB->delete_records('grade_outcomes_courses', array('outcomeid' => $this->id, 'courseid' => $this->courseid));
     }
     if (parent::delete($source)) {
         $context = context_system::instance();
         $fs = get_file_storage();
         $files = $fs->get_area_files($context->id, 'grade', 'outcome', $this->id);
         foreach ($files as $file) {
             $file->delete();
         }
         return true;
     }
     return false;
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:23,代码来源:grade_outcome.php

示例6: delete

 /**
  * Delete all grades and force_regrading of parent category.
  * @param string $source from where was the object deleted (mod/forum, manual, etc.)
  * @return boolean success
  */
 function delete($source = null)
 {
     if (!$this->is_course_item()) {
         $this->force_regrading();
     }
     if ($grades = grade_grade::fetch_all(array('itemid' => $this->id))) {
         foreach ($grades as $grade) {
             $grade->delete($source);
         }
     }
     return parent::delete($source);
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:17,代码来源:grade_item.php

示例7: delete

 /**
  * Deletes this outcome from the database.
  * @param string $source from where was the object deleted (mod/forum, manual, etc.)
  * @return boolean success
  */
 public function delete($source = null)
 {
     global $DB;
     if (!empty($this->courseid)) {
         $DB->delete_records('grade_outcomes_courses', array('outcomeid' => $this->id, 'courseid' => $this->courseid));
     }
     return parent::delete($source);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:13,代码来源:grade_outcome.php

示例8: delete

 /**
  * Deletes this outcome from the database.
  *
  * @param string $source from where was the object deleted (mod/forum, manual, etc.)
  * @return bool success
  */
 public function delete($source = null)
 {
     global $DB;
     if (parent::delete($source)) {
         $context = context_system::instance();
         $fs = get_file_storage();
         $files = $fs->get_area_files($context->id, 'grade', 'scale', $this->id);
         foreach ($files as $file) {
             $file->delete();
         }
         return true;
     }
     return false;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:20,代码来源:grade_scale.php


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