/** * Get the select box of types * * @param string|bool parent type. Can be 'article', 'page', etc. * @param string|bool parent ID. * * @return string HTML types select box * */ function get_select($parent = FALSE, $id_parent = FALSE) { $this->load->model('article_model', '', TRUE); // Get data formed to feed the category select box $types = $this->article_type_model->get_types_select(); // Get the current categories for the element $current_type = FALSE; if ($parent && $id_parent) { $article = $this->article_model->get_by_id($id_parent); if (!empty($article)) { $current_type = $article['id_type']; } } // Outputs the categories form dropdown $this->xhr_output(form_dropdown('id_type', $types, $current_type, 'class="select"')); }
/** * Duplicates one article * Called by /views/toolboxes/article_toolbox * * @param int $id_article Source article ID * * TODO : Check if the article exists and display an error window if not. * JS Callbacks of MUI.formWindow() needs to be implemented * */ public function duplicate($id_article) { // Source article $cond = array('id_page' => $this->input->post('id_page'), 'id_article' => $id_article); if ($this->input->post('id_page')) { $source_article = array_shift($this->article_model->get_linked_lang_items('page', 'article', $cond, Settings::get_lang('default'))); } else { unset($cond['id_page']); $source_article = $this->article_model->get($cond, Settings::get_lang('default')); } // Context page, if any $this->template['page'] = $this->page_model->get_by_id($this->input->post('id_page'), Settings::get_lang('default')); // Dropdowns Views if (is_file(APPPATH . '../themes/' . Settings::get('theme') . '/config/views.php')) { require_once APPPATH . '../themes/' . Settings::get('theme') . '/config/views.php'; } $views = isset($views['article']) ? $views['article'] : array(); if (count($views) > 0) { if (!isset($source_article['view'])) { $source_article['view'] = FALSE; } $views = array('' => lang('ionize_select_default_view')) + $views; $this->template['views'] = form_dropdown('article_view', $views, $source_article['view'], 'class="select w160"'); } $this->template['all_views'] = $views; // All articles type to template $types = $this->article_type_model->get_types_select(); $types = array('' => lang('ionize_select_no_type')) + $types; $this->template['all_types'] = $types; if (!isset($source_article['id_type'])) { $source_article['id_type'] = FALSE; } $this->template = array_merge($this->template, $source_article); $this->template['name'] = $source_article['name']; // $this->template['has_url'] = $source_article['has_url']; $this->template['title'] = $source_article['title'] != '' ? $source_article['title'] : $source_article['name']; // Dropdown menus $data = $this->menu_model->get_select(); $this->template['menus'] = form_dropdown('dup_id_menu', $data, '1', 'id="dup_id_menu" class="select"'); $this->output('article/duplicate'); }