public function getIndex()
 {
     $this->preload_menu_item_names();
     $menus = '';
     $menu_item_info = new \stdClass();
     $menu_item_info->permissions['delete'] = Auth::action('menus.delete');
     $menu_item_info->permissions['subpage'] = Auth::action('menus.save_levels');
     $menu_item_info->permissions['rename'] = Auth::action('menus.rename');
     foreach (Menu::all() as $menu) {
         $menu_items = $menu->items()->get();
         $menus_li = '';
         $menu_item_info->max_sublevel = $menu->max_sublevel;
         foreach ($menu_items as $menu_item) {
             if (isset($this->page_names[$menu_item->page_id])) {
                 $menu_item_info->custom_name = trim($menu_item->custom_name);
                 $menu_item_info->custom_name = !empty($menu_item_info->custom_name) ? ' (Custom Name: ' . $menu_item_info->custom_name . ')' : null;
                 $menu_item_info->name = $this->page_names[$menu_item->page_id];
                 $menu_item_info->id = $menu_item->id;
                 $menu_item_info->sub_levels = $menu_item->sub_levels;
                 $menus_li .= View::make('coaster::partials.menus.li', array('item' => $menu_item_info))->render();
             }
         }
         $menus .= View::make('coaster::partials.menus.ol', array('menus_li' => $menus_li, 'menu' => $menu, 'can_add_item' => Auth::action('menus.add')))->render();
     }
     $this->layoutData['content'] = View::make('coaster::pages.menus', array('menus' => $menus));
     $this->layoutData['modals'] = View::make('coaster::modals.menus.add_item', array('options' => Page::get_page_list()))->render() . View::make('coaster::modals.general.delete_item')->render() . View::make('coaster::modals.menus.edit_item')->render() . View::make('coaster::modals.menus.rename_item')->render();
 }
Esempio n. 2
0
 /**
  * Populate select options with page names (also add no page option)
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $parent = BlockSelectOption::where('block_id', '=', $this->_block->id)->where('option', '=', 'parent')->first();
     $parentPageId = !empty($parent) ? $parent->value : 0;
     $this->_editViewData['selectOptions'] = [0 => '-- No Page Selected --'] + Page::get_page_list(['parent' => $parentPageId]);
     return String_::edit($content);
 }
Esempio n. 3
0
 /**
  * Edit link settings
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $content = $this->_defaultData($content);
     $link = str_replace('internal://', '', $content['link'], $count);
     $content['link'] = $count > 0 ? '' : $content['link'];
     $this->_editViewData['targetOptions'] = [0 => 'Target: Same Tab', '_blank' => 'Target: New Tab'];
     $this->_editViewData['selectedPage'] = $count > 0 ? $link : 0;
     $this->_editViewData['pageList'] = [0 => 'Custom Link: '] + Page::get_page_list();
     return parent::edit($content);
 }
Esempio n. 4
0
 /**
  * Display form settings
  * Template selector should only should if custom template selected (otherwise deprecated)
  * @param string $postContent
  * @return string
  */
 public function edit($postContent)
 {
     $formData = $this->_defaultData($postContent);
     $formData->template = $formData->template == $this->_block->name ? 0 : $formData->template;
     $this->_editViewData['pageList'] = Page::get_page_list();
     $this->_editViewData['formTemplates'] = [0 => '-- Use view from template --'];
     $theme = Theme::find(config('coaster::frontend.theme'));
     if (!empty($theme)) {
         $forms = base_path('/resources/views/themes/' . $theme->theme . '/blocks/forms');
         if (is_dir($forms)) {
             foreach (scandir($forms) as $form) {
                 if (!is_dir($forms . DIRECTORY_SEPARATOR . $form)) {
                     $form_file = explode('.', $form);
                     if (!empty($form_file[0])) {
                         $this->_editViewData['formTemplates'][$form_file[0]] = $form_file[0] . (strpos(file_get_contents($forms . DIRECTORY_SEPARATOR . $form), 'captcha') ? ' (supports captcha)' : ' (does not support captcha)');
                     }
                 }
             }
         }
     }
     return parent::edit($formData);
 }