public function getXML() { $this->printHeader = false; $this->printFooter = false; $apps = AppUtil::getAppsByUid($_SESSION['uid']); fb("app", $apps); $reports = ReportUtil::getReportsByCid($this->cid, $this->startDate, $this->endDate, $this->numCat, $this->platform); fb("reports", $reports); $new_reports = $this->collapseReport($reports); if ($this->metricTypeSelected == "CTR") { $this->calculateCTR($new_reports); } fb("nr", $new_reports); $this->smarty->assign('reports', $new_reports); $this->smarty->assign('nets', $reports['nets']); $this->smarty->assign('dates', $new_reports['dates']); $this->smarty->assign('metric', strtolower($this->metricTypeSelected)); //fb("smarty",$this->smarty->get_template_vars()); return $this->smarty->fetch('../tpl/www/reports/applicationReportsXML.tpl'); // // foreach($houseAds as $houseAd) { // $houseAd->reports = ReportUtil::getReportsByCid($houseAd->id, $this->startDate, $this->endDate); // } // // $totals = array(); // $dates = array(); // for($i=$this->startDate; $i<=$this->endDate; $i=date('Y-m-d', strtotime('+1 day', strtotime($i)))) { // $dates[] = $i; // // foreach($houseAds as $houseAd) { // if(isset($totals[$i])) { // $totals[$i]['impressions'] += $houseAd->reports[$i]['impressions']; // $totals[$i]['clicks'] += $houseAd->reports[$i]['clicks']; // } // else { // $totals[$i]['impressions'] = $houseAd->reports[$i]['impressions']; // $totals[$i]['clicks'] = $houseAd->reports[$i]['clicks']; // } // } // } // // $this->smarty->assign('houseAds', $houseAds); // $this->smarty->assign('dates', $dates); // $this->smarty->assign('totals', $totals); // // return $this->smarty->fetch('../tpl/www/reports/houseAdReportsXML.tpl'); }