|
Source for file my_class.php
Documentation is available at my_class.php
* @copyright Amiro.CMS. All rights reserved.
* @version $Id: my_class.php 61273 2013-08-07 10:47:54Z Leontiev Anton $
private $tplBlock = 'sample_plugin';
* @param string $side front|admin
* @param array $aPluginParams $pluginParams variable
public function __construct($side, array $aPluginParams){
$this->aParams = $aPluginParams;
$this->oTpl = AMI::getSingleton('env/template_sys');
$templateName = $side == 'front' ? 'front' : 'admin';
$this->oTpl->addBlock($this->tplBlock, $this->aParams['templates_path'] . $templateName . '.tpl');
$this->oTpl->parseLocale($this->aParams['templates_path'] . $templateName . '.lng');
$res = $this->oTpl->parse($this->tplBlock . ':body', $aData);
* Returns HTML table containing plugin parameters.
foreach($this->aParams as $key => $value){
$rows .= $this->oTpl->parse($this->tplBlock . ':plugin_params_row', array('key' => $key, 'value' => $value));
$res = $this->oTpl->parse($this->tplBlock . ':plugin_params', array('rows' => $rows));
* Returns HTML table containing user defined plugin options.
* @see options/options.php
'bool', 'uint', 'sint', 'float', 'char', 'text', 'email', 'enum',
'enum_multi_array', 'enum_multi_array2',
'date_period', 'date_period_positive', 'date_period_negative'
) as $optionNamePostfix){
$optionName = 'option_' . $optionNamePostfix;
$rows .= $this->oTpl->parse($this->tplBlock . ':options_row', array('name' => $optionName, 'value' => $optionValue));
$res = $this->oTpl->parse($this->tplBlock . ':options', array('rows' => $rows));
* Returns HTML table containing database table data.
$sql = "SELECT * FROM `cms_plugin_sample`";
foreach($oRS as $aRecord){
$rows .= $this->oTpl->parse($this->tplBlock . ':database_row', $aRecord);
$res = $this->oTpl->parse($this->tplBlock . ':database', array('rows' => $rows));
* Fills db table with test data if empty.
private function fillDB(){
if(!$oDB->fetchValue("SELECT COUNT(1) FROM `cms_plugin_sample`")){
array('name' => 'record 1', 'value' => 'value 1'),
array('name' => 'record 2', 'value' => 'value 2'),
array('name' => 'record 3', 'value' => 'value 3'),
|