Source for file class.acContentBlockBase.php
Documentation is available at class.acContentBlockBase.php
* Class definition and methods for AdvancedContent contentblock types.<br />
* All block types needs to inherit and extend this class!
* @package AdvancedContent
* @category CMSModuleContentType
* @author Georg Busch (NaN)
* @copyright 2010-2012 Georg Busch (NaN)
private $_properties =
array('active' =>
true); // we shouldn't be here if the block is not active
private $_content =
NULL;
protected $_header_html_called =
false;
* Required for all subclasses.<br />
* Should be called from each subclass as the very first.
* @param array $params - the parameters of that contentblock
$this->content_obj =
$content_obj;
$AC =
&ac_utils::get_module('AdvancedContent');
$this->_properties['smarty'] = isset
($params['smarty']) ?
$params['smarty'] :
false;
$this->_properties['editor_groups'] = isset
($params['editor_groups']) ?
$params['editor_groups'] :
'';
$this->_properties['editor_users'] = isset
($params['editor_users']) ?
$params['editor_users'] :
'';
$this->_properties['type'] = isset
($params['block_type']) ?
$params['block_type'] :
'';
$this->_properties['name'] = isset
($params['block']) ?
$params['block'] :
'content_en';
$this->_properties['id'] = isset
($params['block_id']) ?
$params['block_id'] :
preg_replace('/-+/','_', munge_string_to_url($this->_properties['name']));
$this->_properties['label'] = isset
($params['label']) ?
$params['label'] :
ucwords($this->_properties['name']);
$this->_properties['default'] = isset
($params['default']) ?
$params['default'] :
'';
$this->_properties['style'] = isset
($params['style']) ?
$params['style'] :
''; # deprecated
$this->_properties['page_tab'] = isset
($params['page_tab']) ?
$params['page_tab'] :
'main';
$this->_properties['block_tab'] = isset
($params['block_tab']) ?
$params['block_tab'] :
'';
$this->_properties['block_group'] = isset
($params['block_group']) ?
$params['block_group'] :
'';
$this->_properties['description'] = isset
($params['description']) ?
$params['description'] :
'';
$this->_properties['translate_labels'] =
(isset
($params['translate_labels']) &&
ac_utils::IsTrue($params['translate_labels']));
$this->_properties['translate_values'] =
(isset
($params['translate_values']) &&
ac_utils::IsTrue($params['translate_values']));
$this->_properties['required'] =
(isset
($params['required']) &&
ac_utils::IsTrue($params['required']));
$this->_properties['allow_none'] =
!(isset
($params['allow_none']) &&
ac_utils::IsFalse($params['allow_none']));
$this->_properties['no_collapse'] =
(isset
($params['no_collapse']) &&
ac_utils::IsTrue($params['no_collapse']));
$this->_properties['collapsible'] =
!$this->_properties['no_collapse'] &&
$this->_properties['type'];
if(!$this->_properties['collapsible'])
$this->_properties['collapse'] =
false;
$this->_properties['collapse'] = isset
($params['collapse']) ?
!ac_utils::IsFalse($params['collapse']) :
$AC->GetPreference('collapse_block_default', true);
$this->_properties['feu_access'] = isset
($params['feu_access']) ?
$params['feu_access'] :
'';
$this->_properties['feu_action'] =
(isset
($params['feu_action']) &&
ac_utils::IsTrue($params['feu_action']));
$this->_properties['feu_hide'] =
(isset
($params['feu_hide']) &&
ac_utils::IsTrue($params['feu_hide']));
* Backwards compatibility
public function __call($name, $arguments =
array())
$config =
cmsms()->GetConfig();
trigger_error('AdvancedContent blocktype method "' .
$name .
'()" is deprecated! Use "' .
$_name .
'()" instead.', E_USER_WARNING);
return $this->$_name(isset
($arguments[0]) ?
$arguments[0] :
NULL, isset
($arguments[1]) ?
$arguments[1] :
NULL, isset
($arguments[2]) ?
$arguments[2] :
NULL);
public final function Type()
if(strpos($class, "acBlockType_") ===
false)
return AC_INVALID_BLOCK_TYPE;
* Sets the value of a property. If not exists it will be created.
* @param string $name - the name of the property
* @param string $value - the value of the property
* Returns the value of a property.
* @param string $name - the name of the property
* @param string $default - the default value of the property if not exists
* @return mixed - usually this will be a string
public final function GetProperty($name, $default =
'')
if(isset
($this->_properties[$name]))
return $this->_properties[$name];
* Returns all valid properties of that block.
* @return array - array(propname => propvalue)
return $this->_properties;
* Defines additional properties of the blocktype that affects all blocks of this type
* and needs to be stored "outside" the block.
* @return array - array(propname => propvalue)
* Gets the html output of the block in backend.<br />
* This method is required and needs to be overwritten.
* Gets the html that needs to be inserted in the head section for all blocks of this type when editing a page.<br />
* Can be useful to add css or js.<br/>
* Will be called only once for each block type.
$this->_header_html_called =
true;
* Displays the help text for this blocktype.<br />
* Helptext will be displayed in modulehelp.
* Displays the changelog text for this blocktype.<br />
* Changelog will be displayed in modules changelog.
* Function for the subclass to parse out data for it's parameters.<br />
* Needs to be overwritten if the blocktype provides a special kind of data that needs to be processed before storing it.
* @param array &$params - the parameters that are passed when the form is submitted
* @param bool $editing - a flag to determine if the page is created or edited
public function FillParams(&$params, $editing =
false)
return isset
($params[$this->_properties['id']]) ?
$params[$this->_properties['id']] :
'';
* Function for the subclass to perform the blocks output<br />
* Needs to be overwritten if the blocktype provides a special kind of data that needs to be processed before displaying it in frontend.
* Function for the subclass to validate its data
* Function to get the blocks raw content<br />
return $this->_content !==
NULL ?
$this->_content :
$this->content_obj->GetPropertyValue($this->_properties['id']);
* Function to set the content of a block temporary on runtime to a certain value<br />
$this->_content =
$value;
Documentation generated on Tue, 09 Oct 2012 16:57:05 +0200 by phpDocumentor 1.4.1