Exemplo n.º 1
0
 /**
  * Run keyword group cron job by id
  * @return json
  * @author Ruslan Ushakov
  */
 public function keyword_group_cron_jobs_run_by_id()
 {
     $id = $this->input->post('id');
     $this->load->model('ranking_model');
     $keyword_group_cron_jobs = $this->ranking_model->getKeywordGroupCronJob(-1, $id);
     if (!empty($keyword_group_cron_jobs)) {
         foreach ($keyword_group_cron_jobs as $job) {
             $this->ranking_model->updateKeywordCronJob($job->id, $job->period, $job->add_period_param);
             if (!empty($job->group_id)) {
                 $group_id = $job->group_id;
             } else {
                 $group_id = -1;
             }
             //get associated with currrent group sites
             $sites = $this->ranking_model->getSitesForGroups($group_id);
             if (!empty($sites)) {
                 foreach ($sites as $site) {
                     if (!empty($site->site_id)) {
                         $selected_keywords = $this->ranking_model->getTearmsByGroup($group_id);
                         if (!empty($selected_keywords)) {
                             $this->ranking_model->addCronJob($group_id, $site->site_id);
                         }
                     }
                 }
             }
         }
     }
     echo json_encode(array('status' => 'ok'));
     die;
 }
Exemplo n.º 2
0
 /**
  * Get All group params
  * @return json
  */
 function getGroupParams()
 {
     $group_id = (int) $this->input->post('group_id');
     $this->load->model('ranking_model');
     $group_info = $this->ranking_model->getGroupInfoByGroupId($group_id);
     $sites = $this->ranking_model->getSitesForGroups($group_id);
     $keywords = $this->ranking_model->getTermsIdsByGroupId($group_id);
     $this->output->set_content_type('application/json')->set_output(json_encode(array('status' => 'ok', 'group_name' => $group_info->name, 'sites' => $sites, 'keywords' => $keywords, 'enabled' => $group_info->enabled)));
 }