コード例 #1
0
 public function campaignAction()
 {
     $success = null;
     $message = null;
     $error = null;
     $recipients = array();
     $sentto = array();
     $description = null;
     $sendtime = null;
     $timezone = null;
     $status = null;
     $shortcode = 0;
     // set the default message body values
     $this->defaultValues();
     $userid = $this->user->getId();
     $formObj = new Application_Model_Form();
     $user = new Application_Model_User($userid);
     $rpt = new Application_Model_Report();
     $yearmonth = date('Y-m');
     // Logged in users folder ID's
     $user_folders = $this->user->getFolders();
     $this->view->folders = $user_folders;
     // When the form is submit
     if ($this->request->isPost()) {
     }
     //          $msg = new Application_Model_Message();
     //          $arr = $msg->selectStatusSend();
     //          $ids = $msg->verifyifcampaignSend($arr);
     //          $msg->updateSendNowcampaign($ids);
     //          echo '<pre>'; print_r($arr);
     //          echo '<pre>'; print_r();
     //           exit;
     $campid = date('YmdHis') . $this->user->getId();
     $userusage = $rpt->dashboard_totalMessagesSentOut($userid, $yearmonth);
     // Send the message values back to the view
     $this->view->description = $description;
     $this->view->sendtime = $sendtime;
     $this->view->timezone = $timezone;
     $this->view->msg_head = $this->msg_head;
     $this->view->msg_body = $this->msg_body;
     $this->view->msg_foot = $this->msg_foot;
     // Status back to the view
     $this->view->error = $error;
     $this->view->success = $success;
     $this->view->message = $message;
     $this->view->formobject = $formObj;
     $this->view->formobjects = $formObj->webformList($userid);
     $this->view->userid = $userid;
     $this->view->userObj = $user;
     $this->view->msglimit = $user->messagelimit;
     $this->view->userusage = $userusage;
     $this->view->campid = $campid;
 }
