Advertisement
RnD

Untitled

RnD
Feb 6th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.13 KB | None | 0 0
  1. <?php
  2. class ControllerAccountNewsletter extends Controller {  
  3.     public function index() {
  4.         if (!$this->customer->isLogged()) {
  5.             $this->session->data['redirect'] = $this->url->link('account/newsletter', '', 'SSL');
  6.      
  7.             $this->redirect($this->url->link('account/login', '', 'SSL'));
  8.         }
  9.        
  10.         $this->language->load('account/newsletter');
  11.        
  12.         $this->document->setTitle($this->language->get('heading_title'));
  13.                
  14.         if ($this->request->server['REQUEST_METHOD'] == 'POST') {
  15.             $this->load->model('account/customer');
  16.            
  17.             $this->model_account_customer->editNewsletter($this->request->post['newsletter']);
  18.            
  19.             $this->session->data['success'] = $this->language->get('text_success');
  20.            
  21.             $this->redirect($this->url->link('account/newsletter', '', 'SSL'));
  22.         }
  23.        
  24.         if (isset($this->session->data['success'])) {
  25.             $this->data['success'] = $this->session->data['success'];
  26.            
  27.             unset($this->session->data['success']);
  28.         } else {
  29.             $this->data['success'] = '';
  30.         }
  31.        
  32.         $this->data['heading_title'] = $this->language->get('heading_title');
  33.         $this->data['text_subheading'] = $this->language->get('text_subheading');      
  34.         $this->data['entry_newsletter'] = sprintf($this->language->get('entry_newsletter'), $this->config->get('config_name'));
  35.         $this->data['button_update'] = $this->language->get('button_update');
  36.        
  37.         $this->data['action'] = $this->url->link('account/newsletter', '', 'SSL');
  38.        
  39.         $this->data['newsletter'] = $this->customer->getNewsletter();
  40.        
  41.         $this->data['back'] = $this->url->link('account/account', '', 'SSL');
  42.  
  43.         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/newsletter.tpl')) {
  44.             $this->template = $this->config->get('config_template') . '/template/account/newsletter.tpl';
  45.         } else {
  46.             $this->template = 'default/template/account/newsletter.tpl';
  47.         }
  48.        
  49.         $this->children = array(
  50.             'common/column_left',
  51.             'common/column_right',
  52.             'common/content_top',
  53.             'common/content_bottom',
  54.             'common/footer',
  55.             'common/header'
  56.         );
  57.                        
  58.         $this->response->setOutput($this->render());           
  59.     }
  60. }
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement