예제 #1
0
 public static function CreateRedirectDropdown($id = '', $name = 'redirect_page', $selectedPage = '', $currentPage = '', $add_txt = '')
 {
     $AC =& ac_utils::get_module('AdvancedContent');
     $pages = self::GetPages();
     $dropdown = '<select class="cms_dropdown" name="' . $id . $name . '" ' . ($add_txt != '' ? $add_txt : '') . (!$AC->GetPreference('use_advanced_pageoptions', 0) ? ' disabled="disabled"' : '') . '>';
     $dropdown .= '<option value=""' . ($selectedPage == '' ? ' selected="selected"' : '') . '>' . $AC->lang('hide_content') . '</option>';
     $dropdown .= '<option value="-1"' . ($selectedPage == -1 ? ' selected="selected"' : '') . '>' . $AC->lang('inherit_from_parent') . '</option>';
     if (count($pages)) {
         $dropdown .= '<optgroup label="------------------------------------">';
         $contentops =& cmsms()->GetContentOperations();
         foreach ($pages as $page) {
             $page['content'] = $page['content'] < 0 ? ac_utils::InheritParentProp($page['content_id'], $page['parent_id'], 'redirect_page') : $page['content'];
             $disabled = '';
             $indent = '';
             foreach (explode('.', $page['hierarchy']) as $v) {
                 $indent .= '&nbsp;&nbsp;&nbsp;';
             }
             # don't redirect to pages with no public access, invalid content type, inactive or same content id
             if ($page['active'] != 1 || $page['content'] != 0 || $page['content_id'] == $currentPage || $page['type'] != 'content' && $page['type'] != 'advanced_content') {
                 $disabled = ' disabled="disabled"';
             }
             $dropdown .= '<option' . $disabled . ' value="' . $page['content_id'] . '" ' . ($selectedPage == $page['content_id'] && $disabled == '' ? 'selected="selected"' : '') . '>' . $indent . $contentops->CreateFriendlyHierarchyPosition($page['hierarchy']) . ' - ' . $page['menu_text'] . ($disabled != '' ? ' (' . $AC->lang('invalid') . ')' : '') . '</option>';
         }
         $dropdown .= '</optgroup>';
     }
     $dropdown .= '</select>';
     return $dropdown;
 }
 public function InheritParentProp($propName, $currentProp = array())
 {
     return ac_utils::InheritParentProp($this->Id(), $this->ParentId(), $propName, $currentProp);
 }