energine
[ class tree: energine ] [ index: energine ] [ all elements ]

Source for file ManufacturersEditor.class.php

Documentation is available at ManufacturersEditor.class.php

  1. <?php
  2. /**
  3.  * Содержит класс ManufacturersEditor
  4.  *
  5.  * @package energine
  6.  * @subpackage shop
  7.  * @author d.pavka
  8.  * @copyright d.pavka@gmail.com
  9.  */
  10.  
  11.  /**
  12.   * Редактор производителей
  13.   *
  14.   * @package energine
  15.   * @subpackage shop
  16.   * @author d.pavka@gmail.com
  17.   * @final
  18.   */
  19.  final class ManufacturersEditor extends Grid {
  20.     /**
  21.      * Конструктор класса
  22.      *
  23.      * @param string $name 
  24.      * @param string $module 
  25.      * @param Document $document 
  26.      * @param array $params 
  27.      * @access public
  28.      */
  29.     public function __construct($name$moduleDocument $document,  array $params null{
  30.         parent::__construct($name$module$document,  $params);
  31.         $this->setTableName('shop_producers');
  32.         $this->setOrder(array('producer_name' => QAL::ASC));
  33.     }
  34.     
  35.     protected function add(){
  36.         parent::add();
  37.         $f $this->getDataDescription()->getFieldDescriptionByName('producer_segment');
  38.         $f->setProperty('nullable''nullable');
  39.         $f->setProperty('pattern''/^[-_a-z0-9]*$/');    
  40.         $f->setProperty('message'$this->translate('TXT_BAD_SEGMENT_FORMAT'));
  41.     }
  42.         
  43.     protected function saveData(){
  44.         if(($this->getPreviousAction(== 'add'&& (!isset($_POST[$this->getTableName()]['producer_segment']|| empty($_POST[$this->getTableName()]['producer_segment'])) ){
  45.             $_POST[$this->getTableName()]['producer_segment'Translit::transliterate($_POST[$this->getTableName()]['producer_name']'-'true);
  46.         }
  47.         $result parent::saveData();
  48.  
  49.         return $result;
  50.     }
  51. }
В создании документации нам помог: phpDocumentor