コード例 #1
0
ファイル: lib.php プロジェクト: krzpassrl/SRL_Moodle_Baseline
/**
 * Call cron on the sepl module.
 */
function sepl_cron()
{
    global $CFG;
    require_once $CFG->dirroot . '/mod/sepl/locallib.php';
    sepl::cron();
    $plugins = core_component::get_plugin_list('seplsubmission');
    foreach ($plugins as $name => $plugin) {
        $disabled = get_config('seplsubmission_' . $name, 'disabled');
        if (!$disabled) {
            $class = 'sepl_submission_' . $name;
            require_once $CFG->dirroot . '/mod/sepl/submission/' . $name . '/locallib.php';
            $class::cron();
        }
    }
    $plugins = core_component::get_plugin_list('seplfeedback');
    foreach ($plugins as $name => $plugin) {
        $disabled = get_config('seplfeedback_' . $name, 'disabled');
        if (!$disabled) {
            $class = 'sepl_feedback_' . $name;
            require_once $CFG->dirroot . '/mod/sepl/feedback/' . $name . '/locallib.php';
            $class::cron();
        }
    }
    return true;
}
コード例 #2
0
 /**
  * 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();
     sepl::cron();
     // Now create an seplment with marking workflow enabled.
     $this->setUser($this->editingteachers[0]);
     $sepl = $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;
     $sepl->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
     // This student will receive notification.
     $data->workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_RELEASED;
     $sepl->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 seplment submissions/');
     sepl::cron();
     $messages = $sink->get_messages();
     $this->assertEquals(1, count($messages));
     $this->assertEquals($messages[0]->useridto, $this->students[1]->id);
     $this->assertEquals($sepl->get_instance()->name, $messages[0]->contexturlname);
 }