public function dataAction()
 {
     $this->_helper->layout->setLayout('nonadmin');
     $userid = $this->user->getId();
     $subscriberid = $this->request->getParam('id');
     $formObj = new Application_Model_Form();
     $subscriberDetails = $formObj->getSubscriberDataById($subscriberid, $userid);
     //echo "<pre>"; print_r($subscriberDetails); exit;
     $subscribersDetailsForm = $formObj->getSubscriberDataValueById($subscriberid, $subscriberDetails['0']['webform_url_id']);
     ////echo "<pre>"; print_r($subscribersDetailsForm); exit;
     $folder = new Application_Model_Folder($this->user);
     $phonenumberOptinoutDate = $folder->getPhoneNumberOptinoutDate($subscriberDetails['0']['phonenumber'], $subscriberDetails['0']['folderid']);
     //echo "<pre>"; print_r($phonenumberOptinoutDate); exit;
     $this->view->subscriberDetails = $subscriberDetails;
     $this->view->otherSubscribersDetails = $subscribersDetailsForm;
     $this->view->phonenumberOptinoutDate = $phonenumberOptinoutDate;
 }
Ejemplo n.º 2
0
 /**
  * 
  *  Data upload action
  *  Capturing info from account who is
  *  attended to upload data to the system
  *  
  */
 public function datauploadAction()
 {
     $folderObj = new Application_Model_Folder($this->user);
     if ($this->request->isPost()) {
         $act_id = $this->request->getParam('accountid');
         $email = $this->request->getParam('email');
         $business = $this->request->getParam('business');
         $phone = $this->request->getParam('phone');
         $rs = $folderObj->insertDataUpload($act_id, $email, $business, $phone);
         if ($rs) {
             //                   $msg = "Data uploaded to the Textm system by:\n\nAccountid: ".$act_id."\nEmail: ".$email."\nBusinessname: ".$business."\nPhone: ".$phone;
             //                   $folderObj->sendEmail($email, "New data upload", $msg);
             echo 'TRUE';
         } else {
             echo 'FALSE';
         }
     }
     exit;
 }
Ejemplo n.º 3
0
 /**
  * 
  * 
  */
 public function hollyentryAction()
 {
     if ($this->getRequest()->isPost()) {
         $userid = $this->user->getId();
         $folderObj = new Application_Model_Folder($this->user);
         $h_cid = (int) trim($this->request->getParam("h_cid")) ?: 0;
         $h_msg = trim($this->request->getParam("h_msg"));
         $h_sendtime = trim($this->request->getParam("h_sendtime"));
         $h_msgid = (int) trim($this->request->getParam('h_msgid'));
         $h_folder = trim($this->request->getParam('h_folder'));
         if ($h_cid != 0 && $folderObj->canselinghollyCampaign($h_cid)) {
             echo 'Campaign has been canceled';
             exit;
         }
         if ($h_msgid == 0 && $folderObj->sethollyCampaign($h_msg, $h_sendtime, $h_folder, $userid) == 1) {
             echo 'Data has been saved';
         } elseif ($h_msgid != 0 && $folderObj->updatehollyCampaign($h_msg, $h_sendtime, $h_folder, $h_msgid, $userid) == 1) {
             echo 'Changes has been saved';
         } else {
             echo 'No data action';
         }
         //            echo  $h_msg."\n".$h_sendtime."\n".$h_folder."\n".$h_msgid;
     }
     exit;
 }
 /**
  * Created a sendMessage method that will do everything the post controller would
  * because we have a user who wants to send a message via GET and our API does this
  * via POST. I tried using _forward('post'), but it was doubling up the JSON response
  * body for some reason. So now post and get just call this method to do the same thing.
  * 
  * @access private
  */
 private function sendMessage()
 {
     $valid = true;
     echo $recipients = $this->_requestParam('recipients');
     exit;
     $subjecttext = $this->_requestParam('subject');
     $bodytext = $this->_requestParam('message');
     $sendtime = $this->_requestParam('sendtime');
     $timezone = $this->_requestParam('timezone');
     // Cleanup send time
     if ($sendtime) {
         $tparts = str_split($sendtime, 2);
         $sendtime = $tparts[0] . $tparts[1] . '-' . $tparts[2] . '-' . $tparts[3] . ' ' . $tparts[4] . ':' . $tparts[5] . ':00';
     }
     // Not using this at the moment, so don't want anyone to access it
     //$folder = $this->_request->getParam('id');
     //$loadby = $this->_request->getParam('field');
     $folder = false;
     $loadby = false;
     // Folder is optional (at the moment...)
     if ($folder) {
         $folder = new Application_Model_Folder($this->apiuser, $folder, $loadby);
         if ($folder->isValid()) {
             // Get subscribers in this folder
             $subscribers = $folder->getSubscribers();
             // TODO: Come up with a better way to pull phone #'s out of a folder's subscriber list
             foreach ($subscribers as $subscriber) {
                 $recipients[] = $subscriber['phonenumber'];
             }
         } else {
             $valid = false;
             $this->setError($folder->getError(), 500);
         }
     }
     // Validate and send
     if ($valid) {
         if ($recipients) {
             if ($bodytext) {
                 $message = new Application_Model_Message($this->apiuser);
                 $bodytext = urldecode($bodytext);
                 $subjecttext = urldecode($subjecttext);
                 // Build the message with a subject if there is one.
                 $msg = $subjecttext ? $subjecttext . ': ' . $bodytext : $bodytext;
                 // Queue it up for delivery
                 $return = $message->queue($msg, $recipients, $sendtime, $timezone);
                 if ($return) {
                     $this->setOutputParam('status', true);
                     $this->setOutputParam('message', 'Message successfully sent.');
                 } else {
                     $this->setError($message->getError(), 500);
                 }
             } else {
                 $this->setError('Message is required.', 500);
             }
         } else {
             $this->setError('At least one recipient is required.', 500);
         }
     }
 }