/** * Shows one media meta data * * @param int $id_media Media ID * @param string $parent parent type ('page', 'article') * @param int $id_parent Parent ID (context in which the media is linked) * */ public function edit($id_media, $parent = NULL, $id_parent = NULL) { $this->media_model->feed_template($id_media, $this->template); $this->media_model->feed_lang_template($id_media, $this->template); $this->template['parent'] = $parent; $this->template['id_parent'] = $id_parent; // Get the mp3 tags /* if ( $this->media_model->is($this->template['path'], 'mp3') ) { $this->template = $this->add_ID3_to_data($this->template, $this->media_model->get_ID3($this->template['path'])); } */ // Get the thumbs to check each thumb status $this->template['thumbs'] = $this->settings_model->get_list(array('name like' => 'thumb_%')); // Extend fields $this->template['extend_fields'] = $this->extend_field_model->get_element_extend_fields('media', $id_media); // context data if ($parent) { $this->template['context_data'] = $this->media_model->get_context_data($id_media, $parent, $id_parent); } // Modules addons $this->load_modules_addons($this->template); $this->output('media/edit'); }
/** * Get Parent's extends instances * * @param null $mode */ public function get_instances_list($mode = NULL) { $parent = $this->input->post('parent'); $id_parent = $this->input->post('id_parent'); $id_field_parent = $this->input->post('id_field_parent'); $items = $this->extend_field_model->get_element_extend_fields($parent, $id_parent, $id_field_parent); if ($mode === 'json') { $this->xhr_output($items); } }
/** * Edit one article * * @param string $rel article REL. Composed by the page ID and the article ID * Example : 1.23 * 1 : id_page * 23 : id_article */ public function edit($rel) { // IDs $rel = explode(".", $rel); $id_page = !empty($rel[1]) ? $rel[0] : '0'; $id_article = !empty($rel[1]) ? $rel[1] : NULL; $resource = $this->_get_resource_name('backend', 'article', $id_article); $page_resource = $this->_get_resource_name('backend', 'page', $id_page); if (Authority::can('edit', 'admin/article') && Authority::can('edit', $resource, NULL, TRUE) && Authority::can('edit', $page_resource, NULL, TRUE)) { // Edit article if ID exists if (!is_null($id_article)) { $article = $this->article_model->get_by_id($id_article); if (!empty($article)) { // Loads the modules addons $this->load_modules_addons($article); // Page context of the current edited article $article['id_page'] = $id_page; // Data & Lang Data $this->template = array_merge($this->template, $article); $this->article_model->feed_lang_template($id_article, $this->template); // Extends fields $extend_fields = $this->extend_field_model->get_element_extend_fields('article', $id_article); $this->template['has_translated_extend_fields'] = $this->_has_translated_extend_fields($extend_fields); $this->template['extend_fields'] = $extend_fields; // Link : Depending on the context $context = $this->article_model->get_context($id_article, $id_page); if (!empty($context)) { $this->template['main_parent'] = $context['main_parent']; $pages = $this->page_model->get_parent_array($id_page, array(), Settings::get_lang('default')); // Breadcrump $breadcrump = array(); foreach ($pages as $page) { $breadcrump[] = !empty($page['title']) ? $page['title'] : $page['name']; } $this->template['breadcrump'] = implode(' > ', $breadcrump); } else { $this->template['main_parent'] = '0'; } Event::fire('Article.edit', $this->template); $this->output('article/article'); } } } else { $this->output(self::$_DENY_MAIN_VIEW); } }
/** * Edit one page * * @param string $id_page */ public function edit($id_page) { $resource = $this->_get_resource_name('backend', 'page', $id_page); if (Authority::can('edit', 'admin/page') && Authority::can('edit', $resource, null, true)) { // Data $page = $this->page_model->get_by_id($id_page); if (!empty($page)) { $this->load_modules_addons($page); // Correct the menu ID (for phantom pages) if ($page['id_menu'] == '0') { $page['id_menu'] = '1'; } // Data & Lang Data $this->template = array_merge($this->template, $page); $this->page_model->feed_lang_template($id_page, $this->template); // Array of path to the element. Gives the complete URL to the element. $this->template['parent_array'] = $this->page_model->get_parent_array($id_page); // Breadcrumbs $pages = $this->page_model->get_parent_array($id_page, array(), Settings::get_lang('default')); $breadcrumps = array(); foreach ($pages as $page) { $breadcrumps[] = !empty($page['title']) ? $page['title'] : $page['name']; } $this->template['breadcrump'] = implode(' > ', $breadcrumps); // Extend fields $this->template['extend_fields'] = $this->extend_field_model->get_element_extend_fields('page', $id_page); // URLs $this->template['urls'] = $this->url_model->get_entity_urls('page', $id_page); // Output $this->output('page/page'); } else { $this->error(lang('ionize_message_page_not_exist')); } } else { $this->output(self::$_DENY_MAIN_VIEW); } }