Example #1
0
 /**
  * Checks if the tables of the plugins are installed
  * Indicate to the cartpay plugin if the plugin is already installed/active or not
  */
 public function c_active()
 {
     return parent::c_show_tables();
 }
Example #2
0
 /**
  * Inscription sur mailchimp
  * @param $mail
  * @param $fstname
  * @param $lstname
  * @param bool $notify
  */
 public function subscribe($mail, $fstname, $lstname, $notify = true)
 {
     if (self::install_table() == true) {
         $api = parent::getApi();
         if ($api != null) {
             $iso = frontend_model_template::current_Language();
             $list = parent::getCode($api['idapi'], $iso);
             if ($list != null) {
                 $code = $list['list_id'];
                 $MailChimp = new \Drewm\MailChimp($api['account_api']);
                 $result = $MailChimp->call('lists/subscribe', array('id' => $code, 'email' => array('email' => $mail), 'merge_vars' => array('FNAME' => $fstname, 'LNAME' => $lstname), 'double_optin' => false, 'update_existing' => true, 'replace_interests' => false, 'send_welcome' => false));
                 if ($notify) {
                     $this->getNotify('add');
                 }
             } else {
                 $this->getNotify('error');
             }
         } else {
             $this->getNotify('error');
         }
     }
 }
Example #3
0
 /**
  * @throws Exception
  */
 public function run()
 {
     if (self::install_table() == true) {
         if (magixcjquery_filter_request::isGet('getlang')) {
             $api = parent::getApi();
             if (isset($this->tab)) {
                 if ($this->tab == 'about') {
                     $this->template->display('about.tpl');
                 } else {
                     if ($this->tab == 'list') {
                         if (isset($this->action)) {
                             switch ($this->action) {
                                 case 'add':
                                     $this->addList();
                                     $this->notify('add');
                                     break;
                                 case 'deleteList':
                                     $this->delList();
                                     $this->notify('delete');
                                     break;
                             }
                         }
                         $this->template->assign('account', $api['account_api']);
                         $this->template->assign('list', $this->getList($api['idapi']));
                         $this->template->assign('getListCall', $this->setListCall());
                         $this->template->display('list.tpl');
                     } else {
                         if ($this->tab == 'account') {
                             switch ($this->action) {
                                 case 'save':
                                     if ($this->idapi != null) {
                                         $this->saveApi();
                                         $this->notify('save');
                                     }
                                     $this->template->assign('account', $this->idapi);
                                     break;
                                 case 'deleteApi':
                                     $this->delApi($api);
                                     $this->notify('reset');
                                     break;
                                 default:
                                     if ($api != null) {
                                         $this->template->assign('account', $api['account_api']);
                                     }
                             }
                             $this->template->display('account.tpl');
                         }
                     }
                 }
             } else {
                 if ($api != null) {
                     $this->template->assign('account', $api['account_api']);
                 }
                 $this->template->display('account.tpl');
             }
         }
     }
 }