public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
public function preDispatch() { parent::preDispatch(); $this->_helper->layout()->setLayout('hts_canvas'); $this->_page_list = $this->_social->getPageList(); $this->_id_page = !empty($this->_params['id_page']) ? $this->_params['id_page'] : null; $this->_id_store = !empty($this->_params['id_store']) ? $this->_params['id_store'] : null; $this->_store_row = Core_Model_DbTable_Stores::getInstance()->findOne($this->_id_store); $this->_initMenus($this->_params); $this->_extraValues(); }
public function preDispatch() { parent::preDispatch(); $this->_helper->layout()->setLayout('hts_canvas'); $this->_id_page = !empty($this->_params['id_page']) ? $this->_params['id_page'] : null; $this->_id_store = !empty($this->_params['id_store']) ? $this->_params['id_store'] : null; $this->_id_category = !empty($this->_params['id_category']) ? $this->_params['id_category'] : null; $this->_store_row = Core_Model_DbTable_Stores::getInstance()->findOne($this->_id_store); $this->_categories_list = Core_Model_DbTable_Categories::getInstance()->getAllCategories($this->_params); $this->_initMenus($this->_params); $this->_extraValues(); $this->_main_menu->addPage(array('params' => array('id_store' => $this->_id_store, 'id_page' => $this->_id_page), 'action' => 'index', 'controller' => 'products', 'module' => 'stores', 'label' => sprintf(HTS_Util::translate('MENU_MANAGE_PRODUCTS'), substr($this->_store_row->name, 0, 100)))); }
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')); }