/** * Saves article types ordering * * @param bool|false $parent * @param bool|false $id_parent */ function save_ordering($parent = FALSE, $id_parent = FALSE) { $order = $this->input->post('order'); if ($order !== FALSE) { // Saves the new ordering $this->article_type_model->save_ordering($order); // Update Array for JSON $this->update[] = array('element' => 'article_types', 'url' => admin_url() . 'article_type/get_select/' . $parent . '/' . $id_parent); // Answer $this->success(lang('ionize_message_operation_ok')); } else { $this->error(lang('ionize_message_operation_nok')); } }
/** * 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'); }
/** * Edit one extend field * */ public function edit() { $id = $this->input->post('id_extend_field'); $context = $this->input->post('context'); $id_context = $this->input->post('id_context'); // Pre-defined parent: No parent select in this case $parent = $this->input->post('parent'); if ($id) { $this->extend_field_model->feed_template($id, $this->template); $this->extend_field_model->feed_lang_template($id, $this->template); } else { $this->extend_field_model->feed_blank_template($this->template); $this->extend_field_model->feed_blank_lang_template($this->template); } // Context: NULL by default $this->template['context'] = NULL; $this->template['id_context'] = NULL; if ($context) { $this->template['context'] = $context; $this->template['id_context'] = $id_context; } // Limit to one parent type? $this->template['limit_to_parent'] = FALSE; if ($parent) { $this->template['limit_to_parent'] = $parent; } // Available parents $parents = $this->extend_field_model->get_parents(); $this->template['parents'] = $parents; // Types $extend_types_select = $this->extend_field_type_model->get_form_select('type_name'); $this->template['type_select'] = form_dropdown('type', $extend_types_select, $this->template['type'], 'id=type' . $this->template['id_extend_field'] . ' class="select"'); // Available article types $this->template['article_types'] = $this->article_type_model->get_all(); $this->template['_article_types'] = $this->extend_field_model->get_article_types($this->template['id_extend_field']); // Extend Types details $this->template['extend_types'] = json_encode($this->extend_field_type_model->get_list(), TRUE); $this->output('extend/field'); }