public function GetInput() { $AC =& ac_utils::get_module('AdvancedContent'); $multi_input_ids = ac_utils::CleanArray(explode(',', $this->GetProperty('inputs'))); $input_values = array(); $multi_input = ''; foreach (explode($this->GetProperty('input_delimiter'), $this->GetContent()) as $input_data) { $input_values[] = explode($this->GetProperty('value_delimiter'), $input_data); } $blockType =& acContentBlockManager::GetBlockType('multi_input'); $multiInput_props = $blockType['props']; foreach ($multi_input_ids as $k1 => $multi_input_id) { if (isset($multiInput_props[$multi_input_id])) { if (!isset($multiInput_props[$multi_input_id]['template'])) { $multiInput_props[$multi_input_id]['template'] = $AC->GetTemplate($multiInput_props[$multi_input_id]['tpl_name']); acContentBlockManager::SetBlockTypeProperty('multi_input', $multi_input_id, $multiInput_props[$multi_input_id]); } $inputs = array(); foreach ($multiInput_props[$multi_input_id]['elements'] as $k2 => $inputBlock) { if ($inputBlock->GetProperty('smarty')) { foreach ($inputBlock->GetProperties() as $propName => $propValue) { $inputBlock->SetProperty($propName, ac_utils::DoSmarty($content_obj, $propValue)); } } $inputBlock->SetProperty('id', 'multiInput-' . $this->GetProperty('id') . '-' . $multi_input_id . '-' . $k1 . '-' . $k2); $inputBlock->SetContent(isset($input_values[$k1][$k2]) ? $input_values[$k1][$k2] : ''); $inputs[$inputBlock->GetProperty('id')] = $inputBlock; } $AC->smarty->assign_by_ref('inputs', $inputs); #$multi_input .= $AC->ProcessTemplateFromData($multiInput_props[$multi_input_id]['template']); $multi_input .= $AC->smarty->fetch('string:' . $multiInput_props[$multi_input_id]['template']); } } return $multi_input; }
/** * @internal * @access private */ public static function _register_content_block(&$content_obj, &$contentBlock) { # do not process blocks with same id twice if (isset(self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')])) { self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')]->SetProperty('multiple', true); return; } $AC =& ac_utils::get_module('AdvancedContent'); $block_id = $contentBlock->GetProperty('id'); # this block has been added to the template after page has been created? if (!$content_obj->HasProperty($block_id)) { $contentBlock->SetProperty('new_block', true); } # ToDo: how remove the backend stuff from this class without need to loop through all content blocks again? if (!ac_utils::is_frontend_request()) { $type = $contentBlock->Type(); if (!isset(self::$_block_types[$type])) { self::$_block_types[$type] = array('content_blocks' => array(), 'header_html_called' => false, 'props' => array()); } self::$_block_types[$type]['content_blocks'][$block_id] = $block_id; acTabManager::SetTabs($content_obj, $contentBlock); if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE) { if ($contentBlock->GetProperty('smarty')) { foreach ($contentBlock->GetProperties() as $propName => $propValue) { $contentBlock->SetProperty($propName, ac_utils::DoSmarty($content_obj, $propValue)); } } $value = $contentBlock->GetContent(); if ($content_obj->Id() < 0 && $value == '' || $value == '' && !$contentBlock->GetProperty('allow_none') || $contentBlock->GetProperty('new_block')) { $value = $contentBlock->GetProperty('default'); } $content_obj->SetPropertyValueNoLoad($block_id, $value); $block_display = true; if ($contentBlock->GetProperty('collapsible')) { $block_display = ac_admin_ops::GetVisibility('block', $block_id, $content_obj->Id(), $content_obj->TemplateId(), !$contentBlock->GetProperty('collapse')); $contentBlock->SetProperty('pref_url', str_replace('&);', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_block'), array('item_type' => 'block', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => !$block_display), '', true))); } $contentBlock->SetProperty('display', $block_display); } if (strtolower($contentBlock->GetProperty('label')) == 'content_en') { $contentBlock->SetProperty('label', lang('content')); } if ($contentBlock->GetProperty('translate_labels')) { $contentBlock->SetProperty('label', $AC->lang($contentBlock->GetProperty('label'))); } # deprecated (should not be needed since CMSms 1.11) if ($contentBlock->GetProperty('multiple') && ac_admin_ops::GetVisibility('message', $block_id, $content_obj->Id(), $content_obj->TemplateId())) { $hide_link = str_replace('&', '&', $AC->CreateLink('m1_', 'savePrefs', '', $AC->lang('toggle_message'), array('item_type' => 'message', 'disable_theme' => true, 'edit_content' => true, 'content_id' => $content_obj->Id(), 'template_id' => $content_obj->TemplateId(), 'item_id' => $block_id, 'item_display' => 0), '', false, '', 'onclick="jQuery.get(this.href); jQuery(\'#' . $block_id . '_message\').toggle(\'fast\',function(){jQuery(this).remove()}); return false;"')); $contentBlock->SetProperty('message', $AC->lang('notice_duplicatecontent', $contentBlock->GetProperty('name')) . ' (' . $hide_link . ')'); } #--- $contentBlock->SetBlockTypeProperties(); } if ($contentBlock->Type() != AC_INVALID_BLOCK_TYPE && ac_utils::is_frontend_request() || !ac_utils::is_frontend_request()) { $content_obj->AddExtraProperty($block_id); # backward compatibility (deprecated) self::$_content_blocks[$content_obj->Id()][$block_id] = $contentBlock; } }
public static function FillParams(&$content_obj, &$params, $editing = false) { $AC =& ac_utils::get_module('AdvancedContent'); $parameters = array_merge(array('pagedata', 'searchable', 'disable_wysiwyg'), $content_obj->GetAdvancedAttribs()); if (check_permission(get_userid(), 'Manage AdvancedContent Options') && $AC->GetPreference('use_advanced_pageoptions', 0)) { $params['feu_access'] = isset($params['feu_access']) && is_array($params['feu_access']) ? $params['feu_access'] : ($editing ? ac_utils::CleanArray(explode(',', $content_obj->GetPropertyValue('feu_access'))) : ac_utils::CleanArray(explode(',', $AC->GetPreference('feu_access')))); # if page has no parents but wants to inherit -> remove inheritance if ($content_obj->ParentId() <= 0 && in_array(-1, $params['feu_access'])) { foreach ($params['feu_access'] as $k => $v) { if ($v == -1) { unset($params['feu_access'][$k]); } } } # if there is still inheritance -> check if there actually is any feu group selected by parents $_feuAccess = array(); if (in_array(-1, $params['feu_access'])) { # $_feuAccess contains all feu groups (of current page as well as of all parent pages) $_feuAccess = $content_obj->InheritParentProp('feu_access', $params['feu_access']); } # if we have selected any feu group -> disable caching and search if (count($_feuAccess) || count($params['feu_access']) && !in_array(-1, $params['feu_access'])) { $params['cachable'] = false; $content_obj->SetCachable(false); $params['searchable'] = false; } $params['feu_access'] = implode(',', $params['feu_access']); $params['redirect_page'] = isset($params['redirect_page']) ? $params['redirect_page'] : ($editing ? $content_obj->GetPropertyValue('redirect_page') : $AC->GetPreference('redirect_page')); if ($content_obj->ParentId() <= 0 && $params['redirect_page'] == -1) { $params['redirect_page'] = ''; } $params['feu_action'] = isset($params['feu_action']) ? $params['feu_action'] : ($editing ? $content_obj->GetPropertyValue('feu_action') : $AC->GetPreference('feu_action', 1)); if ($content_obj->ParentId() <= 0 && $params['feu_action'] == -1) { $params['feu_action'] = 1; } $params['hide_menu_item'] = isset($params['hide_menu_item']) ? $params['hide_menu_item'] : ($editing ? $content_obj->GetPropertyValue('hide_menu_item') : $AC->GetPreference('hide_menu_item', 0)); if ($content_obj->ParentId() <= 0 && $params['hide_menu_item'] == -1) { $params['hide_menu_item'] = 0; } /*ToDo: do this on validation if($params['feu_access'] && $params['hide_menu_item'] == 2) { $params['hide_menu_item'] = $AC->GetPreference('hide_menu_item',0); } */ $params['inherit_feu_params'] = isset($params['inherit_feu_params']) ? true : ($editing ? $content_obj->GetPropertyValue('inherit_feu_params') : $AC->GetPreference('inherit_feu_params')); if ($content_obj->ParentId() <= 0 && $params['inherit_feu_params']) { $params['inherit_feu_params'] = false; } if ($params['inherit_feu_params']) { $params['feu_params'] = -1; $params['feu_params_smarty'] = -1; } $params['inherit_custom_params'] = isset($params['inherit_custom_params']) ? true : ($editing ? $content_obj->GetPropertyValue('inherit_custom_params') : $AC->GetPreference('inherit_custom_params')); if ($content_obj->ParentId() <= 0 && $params['inherit_custom_params']) { $params['inherit_custom_params'] = false; } if ($params['inherit_custom_params']) { $params['custom_params'] = -1; $params['custom_params_smarty'] = -1; } $params['use_expire_date'] = isset($params['use_expire_date']) ? $params['use_expire_date'] : ($editing ? $content_obj->GetPropertyValue('use_expire_date') : $AC->GetPreference('use_expire_date')); if ($content_obj->ParentId() <= 0 && $params['use_expire_date'] == -1) { $params['use_expire_date'] = 0; } if ($params['use_expire_date'] == -1) { $params['start_date'] = -1; $params['end_date'] = -1; } else { if ($params['use_expire_date'] == 0) { $params['start_date'] = ''; $params['end_date'] = ''; } else { if (isset($params['start_date'])) { $params['start_date'] = $params['start_date']['time'] + $params['start_date']['date'] / 1000; } else { $params['start_date'] = $editing && $content_obj->GetPropertyValue('start_date') ? $content_obj->GetPropertyValue('start_date') : strtotime('+' . $AC->GetPreference("start_date", '1 week')); } if (isset($params['end_date'])) { $params['end_date'] = $params['end_date']['time'] + $params['end_date']['date'] / 1000; } else { $params['end_date'] = $editing && $content_obj->GetPropertyValue('end_date') ? $content_obj->GetPropertyValue('end_date') : strtotime('+' . $AC->GetPreference("end_date", '1 week'), $params['start_date']); } } } } # do the content property parameters foreach ($parameters as $oneparam) { if (isset($params[$oneparam])) { $content_obj->SetPropertyValueNoLoad($oneparam, $params[$oneparam]); } } if (check_permission(get_userid(), 'Manage AdvancedContent Options') && $AC->GetPreference('use_advanced_pageoptions', 0) && $content_obj->GetPropertyValue('use_expire_date') && ($content_obj->GetProperty('start_date') > time() || $content_obj->GetProperty('end_date') < time())) { $params['active'] = false; $content_obj->SetActive(false); } # metadata $content_obj->SetMetadata(isset($params['metadata']) ? $params['metadata'] : $content_obj->Metadata()); # contentblocks # ToDo: this causes issues on import in TMS # (maybe caused by $contentBlock->FillParams()) foreach ($content_obj->GetContentBlocks() as $blockId => $contentBlock) { $value = $contentBlock->FillParams($params, $editing); if ($value == '' && !$contentBlock->GetProperty('allow_none')) { $value = $contentBlock->GetProperty('default'); if ($contentBlock->GetProperty('smarty')) { $value = ac_utils::DoSmarty($content_obj, $value); } } $content_obj->SetPropertyValueNoLoad($blockId, $value); } }
$module =& ac_utils::get_module($modulename); if (is_object($module) && $module->IsPluginModule()) { @ob_start(); $params = GetModuleParameters($id); $returnid = isset($params['returnid']) ? $params['returnid'] : $content_obj->Id(); $output = $module->DoActionBase($action, $id, $params, $returnid); if ($output !== FALSE && (!isset($params['no_output']) || ac_utils::IsFalse($params['no_output']))) { echo $output; } $output = @ob_get_contents(); @ob_end_clean(); } } else { $oldvalue = cmsms()->GetSmarty()->caching; cmsms()->GetSmarty()->caching = false; $contentId = $content_obj->Id(); $output = cmsms()->GetSmarty()->fetch(str_replace(' ', '_', 'content:' . $block), '|' . $block, $contentId . $block); cmsms()->GetSmarty()->caching = $oldvalue; $defaultValue = isset($params['default']) ? trim($params['default']) : ''; $doSmarty = isset($params['smarty']) && ac_utils::IsTrue($params['smarty']); if ($doSmarty) { $defaultValue = ac_utils::DoSmarty($content_obj, $defaultValue); } $allowNone = !isset($params['allow_none']) || ac_utils::IsFalse($params['allow_none']); if ($output == '' && !$allowNone) { $output = $defaultValue; } } if (!isset($params['no_output']) || ac_utils::IsFalse($params['no_output'])) { echo trim($output); }