public function renderForm()
 {
     $this->fields_option = array('hreflang' => array('title' => $this->l('Internationalization'), 'icon' => 'icon-flag', 'fields' => array('ZZSEOTK_HREFLANG_ENABLED' => array('title' => $this->l('Enable "hreflang" meta tag'), 'hint' => $this->l('Set "hreflang" meta tag into the html head to handle the same content in different languages.'), 'validation' => 'isBool', 'cast' => 'boolval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'))), 'canonical' => array('title' => $this->l('Canonical URL'), 'icon' => 'icon-link', 'fields' => array('ZZSEOTK_CANONICAL_ENABLED' => array('title' => $this->l('Enable "canonical" meta tag'), 'hint' => $this->l('Set "canonical"meta tag into the html head to avoid content duplication issues in SEO.'), 'validation' => 'isBool', 'cast' => 'boolval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'))), 'nobots' => array('title' => $this->l('"nobots"'), 'icon' => 'icon-sitemap', 'fields' => array('ZZSEOTK_NOBOTS_ENABLED' => array('title' => $this->l('Enable "noindex" meta tag'), 'hint' => $this->l('Set "noindex" meta tag into the html head to avoid search engine indicization of "private" pages. Public pages are not affected of course.'), 'validation' => 'isBool', 'cast' => 'boolval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'))));
     $helper = new HelperOptions($this);
     $helper->id = $this->id;
     $helper->module = $this;
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->title = $this->displayName;
     return $helper->generateOptions($this->fields_option);
 }
Exemple #2
0
 public function api_1_3_getContent()
 {
     $html = '';
     if (Tools::isSubmit('PS_GAPI13_EMAIL')) {
         if ($this->api_1_3_authenticate(Tools::getValue('PS_GAPI13_EMAIL'), Tools::getValue('PS_GAPI13_PASSWORD'))) {
             Configuration::updateValue('PS_GAPI13_EMAIL', Tools::getValue('PS_GAPI13_EMAIL'));
             Configuration::updateValue('PS_GAPI13_PASSWORD', Tools::getValue('PS_GAPI13_PASSWORD'));
             Configuration::updateValue('PS_GAPI_PROFILE', Tools::getValue('PS_GAPI_PROFILE'));
         } else {
             $html .= $this->displayError($this->l('Authentication failed'));
         }
     }
     if ($this->api_1_3_isConfigured()) {
         $result_test = $this->api_1_3_requestReportData('', 'ga:visits,ga:uniquePageviews', date('Y-m-d', strtotime('-1 day')), date('Y-m-d', strtotime('-1 day')), null, null, 1, 1);
         if (!$result_test) {
             $html .= $this->displayError('Cannot retrieve test results');
         } else {
             $html .= $this->displayConfirmation(sprintf($this->l('Yesterday, your store received the visit of %d people for a total of %d unique page views.'), $result_test[0]['metrics']['visits'], $result_test[0]['metrics']['uniquePageviews']));
         }
     }
     $helper = new HelperOptions($this);
     $helper->id = $this->id;
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->module = $this;
     $fields_options = array('general' => array('title' => $this->l('Google Analytics API v1.3'), 'fields' => $fields = array('PS_GAPI13_EMAIL' => array('title' => $this->l('Email'), 'type' => 'text'), 'PS_GAPI13_PASSWORD' => array('title' => $this->l('Password'), 'type' => 'password'), 'PS_GAPI_PROFILE' => array('title' => $this->l('Profile'), 'type' => 'text', 'desc' => $this->l('You can find your profile ID in the address bar of your browser while accessing Analytics report.') . '<br />' . $this->l('For the OLD VERSION of Google Analytics, the profile ID is in the URL\'s "id" parameter (see "&id=xxxxxxxx"):') . '<br />' . 'https://www.google.com/analytics/reporting/?reset=1&id=XXXXXXXX&pdr=20110702-20110801' . '<br />' . $this->l('For the NEW VERSION of Google Analytics, the profile ID is the number at the end of the URL, starting with p:') . '<br />' . 'https://www.google.com/analytics/web/#home/a11345062w43527078pXXXXXXXX/')), 'submit' => array('title' => $this->l('Save and Authenticate'))));
     $helper->tpl_vars = array('currentIndex' => $helper->currentIndex);
     return $html . $helper->generateOptions($fields_options);
 }
Exemple #3
0
 protected function displayFormSettings()
 {
     $helper = new HelperOptions();
     // Helper Options
     $helper->required = false;
     $helper->id = Tab::getCurrentTabId();
     //always Tab::getCurrentTabId() at helper option
     // Helper
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $helper->table = '';
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->module = $this;
     $helper->identifier = null;
     //alway null at helper option
     $helper->toolbar_btn = null;
     //alway null at helper option
     $helper->ps_help_context = null;
     //alway null at helper option
     $helper->title = null;
     //alway null at helper option
     $helper->show_toolbar = true;
     //alway true at helper option
     $helper->toolbar_scroll = false;
     //alway false at helper option
     $helper->bootstrap = false;
     //alway false at helper option
     $this->getOptionFieldsSettings();
     return $helper->generateOptions($this->option_fields_settings);
 }
 /**
  * Compiles and returns module configuration page content
  *
  * @return string
  */
 public function getContent()
 {
     if (Tools::isSubmit('submit' . $this->name)) {
         $this->postProcess();
     }
     $moduleUrl = $this->context->link->getAdminLink('AdminModules') . '&configure=' . $this->name;
     $fieldSets = array('general' => array('title' => $this->l('Module settings'), 'fields' => $this->getOptionFields(), 'buttons' => array('cancelBlock' => array('title' => $this->l('Cancel'), 'href' => $moduleUrl, 'icon' => 'process-icon-cancel')), 'submit' => array('name' => 'submit' . $this->name, 'title' => $this->l('Save'))));
     $h = new HelperOptions();
     $h->token = Tools::getAdminTokenLite('AdminModules');
     $h->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     $h->id = Tab::getIdFromClassName('AdminTools');
     return $h->generateOptions($fieldSets);
 }