public function init(KalturaLiveReportExportJobData $jobData)
 {
     $filter = new KalturaLiveReportInputFilter();
     $filter->live = false;
     $filter->toTime = $jobData->timeReference;
     $filter->fromTime = $jobData->timeReference - LiveReportConstants::SECONDS_36_HOURS;
     $pager = new KalturaFilterPager();
     $pager->pageIndex = 0;
     $pager->pageSize = LiveReportConstants::MAX_ENTRIES;
     $entryIds = LiveReportQueryHelper::retrieveFromReport(KalturaLiveReportType::ENTRY_TOTAL, $filter, $pager, null, "entryId");
     $this->params[LiveReportConstants::ENTRY_IDS] = implode(",", $entryIds);
 }
 protected function querySyndicationReport($timeFrame, $pageIdx, $args)
 {
     $this->checkParams($args, array(LiveReportConstants::TIME_REFERENCE_PARAM, LiveReportConstants::ENTRY_IDS));
     $reportType = KalturaLiveReportType::ENTRY_SYNDICATION_TOTAL;
     $filter = new KalturaLiveReportInputFilter();
     $filter->toTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM];
     $filter->fromTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM] - $timeFrame;
     $filter->entryIds = $args[LiveReportConstants::ENTRY_IDS];
     $pager = new KalturaFilterPager();
     $pager->pageIndex = $pageIdx;
     $pager->pageSize = self::CHUNK_SIZE;
     return LiveReportQueryHelper::retrieveFromReport($reportType, $filter, $pager, "referrer", "plays");
 }
 public function run($fp, array $args = array())
 {
     $this->checkParams($args, array(LiveReportConstants::TIME_REFERENCE_PARAM, LiveReportConstants::IS_LIVE, LiveReportConstants::ENTRY_IDS));
     $reportType = KalturaLiveReportType::ENTRY_TOTAL;
     $filter = new KalturaLiveReportInputFilter();
     $filter->live = $args[LiveReportConstants::IS_LIVE];
     $filter->toTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM];
     $filter->fromTime = $args[LiveReportConstants::TIME_REFERENCE_PARAM] - $this->timeFrame;
     $filter->entryIds = $args[LiveReportConstants::ENTRY_IDS];
     $res = LiveReportQueryHelper::retrieveFromReport($reportType, $filter, null, "entryId", $this->fieldName);
     if ($this->printResult) {
         if (empty($res)) {
             $res = $this->defaultVal;
         }
         $msg = $this->title . LiveReportConstants::CELLS_SEPARATOR . implode(LiveReportConstants::CELLS_SEPARATOR, $res);
         fwrite($fp, $msg);
     }
     return $res;
 }