Exemplo n.º 1
0
 public function getContent()
 {
     if ($this->account->MASTER_LIST_SYNCHRONIZED == 0) {
         $this->initalSynchronize();
     }
     $this->mj_template = new MailjetTemplate();
     $this->page_name = $this->mj_pages->getCurrentPageName();
     $this->postProcess();
     $this->context->smarty->assign(array('is_landing' => false));
     switch ($this->page_name) {
         case 'SETUP_LANDING':
             $mt = new MailjetTemplate();
             $this->context->smarty->assign(array('is_landing' => true, 'lang' => $mt->getLang()));
             $this->mj_template->fetchTemplate('setup_landing_message');
             $this->mj_template->fetchTemplate('setup_landing_bt_more');
             $this->mj_template->fetchTemplate('setup_landing_bt_activate');
             break;
         case 'SETUP_STEP_0':
             $this->mj_template->fetchTemplate('setup_hosting_error_message');
             $this->mj_template->fetchTemplate('setup_hosting_error_bt_support');
             break;
         case 'SETUP_STEP_1':
             $this->mj_template->getSignupURL('SETUP_STEP_1');
             break;
         case 'CONNECT_STEP_0':
             $this->context->smarty->assign(array('account' => $this->account));
             $this->mj_template->fetchTemplate('connect_step_0');
             break;
         case 'SEGMENTATION':
             $this->segmentation = new Segmentation();
             $this->mj_template->setContent('SEGMENTATION', $this->segmentation->initContent());
             break;
         case 'CAMPAIGN':
             $this->mj_template->getCampaignURL('CAMPAIGN', $this->account->{'TOKEN_' . $this->context->employee->id});
             break;
         case 'STATS':
             $this->mj_template->getStatsURL('STATS', $this->account->{'TOKEN_' . $this->context->employee->id});
             break;
         case 'CONTACTS':
             $this->mj_template->getContactsURL('CONTACTS', $this->account->{'TOKEN_' . $this->context->employee->id});
             break;
         case 'NEWSLETTER':
             $this->displayNewsletter();
             break;
         case 'CAMPAIGN1':
             $this->displayCampaign(1);
             break;
         case 'CAMPAIGN2':
             $this->displayCampaign(2);
             break;
         case 'CAMPAIGN3':
             $this->displayCampaign(3);
             break;
         case 'TRIGGERS':
             $this->displayTriggers();
             break;
         case 'PRICING':
             $this->mj_template->getPricingURL('PRICING', $this->account->{'TOKEN_' . $this->context->employee->id});
             break;
         case 'ROI':
             $this->displayROI();
             break;
         case 'EVENTS':
             $page = ($page = Tools::getValue('page')) ? $page : 1;
             $mj_event = new MailJetEvents(!($event = Tools::getValue('event')) ? MailJetEvents::ALL_EVENTS_KEYS : $event);
             $mj_event->setPage($page);
             $titles = $mj_event->getFieldsName();
             unset($titles['agent']);
             unset($titles['ip']);
             unset($titles['geo']);
             unset($titles['original_address']);
             unset($titles['new_address']);
             $url = 'http://' . $this->context->shop->domain . '/modules/mailjet/events.php?h=' . $this->getEventsHash();
             $this->context->smarty->assign(array('MJ_events_list' => $this->setUserLinkToEvents($mj_event->fetch()), 'MJ_title_list' => $titles, 'MJ_paging' => array('total_element' => $mj_event->getTotal(), 'current_page' => $page, 'next' => $page * MailJetEvents::LIMIT_EVENT < $mj_event->getTotal() ? true : false, 'prev' => $page > 1 ? true : false, 'last' => $mj_event->getTotalPages()), 'MJ_all_scheme_fields' => $mj_event->getScheme(MailJetEvents::ALL_EVENTS_KEYS), 'host' => $this->context->shop->domain, 'url' => $url));
             break;
         case 'ACCOUNT':
             $this->displayAccount();
             break;
     }
     if ($this->isAccountSet()) {
         $this->checkTokenValidity();
         $this->checkPlanValidity();
     }
     $this->context->smarty->assign(array('MJ_templates' => $this->mj_template->getTemplates(), 'MJ_iframes' => $this->mj_template->getIframesURL(), 'MJ_errors' => $this->errors_list, 'MJ_page_name' => $this->page_name, 'MJ_template_name' => $this->mj_pages->getTemplateName($this->page_name), 'MJ_template_tab_name' => $this->mj_pages->getTemplateTabName($this->page_name), 'MJ_authentication' => $this->isAccountSet(), 'MJ_TOKEN_USER' => isset($this->account->{'TOKEN_' . $this->context->employee->id}) ? $this->account->{'TOKEN_' . $this->context->employee->id} : null, 'MJ_user_plan' => $this->_getPlan()));
     return $this->fetchTemplate('/views/templates/admin/', 'configuration');
 }