Exemple #1
0
 /**
  * View Tracking Information task
  *
  * @return 	void
  */
 public function trackingTask()
 {
     //get request vars
     $ids = Request::getVar('id', array());
     $id = isset($ids) ? $ids[0] : null;
     //instantiate newsletter mailing object
     $newsletterMailing = new NewsletterMailing($this->database);
     $mailing = $newsletterMailing->getMailings($id);
     //get mailing recipients
     $newsletterMailingRecipient = new MailingRecipient($this->database);
     $this->view->recipients = $newsletterMailingRecipient->getRecipients($id, 'sent');
     //instantiate newsletter object
     $newsletterNewsletter = new Newsletter($this->database);
     $newsletterNewsletter->load($mailing->nid);
     //make sure we are supposed to be tracking
     if (!$newsletterNewsletter->tracking) {
         $this->setError(Lang::txt('COM_NEWSLETTER_MAILING_NOT_TRACKING'));
         $this->displayTask();
         return;
     }
     //get bounces
     $sql = "SELECT * FROM `#__email_bounces`\n\t\t\t\tWHERE component='com_newsletter'\n\t\t\t\tAND object=" . $this->database->quote('Campaign Mailing') . "\n\t\t\t\tAND object_id=" . $this->database->quote($id);
     $this->database->setQuery($sql);
     $this->view->bounces = $this->database->loadObjectList();
     //new mailing recipient action object
     $newsletterMailingRecipientAction = new MailingRecipientAction($this->database);
     //get opens, clicks, forwards, and prints
     $this->view->opens = $newsletterMailingRecipientAction->getMailingActions($id, 'open');
     $this->view->forwards = $newsletterMailingRecipientAction->getMailingActions($id, 'forward');
     $this->view->prints = $newsletterMailingRecipientAction->getMailingActions($id, 'print');
     //get opens geo
     $this->view->opensGeo = $this->getOpensGeoTask($id);
     //get clicks and process
     $clicks = $newsletterMailingRecipientAction->getMailingActions($id, 'click');
     $this->view->clicks = array();
     foreach ($clicks as $click) {
         //get click action
         $clickAction = json_decode($click->action_vars);
         $this->view->clicks[$clickAction->url] = isset($this->view->clicks[$clickAction->url]) ? $this->view->clicks[$clickAction->url] + 1 : 1;
     }
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Output the HTML
     $this->view->setLayout('tracking')->display();
 }