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


PHP assign::cron方法代码示例

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


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

示例1: assign_cron

/**
 * Call cron on the assign module
 */
function assign_cron()
{
    global $CFG;
    require_once $CFG->dirroot . '/mod/assign/locallib.php';
    assign::cron();
    $plugins = get_plugin_list('assignsubmission');
    foreach ($plugins as $name => $plugin) {
        $disabled = get_config('assignsubmission_' . $name, 'disabled');
        if (!$disabled) {
            $class = 'assign_submission_' . $name;
            require_once $CFG->dirroot . '/mod/assign/submission/' . $name . '/locallib.php';
            $class::cron();
        }
    }
    $plugins = get_plugin_list('assignfeedback');
    foreach ($plugins as $name => $plugin) {
        $disabled = get_config('assignfeedback_' . $name, 'disabled');
        if (!$disabled) {
            $class = 'assign_feedback_' . $name;
            require_once $CFG->dirroot . '/mod/assign/feedback/' . $name . '/locallib.php';
            $class::cron();
        }
    }
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:27,代码来源:lib.php

示例2: test_markingworkflow_cron

 /**
  * Test delivery of grade notifications as controlled by marking workflow.
  */
 public function test_markingworkflow_cron()
 {
     // First run cron so there are no messages waiting to be sent (from other tests).
     cron_setup_user();
     assign::cron();
     // Now create an assignment with marking workflow enabled.
     $this->setUser($this->editingteachers[0]);
     $assign = $this->create_instance(array('sendstudentnotifications' => 1, 'markingworkflow' => 1));
     // Simulate adding a grade.
     $this->setUser($this->teachers[0]);
     $data = new stdClass();
     $data->grade = '50.0';
     // This student will not receive notification.
     $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_READYFORRELEASE;
     $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
     // This student will receive notification.
     $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_RELEASED;
     $assign->testable_apply_grade_to_user($data, $this->students[1]->id, 0);
     // Now run cron and see that one message was sent.
     $this->preventResetByRollback();
     $sink = $this->redirectMessages();
     cron_setup_user();
     $this->expectOutputRegex('/Done processing 1 assignment submissions/');
     assign::cron();
     $messages = $sink->get_messages();
     $this->assertEquals(1, count($messages));
     $this->assertEquals($messages[0]->useridto, $this->students[1]->id);
     $this->assertEquals($assign->get_instance()->name, $messages[0]->contexturlname);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:32,代码来源:locallib_test.php

示例3: test_cron

 public function test_cron()
 {
     // First run cron so there are no messages waiting to be sent (from other tests).
     cron_setup_user();
     assign::cron();
     // Now create an assignment and add some feedback.
     $this->setUser($this->editingteachers[0]);
     $assign = $this->create_instance(array('sendstudentnotifications' => 1));
     // Simulate adding a grade.
     $this->setUser($this->teachers[0]);
     $data = new stdClass();
     $data->grade = '50.0';
     $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
     $assign->testable_apply_grade_to_user($data, $this->students[1]->id, 0);
     $data->sendstudentnotifications = false;
     $assign->testable_apply_grade_to_user($data, $this->students[2]->id, 0);
     // Now run cron and see that one message was sent.
     $this->preventResetByRollback();
     $sink = $this->redirectMessages();
     cron_setup_user();
     $this->expectOutputRegex('/Done processing 2 assignment submissions/');
     assign::cron();
     $messages = $sink->get_messages();
     // The sent count should be 2, because the 3rd one was marked as do not send notifications.
     $this->assertEquals(2, count($messages));
     $this->assertEquals(1, $messages[0]->notification);
     $this->assertEquals($assign->get_instance()->name, $messages[0]->contexturlname);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:28,代码来源:locallib_test.php

示例4: test_cron_message_includes_courseid

 public function test_cron_message_includes_courseid()
 {
     // First run cron so there are no messages waiting to be sent (from other tests).
     cron_setup_user();
     assign::cron();
     // Now create an assignment.
     $this->setUser($this->editingteachers[0]);
     $assign = $this->create_instance(array('sendstudentnotifications' => 1));
     // Simulate adding a grade.
     $this->setUser($this->teachers[0]);
     $data = new stdClass();
     $data->grade = '50.0';
     $assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
     $this->preventResetByRollback();
     $sink = $this->redirectEvents();
     $this->expectOutputRegex('/Done processing 1 assignment submissions/');
     assign::cron();
     $events = $sink->get_events();
     // Two messages are sent, one to student and one to teacher. This generates
     // four events:
     // core\event\message_sent
     // core\event\message_viewed
     // core\event\message_sent
     // core\event\message_viewed.
     $event = reset($events);
     $this->assertInstanceOf('\\core\\event\\message_sent', $event);
     $this->assertEquals($assign->get_course()->id, $event->other['courseid']);
     $sink->close();
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:29,代码来源:locallib_test.php


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