コード例 #2
0
 public function createAction()
 {
     $error = null;
     $message = null;
     $userid = $this->user->getId();
     $username = $this->user->username();
     $formObj = new Application_Model_Form();
     $reportObj = new Application_Model_Report();
     $webformListSubAccount = array();
     if ($reportObj->checkAdminUser($userid)) {
         $subUsersArray = $reportObj->findChildEntityList($userid, 5, "");
         //echo "<pre>"; print_r($subUsersArray); exit;
         foreach ($subUsersArray as $subuser) {
             $webformlistmerge = $formObj->webformList($subuser['childuserid']);
             if (!empty($webformlistmerge) and is_array($webformlistmerge)) {
                 $webformListSubAccount = array_merge($webformListSubAccount, $webformlistmerge);
             }
         }
         //echo "<pre>"; print_r($webformListSubAccount); exit;
     }
     if ($this->request->isPost()) {
         //echo "<pre>"; print_r($this->_request->getParams()); exit;
         $postdataValue = $this->_request->getParams();
         //echo '<pre>'; print_r($postdataValue);exit;
         $this->view->postedValues = $postdataValue;
         if ($this->request->getParam('formurl') == "") {
             $message['type'] = "error";
             $message['body'] = "Atleast Unique URL is required";
         } else {
             $createformfor = "";
             if ($this->request->getParam('subacc') == "on") {
                 $folderidArray = "subacc";
             } else {
                 $folderidArray = $this->request->getParam('folderid');
             }
             // echo '<pre>'; print_r($folderidArray); exit;
             if (!empty($folderidArray)) {
                 $webformUrlArray = array();
                 $weburl = trim($this->request->getParam('formurl'));
                 $weburlfilter = preg_replace('/[^a-z0-9]/', '-', $weburl);
                 if ($folderidArray == "subacc") {
                     foreach ($subUsersArray as $subuser) {
                         $userid = $subuser['childuserid'];
                         $folderids = $this->user->getFolderElseCreate("weboptin", $userid);
                         $webformUrlArray = array("entityid" => $userid, "urlname" => addslashes($weburlfilter), "thankumsg" => addslashes($this->request->getParam('thanku_message')), "descmsg" => addslashes($this->request->getParam('formdesc')), "folderid" => $folderids, "dobstatus" => addslashes($this->request->getParam('dobstatus')), "alertmessage" => addslashes($this->request->getParam('alertmessage')), "notifybysms" => $this->request->getParam('notifybysms'), "notifybyemail" => addslashes($this->request->getParam('notifybyemail')));
                         $webformAttbArray = $this->request->getParam('chkname');
                         //echo "<pre>"; print_r($webformAttbArray);
                         $webformAttbTypeArray = $this->request->getParam('chktype');
                         //echo "<pre>"; print_r($webformAttbTypeArray);
                         $webformAttbWeightage = $this->request->getParam('weightage');
                         //echo "<pre>"; print_r($webformAttbTypeArray);
                         //echo "<pre>"; print_r($this->request->getParam('chk'));
                         foreach ($this->request->getParam('chk') as $key => $checked) {
                             $webformAttbArrayToinsert[$key]['weightage'] = addslashes($webformAttbWeightage[$checked]);
                             $webformAttbArrayToinsert[$key]['attb'] = addslashes($webformAttbArray[$checked]);
                             $webformAttbArrayToinsert[$key]['attbtype'] = addslashes($webformAttbTypeArray[$checked]);
                             $webformAttbOptionArray = $this->request->getParam('chkvalue' . $checked);
                             //echo "<pre>"; print_r($webformAttbOptionArray);
                             if (!empty($webformAttbOptionArray)) {
                                 $webformAttbOptionString = implode(",", $webformAttbOptionArray);
                             } else {
                                 $webformAttbOptionString = "";
                             }
                             $webformAttbArrayToinsert[$key]['attboption'] = addslashes($webformAttbOptionString);
                         }
                         //echo "<pre>"; print_r($webformAttbArrayToinsert);   exit;
                         if (empty($webformAttbArrayToinsert)) {
                             $message['type'] = "error";
                             $message['body'] = "Please check atleast one information field";
                         } elseif (empty($folderidArray)) {
                             $message['type'] = "error";
                             $message['body'] = "Please choose atleast one folder";
                         } else {
                             $dataInserted = $formObj->insertFormDetails($webformUrlArray, $webformAttbArrayToinsert);
                             if ($dataInserted) {
                                 $message['type'] = "success";
                                 $message['body'] = "Form created successfully";
                             } else {
                                 $message['type'] = "error";
                                 $message['body'] = $formObj->getError();
                             }
                         }
                     }
                     $this->_redirector->gotoUrl('/form/create/');
                 } else {
                     $folderids = implode($folderidArray, ',');
                     $webformUrlArray = array("entityid" => $userid, "urlname" => addslashes($weburlfilter), "thankumsg" => addslashes($this->request->getParam('thanku_message')), "descmsg" => addslashes($this->request->getParam('formdesc')), "folderid" => $folderids, "dobstatus" => addslashes($this->request->getParam('dobstatus')), "alertmessage" => addslashes($this->request->getParam('alertmessage')), "notifybysms" => $this->request->getParam('notifybysms'), "notifybyemail" => addslashes($this->request->getParam('notifybyemail')));
                     $webformAttbArray = $this->request->getParam('chkname');
                     //echo "<pre>"; print_r($webformAttbArray);
                     $webformAttbTypeArray = $this->request->getParam('chktype');
                     //echo "<pre>"; print_r($webformAttbTypeArray);
                     $webformAttbWeightage = $this->request->getParam('weightage');
                     //echo "<pre>"; print_r($webformAttbTypeArray);
                     //echo "<pre>"; print_r($this->request->getParam('chk'));
                     foreach ($this->request->getParam('chk') as $key => $checked) {
                         $webformAttbArrayToinsert[$key]['weightage'] = addslashes($webformAttbWeightage[$checked]);
                         $webformAttbArrayToinsert[$key]['attb'] = addslashes($webformAttbArray[$checked]);
                         $webformAttbArrayToinsert[$key]['attbtype'] = addslashes($webformAttbTypeArray[$checked]);
                         $webformAttbOptionArray = $this->request->getParam('chkvalue' . $checked);
                         //echo "<pre>"; print_r($webformAttbOptionArray);
                         if (!empty($webformAttbOptionArray)) {
                             $webformAttbOptionString = implode(",", $webformAttbOptionArray);
                         } else {
                             $webformAttbOptionString = "";
                         }
                         $webformAttbArrayToinsert[$key]['attboption'] = addslashes($webformAttbOptionString);
                     }
                     //echo "<pre>"; print_r($webformAttbArrayToinsert);   exit;
                     if (empty($webformAttbArrayToinsert)) {
                         $message['type'] = "error";
                         $message['body'] = "Please check atleast one information field";
                     } elseif (empty($folderidArray)) {
                         $message['type'] = "error";
                         $message['body'] = "Please choose atleast one folder";
                     } else {
                         $dataInserted = $formObj->insertFormDetails($webformUrlArray, $webformAttbArrayToinsert);
                         if ($dataInserted) {
                             $message['type'] = "success";
                             $message['body'] = "Form created successfully";
                         } else {
                             $message['type'] = "error";
                             $message['body'] = $formObj->getError();
                         }
                     }
                 }
             } else {
                 $message['type'] = "error";
                 $message['body'] = "Please select atleast one folder from dropdown.";
             }
         }
     }
     $user = new Application_Model_User((int) $userid);
     $this->view->message = $message;
     $this->view->folders = $this->user->getFolders();
     $this->view->webformlist = $formObj->webformList($userid);
     $this->view->webformlistSubaccount = $webformListSubAccount;
     $this->view->business = $user->businessname;
     $this->view->ainfo = $user->reward;
     $this->view->userid = $userid;
 }
