Пример #1
0
 /**
  * @action exportToCsv
  * @param KalturaLiveReportExportType $reportType 
  * @param KalturaLiveReportExportParams $params
  * @return KalturaLiveReportExportResponse
  */
 public function exportToCsvAction($reportType, KalturaLiveReportExportParams $params)
 {
     if (!$params->recpientEmail) {
         $kuser = kCurrentContext::getCurrentKsKuser();
         if ($kuser) {
             $params->recpientEmail = $kuser->getEmail();
         } else {
             $partnerId = kCurrentContext::getCurrentPartnerId();
             $partner = PartnerPeer::retrieveByPK($partnerId);
             $params->recpientEmail = $partner->getAdminEmail();
         }
     }
     // Validate input
     if ($params->entryIds) {
         $entryIds = explode(",", $params->entryIds);
         $entries = entryPeer::retrieveByPKs($entryIds);
         if (count($entryIds) != count($entries)) {
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $params->entryIds);
         }
     }
     $dbBatchJob = kJobsManager::addExportLiveReportJob($reportType, $params);
     $res = new KalturaLiveReportExportResponse();
     $res->referenceJobId = $dbBatchJob->getId();
     $res->reportEmail = $params->recpientEmail;
     return $res;
 }