/** * Checks views of both pages and articles * */ public function check_views() { $nb = 0; $result = array('title' => lang('ionize_title_check_views'), 'status' => 'success'); $views_folder = FCPATH . 'themes/' . Settings::get('theme') . '/views/'; // Check and correct page's views $pages = $this->page_model->get_list(); foreach ($pages as $page) { if (!empty($page['view']) && !is_file($views_folder . $page['view'] . EXT)) { $this->db->set('view', ''); $this->db->where('id_page', $page['id_page']); $nb += $this->db->update('page'); } } // Check and correct article's views $article_contexts = $this->article_model->get_all_context(); foreach ($article_contexts as $context) { if (!empty($context['view']) && !is_file($views_folder . $page['view'] . EXT)) { $this->db->set('view', ''); $this->db->where(array('id_page' => $context['id_page'], 'id_article' => $context['id_article'])); $nb += $this->db->update('page_article'); } } // Correct if ($nb > 0) { $result['message'] = lang('ionize_message_check_corrected'); } else { $result['message'] = lang('ionize_message_check_ok'); } // Result view $view = $this->load->view('system/check_result', $result, TRUE); $this->callback = array(array('fn' => 'ION.appendDomElement', 'args' => array('system_check_report', $view)), array('fn' => 'ION.notification', 'args' => array('success', 'Check complete !'))); $this->response(); }