public function load() { $newslettersManager = NewslettersManager::getInstance($this->config, $this->args); $allNewsletters = $newslettersManager->getAllNewslettersMap(); $this->addParam('all_newsletters', $allNewsletters); $newslettersIds = array_keys($allNewsletters); $this->addParam('selected_newsletter_id', $newslettersIds[0]); }
public function service() { $newslettersManager = NewslettersManager::getInstance($this->config, $this->args); $newsletter_id = $this->secure($_REQUEST['newsletter_id']); $byTitle = $newslettersManager->selectByPK($newsletter_id); if (isset($byTitle)) { $this->ok(array('html' => $byTitle->getHtml(), 'include_all_active_users' => $byTitle->getIncludeAllActiveUsers(), 'newsletter_title' => $byTitle->getTitle())); } else { $this->error(array('message' => "Newsletter doesn't exists!")); } }
public function service() { $newslettersManager = NewslettersManager::getInstance($this->config, $this->args); $newsletter_id = $this->secure($_REQUEST['newsletter_id']); $newsletter = $newslettersManager->selectByPK($newsletter_id); if (isset($newsletter)) { $newslettersManager->deleteByPK($newsletter_id); $this->ok(); } else { $this->error(array('message' => "Newsletter doesn't exists!")); } }
public function service() { $newslettersManager = NewslettersManager::getInstance($this->config, $this->args); $title = $this->secure($_REQUEST['title']); $html = $_REQUEST['html']; $include_all_active_users = $this->secure($_REQUEST['include_all_active_users']); $byTitle = $newslettersManager->getByTitle($title); if (isset($byTitle)) { $newslettersManager->saveNewsletter($byTitle->getId(), $html, $include_all_active_users); } else { $newslettersManager->addNewsletter($title, $html, $include_all_active_users); } $this->ok(); }
public function load() { $newslettersManager = NewslettersManager::getInstance($this->config, $this->args); $selected_email_accounts_ids = $_REQUEST['selected_email_accounts_ids']; $emailAccountsManager = EmailAccountsManager::getInstance($this->config, $this->args); $allEmailAccounts = $emailAccountsManager->selectAll(); $emailAccountsNameIdMap = array(); foreach ($allEmailAccounts as $dto) { $emailAccountsNameIdMap[$dto->getid()] = $dto->getLogin(); } $this->addParam('email_accounts_logins', $emailAccountsNameIdMap); $this->addParam('selected_email_accounts_ids', explode(',', $selected_email_accounts_ids)); $include_all_active_users = $_REQUEST['include_all_active_users']; $this->addParam('include_all_active_users', $include_all_active_users); }