Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

Source for file AmiSample_ListViewFrn.php

Documentation is available at AmiSample_ListViewFrn.php

  • <?php
  • /**
  •  * @copyright  Amiro.CMS. All rights reserved.
  •  * @category   AMI
  •  * @package    Module_Sample
  •  * @since      5.12.0
  •  * @filesource
  •  * @version    $Id: AmiSample_ListViewFrn.php 61273 2013-08-07 10:47:54Z Leontiev Anton $
  •  */
  •  
  • /**
  •  * Sample module front list view.
  •  *
  •  * @package    Module_Sample
  •  * @subpackage View
  •  * @resource   ami_sample/list/view/frn <code>AMI::getResource('ami_sample/list/view/frn')</code>
  •  * @since      5.12.0
  •  */
  •     /**
  •      * Template block name
  •      *
  •      * @var string 
  •      */
  •     protected $tplBlockName = 'ami_sample';
  •  
  •     /**
  •      * Table list model
  •      *
  •      * @var AMI_ModTableList 
  •      */
  •     protected $oModel;
  •  
  •     /**
  •      * Returns view data.
  •      *
  •      * @return string 
  •      */
  •     public function get(){
  •         $res '';
  •         $oTpl $this->getTemplate();
  •  
  •         // Load model
  •         $this->oModel->addWhereDef('AND `public` = 1')->load();
  •         if($this->oModel->count(0){
  •             // Add template block
  •             $oTpl->addBlock($this->tplBlockName$this->aScope['templates_path''front.tpl');
  •             $rows '';
  •  
  •             // Prepare all rows
  •             foreach($this->oModel as $oModelItem){
  •                 $aRowData array(
  •                     'id'       => $oModelItem->id,
  •                     'nickname' => AMI_Lib_String::htmlChars($oModelItem->nickname),
  •                     'birth'    => $oModelItem->birth
  •                 );
  •                 $rows .= $oTpl->parse($this->tplBlockName . ':item_row'$aRowData);
  •             }
  •  
  •             // Prepare complete table
  •             $res $oTpl->parse($this->tplBlockName . ':items'array('rows' => $rows));
  •         }else{
  •             // No items found
  •         }
  •         return $res;
  •     }
  •  
  •     /**
  •      * Model typification.
  •      *
  •      * @param  AMI_ModTableList $oModel  Model object
  •      * @return AmiSample_ListViewFrn 
  •      */
  •     protected function _setModel(AMI_ModTableList $oModel){
  •         return parent::_setModel($oModel);
  •     }
  • }