public function publishedPageAction() { echo '<pre>'; var_dump('Facebook_FacebookController' . $this->_params); echo '</pre>'; die; $survey = $this->_params['survey']; $survey_pages_db = HTS_Util::getDbTable('SurveyPages'); $this->view->pages = $survey_pages_db->getAllByIdSurvey($survey['id']); }
protected function _saveStore($data, $id = null) { if (empty($id)) { $this->_store_row = HTS_Util::getDbRow('stores'); $this->_store_row->setFromArray($data); } else { $this->_store_row = $this->_stores_table->findOne($id); $this->_store_row->setFromArray($data); } return $this->_store_row->save(); }
function indexAction() { if (!HTS_Util::isFacebookRequest()) { $this->disableAutoRender(); $data = $this->_social->getAppRequestData(); if (isset($data)) { $data = json_decode($data, true); Zend_Debug::dump($data); die; } //$this->_forward('index','stores','stores'); //$this->_redirect('/stores/stores/index'); HTS_Util::parentRedirect($this->view->url(array('module' => 'stores', 'controller' => 'stores', 'action' => 'index'))); } }
public function indexAction() { //Zend_Debug::dump($this->_categories_list); if (empty($this->_id_category)) { $this->view->categories_list = $this->_categories_list; } else { if (!empty($this->_categories_list[$this->_id_category]['children'])) { $this->view->categories_list = $this->_categories_list[$this->_id_category]['children']; } else { $this->view->categories_list = array(); } } $form_add_categories = new Stores_Form_Categories(array('name' => 'form_add_categories')); $form_edit_category = new Stores_Form_Categories(array('name' => 'form_edit_category')); $this->view->form_add_categories = $form_add_categories; $this->view->form_edit_category = $form_edit_category; $this->_main_menu->addPage(array('params' => array('id_store' => $this->_id_store, 'id_page' => $this->_id_page), 'action' => 'index', 'controller' => 'categories', 'module' => 'stores', 'label' => sprintf(HTS_Util::translate('MENU_MANAGE_CATEGORIES'), substr($this->_store_row->name, 0, 100)), 'active' => true)); }
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)); }
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); }
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')); }
protected function getUserAccessToken() { $access_token = $this->getPersistentData('access_token'); if (empty($access_token)) { $this->_cache = HTS_Util::getObjectFileCache(); $access_token = $this->_getCacheAccessToken(); if ($access_token === false || !$this->_checkValidAccessToken($access_token)) { if (isset($this->signedRequest['access_token'])) { $access_token = $this->signedRequest['access_token']; $access_token = $this->_getExtendsTimeOut($access_token); $this->_setCacheAccessToken($access_token); $this->setPersistentData('access_token', $access_token); } else { $access_token = parent::getUserAccessToken(); $access_token = $this->_getExtendsTimeOut($access_token); $this->_setCacheAccessToken($access_token); $this->setPersistentData('access_token', $access_token); } } else { $this->setPersistentData('access_token', $access_token); } } return $access_token; }
public function redirect($url) { HTS_Util::parentRedirect($this->_config->url . $url); }
public function listAction() { $categories_db = HTS_Util::getDbTable('categories'); $categories = $categories_db->getEnableByIdPage($this->_id_page); if (empty($this->_params['id_category'])) { if (isset($_COOKIE['id_' . $this->_id_page]) && $this->_checkValidCategory($_COOKIE['id_' . $this->_id_page], $categories)) { $this->_params['id_category'] = $_COOKIE['id_' . $this->_id_page]; } else { $current_category = $this->_getFirstCategory($categories); if (!empty($current_category)) { $this->_params['id_category'] = $current_category->id; //TODO Zend_Cookie setcookie('detail_source_' . $this->_id_page, "all", time() + 7 * 24 * 60 * 60, '/'); } } } else { if ($this->_checkValidCategory($this->_params['id_category'], $categories)) { setcookie('id_' . $this->_id_page, $this->_params['id_category'], time() + 7 * 24 * 60 * 60, '/'); setcookie('detail_source_' . $this->_id_page, "all", time() + 7 * 24 * 60 * 60, '/'); } else { $current_category = $this->_getFirstCategory($categories); if (!empty($current_category)) { $this->_params['id_category'] = $current_category->id; //TODO Zend_Cookie setcookie('detail_source_' . $this->_id_page, "all", time() + 7 * 24 * 60 * 60, '/'); } } } if (!empty($this->_params['id_category'])) { $rss_db = HTS_Util::getDbTable('rss'); $rss_list = $rss_db->getEnableByCategory($this->_params['id_category']); $this->view->rss_list = $rss_list; $this->view->feeds = $this->_orderRssNews($rss_list); $this->view->id_category = $this->_params['id_category']; } if ($this->_social->isPageAdmin()) { $this->view->owner = 'owner'; } $this->view->id_page = $this->_id_page; $this->view->categories = $categories; }
public function redirect($url) { HTS_Util::redirect($this->getAppUrl() . $url); }
public static function getBaseCurrencyList() { $currency = HTS_Util::translate('CURRENCY'); return $base_currency = array("1" => "1 " . $currency, "10" => "10 " . $currency, "100" => "100 " . $currency, "1000" => "1000 " . $currency, "10000" => "10.000 " . $currency, "100000" => "100.000 " . $currency); }
public function __initDbCache() { Zend_Db_Table_Abstract::setDefaultMetadataCache(HTS_Util::getObjectFileCache()); }
public function redirectLink($url) { if ($this->_isUseAppsLink()) { HTS_Util::parentRedirect($url); } else { HTS_Util::redirect($url); } }