public static function axDownloadCSV()
 {
     Wikia::log(__METHOD__, 'Depreciated?');
     $SponsorshipDashboard = new SponsorshipDashboard();
     if (isset($_GET['elementId']) && !empty($_GET['elementId']) && $SponsorshipDashboard->isAllowed()) {
         $report = new SponsorshipDashboardReport($_GET['elementId']);
         $report->loadReportParams();
         $dataFormatter = SponsorshipDashboardOutputCSV::newFromReport($report);
         echo $dataFormatter->getHTML();
         exit;
     } else {
         echo wfMsg('sponsorship-dashboard-not-allowed');
     }
 }
 private function getReport()
 {
     $oReport = new SponsorshipDashboardReport();
     $oReport->name = $this->msg('special-pageviews-report-title')->escaped();
     $oReport->frequency = SponsorshipDashboardDateProvider::SD_FREQUENCY_DAY;
     $oReport->tmpSource = $this->getSource();
     $oReport->setLastDateUnits($this->startDate->diff($this->endDate)->days);
     $oReport->acceptSource();
     $oReport->setId(1);
     $oReport->lockSources();
     return $oReport;
 }
 private function getReport($startDate, $endDate, $param)
 {
     $oReport = new SponsorshipDashboardReport();
     $oReport->name = wfMsg('newwikisgraph-report-title');
     $oReport->frequency = SponsorshipDashboardDateProvider::SD_FREQUENCY_DAY;
     $oReport->tmpSource = $this->getSource($startDate, $endDate, $param);
     $oReport->setLastDateUnits($startDate->diff($endDate)->days);
     $oReport->acceptSource();
     $oReport->setId(0);
     $oReport->lockSources();
     return $oReport;
 }
 protected function HTMLViewReport($id)
 {
     $wgOut = F::app()->getGlobal('wgOut');
     $this->HTMLAdminHeader('ViewReports');
     $report = new SponsorshipDashboardReport($id);
     $report->setId($id);
     $report->loadReportParams();
     $report->loadSources();
     $chart = SponsorshipDashboardOutputChart::newFromReport($report);
     $table = SponsorshipDashboardOutputTable::newFromReport($report);
     $wgOut->addHTML($chart->getHTML());
     $wgOut->addHTML($table->getHTML());
 }
 /**
  * Returns HTML for a SponsorshipDashboard chart of the data that queryString gets from the database.
  *
  * The query is expected to return "number" and "creation_date" fields in each row.
  *
  * @param queryString - string - query to run whose 'number' and 'creation_date' fields will be charted.
  * @param frequency - enum - defined value of SponsorshipDashboardDateProvider::SD_FREQUENCY_<something>.
  * @param uniqueMemCacheKey - string - key under which the processed results of the query will be cached.
  * @param metricName - string - the name of the line of data which will be generated by the query (charts could have many lines in some cases).
  * @param chartName - string - the name of the whole chart.
  */
 public static function getChartHtmlByQuery($queryString, $frequency, $uniqueMemCacheKey, $metricName, $chartName)
 {
     wfProfileIn(__METHOD__);
     //lets create data source
     $oSource = new SponsorshipDashboardSourceDatabase($uniqueMemCacheKey);
     // this name will be displayed in on a chart
     $oSource->serieName = $metricName;
     // configure the soruce ( source config depends on source type )
     $dbr = wfGetDB(DB_SLAVE, array(), F::app()->wg->externalSharedDB);
     $oSource->setDatabase($dbr);
     $oSource->setQuery($queryString);
     $oSource->setFrequency($frequency);
     // so we have the source, lets configure the report object
     $oReport = new SponsorshipDashboardReport();
     $oReport->name = $chartName;
     // this shows how many steps will be displayed on chart ( counting backwards from now )
     $oReport->setLastDateUnits(30);
     // lest choose the time resolution
     $oReport->frequency = $frequency;
     // then pass ready source to report ( you can pass many sources )
     $oReport->tmpSource = $oSource;
     $oReport->acceptSource();
     $oReport->setId(0);
     $oReport->lockSources();
     // now is the time for making output. There are chart, raw and table outputs.
     $oOutput = new SponsorshipDashboardOutputChart();
     $oOutput->showActionsButton = false;
     $oOutput->emptyChartMsg = wfMsg('apigate-chart-empty');
     $oOutput->set($oReport);
     // to get HTML just call
     $html = $oOutput->getHTML(false);
     // false stops it from setting the HTML <title> tag
     wfProfileOut(__METHOD__);
     return $html;
 }