Exemple #1
0
<?php
$this->load->helper('crawler_instances_helper');
$this->load->helper('pending_batches_helper');
$pending_batches_number = pending_batches_number();

$batch = array(
    array(
        'site_url' => 'system/batch_management',
        'label' => 'Crawlers',
    ),
    array(
        'site_url' => 'system/batch_repair',
        'label' => 'Chronicles <span id="pending_count">' . (($pending_batches_number) ? '(' . $pending_batches_number . ' hidden)' : '') . '</span>',
    ),
        array(
        'site_url' => 'system/virtualChronicle',
        'label' => 'Virtual Chronicle',
    ),
	array(
		'site_url' => 'system/filter_order',
		'label' => 'Filter Order',
	),
    array(
        'site_url' => 'system/system_uploadmatchspecifications',
        'label' => 'Upload Match Specifications',
    ),
    array(
        'site_url' => 'system/system_uploadmatchurls',
        'label' => 'Upload Match URLs',
    ),
    array(
Exemple #2
0
 /**
  *   function to change event (or chronicle) status. (this function has separate one in rest_api.php)
  *
  */
 public function set_event_status()
 {
     //load libraries and models
     $this->load->model('combo_chronicle_model');
     $this->load->model('event_status_model');
     $this->load->helper('pending_batches_helper');
     $event_id = $this->input->post('event_id');
     $action = $this->input->post('action');
     $value = $this->input->post('value');
     $chronicle_data = $this->combo_chronicle_model->findByPk($event_id);
     $status_name = empty($chronicle) ? '' : $this->event_status_model->getRecord($chronicle_data->status_id)->name;
     $response = array('status' => 'success', 'chronicle_id' => $event_id, 'event_status' => $status_name);
     if (empty($chronicle_data)) {
         $response['status'] = 'failed';
         $response['message'] = 'combination not exists';
     } else {
         switch ($action) {
             case 'abort':
                 break;
             case 'publish':
                 if ($value == '1') {
                     if ($chronicle_data->status_id == 2) {
                         $response['status'] = 'failed';
                         $response['message'] = 'cannot publish event that is in progress';
                         break;
                     } else {
                         if (!in_array($chronicle_data->status_id, array(3, 4, 5))) {
                             $response['status'] = 'failed';
                             $response['message'] = 'cannot publish event';
                             break;
                         }
                     }
                     // publish chronicle
                     $this->event_status_model->update_combination_status($event_id, 6);
                     $response['event_status'] = 'published';
                 } else {
                     if (!in_array($chronicle_data->status_id, array(3, 4, 5, 6))) {
                         $response['status'] = 'failed';
                         $response['message'] = 'cannot publish event';
                         break;
                     }
                     // unpublish chronicle
                     $this->event_status_model->update_combination_status($event_id, 3);
                     $response['event_status'] = 'completed';
                 }
                 break;
             default:
                 $response['status'] = 'failed';
                 $response['message'] = 'Unsupported action';
                 break;
         }
     }
     $response['pending_count'] = pending_batches_number();
     $this->output->set_content_type('application/json')->set_output(json_encode($response));
 }