getBlast() public method

Get Blast information
public getBlast ( $blast_id ) : array
return array API result
Ejemplo n.º 1
0
 public function view_campaigns_stats()
 {
     $sailthruClient = new Sailthru_Client(API_KEY, API_SECRET);
     try {
         if (!isset($response['error'])) {
             if (isset($this->params['pass'][0])) {
                 $blast_id = $this->params['pass'][0];
             } else {
                 exit;
             }
             $options['beacon_times'] = 1;
             $options['click_times'] = 1;
             $options['clickmap'] = 1;
             $options['engagement'] = 1;
             $options['signup'] = 1;
             $options['subject'] = 1;
             $options['urls'] = 1;
             $response = $sailthruClient->stats_blast($blast_id, $options);
             //associative array with everything i need
             $responseName = $sailthruClient->getBlast($blast_id);
             $name = $responseName['name'];
             if (isset($response['count'])) {
                 $num_users = $response['count'];
             } else {
                 $num_users = 0;
             }
             if (isset($response['estopens'])) {
                 $est_open_rate = $response['estopens'];
             } else {
                 $est_open_rate = 0;
             }
             if (isset($reponse['click_total'])) {
                 $click_total = $reponse['click_total'];
             } else {
                 $click_total = 0;
             }
             if (isset($response['rev'])) {
                 $revenue_in_cents = $response['rev'];
             } else {
                 $revenue_in_cents = 'n/a';
             }
             if (isset($response['optout'])) {
                 $optout = $response['optout'];
             } else {
                 $optout = 0;
             }
             if (isset($response['spam'])) {
                 $spam = $response['spam'];
             } else {
                 $spam = 0;
             }
             $this->set('name', $name);
             $this->set('num_users', $num_users);
             $this->set('est_open_rate', $est_open_rate);
             $this->set('click_total', $click_total);
             $this->set('revenue_in_cents', $revenue_in_cents);
             $this->set('optout', $optout);
             $this->set('spam', $spam);
             $this->layout = 'popup_template';
             $this->layout = 'popup_template';
             $this->render('view_campaign_stats');
         } else {
             echo 'error';
         }
     } catch (Sailthru_Client_Exception $e) {
         echo 'exception';
     }
 }