コード例 #1
0
 /**
  * Validate that the "delete job" method works
  */
 public function test_deletingjob()
 {
     global $DB;
     $DB->delete_records('local_eliscore_sched_tasks');
     // Create a scheduled job.
     $data = array('plugin' => 'dhexport_version1', 'period' => '5m', 'label' => 'bogus', 'type' => 'dhexport');
     $jobid = rlip_schedule_add_job($data);
     // Setup validation.
     $this->assertEquals($DB->count_records(RLIP_SCHEDULE_TABLE), 1);
     $this->assertEquals($DB->count_records('local_eliscore_sched_tasks'), 1);
     // Delete the job.
     rlip_schedule_delete_job($jobid);
     // Data validation.
     $this->assertEquals($DB->count_records(RLIP_SCHEDULE_TABLE), 0);
     $this->assertEquals($DB->count_records('local_eliscore_sched_tasks'), 0);
 }
コード例 #2
0
ファイル: schedulepage.php プロジェクト: jamesmcq/elis
 function display_delete()
 {
     global $DB, $OUTPUT;
     $this->get_base_page_params();
     $id = $this->required_param('id', PARAM_INT);
     $confirm = $this->optional_param('confirm', 0, PARAM_INT);
     if ($confirm) {
         rlip_schedule_delete_job($id);
         $this->display_default();
     } else {
         $target = $this->get_new_page(array('id' => $id, 'plugin' => $this->get_ip_plugin()));
         $continue_url = new moodle_url($target->url->out(true, array('action' => 'delete', 'confirm' => 1)));
         $buttoncontinue = new single_button($continue_url, get_string('yes'));
         $cancel_url = new moodle_url($target->url->out(true, array('action' => 'default')));
         $buttoncancel = new single_button($cancel_url, get_string('no'));
         echo $OUTPUT->confirm(get_string('confirm_delete_ipjob', 'local_datahub', $id), $buttoncontinue, $buttoncancel);
     }
 }