コード例 #1
0
ファイル: ReportService.php プロジェクト: richhl/kalturaCE
 /**
  * report getGraphs action allows to get a graph data for a specific report. 
  * 
  * @action getGraphs
  * @param KalturaReportType $reportType  
  * @param KalturaReportInputFilter $reportInputFilter
  * @param string $dimension
  * @param string $objectIds - one ID or more (separated by ',') of specific objects to query
  * @return KalturaReportGraphArray 
  */
 function getGraphsAction($reportType, KalturaReportInputFilter $reportInputFilter, $dimension = null, $objectIds = null)
 {
     $reportGraphs = KalturaReportGraphArray::fromReportDataArray(myReportsMgr::getGraph($this->getPartnerId(), $reportType, $reportInputFilter->toReportsInputFilter(), $dimension, $objectIds));
     //print_r ( $reportGraphs );
     //		die();
     return $reportGraphs;
 }
コード例 #2
0
 /**
  * report getGraphs action allows to get a graph data for a specific report. 
  * 
  * @action getGraphs
  * @param KalturaReportType $reportType  
  * @param KalturaReportInputFilter $reportInputFilter
  * @param string $dimension
  * @param string $objectIds - one ID or more (separated by ',') of specific objects to query
  * @return KalturaReportGraphArray 
  */
 public function getGraphsAction($reportType, KalturaReportInputFilter $reportInputFilter, $dimension = null, $objectIds = null)
 {
     if ($reportType == KalturaReportType::PARTNER_USAGE || $reportType == KalturaReportType::VAR_USAGE) {
         $objectIds = $this->validateObjectsAreAllowedPartners($objectIds);
     }
     $reportGraphs = KalturaReportGraphArray::fromReportDataArray(myReportsMgr::getGraph($this->getPartnerId(), $reportType, $reportInputFilter->toReportsInputFilter(), $dimension, $objectIds));
     return $reportGraphs;
 }
コード例 #3
0
 /**
  * @param int $startDate
  * @param int $endDate
  * @param Partner $partner
  * @param reportInterval $resolution
  * @param int $tzOffset
  * @return string
  */
 public static function getPartnerUsageGraph($startDate, $endDate, Partner $partner, $resolution = reportInterval::DAYS, $tzOffset = null, $reportType = myReportsMgr::REPORT_TYPE_PARTNER_BANDWIDTH_USAGE)
 {
     $reportFilter = new reportsInputFilter();
     $reportFilter->from_date = $startDate;
     $reportFilter->to_date = $endDate;
     $reportFilter->from_day = date("Ymd", $startDate);
     $reportFilter->to_day = date("Ymd", $endDate);
     $reportFilter->interval = $resolution;
     // if TZ offset provided, add TZ offset to the UTC time created above to reflect the user's timezone
     // in myReportsMgr the offset will be later cleaned again to reflect UTC time so that the DWH query will be correct (with the TIME_SHIFT)
     if (!is_null($tzOffset)) {
         $tzOffsetSec = $tzOffset * 60;
         $reportFilter->timeZoneOffset = $tzOffsetSec;
         $reportFilter->from_date = $reportFilter->from_date + $tzOffsetSec;
         $reportFilter->to_date = $reportFilter->to_date + $tzOffsetSec;
     }
     $data = myReportsMgr::getGraph($partner->getId(), $reportType, $reportFilter, null, null);
     $graphPointsLine = array();
     if ($resolution == reportInterval::MONTHS) {
         $graphPointsLine = myPartnerUtils::annualActivityGraph($data);
     } else {
         $graphPointsLine = myPartnerUtils::dailyActivityGraph($data, $startDate);
     }
     ksort($graphPointsLine);
     $graphLine = '';
     foreach ($graphPointsLine as $point => $usage) {
         $graphLine .= intval($point) . ",{$usage};";
     }
     return $graphLine;
 }
コード例 #4
0
 public static function getPartnerBandwidthUsageFromDWH($partnerId, $startDate, $endDate, $resolution, $tzOffset = null)
 {
     $reportFilter = new reportsInputFilter();
     // use gmmktime to avoid server timezone offset - this is for backward compatibility while the KMC is not sending TZ info
     list($year, $month, $day) = explode('-', $startDate);
     $reportFilter->from_date = gmmktime(0, 0, 0, $month, $day, $year);
     list($year, $month, $day) = explode('-', $endDate);
     $reportFilter->to_date = gmmktime(0, 0, 0, $month, $day, $year);
     // if TZ offset provided, add TZ offset to the UTC time created above to reflect the user's timezone
     // in myReportsMgr the offset will be later cleaned again to reflect UTC time so that the DWH query will be correct (with the TIME_SHIFT)
     if (!is_null($tzOffset)) {
         $tzOffsetSec = $tzOffset * 60;
         $reportFilter->timeZoneOffset = $tzOffsetSec;
         $reportFilter->from_date = $reportFilter->from_date + $tzOffsetSec;
         $reportFilter->to_date = $reportFilter->to_date + $tzOffsetSec;
     }
     $reportFilter->extra_map = array('{GROUP_COLUMN}' => $resolution == 'months' ? "month_id" : "date_id");
     $res = myReportsMgr::getGraph($partnerId, myReportsMgr::REPORT_TYPE_PARTNER_BANDWIDTH_USAGE, $reportFilter, null, null);
     return $res;
 }