/** * Add/Update keyword group cron job * @return json * @author Ruslan Ushakov */ public function keyword_group_cron_jobs_add() { $job = (int) $this->input->post('job'); $group = (int) $this->input->post('group'); $period = (int) $this->input->post('period'); $add_param = $this->input->post('add_param'); $this->load->model('ranking_model'); if (!empty($job)) { if (!empty($add_param) && is_array($add_param)) { $add_param = $add_param[0]; } $this->ranking_model->updateKeywordCronJob($job, $period, (int) $add_param); } else { if (!empty($add_param) && is_array($add_param)) { foreach ($add_param as $param) { $this->ranking_model->addKeywordGroupCronJob($group, $period, $param); } } else { $this->ranking_model->addKeywordGroupCronJob($group, $period, $add_param); } } $keyword_group_cron_jobs = $this->ranking_model->getKeywordGroupCronJob(); echo json_encode($keyword_group_cron_jobs); die; }