コード例 #3
0
 public function bdayclubeditAction()
 {
     $uniquekey = $this->request->getParam('id');
     $messageObj = new Application_Model_Message($this->user);
     $userid = $this->user->getId();
     $user_folders = $this->user->getFolders();
     $folder_messageset = $this->user->getFoldersBdayClub($userid);
     $folder_messageset_edit = $this->user->getFoldersBdayClubBuUniqueKey($uniquekey);
     $folderotshow = array_diff_key($user_folders, $folder_messageset);
     $userid = $this->user->getId();
     $formObj = new Application_Model_Form();
     $bdaymsgedit = $messageObj->getBirthDayMessage($uniquekey);
     //echo "<pre>"; print_r($bdaymsgedit); exit;
     $this->view->folders = $folderotshow;
     $this->view->folder_messageset_edit = $folder_messageset_edit;
     $this->view->messagedesc = $bdaymsgedit['0']['messagedesc'];
     $this->view->messagebody = $bdaymsgedit['0']['messagebody'];
     $this->view->msg_foot = $bdaymsgedit['0']['messagefooter'];
     $this->view->sendbefore = $bdaymsgedit['0']['sendbefore'];
     $sendtime = $bdaymsgedit['0']['sendtime'];
     $sendtime = explode(":", $sendtime);
     $this->view->sendhour = $sendtime['0'];
     $this->view->sendmin = $sendtime['1'];
     $this->view->sendsec = $sendtime['2'];
     if ($this->_request->isPost()) {
         $postdataValue = $this->_request->getParams();
         //echo "<pre>"; print_r($postdataValue); exit;
         $sendtime = implode(":", $postdataValue['sendtime']);
         $bdayMessageUpdate = $messageObj->updateBirthDayMessage($uniquekey, addslashes($postdataValue['messagedesc']), addslashes($postdataValue['messagebody']), addslashes($postdataValue['msg_foot']), addslashes($postdataValue['sendbefore']), addslashes($sendtime));
         if (!empty($postdataValue['foldertoremove'])) {
             foreach ($postdataValue['foldertoremove'] as $folderid) {
                 $messageObj->deleteBirthDayMessageByFolderId($folderid);
             }
         }
         if (!empty($postdataValue['folders']) and is_array($postdataValue['folders'])) {
             foreach ($postdataValue['folders'] as $folderid) {
                 $bdayMessageSet = $messageObj->setBirthDayMessage($uniquekey, addslashes($userid), addslashes($folderid), addslashes($postdataValue['messagedesc']), addslashes($postdataValue['messagebody']), addslashes($postdataValue['msg_foot']), addslashes($postdataValue['sendbefore']), addslashes($sendtime));
             }
         }
         $folder_messageset_edit = $this->user->getFoldersBdayClubBuUniqueKey($uniquekey);
         foreach ($folder_messageset_edit as $folderid => $foldrexist) {
             $subscribersListArray = $messageObj->getSubscribersListByFolderId($folderid);
             foreach ($subscribersListArray as $subscribersList) {
                 if ($subscribersList['birthday'] != null) {
                     $bdaydate = Date("Y") . "-" . $subscribersList['birthday'];
                     $bdaymsgtobesenton = date("Y-m-d", strtotime(date("Y-m-d", strtotime($bdaydate)) . " -" . $postdataValue['sendbefore'] . " day"));
                     $bdaymsgtobesenton = $bdaymsgtobesenton . " " . $sendtime;
                     $messageObj->updateBdayMsgSendDate($subscribersList['id'], $bdaymsgtobesenton);
                 }
             }
         }
         $this->_redirector->gotoUrl('/messages/bdayclub/');
     }
     $this->view->formobject = $formObj;
     $this->view->formobjects = $formObj->webformList($userid);
 }