Example #1
0
File: page.php Project: trk/ionize
 /**
  * Create one page
  *
  * @param	int		$id_menu
  * @param	int		$id_parent	Parent page ID
  */
 public function create($id_menu, $id_parent = NULL)
 {
     $this->load_modules_addons();
     // Current menu : Needs to be improved.
     // TODO : Create a menu table or see how to manage menus.
     $this->template['id_menu'] = $id_menu;
     // Create blank data for this page
     $this->page_model->feed_blank_template($this->template);
     $this->page_model->feed_blank_lang_template($this->template);
     // Dropdown menus
     $data = $this->menu_model->get_select();
     $this->template['menus'] = form_dropdown('id_menu', $data, $id_menu, 'id="id_menu" class="select"');
     // Dropdown Views : Get $view var from my_theme/config/views.php
     $views = array();
     if (is_file(FCPATH . 'themes/' . Settings::get('theme') . '/config/views.php')) {
         require_once FCPATH . 'themes/' . Settings::get('theme') . '/config/views.php';
     }
     // Dropdown Page views
     $data = isset($views['page']) ? $views['page'] : array();
     if (count($data) > 0) {
         $data = $this->_get_views_dropdown_data($data, 'Page');
         $data = array('0' => lang('ionize_select_default_view')) + $data;
         $this->template['views'] = $this->template['single_views'] = form_dropdown('view', $data, FALSE, 'class="select w160"');
     }
     // Dropdown Article views
     $data = isset($views['article']) ? $views['article'] : array();
     if (count($data) > 0) {
         $data = $this->_get_views_dropdown_data($data, 'Article');
         $data = array('0' => lang('ionize_select_default_view')) + $data;
         $this->template['article_views'] = form_dropdown('article_view', $data, FALSE, 'class="select w160"');
         $this->template['article_list_views'] = form_dropdown('article_list_view', $data, FALSE, 'class="select w160"');
     }
     $this->template['priority'] = '5';
     $this->template['has_url'] = '1';
     $this->template['id_parent'] = $id_parent;
     //  Extend fields
     $this->template['extend_fields'] = $this->extend_field_model->get_element_extend_fields('page');
     $this->output('page/page');
 }