protected function fillDataToTemplate(Gpf_Templates_Template $tmpl, Gpf_Rpc_Params $params) { $tmpl = parent::fillDataToTemplate($tmpl, $params); $tmpl->assign('subaffiliatesCount', $this->subaffiliatesCount()); $todayParams = $this->getStatsParams(Gpf_Data_Filter::RANGE_TODAY); $tmpl->assign('todaySubaffiliatesCount', $this->subaffiliatesCount($todayParams)); $thisMonthParams = $this->getStatsParams(Gpf_Data_Filter::RANGE_THIS_MONTH); $tmpl->assign('thisMonthSubaffiliatesCount', $this->subaffiliatesCount($thisMonthParams)); return $tmpl; }
public function traficOverview($session,$today){ $this->loginFromSession($session); $homeData = new Pap_Merchants_HomeData(); if($today){ $statParams = $homeData->getStatsParams('T'); }else{ $statParams = $homeData->getStatsParams('TM'); } $response = new Pap_Mobile_Response(true); $impressions = new Pap_Stats_Impressions($statParams); $response->impressionsraw = (int)$impressions->getCount()->getRaw(); $response->impressionsunique = (int)$impressions->getCount()->getUnique(); $clicks = new Pap_Stats_Clicks($statParams); $response->clicksraw = (int)$clicks->getCount()->getRaw(); $response->clicksunique = (int)$clicks->getCount()->getUnique(); $sales = new Pap_Stats_Sales($statParams); $response->salespaid = (int)$sales->getCount()->getPaid(); $response->salespending = (int)$sales->getCount()->getPending(); $response->salesapproved = (int)$sales->getCount()->getApproved(); $response->salescostpaid = $this->toCurency($sales->getTotalCost()->getPaid()); $response->salescostpending = $this->toCurency($sales->getTotalCost()->getPending()); $response->salescostapproved = $this->toCurency($sales->getTotalCost()->getApproved()); $commisions = new Pap_Stats_Transactions($statParams); $response->commisionspaid = $this->toCurency($commisions->getCommission()->getPaid()); $response->commisionspending = $this->toCurency($commisions->getCommission()->getPending()); $response->commisionsapproved = $this->toCurency($commisions->getCommission()->getApproved()); $refunds = new Pap_Stats_Refunds($statParams); $response->refundspaid = $this->toCurency($refunds->getCommission()->getPaid()); $response->refundspending = $this->toCurency($refunds->getCommission()->getPending()); $response->refundsapproved = $this->toCurency($refunds->getCommission()->getApproved()); $chargebacks = new Pap_Stats_Chargebacks($statParams); $response->chargebackspaid = $this->toCurency($chargebacks->getCommission()->getPaid()); $response->chargebackspending = $this->toCurency($chargebacks->getCommission()->getPending()); $response->chargebacksapproved = $this->toCurency($chargebacks->getCommission()->getApproved()); return $response; }