當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。