Пример #1
0
 $times[$this->lang('weeks')] = 'week';
 $times[$this->lang('months')] = 'month';
 $times[$this->lang('years')] = 'year';
 $start_date = explode(' ', $this->GetPreference("start_date", '1 week'));
 $end_date = explode(' ', $this->GetPreference("end_date", '1 week'));
 $this->smarty->assign('start_date_text', $this->lang('startdate'));
 $this->smarty->assign('start_date_input', $this->CreateInputText($id, 'AdvancedContentStartDate', $start_date[0], 3, 5) . $this->CreateInputDropdown($id, 'AdvancedContentStartTime', $times, '', $start_date[1]) . ' ' . $this->lang('aftercurrdate'));
 $this->smarty->assign('end_date_text', $this->lang('enddate'));
 $this->smarty->assign('end_date_input', $this->CreateInputText($id, 'AdvancedContentEndDate', $end_date[0], 3, 5) . $this->CreateInputDropdown($id, 'AdvancedContentEndTime', $times, '', $end_date[1]) . ' ' . $this->lang('afterstartdate'));
 if ($feusers =& $this->GetModuleInstance('FrontEndUsers')) {
     $this->smarty->assign('feuaccess_text', $this->lang('frontendaccess'));
     $feuAccess = array($this->lang('inherit_from_parent') => -1);
     $feuAccess = array_merge($feuAccess, $feusers->GetGroupList());
     $selectedGroups = $this->GetPreference('feu_access');
     $delim = strpos($selectedGroups, ',') === FALSE ? ';' : ',';
     $selectedGroups = ac_utils::CleanArray(explode($delim, $selectedGroups));
     $this->smarty->assign('feuaccess_input', $this->CreateInputHidden($id, 'feu_access', '') . $this->CreateInputSelectList($id, 'feu_access[]', $feuAccess, $selectedGroups, count($feuAccess), !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : '', 1));
     $this->smarty->assign('redirectpage_text', $this->lang('redirectpage'));
     $this->smarty->assign('redirectpage_input', ac_admin_ops::CreateRedirectDropdown($id, 'redirect_page', $this->GetPreference('redirect_page')));
     $this->smarty->assign('inherit_text', $this->lang('inherit_from_parent'));
     $this->smarty->assign('redirectparams_text', $this->lang('redirectparams'));
     $this->smarty->assign('evaluatesmarty_text', $this->lang('evaluatesmarty'));
     $inheritParams = $this->GetPreference('inherit_feu_params', 0);
     $this->smarty->assign('inherit_feu_params_input', $this->CreateInputHidden($id, 'inherit_feu_params', 0) . $this->CreateInputCheckbox($id, 'inherit_feu_params', 1, $inheritParams, !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $this->smarty->assign('feu_params_text', $this->lang('feu_params'));
     $this->smarty->assign('feu_params_input', $this->CreateInputText($id, 'feu_params', $this->GetPreference('feu_params'), 32, 128, !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $this->smarty->assign('feu_params_smarty_text', $this->lang('feu_params_smarty'));
     $this->smarty->assign('feu_params_smarty_input', $this->CreateInputHidden($id, 'feu_params_smarty', 0) . $this->CreateInputCheckbox($id, 'feu_params_smarty', 1, $this->GetPreference('feu_params_smarty'), !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $inheritParams = $this->GetPreference('inherit_custom_params', 0);
     $this->smarty->assign('inherit_custom_params_input', $this->CreateInputHidden($id, 'inherit_custom_params', 0) . $this->CreateInputCheckbox($id, 'inherit_custom_params', 1, $inheritParams, !$this->GetPreference('use_advanced_pageoptions', 0) ? 'disabled="disabled"' : ''));
     $this->smarty->assign('custom_params_text', $this->lang('custom_params'));
    public function GetInput()
    {
        if (!$this->GetContent()) {
            $this->SetContent(time());
        }
        setlocale(LC_ALL, get_preference(get_userid(), 'default_cms_language'));
        $date = strftime('%x', intval($this->GetContent()));
        $time = '0:0';
        if ($this->GetProperty('show_clock')) {
            $time = strftime('%H:%M', intval($this->GetContent()));
        }
        $_tmp = ac_utils::CleanArray(explode(':', $time));
        $timeSeconds = $_tmp[0] * 3600 + $_tmp[1] * 60;
        $dateSeconds = $this->GetContent() - $timeSeconds;
        $dateInput = '<input id="' . $this->GetProperty('id') . '_AdvancedContentDatePickerDisplay" type="text" value="' . $date . '" />
			<input id="' . $this->GetProperty('id') . '_AdvancedContentDate" type="hidden" name="' . $this->GetProperty('id') . '[date]" value="' . $dateSeconds * 1000 . '" />';
        $suffix = '';
        $timeInput = '';
        if ($this->GetProperty('show_clock')) {
            $timeInput = '&nbsp;&nbsp;-&nbsp;&nbsp;<select name="' . $this->GetProperty('id') . '[time]">';
            $_i = 0;
            for ($i = $this->GetProperty('start_hour'); $i <= $this->GetProperty('end_hour'); $i += $this->GetProperty('step_hours')) {
                if ($i < 12 && !$this->GetProperty('show24h')) {
                    $suffix = ' am';
                } else {
                    if (!$this->GetProperty('show24h')) {
                        $suffix = ' pm';
                    }
                }
                for ($j = $this->GetProperty('start_minute'); $j <= $this->GetProperty('end_minute'); $j += $this->GetProperty('step_minutes')) {
                    $value = $i * 3600 + $j * 60;
                    if ($this->GetProperty('end_hour') < 23 && $value <= $this->GetProperty('end_hour') * 3600 || $this->GetProperty('end_hour') == 23) {
                        $timeInput .= '<option value="' . $value . '"' . ($value == $timeSeconds ? ' selected="selected"' : '') . '>' . ($i < 10 ? '0' . $i : (!$this->GetProperty('show24h') && $i > 12 ? $i - 12 : $i)) . ':' . ($j < 10 ? '0' . $j : $j) . $suffix . '</option>';
                    }
                }
                $j = $this->GetProperty('start_minute');
            }
            $timeInput .= '</select>';
        }
        return $dateInput . $timeInput;
    }
 /**
  * Smarty Plugin : {get_global_contents}
  * Purpose       : This plugin displays properties of global content blocks of CMSms 
  *                 divided by a separator
  * Author        : Georg Busch (NaN)
  * Copyright     : 2010 - 2012 Georg Busch (NaN)
  * Version       : 1.0
  * License       : GPL
  */
 public static function get_global_contents($params, &$obj)
 {
     if (version_compare(CMS_VERSION, '1.11') < 0) {
         $smarty =& $obj;
     } else {
         $smarty =& $obj->smarty;
     }
     $gcbs = cmsms()->GetGlobalContentOperations()->LoadHtmlBlobs();
     $delimiter = "<hr />";
     if (isset($params['delimiter']) && trim($params['delimiter']) != '') {
         $delimiter = trim($params['delimiter']);
     }
     $excl_prefix = array();
     $incl_prefix = array();
     $excl_sufix = array();
     $incl_sufix = array();
     if (isset($params['excl_prefix'])) {
         $excl_prefix = ac_utils::CleanArray(explode(',', $params['excl_prefix']));
     }
     if (isset($params['excl_sufix'])) {
         $excl_sufix = ac_utils::CleanArray(explode(',', $params['excl_sufix']));
     }
     if (isset($params['incl_prefix'])) {
         $incl_prefix = ac_utils::CleanArray(explode(',', $params['incl_prefix']));
     }
     if (isset($params['incl_sufix'])) {
         $incl_sufix = ac_utils::CleanArray(explode(',', $params['incl_sufix']));
     }
     $assign_as = 'string';
     if (isset($params['assign_as'])) {
         $assign_as = $params['assign_as'];
     }
     $output = 'content';
     // name, id, owner, modified_date, full_object
     if (isset($params['output'])) {
         $output = $params['output'];
     }
     $sort_by = 'id';
     if (isset($params['sort_by'])) {
         $sort_by = $params['sort_by'];
     }
     $sort_order = 'asc';
     if (isset($params['sort_order'])) {
         $sort_order = $params['sort_order'];
     }
     $gcb_array = array();
     foreach ($gcbs as $gcb) {
         $skip = false;
         foreach ($excl_prefix as $str) {
             if (startswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         foreach ($incl_prefix as $str) {
             if (!startswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         foreach ($excl_sufix as $str) {
             if (endswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         foreach ($incl_sufix as $str) {
             if (!endswith($gcb->name, $str)) {
                 $skip = true;
                 break;
             }
         }
         if ($skip) {
             continue;
         }
         switch ($sort_by) {
             case 'name':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->name] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->name] = $gcb->{$output};
                 break;
             case 'modified_date':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->modified_date] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->modified_date] = $gcb->{$output};
                 break;
             case 'owner':
             case 'owner+create_date':
             case 'owner+id':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->owner . '_' . $gcb->id] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->owner . '_' . $gcb->id] = $gcb->{$output};
                 break;
             case 'owner+name':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->owner . '_' . $gcb->name] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->owner . '_' . $gcb->name] = $gcb->{$output};
                 break;
             case 'owner+modified_date':
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->owner . '_' . $gcb->modified_date] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->owner . '_' . $gcb->modified_date] = $gcb->{$output};
                 break;
             case 'id':
             case 'create_date':
             default:
                 if ($output == 'full_object') {
                     $gcb_array[$gcb->id] = $gcb;
                     break;
                 }
                 $gcb_array[$gcb->id] = $gcb->{$output};
                 break;
         }
     }
     if ($sort_order == 'desc') {
         krsort($gcb_array);
     } else {
         ksort($gcb_array);
     }
     if (isset($params['assign'])) {
         if ($assign_as == "array") {
             $smarty->assign($params['assign'], $gcb_array);
             return;
         }
         $smarty->assign($params['assign'], implode($delimiter, $gcb_array));
         return;
     }
     return implode($delimiter, $gcb_array);
 }
Пример #4
0
 public static function EditAsArray(&$content_obj, $adding = false, $tab = 0, $showadmin = false)
 {
     if (!($tab_id = acTabManager::GetTabId($tab))) {
         return array();
     }
     $AC =& ac_utils::get_module('AdvancedContent');
     $ret = array();
     $tmp = array();
     if ($tab_id == 'main' || $tab_id == 'options' && check_permission(get_userid(), 'Manage All Content')) {
         $tmp = ac_utils::CleanArray($content_obj->DisplayAttributes($adding, $tab));
     } else {
         if ($tab_id == 'AdvancedContent') {
             $tmp = self::DisplayAdvancedOptions($content_obj, $adding);
         }
     }
     foreach ($tmp as $one) {
         $ret[] = $one;
     }
     $AC->smarty->assign_by_ref('content_obj', $content_obj);
     $AC->smarty->assign('tab', acTabManager::GetTab($tab_id));
     $AC->smarty->assign('locale', substr(get_preference(get_userid(), 'default_cms_language'), 0, 2));
     if ($tab == 0) {
         $html = $AC->GetHeaderHTML() . '<!-- start ac blocktypes head -->';
         $blockTypes =& acContentBlockManager::GetBlockTypes();
         foreach ($blockTypes as &$btype) {
             if ($btype['header_html_called']) {
                 continue;
             }
             $btype['header_html_called'] = true;
             $blocks = $btype['content_blocks'];
             $block_id = array_shift($blocks);
             $contentBlock =& $content_obj->GetContentBlock($block_id);
             if ($contentBlock->Type() == AC_INVALID_BLOCK_TYPE) {
                 continue;
             }
             $html .= $contentBlock->GetHeaderHTML();
         }
         echo $html . '<!-- end ac blocktypes head -->';
     }
     $ret[] = array('', $AC->ProcessTemplate('editcontent.tpl'));
     return $ret;
 }
 public function FillParams(&$params, $editing = false)
 {
     $blockId = $this->GetProperty('id');
     $multi_inputs = array();
     $value = '';
     $blockType =& acContentBlockManager::GetBlockType('multi_input');
     $multiInput_props = $blockType['props'];
     foreach (ac_utils::CleanArray(explode(',', $this->GetProperty('inputs'))) as $k1 => $multi_input_id) {
         $multi_input_values = array();
         foreach ($multiInput_props[$multi_input_id]['elements'] as $k2 => $inputBlock) {
             if (isset($params['multiInput-' . $blockId . '-' . $multi_input_id . '-' . $k1 . '-' . $k2])) {
                 $inputBlock->SetProperty('id', 'multiInput-' . $blockId . '-' . $multi_input_id . '-' . $k1 . '-' . $k2);
                 $multi_input_values[] = $inputBlock->FillParams($params, $editing);
             }
         }
         $multi_inputs[] = implode($this->GetProperty('value_delimiter'), $multi_input_values);
     }
     if (!ac_utils::IsVarEmpty($multi_inputs)) {
         $value = implode($this->GetProperty('input_delimiter'), $multi_inputs);
     }
     return $value;
 }
Пример #6
0
     $this->SetPreference('group_display_settings', $params['group_display_settings']);
 }
 if (isset($params['collapse_group_default'])) {
     $this->SetPreference('collapse_group_default', $params['collapse_group_default']);
 }
 if (isset($params['use_expire_date'])) {
     $this->SetPreference('use_expire_date', $params['use_expire_date']);
 }
 if (isset($params['AdvancedContentStartDate'])) {
     $this->SetPreference('start_date', intval($params['AdvancedContentStartDate']) . ' ' . $params['AdvancedContentStartTime']);
 }
 if (isset($params['AdvancedContentEndDate'])) {
     $this->SetPreference('end_date', intval($params['AdvancedContentEndDate']) . ' ' . $params['AdvancedContentEndTime']);
 }
 if (isset($params['feu_access'])) {
     $this->SetPreference('feu_access', implode(',', ac_utils::CleanArray($params['feu_access'])));
 }
 if (isset($params['redirect_page'])) {
     $this->SetPreference('redirect_page', $params['redirect_page']);
 }
 if (isset($params['feu_params'])) {
     $this->SetPreference('feu_params', $params['feu_params']);
 }
 if (isset($params['feu_params_smarty'])) {
     $this->SetPreference('feu_params_smarty', $params['feu_params_smarty']);
 }
 if (isset($params['inherit_feu_params'])) {
     $this->SetPreference('inherit_feu_params', $params['inherit_feu_params']);
 }
 if (isset($params['custom_params'])) {
     $this->SetPreference('custom_params', $params['custom_params']);
 public function GetProperty($propName)
 {
     $propValue = $this->GetPropertyValue($propName);
     if (ac_utils::get_module('AdvancedContent')->GetPreference('use_advanced_pageoptions', 0)) {
         if (!$this->_inheritables) {
             $this->_inheritables =& ac_utils::GetInheritables($this->Id());
         }
         if (!isset($this->_inheritables[$propName])) {
             return $propValue;
         }
         $inherit = false;
         if ($propName == 'feu_access') {
             $delim = strpos($propValue, ',') === FALSE ? ';' : ',';
             $propValue = ac_utils::CleanArray(explode($delim, $propValue));
             if (in_array(-1, $propValue)) {
                 $inherit = true;
             }
         } else {
             if ($propValue == -1) {
                 $inherit = true;
             }
         }
         if ($inherit) {
             $propValue = $this->InheritParentProp($propName, $propValue);
         }
         if ($propName == 'feu_params' || $propName == 'custom_params') {
             $matches = array();
             $result = preg_match_all(AC_BLOCK_PARAM_PATTERN, $propValue, $matches);
             $params1 = array();
             $params2 = array();
             for ($i = 0; $i < count($matches[1]); $i++) {
                 if (startswith($matches[2][$i], '\'')) {
                     $matches[2][$i] = trim($matches[2][$i], '\'');
                 } else {
                     if (startswith($matches[2][$i], '"')) {
                         $matches[2][$i] = trim($matches[2][$i], '"');
                     }
                 }
                 $params1[$matches[1][$i]] = $matches[2][$i];
                 $params2[] = $matches[1][$i] . '=' . $matches[2][$i];
             }
             $propValue = array($params1, $params2);
         }
     }
     return $propValue;
 }