Esempio n. 1
0
 /**
  * 
  * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface>
  */
 public function rejectcampaignAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if (!$this->auth->isSuperAdmin($this->config_handle) && !$this->auth->isDomainAdmin($this->config_handle)) {
         die("You do not have permission to access this page");
     }
     $id = $this->getEvent()->getRouteMatch()->getParam('param1');
     if ($id == null) {
         die("Invalid Campaign Preview ID");
     }
     $InsertionOrderPreviewFactory = \_factory\InsertionOrderPreview::get_instance();
     $params = array();
     if (!$this->auth->isSuperAdmin($this->config_handle)) {
         $params["UserID"] = $this->auth->getUserID();
     }
     $params["InsertionOrderPreviewID"] = $id;
     $InsertionOrderPreview = $InsertionOrderPreviewFactory->get_row($params);
     if ($InsertionOrderPreview == null) {
         return $this->redirect()->toRoute('private-exchange');
     }
     $ad_campaign_preview_name = $InsertionOrderPreview->Name;
     $user_id = $InsertionOrderPreview->UserID;
     // set the preview campaigns and its elements to inactive and mark the date and time they went live
     \transformation\TransformPreview::deletePreviewModeCampaign($id, $this->auth, false);
     $authUsersFactory = \_factory\authUsers::get_instance();
     $params = array();
     $params["user_id"] = $user_id;
     $auth_User = $authUsersFactory->get_row($params);
     $site_url = $this->config_handle['delivery']['site_url'];
     $exchange_name = $this->config_handle['delivery']['exchange_name'];
     if ($auth_User !== null && $ad_campaign_preview_name && $this->config_handle['mail']['subscribe']['user_ad_campaigns']) {
         // approval, send out email
         $message = 'Your ' . $exchange_name . ' Demand Ad Campaign on Staging : ' . $ad_campaign_preview_name . ' was reset.<br /><br />Please login <a href="' . $site_url . '/auth/login">here</a> with your email and password to make changes.';
         $subject = "Your " . $exchange_name . " Demand Ad Campaign on Staging : " . $ad_campaign_preview_name . " was reset";
         $transport = $this->getServiceLocator()->get('mail.transport');
         $text = new Mime\Part($message);
         $text->type = Mime\Mime::TYPE_HTML;
         $text->charset = 'utf-8';
         $mimeMessage = new Mime\Message();
         $mimeMessage->setParts(array($text));
         $zf_message = new Message();
         $zf_message->addTo($auth_User->user_email)->addFrom($this->config_handle['mail']['reply-to']['email'], $this->config_handle['mail']['reply-to']['name'])->setSubject($subject)->setBody($mimeMessage);
         $transport->send($zf_message);
     }
     return $this->redirect()->toRoute('private-exchange');
 }
Esempio n. 2
0
 /**
  * 
  * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface>
  */
 public function rejectcampaignAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if (strpos($this->auth->getPrimaryRole(), $this->config_handle['roles']['admin']) === false) {
         die("You do not have permission to access this page");
     }
     $id = $this->getEvent()->getRouteMatch()->getParam('param1');
     if ($id == null) {
         die("Invalid Campaign Preview ID");
     }
     // set the preview campaigns and its elements to inactive and mark the date and time they went live
     \transformation\TransformPreview::deletePreviewModeCampaign($id, $this->auth, false);
     return $this->redirect()->toRoute('demand');
 }
 /**
  * 
  * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface>
  */
 public function rejectcampaignAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if (strpos($this->auth->getPrimaryRole(), $this->config_handle['roles']['admin']) === false) {
         die("You do not have permission to access this page");
     }
     $id = $this->getEvent()->getRouteMatch()->getParam('param1');
     if ($id == null) {
         die("Invalid Campaign Preview ID");
     }
     $AdCampaignPreviewFactory = \_factory\AdCampaignPreview::get_instance();
     $params = array();
     $params["AdCampaignPreviewID"] = $id;
     $AdCampaignPreview = $AdCampaignPreviewFactory->get_row($params);
     if ($AdCampaignPreview == null) {
         die("AdCampaignPreviewID not found");
     }
     $ad_campaign_preview_name = $AdCampaignPreview->Name;
     $user_id = $AdCampaignPreview->UserID;
     // set the preview campaigns and its elements to inactive and mark the date and time they went live
     \transformation\TransformPreview::deletePreviewModeCampaign($id, $this->auth, false);
     $authUsersFactory = \_factory\authUsers::get_instance();
     $params = array();
     $params["user_id"] = $user_id;
     $auth_User = $authUsersFactory->get_row($params);
     if ($auth_User !== null && $ad_campaign_preview_name && $this->config_handle['mail']['subscribe']['user_ad_campaigns']) {
         // approval, send out email
         $message = 'Your NginAd Exchange Demand Ad Campaign : ' . $ad_campaign_preview_name . ' was rejected.<br /><br />Please login <a href="http://server.nginad.com/auth/login">here</a> with your email and password';
         $subject = "Your NginAd Exchange Demand Ad Campaign : " . $ad_campaign_preview_name . " was rejected";
         $transport = $this->getServiceLocator()->get('mail.transport');
         $text = new Mime\Part($message);
         $text->type = Mime\Mime::TYPE_HTML;
         $text->charset = 'utf-8';
         $mimeMessage = new Mime\Message();
         $mimeMessage->setParts(array($text));
         $zf_message = new Message();
         $zf_message->addTo($auth_User->user_email)->addFrom($this->config_handle['mail']['reply-to']['email'], $this->config_handle['mail']['reply-to']['name'])->setSubject($subject)->setBody($mimeMessage);
         $transport->send($zf_message);
     }
     return $this->redirect()->toRoute('demand');
 }