Ejemplo n.º 1
0
 /**
  * Updates a client record.
  *
  * @param array $record The client record to update.
  * @return mixed
  */
 private function updateClient($record)
 {
     // get the account settings
     $url = $this->get('fork.settings')->get($this->getModule(), 'cm_url');
     $username = $this->get('fork.settings')->get($this->getModule(), 'cm_username');
     $password = $this->get('fork.settings')->get($this->getModule(), 'cm_password');
     // try and update the client info
     try {
         // fetch complete list of timezones as pairs
         $timezones = BackendMailmotorCMHelper::getTimezonesAsPairs();
         // init CampaignMonitor object
         $cm = new \CampaignMonitor($url, $username, $password, 10, $this->clientID);
         // update the client
         $cm->updateClientBasics($record['company_name'], $record['country'], $timezones[$record['timezone']]);
     } catch (\Exception $e) {
         // add an error to the email field
         $this->redirect(BackendModel::createURLForAction('Settings') . '&error=campaign-monitor-error&var=' . $e->getMessage() . '#tabSettingsClient');
     }
 }