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


PHP quiz_delete_override函数代码示例

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


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

示例1: quiz_delete_all_overrides

/**
 * Deletes all quiz overrides from the database and clears any corresponding calendar events
 *
 * @param object $quiz The quiz object.
 */
function quiz_delete_all_overrides($quiz) {
    global $DB;

    $overrides = $DB->get_records('quiz_overrides', array('quiz' => $quiz->id), 'id');
    foreach ($overrides as $override) {
        quiz_delete_override($quiz, $override->id);
    }
}
开发者ID:nutanrajmalanai,项目名称:moodle,代码行数:13,代码来源:lib.php

示例2: require_capability

// Check the user has the required capabilities to modify an override.
require_capability('mod/quiz:manageoverrides', $context);

$url = new moodle_url('/mod/quiz/overridedelete.php', array('id'=>$override->id));
$confirmurl = new moodle_url($url, array('id'=>$override->id, 'confirm'=>1));
$cancelurl = new moodle_url('/mod/quiz/overrides.php', array('cmid'=>$cm->id));

if (!empty($override->userid)) {
    $cancelurl->param('mode', 'user');
}

// If confirm is set (PARAM_BOOL) then we have confirmation of intention to delete.
if ($confirm) {
    require_sesskey();

    quiz_delete_override($quiz, $override->id);

    add_to_log($cm->course, 'quiz', 'delete override',
        "overrides.php?cmid=$cm->id", $quiz->id, $cm->id);

    redirect($cancelurl);
}

// Prepare the page to show the confirmation form.
$stroverride = get_string('override', 'quiz');
$title = get_string('deletecheck', null, $stroverride);

$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
$PAGE->navbar->add($title);
$PAGE->set_title($title);
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:overridedelete.php

示例3: test_group_override_deleted

 /**
  * Test the group override deleted event.
  */
 public function test_group_override_deleted()
 {
     global $DB;
     $this->resetAfterTest();
     $this->setAdminUser();
     $course = $this->getDataGenerator()->create_course();
     $quiz = $this->getDataGenerator()->create_module('quiz', array('course' => $course->id));
     // Create an override.
     $override = new stdClass();
     $override->quiz = $quiz->id;
     $override->groupid = 2;
     $override->id = $DB->insert_record('quiz_overrides', $override);
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     quiz_delete_override($quiz, $override->id);
     $events = $sink->get_events();
     $event = reset($events);
     // Check that the event data is valid.
     $this->assertInstanceOf('\\mod_quiz\\event\\group_override_deleted', $event);
     $this->assertEquals(context_module::instance($quiz->cmid), $event->get_context());
     $expected = array($course->id, 'quiz', 'delete override', 'overrides.php?cmid=' . $quiz->cmid, $quiz->id, $quiz->cmid);
     $this->assertEventLegacyLogData($expected, $event);
     $this->assertEventContextNotUsed($event);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:27,代码来源:events_test.php


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