コード例 #1
0
 public function init()
 {
     parent::init();
     $this->__initialization();
     $this->addElement('text', 'name', array('label' => "LABEL_STORE_NAME", 'required' => true, 'validators' => array($this->_getValidatorNotEmpty('LABEL_STORE_NAME'), $this->_getValidatorStringLength(10, 255, 'UTF-8', 'LABEL_STORE_NAME')), 'decorators' => $this->_customDecorators()));
     $this->addElement('text', 'owner', array('label' => "LABEL_SHOP_OWNER", 'required' => true, 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorNotEmpty("LABEL_SHOP_OWNER"), $this->_getValidatorStringLength(0, 255, 'UTF-8', 'LABEL_SHOP_OWNER'))));
     $this->addElement('text', 'phone_number', array('label' => "LABEL_PHONE_NUMBER", 'required' => true, 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorNotEmpty("LABEL_PHONE_NUMBER"), $this->_getValidatorRegex('/^[0-9]{0,11}$/', 'LABEL_PHONE_NUMBER'))));
     $this->addElement('text', 'email', array('label' => "LABEL_EMAIL", 'required' => true, 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorNotEmpty("LABEL_EMAIL"), $this->_getValidatorRegex('/^[\\w\\d\\-\\_]+\\@[\\w\\d\\-\\_]+(\\.[\\d\\w]+){1,2}$/', 'LABEL_EMAIL'))));
     $this->addElement('text', 'address', array('label' => "LABEL_ADDRESS", 'required' => true, 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorNotEmpty("LABEL_ADDRESS"), $this->_getValidatorStringLength(0, 255, 'UTF-8', 'LABEL_ADDRESS'))));
     $this->addElement('text', 'city', array('label' => "LABEL_CITY", 'required' => true, 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorNotEmpty("LABEL_CITY"), $this->_getValidatorStringLength(0, 100, 'UTF-8', 'LABEL_CITY'))));
     $this->addElement('select', 'base_currency', array('label' => "LABEL_BASE_CURRENCY", 'value' => '1000', 'decorators' => $this->_customDecorators(), 'multiOptions' => Core_Model_DbTable_Stores::getBaseCurrencyList()));
     $this->addElement('textarea', 'more_info', array('label' => "LABEL_MORE_INFO", 'required' => false, 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorStringLength(0, 1000, 'UTF-8', 'LABEL_MORE_INFO'))));
     $this->addElement('textarea', 'payment_methods', array('label' => "LABEL_PAYMENT_METHODS", 'required' => false, 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorStringLength(0, 1000, 'UTF-8', 'LABEL_PAYMENT_METHODS'))));
     $this->addElement('file', 'banner', array('label' => "LABEL_BANNER", 'description' => "HINT_BANNER", 'decorators' => $this->_customDecorators('File'), 'destination' => UPLOAD_PATH, 'validators' => array($this->_getValidatorFileExtensions(array('jpg', 'jpeg', 'gif', 'png'), "LABEL_BANNER"), $this->_getValidatorFileSize(0, "512kB", "LABEL_BANNER"))));
     $this->addElement('text', 'link', array('label' => "LABEL_LINK", 'description' => "HINT_LINK", 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorRegex(HTS_Util::getPatternRegexUri(), "LABEL_LINK"))));
     $this->addElement('text', 'products_frequency', array('label' => "LABEL_PRODUCTS_FREQUENCY", 'value' => 12, 'class' => "products_frequency", 'decorators' => $this->_customDecorators(), 'validators' => array($this->_getValidatorBetween(1, 32, "LABEL_PRODUCTS_FREQUENCY"))));
     $this->addElement('select', 'id_page', array('label' => "LABEL_ID_PAGE", 'decorators' => $this->_customDecorators(), 'multiOptions' => $this->_social->getPageList()));
     $this->addElement('submit', 'submit', array('label' => 'LABEL_SUBMIT', 'decorators' => $this->_customDecorators(null, null, 'hidden', null)));
     $this->_generateGroup('store_owner_info', 'FORM_GROUP_STORE_OWNER_INFO', 0, array('name', 'owner', 'phone_number', 'email', 'address', 'city', 'base_currency', 'more_info', 'payment_methods'));
     $this->_generateGroup('store_popular_info', 'FORM_GROUP_STORE_POPULAR_INFO', 1, array('banner', 'link', 'products_frequency', 'id_page'));
 }