public static function GetTabNames() { if (!self::$_init) { self::_init(); } if (!self::$_tab_names) { self::$_tab_names = array(); foreach (self::$_tabs as $tab) { self::$_tab_names[] = $tab['tab_name']; } } return self::$_tab_names; }
/** * @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 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; }
# CMS Made Simple is (c) 2004-2013 by Ted Kulp # The projects homepage is: cmsmadesimple.org # Version: 0.9.4 # File : event.Core.ContentEditPost.php # Purpose: copys the expand/collapse status of blocks when page is copied # License: GPL # #------------------------------------------------------------------------------- if (!function_exists('cmsms') || !is_object(cmsms())) { exit; } if (basename($_SERVER['PHP_SELF']) == 'copycontent.php' && isset($params['content']) && is_object($params['content']) && $params['content']->Type() == 'advanced_content') { if (isset($_GET['content_id'])) { $old_content_id = $_GET['content_id']; } else { $old_content_id = $params['content']->Id(); } foreach ($params['content']->GetContentBlocks() as $contentBlock) { ac_admin_ops::SetVisibility('block', $contentBlock->GetProperty('id'), $params['content']->Id(), $params['content']->TemplateId(), ac_admin_ops::GetVisibility('block', $contentBlock->GetProperty('id'), $old_content_id, $params['content']->TemplateId(), !$contentBlock->GetProperty('collapse'))); } foreach (acTabManager::GetTabs() as $tab) { foreach ($tab['block_groups'] as $groupInfo) { ac_admin_ops::SetVisibility('group', $groupInfo['group_id'], $params['content']->Id(), $params['content']->TemplateId(), ac_admin_ops::GetVisibility('group', $groupInfo['group_id'], $old_content_id, $params['content']->TemplateId(), !$this->GetPreference('collapse_group_default', 1))); } foreach ($tab['block_tabs'] as $block_tab) { foreach ($block_tab['block_groups'] as $groupInfo) { ac_admin_ops::SetVisibility('group', $groupInfo['group_id'], $params['content']->Id(), $params['content']->TemplateId(), ac_admin_ops::GetVisibility('group', $groupInfo['group_id'], $old_content_id, $params['content']->TemplateId(), !$this->GetPreference('collapse_group_default', 1))); } } } }
function TabNames() { $this->GetContentBlocks(); return acTabManager::GetTabNames(); }