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


PHP scorm_delete_attempt函数代码示例

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


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

示例1: test_attempt_deleted_event

 /** Tests for attempt deleted event */
 public function test_attempt_deleted_event()
 {
     global $USER;
     $this->resetAfterTest();
     scorm_insert_track(2, $this->eventscorm->id, 1, 4, 'cmi.core.score.raw', 10);
     $sink = $this->redirectEvents();
     scorm_delete_attempt(2, $this->eventscorm, 4);
     $events = $sink->get_events();
     $sink->close();
     $event = reset($events);
     // Verify data.
     $this->assertCount(3, $events);
     $this->assertInstanceOf('\\mod_scorm\\event\\attempt_deleted', $event);
     $this->assertEquals($USER->id, $event->userid);
     $this->assertEquals(context_module::instance($this->eventcm->id), $event->get_context());
     $this->assertEquals(4, $event->other['attemptid']);
     $this->assertEquals(2, $event->relateduserid);
     $expected = array($this->eventcourse->id, 'scorm', 'delete attempts', 'report.php?id=' . $this->eventcm->id, 4, $this->eventcm->id);
     $this->assertEventLegacyLogData($expected, $events[0]);
     $this->assertEventContextNotUsed($event);
     // Test event validations.
     $this->setExpectedException('coding_exception');
     \mod_scorm\event\attempt_deleted::create(array('contextid' => 5, 'relateduserid' => 2));
     $this->fail('event \\mod_scorm\\event\\attempt_deleted is not validating events properly');
 }
开发者ID:rushi963,项目名称:moodle,代码行数:26,代码来源:events_test.php

示例2: scorm_delete_responses

/**
 * Delete Scorm tracks for selected users
 *
 * @param array $attemptids list of attempts that need to be deleted
 * @param int $scorm instance
 *
 * return bool true deleted all responses, false failed deleting an attempt - stopped here
 */
function scorm_delete_responses($attemptids, $scorm)
{
    if (!is_array($attemptids) || empty($attemptids)) {
        return false;
    }
    foreach ($attemptids as $num => $attemptid) {
        if (empty($attemptid)) {
            unset($attemptids[$num]);
        }
    }
    foreach ($attemptids as $attempt) {
        $keys = explode(':', $attempt);
        if (count($keys) == 2) {
            $userid = clean_param($keys[0], PARAM_INT);
            $attemptid = clean_param($keys[1], PARAM_INT);
            if (!$userid || !$attemptid || !scorm_delete_attempt($userid, $scorm, $attemptid)) {
                return false;
            }
        } else {
            return false;
        }
    }
    return true;
}
开发者ID:helenagarcia90,项目名称:moodle,代码行数:32,代码来源:locallib.php


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