/** * Return array of available dates of branding info by site id * @return json * @author Ruslan Ushakov */ public function getAvailableDatesForSite() { $this->load->model('ranking_model'); $this->load->model('ranking_summary_model'); $sort = 'desc'; $term = $this->input->post('term_id'); $brand_id = $this->input->post('brand_id'); $view = $this->input->post('view'); if ($this->input->post('sort')) { $sort = $this->input->post('sort'); } $data = array(); if (!empty($view) && $view == 'DshSum') { if (!empty($term)) { $data = $this->ranking_summary_model->getAvailableDatesForSite($this->input->post('site_id'), 0, $term, $sort); } } else { //Issue #3645 if (!empty($term)) { //Issue #3133 $data = $this->ranking_model->getAvailableDatesForSite($this->input->post('site_id'), 0, $term, $sort); } elseif ($this->input->post('search_box')) { $data = $this->ranking_model->getAvailableDatesForSite($this->input->post('site_id'), 0, $term, $sort); } } foreach ($data as &$v) { if ($this->session->userdata['dateformat'] == 1) { $v['option_title'] = date('m/d/Y', strtotime($v['date_of_upload'])); } elseif ($this->session->userdata['dateformat'] == 2) { $v['option_title'] = date('d/m/Y', strtotime($v['date_of_upload'])); } else { $v['option_title'] = $v['date_of_upload']; } } $this->output->set_content_type('application/json')->set_output(json_encode($data)); }