本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}