public function init()
 {
     parent::init();
     $this->__initialization();
     $this->addElement('text', 'name', array('label' => "LABEL_CATEGORY_NAME", 'required' => true, 'max_length' => 255, 'validators' => array($this->_getValidatorNotEmpty('LABEL_CATEGORY_NAME'), $this->_getValidatorStringLength(0, 255, 'UTF-8', 'LABEL_CATEGORY_NAME')), 'decorators' => $this->_customDecorators()));
     if (empty($this->_configs['name']) || $this->_configs['name'] == 'form_add_categories') {
         $this->addElement('button', 'btn_add_more', array('label' => 'LABEL_ADD_MORE', 'decorators' => $this->_button_decorators));
         $this->addElement('submit', 'btn_submit', array('label' => 'LABEL_SUBMIT', 'decorators' => $this->_button_decorators));
     } else {
         $this->addElement('submit', 'btn_save', array('label' => 'LABEL_SAVE', 'decorators' => $this->_customDecorators(null, null, 'hidden', null)));
     }
 }
Exemplo n.º 2
0
 public function init()
 {
     parent::init();
     $this->__initialization();
     $this->addElement('text', 'name', array('label' => "LABEL_NAME", 'required' => true, 'validators' => array($this->_getValidatorNotEmpty('NAME_'), $this->_getValidatorStringLength(10, 255, 'UTF-8', 'NAME_')), 'decorators' => $this->_elementDecorators));
     $this->addElement('textarea', 'description', array('label' => "LABEL_DESCRIPTION", 'required' => true, 'decorators' => $this->_elementDecorators, 'validators' => array($this->_getValidatorNotEmpty("DESCRIPTION_"), $this->_getValidatorStringLength(0, 1000, 'UTF-8', 'description_'))));
     $this->addElement('file', 'logo', array('label' => "LABEL_LOGO", 'required' => true, 'description' => "HINT_LOGO", 'decorators' => $this->_file_decorators, 'validators' => array($this->_getValidatorFileUpload("LOGO_"), $this->_getValidatorFileCount(0, 1, "LOGO_"), $this->_getValidateIsImage(array(), "LOGO_"), $this->_getValidatorFileSize(0, "200kB", "LOGO_"))));
     $this->addElement('file', 'banner', array('label' => "LABEL_BANNER", 'description' => "HINT_BANNER", 'decorators' => $this->_file_decorators, 'validators' => array($this->_getValidatorFileCount(0, 1, "BANNER_"), $this->_getValidateIsImage(array(), "BANNER_"), $this->_getValidatorFileSize(0, "200kB", "BANNER_"))));
     $this->addElement('text', 'link', array('label' => "LABEL_LINK", 'description' => "HINT_LINK", 'decorators' => $this->_elementDecorators, 'validators' => array($this->_getValidatorRegex(HTS_Util::getPatternRegexUri(), "LINK_"))));
     $this->addElement('select', 'currency', array('label' => "LABEL_PAYMENT_UNIT", 'value' => "USD", 'decorators' => $this->_elementDecorators, 'multiOptions' => $this->_currency_code));
     $this->addElement('text', 'number_products', array('label' => "LABEL_NUMBER_PRODUCTS", 'value' => 20, 'class' => "number_products", 'decorators' => $this->_elementDecorators, 'validators' => array($this->_getValidatorBetween(1, 30, "NUMBER_PRODUCTS"))));
     $this->addElement('textarea', "about_us", array('label' => 'LABEL_ABOUT_US', 'decorators' => $this->_elementDecorators, 'validators' => array($this->_getValidatorStringLength(0, 1000, 'UTF-8', 'description_'))));
     $this->addElement('textarea', "terms_conditions", array('label' => 'LABEL_TERMS_CONDITIONS', 'decorators' => $this->_elementDecorators, 'validators' => array($this->_getValidatorStringLength(0, 1000, 'UTF-8', 'TERMS_CONDITIONS_'))));
     $this->addElement('textarea', "contact_info", array('label' => 'LABEL_CONTACT_INFO', 'decorators' => $this->_elementDecorators, 'validators' => array($this->_getValidatorStringLength(10, 1000, 'UTF-8', 'contact_info_'))));
     $this->addElement('select', 'classification', array('label' => "LABEL_CLASSIFICATION", 'decorators' => $this->_elementDecorators, 'multiOptions' => $this->_classification));
     $this->addElement('select', 'id_page', array('label' => "LABEL_ID_PAGE", 'decorators' => $this->_elementDecorators, 'multiOptions' => $this->_social->getPageList()));
     $this->addElement('file', 'theme', array('label' => 'LABEL_THEME', 'decorators' => $this->_file_decorators, 'validators' => array($this->_getValidatorFileCount(0, 1, "THEME_"), $this->_getValidatorFileExtensions(array('css'), "THEME_"), $this->_getValidatorFileUpload("THEME_"))));
     $this->addElement('submit', 'submit', array('decorators' => $this->_hidden_label_decorators));
 }
