Example #1
0
 /**
  * 
  * 
  * @param file $fileData 
  * @param KalturaBulkUploadJobData $bulkUploadData 
  * @param KalturaBulkUploadUserData $bulkUploadUserData 
  * @return KalturaBulkUpload
  */
 function addFromBulkUpload($fileData, KalturaBulkUploadJobData $bulkUploadData = null, KalturaBulkUploadUserData $bulkUploadUserData = null)
 {
     $kparams = array();
     $kfiles = array();
     $this->client->addParam($kfiles, "fileData", $fileData);
     if ($bulkUploadData !== null) {
         $this->client->addParam($kparams, "bulkUploadData", $bulkUploadData->toParams());
     }
     if ($bulkUploadUserData !== null) {
         $this->client->addParam($kparams, "bulkUploadUserData", $bulkUploadUserData->toParams());
     }
     $this->client->queueServiceActionCall("user", "addFromBulkUpload", $kparams, $kfiles);
     if ($this->client->isMultiRequest()) {
         return $this->client->getMultiRequestResult();
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaBulkUpload");
     return $resultObject;
 }
Example #2
0
 /**
  * @action addUsers
  * @actionAlias user.addFromBulkUpload
  * Action adds users from a bulkupload CSV file
  * @param file $fileData
  * @param KalturaBulkUploadJobData $bulkUploadData
  * @param KalturaBulkUploadUserData $bulkUploadUserData
  * @return KalturaBulkUpload
  */
 public function addUsersAction($fileData, KalturaBulkUploadJobData $bulkUploadData = null, KalturaBulkUploadUserData $bulkUploadUserData = null)
 {
     if (!$bulkUploadData) {
         $bulkUploadData = KalturaPluginManager::loadObject('KalturaBulkUploadJobData', null);
     }
     if (!$bulkUploadUserData) {
         $bulkUploadUserData = new KalturaBulkUploadUserData();
     }
     if (!$bulkUploadData->fileName) {
         $bulkUploadData->fileName = $fileData["name"];
     }
     $dbBulkUploadJobData = $bulkUploadData->toInsertableObject();
     $bulkUploadCoreType = kPluginableEnumsManager::apiToCore("BulkUploadType", $bulkUploadData->type);
     $dbBulkUploadJobData->setBulkUploadObjectType(BulkUploadObjectType::USER);
     $dbBulkUploadJobData->setUserId($this->getKuser()->getPuserId());
     $dbObjectData = $bulkUploadUserData->toInsertableObject();
     $dbBulkUploadJobData->setObjectData($dbObjectData);
     $dbBulkUploadJobData->setFilePath($fileData["tmp_name"]);
     $dbJob = kJobsManager::addBulkUploadJob($this->getPartner(), $dbBulkUploadJobData, $bulkUploadCoreType);
     $dbJobLog = BatchJobLogPeer::retrieveByBatchJobId($dbJob->getId());
     if (!$dbJobLog) {
         return null;
     }
     $bulkUpload = new KalturaBulkUpload();
     $bulkUpload->fromObject($dbJobLog, $this->getResponseProfile());
     return $bulkUpload;
 }