/** * Add groups sites * @return string */ public function addGroupSites() { $this->load->model('ranking_model'); $selected_keywords_groups = $this->input->post('selected_keywords_groups'); $selected_sites = $this->input->post('selected_sites'); if (!empty($selected_keywords_groups)) { foreach ($selected_keywords_groups as $group_id) { $this->ranking_model->deleteSitesByGroup($group_id); if (!empty($selected_sites)) { foreach ($selected_sites as $site_id) { $this->ranking_model->addGroupSites($group_id, $site_id); } } } echo "Ok"; } else { echo "Errore"; } }