public function get_list() { $id_page = $this->input->post('id_page'); if ($id_page) { // Get articles $articles = $this->article_model->get_lang_list(array('id_page' => $id_page), Settings::get_lang('default')); $this->article_model->add_lang_data($articles); // Dropdowns Views $views = array(); if (is_file(APPPATH . '../themes/' . Settings::get('theme') . '/config/views.php')) { require_once APPPATH . '../themes/' . Settings::get('theme') . '/config/views.php'; } $data = isset($views['article']) ? $views['article'] : NULL; if (!is_null($data)) { $data = array('' => lang('ionize_select_default_view')) + $data; $this->template['all_article_views'] = $data; } else { $this->template['all_article_views'] = NULL; } // All articles type to template $data = $this->article_type_model->get_types_select(); if (!empty($data)) { $data = array('' => lang('ionize_select_no_type')) + $data; $this->template['all_article_types'] = $data; } else { $this->template['all_article_types'] = NULL; } // Article's all pages contexts $articles_id = array(); foreach ($articles as $article) { $articles_id[] = $article['id_article']; } $pages_context = $this->page_model->get_lang_contexts($articles_id, Settings::get_lang('default')); // Add pages contexts data to articles foreach ($articles as &$article) { $article['pages'] = array_values(array_filter($pages_context, create_function('$row', 'return $row["id_article"] == ' . $article['id_article'] . ';'))); } $this->template['articles'] = $articles; $this->template['id_page'] = $id_page; $this->output('article/list'); } }