public function messagemonthyearAction($showLayout = false)
 {
     if (!$showLayout) {
         $this->_helper->layout->disableLayout();
     }
     list($key_used, $key_deleted) = $this->user->getKeywordsCountNew();
     $this->view->key_used = $key_used - $key_deleted;
     $this->view->key_limit = $this->user->keywordlimit;
     $this->view->key_percent = sprintf("%d", $this->view->key_used / $this->view->key_limit * 100);
     $this->view->msg_limit = $this->user->messagelimit;
     $messageObj = new Application_Model_Report();
     $userid = $this->user->getId();
     //*********** Calculate startdate and end date................
     $rmonth = date('m');
     $ryear = date('Y');
     $yearmonth = date('Y-m');
     $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $rmonth, $ryear);
     // echo 'rmstart-'.$monthstartdate = $ryear."-".$rmonth."-1 00:00:00"; echo '<br>';
     //echo 'rmend-'.$monthenddate = $ryear."-".$rmonth."-30 00:00:00";
     $monthstartdate = $ryear . "-" . $rmonth . "-1 00:00:00";
     $monthenddate = $ryear . "-" . $rmonth . "-" . $daysInMonth . " 00:00:00";
     $this->view->msg_used = $messageObj->reportCountTotalMessagesByUserIdNew($userid, $monthstartdate, $monthenddate);
     $this->view->totalNewSubscribers = $messageObj->reportCountTotalSubscribersByUserIdNew($userid, $monthstartdate, $monthenddate, true);
     $this->view->totalKeywordSubscribers = $messageObj->reportCountRegGrpBySubscribersByUserIdNewKeys($userid, life);
     $this->view->totalImportedSubscribers = $this->user->totalupload;
     $myla = $messageObj->getMylaFoldersId();
     $this->view->totalMyla = $messageObj->getMyla($userid, $myla[$userid], 'life');
     $this->view->topThreeKeywordArray = $topThreeKeywordArray;
     /*
               /*one more mess wont change face of this horror*/
     $this->view->dashboardKeywordsAct = $messageObj->dashboardKeyword_activity($userid);
     //                $this->view->dashboardTotalOptins = $messageObj->dashboard_totalOptedIn($userid);
     $this->view->dashboardTotalOptins = $this->user->totalsubscribers;
     //                $this->view->dashboardTotalOptinsByWebform = $messageObj->dashboard_totalOptedInsByWebform($userid);
     $this->view->dashboardTotalOptinsByWebform = $this->user->weboptin;
     $this->view->dashboardTotalMessagesSend = $messageObj->dashboard_totalMessagesSentOut($userid, $yearmonth);
     //                $this->view->dashboardTotalCampaignSend = $messageObj->dashboard_totalCampaignSentOut($userid,$yearmonth);
     $msgpercent = $this->view->dashboardTotalMessagesSend / $this->view->msg_limit * 100;
     if ($msgpercent >= 100) {
         $msgpercent = 100;
     }
     $this->view->msg_percent = sprintf("%d", $msgpercent);
     $this->view->userid = $userid;
     $this->view->mylamt = $this->user->mylamt;
     $this->view->kwdmt = $this->user->keywordmt;
     $this->view->webmt = $this->user->webmt;
     $this->view->dobmt = $this->user->dobmt;
     //                $this->view->totalcampsent = $this->user->totalcampsent;
     $this->view->totalcampsent = $messageObj->totalCampaignFromUserAccount($userid, $yearmonth);
     //                echo $userid."  :  ".$yearmonth."  : ".$this->view->totalcampsent; exit;
     $this->view->totalmt = $this->user->totalmt;
     $this->view->totalmrkmt = $this->user->totalmrkmt;
 }
Esempio n. 2
0
// Because our models need it this way
// Get the messages model
// Set up our current timestamp
// Log the start of this read
logWrite("####################################");
logWrite("User property update starts " . date('Y-m-d H:i:s'));
logWrite("------------------------------------");
$usrprop = array(63, 64, 74, 65, 66, 77, 78);
$mrkinfo = array(67, 68, 69, 70, 71, 72, 75, 76, 73);
$rep = new Application_Model_Report();
$accounts_id = $rep->accountids();
$countusrid = count($accounts_id);
if ($rep->subscribers_reportUpdate()) {
    $myla = $rep->getMylaFoldersId();
    for ($uid = 0; $uid < $countusrid; $uid++) {
        $val = $rep->reportCountRegGrpBySubscribersByUserIdNewKeys($accounts_id[$uid], "daily");
        $rep->activateUserproperty($accounts_id[$uid], $usrprop[0], $val);
        $val_w = $rep->dashboard_totalOptedInsByWebform($accounts_id[$uid], "daily");
        $rep->activateUserproperty($accounts_id[$uid], $usrprop[1], $val_w);
        if ($myla[$accounts_id[$uid]]) {
            $fd = $myla[$accounts_id[$uid]];
            $val_m = $rep->getMyla($accounts_id[$uid], $fd, "daily");
            $rep->activateUserproperty($accounts_id[$uid], $usrprop[2], $val_m);
        } else {
            $val_m = 0;
            $rep->activateUserproperty($accounts_id[$uid], $usrprop[2], $val_m);
        }
        $val_u = $rep->dashboard_totalUpload($accounts_id[$uid]);
        $rep->activateUserproperty($accounts_id[$uid], $usrprop[3], $val_u);
        $val_t = $rep->dashboard_totalOptedIn($accounts_id[$uid], 'daily');
        $rep->activateUserproperty($accounts_id[$uid], $usrprop[4], $val_t);