Exemplo n.º 3
0
 public function init()
 {
     parent::init();
     $this->setName('add_rss');
     $this->setMethod('post');
     //get drop down list for autopost config
     $autopost_configs_db = HTS_Util::getDbTable("autopostconfigs");
     $autopost_configs = $autopost_configs_db->getList();
     $autopost_configs_drop_down = array();
     foreach ($autopost_configs as $config) {
         $autopost_configs_drop_down[$config["id"]] = $config["name"];
     }
     $id_category = new Zend_Form_Element_Select('id_category');
     $id_category->setLabel('CATEGORY');
     $new_category = new Zend_Form_Element_Text('new_category');
     $new_category->setLabel('');
     if (!empty($this->_params['id_category'])) {
         $new_category->setValue("");
     } else {
         $new_category->setValue($this->getTranslator()->translate('CATEGORY_GENERAL'));
     }
     $new_category->addValidator('StringLength', false, array('max' => 200, 'encoding' => 'UTF-8'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('TITLE');
     $title->addValidator('StringLength', false, array('max' => 200, 'encoding' => 'UTF-8'));
     $id_rss = new Zend_Form_Element_Hidden('id_rss');
     $link = new Zend_Form_Element_Text('link');
     $link->setLabel('RSS_URL')->setRequired(true)->addValidator('NotEmpty', true);
     $num_stories = new Zend_Form_Element_Text('num_stories');
     $num_stories->setLabel('NUM_OF_ITEMS')->setValue(5)->addValidator(new Zend_Validate_Digits())->addValidator(new Zend_Validate_Between(array('min' => 5, 'max' => 100)))->setRequired(true);
     $is_allow_comment = new Zend_Form_Element_Checkbox("is_allow_comment");
     $is_allow_comment->setLabel("Allow comment")->setCheckedValue(1)->setUncheckedValue(0)->setValue(1);
     $is_autopost = new Zend_Form_Element_Checkbox("is_autopost");
     $is_autopost->setLabel("Allow auto post")->setCheckedValue(1)->setUncheckedValue(0);
     $id_autopost_config = new Zend_Form_Element_Select("id_autopost_config");
     $id_autopost_config->setLabel("Frequency")->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'ERR_AUTO_POST_EMPTY')))->addMultiOptions($autopost_configs_drop_down);
     $max_news_post = new Zend_Form_Element_Text("max_news_post");
     $max_news_post->setLabel("Max news post")->setValue(5)->setRequired(true)->addValidator('lessThan', true, array('max' => 20, 'messages' => array(Zend_Validate_LessThan::NOT_LESS => 'ERR_MAX_NEW_POSTED_NOT_BETWEEN')));
     $this->addElements(array($id_rss, $link, $title, $id_category, $new_category, $num_stories, $is_allow_comment, $is_autopost, $id_autopost_config, $max_news_post));
     $this->setElementDecorators($this->_element_decorators);
     $id_rss->setDecorators($this->_hidden_decorators);
 }
Exemplo n.º 4
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'));
 }