コード例 #1
0
 public function doAction(Zend_Controller_Action $action)
 {
     $client = Infra_ClientHelper::getClient();
     $virusScanPlugin = Kaltura_Client_VirusScan_Plugin::get($client);
     //create new form
     $newForm = new Form_NewVirusScanProfile();
     $page = $this->_getParam('page', 1);
     $pageSize = $this->_getParam('pageSize', 10);
     //get PartnerId
     $partnerId = $this->_getParam('partnerId');
     //filter form
     $request = $action->getRequest();
     $virusScanFilterForm = new Form_VirusScanFilter();
     $virusScanFilterFormAction = $action->view->url(array('controller' => $request->getParam('controller'), 'action' => $request->getParam('action')), null, true);
     $virusScanFilterForm->setAction($virusScanFilterFormAction);
     $virusScanFilterForm->populate($request->getParams());
     $virusScanFilter = $this->getVirusScanFilterFromRequest($request);
     $newForm->getElement("newPartnerId")->setValue($virusScanFilter->partnerIdEqual);
     //filter also by partnerId
     if (!is_null($partnerId)) {
         $virusScanFilter->partnerIdEqual = $partnerId;
     }
     $paginatorAdapter = new Infra_FilterPaginator($virusScanPlugin->virusScanProfile, "listAction", null, $virusScanFilter);
     $paginator = new Infra_Paginator($paginatorAdapter);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     $action->view->virusScanFilterForm = $virusScanFilterForm;
     $action->view->newForm = $newForm;
     $action->view->paginator = $paginator;
 }
コード例 #2
0
 public function doAction(Zend_Controller_Action $action)
 {
     $request = $action->getRequest();
     $page = $this->_getParam('page', 1);
     $pageSize = $this->_getParam('pageSize', 10);
     $partnerId = $this->_getParam('partnerId');
     // init filter
     $drmProfileFilter = $this->getDrmProfileFilterFromRequest($request);
     $drmProfileFilter->orderBy = "-createdAt";
     $client = Infra_ClientHelper::getClient();
     $drmPluginClient = Kaltura_Client_Drm_Plugin::get($client);
     // get results and paginate
     $paginatorAdapter = new Infra_FilterPaginator($drmPluginClient->drmProfile, "listAction", null, $drmProfileFilter);
     $paginator = new Infra_Paginator($paginatorAdapter, $request);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     // set view
     $drmProfileFilterForm = new Form_DrmProfileFilter();
     $drmProfileFilterForm->populate($request->getParams());
     $drmProfileFilterFormAction = $action->view->url(array('controller' => $request->getParam('controller'), 'action' => $request->getParam('action')), null, true);
     $drmProfileFilterForm->setAction($drmProfileFilterFormAction);
     $action->view->filterForm = $drmProfileFilterForm;
     $action->view->paginator = $paginator;
     $createProfileForm = new Form_CreateDrmProfile();
     $actionUrl = $action->view->url(array('controller' => 'plugin', 'action' => 'DrmProfileConfigure'), null, true);
     $createProfileForm->setAction($actionUrl);
     if ($drmProfileFilter && isset($drmProfileFilter->partnerIdEqual)) {
         $createProfileForm->getElement("newPartnerId")->setValue($drmProfileFilter->partnerIdEqual);
     }
     $action->view->newProfileForm = $createProfileForm;
 }
コード例 #3
0
 protected function addProviderElements()
 {
     $this->setDescription('Unicorn Distribution Profile');
     $element = new Zend_Form_Element_Hidden('providerElements');
     $element->setLabel('Unicorn Specific Configuration');
     $element->setDecorators(array('ViewHelper', array('Label', array('placement' => 'append')), array('HtmlTag', array('tag' => 'b'))));
     $this->addElements(array($element));
     $this->addElement('text', 'api_host_url', array('label' => 'API host URL:', 'filters' => array('StringTrim')));
     $this->addElement('text', 'username', array('label' => 'Username:'******'filters' => array('StringTrim')));
     $this->addElement('text', 'password', array('label' => 'Password:'******'filters' => array('StringTrim')));
     $this->addElement('text', 'domain_name', array('label' => 'Domain name:', 'filters' => array('StringTrim')));
     $this->addElement('text', 'domain_guid', array('label' => 'Domain GUID:', 'filters' => array('StringTrim')));
     $this->addElement('text', 'channel_guid', array('label' => 'Channel GUID:', 'filters' => array('StringTrim')));
     $this->addElement('text', 'ad_free_application_guid', array('label' => 'Ad free application GUID:', 'filters' => array('StringTrim')));
     $this->addElement('select', 'remote_asset_params_id', array('label' => 'Remote asset params ID:', 'registerInArrayValidator' => false));
     $storageProfiles = array();
     try {
         $client = Infra_ClientHelper::getClient();
         Infra_ClientHelper::impersonate($this->partnerId);
         $storageProfileList = $client->storageProfile->listAction();
         Infra_ClientHelper::unimpersonate();
         foreach ($storageProfileList->objects as $storageProfile) {
             /* @var $storageProfile Kaltura_Client_Type_StorageProfile */
             $storageProfiles[$storageProfile->id] = $storageProfile->name;
         }
     } catch (Kaltura_Client_Exception $e) {
     }
     $this->addElement('select', 'storage_profile_id', array('label' => 'Storage profile ID:', 'multiOptions' => $storageProfiles));
 }
コード例 #4
0
 public function doAction(Zend_Controller_Action $action)
 {
     $entryId = $action->getRequest()->getParam('entry-id');
     $xslt = $action->getRequest()->getParam('xslt');
     $this->client = Infra_ClientHelper::getClient();
     $xml = $this->client->media->getMrss($entryId);
     $xslParams = array();
     $xslParams['entryDistributionId'] = '';
     $xslParams['distributionProfileId'] = '';
     ob_start();
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML($xml);
     $xsltDoc = new DOMDocument();
     $xsltDoc->loadXML($xslt);
     $xslt = new XSLTProcessor();
     $xslt->registerPHPFunctions();
     // it is safe to register all php fuctions here
     $xslt->setParameter('', $xslParams);
     $xslt->importStyleSheet($xsltDoc);
     $ob = ob_get_clean();
     ob_end_clean();
     if ($ob) {
         $action->getHelper('json')->direct(array('error' => $ob));
     }
     $obj = array('result' => $xslt->transformToXml($xmlDoc));
     $action->getHelper('json')->direct($obj);
 }
コード例 #5
0
 /**
  * 
  * @param int $offset
  * @param int $itemCountPerPage
  */
 protected function callService($offset, $itemCountPerPage)
 {
     $client = Infra_ClientHelper::getClient();
     if ($this->impersonatedPartnerId) {
         Infra_ClientHelper::impersonate($this->impersonatedPartnerId);
     }
     $pager = new Kaltura_Client_Type_FilterPager();
     $pager->pageIndex = (int) ($offset / $itemCountPerPage) + 1;
     $pager->pageSize = $itemCountPerPage;
     $action = $this->action;
     $params = $this->args;
     $params[] = $pager;
     try {
         $response = call_user_func_array(array($this->service, $action), $params);
     } catch (Kaltura_Client_Exception $e) {
         KalturaLog::err($e->getMessage());
         return array();
     }
     $this->totalCount = $response->totalCount;
     $this->total = $response->total;
     if (!$response->objects) {
         return array();
     }
     return $response->objects;
 }
コード例 #6
0
ファイル: ClientHelper.php プロジェクト: DBezemer/server
 /**
  *
  * @return Kaltura_Client_Client
  */
 public static function getClient()
 {
     if (self::$client) {
         return self::$client;
     }
     if (!class_exists('Kaltura_Client_Client')) {
         throw new Infra_Exception('Kaltura client not found, maybe it wasn\'t generated', Infra_Exception::ERROR_CODE_MISSING_CLIENT_LIB);
     }
     $ks = self::getKs();
     $config = new Kaltura_Client_Configuration();
     $config->serviceUrl = self::getServiceUrl();
     $config->curlTimeout = self::getCurlTimeout();
     $config->setLogger(new Infra_ClientLoggingProxy());
     $settings = Zend_Registry::get('config')->settings;
     if (isset($settings->clientConfig)) {
         foreach ($settings->clientConfig as $attr => $value) {
             $config->{$attr} = $value;
         }
     }
     $front = Zend_Controller_Front::getInstance();
     $bootstrap = $front->getParam('bootstrap');
     if ($bootstrap) {
         $enviroment = $bootstrap->getApplication()->getEnvironment();
         if ($enviroment === 'development') {
             $config->startZendDebuggerSession = true;
         }
     }
     $client = new Kaltura_Client_Client($config);
     $client->setClientTag('Kaltura-' . $settings->applicationName);
     $client->setKs($ks);
     self::$client = $client;
     return $client;
 }
コード例 #7
0
ファイル: AdminUserIdentity.php プロジェクト: DBezemer/server
 /**
  * Reloads the allowed partners list from the server
  */
 public function refreshAllowedPartners()
 {
     $client = Infra_ClientHelper::getClient();
     $user = $client->user->get();
     $userPartners = array_map('trim', explode(',', $user->allowedPartnerIds));
     $this->partners = $userPartners;
 }
コード例 #8
0
ファイル: ChangeUserRole.php プロジェクト: DBezemer/server
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttrib('class', 'form');
     $this->setDescription('user change role');
     $this->loadDefaultDecorators();
     $this->addDecorator('Description', array('placement' => 'prepend'));
     // Add a name element
     $this->addElement('text', 'name', array('label' => 'User Name:', 'filters' => array('StringTrim'), 'readonly' => true, 'ignore' => true));
     // Add an email address element
     $this->addElement('text', 'email', array('label' => 'Email address:', 'filters' => array('StringTrim'), 'readonly' => true, 'ignore' => true));
     // Add a new role element
     $this->addElement('select', 'role', array('label' => 'Role:', 'filters' => array('StringTrim'), 'required' => true));
     $element = $this->getElement('role');
     $client = Infra_ClientHelper::getClient();
     $filter = new Kaltura_Client_Type_UserRoleFilter();
     $filter->tagsMultiLikeAnd = 'admin_console';
     $userRoles = $client->userRole->listAction($filter);
     if ($userRoles && isset($userRoles->objects)) {
         $userRoles = $userRoles->objects;
         foreach ($userRoles as $role) {
             $element->addMultiOption($role->id, $role->name);
         }
     }
 }
 protected function addTypeElements(Kaltura_Client_EventNotification_Type_EventNotificationTemplate $eventNotificationTemplate)
 {
     if (!$eventNotificationTemplate instanceof Kaltura_Client_BusinessProcessNotification_Type_BusinessProcessNotificationTemplate) {
         return;
     }
     $client = Infra_ClientHelper::getClient();
     $businessProcessNotificationPlugin = Kaltura_Client_BusinessProcessNotification_Plugin::get($client);
     $pager = new Kaltura_Client_Type_FilterPager();
     $pager->pageSize = 500;
     $serversList = $businessProcessNotificationPlugin->businessProcessServer->listAction(null, $pager);
     /* @var $serversList Kaltura_Client_BusinessProcessNotification_Type_BusinessProcessServerListResponse */
     $businessProcessProvider = null;
     $servers = array('' => 'Select Server');
     foreach ($serversList->objects as $server) {
         /* @var $server Kaltura_Client_BusinessProcessNotification_Type_BusinessProcessServer */
         $servers[$server->id] = $server->name;
         if ($server->id == $eventNotificationTemplate->serverId) {
             $businessProcessProvider = kBusinessProcessProvider::get($server);
         }
     }
     $processes = array();
     if ($businessProcessProvider) {
         $processes = $businessProcessProvider->listBusinessProcesses();
         asort($processes);
     }
     $this->addElement('select', 'server_id', array('label' => 'Server:', 'multiOptions' => $servers, 'default' => $eventNotificationTemplate->serverId));
     $this->addElement('select', 'process_id', array('label' => 'Business-Process:', 'multiOptions' => $processes, 'default' => $eventNotificationTemplate->processId));
     if ($eventNotificationTemplate instanceof Kaltura_Client_BusinessProcessNotification_Type_BusinessProcessSignalNotificationTemplate) {
         $this->addElement('text', 'message', array('label' => 'Message:', 'filters' => array('StringTrim'), 'required' => true));
         $this->addElement('text', 'event_id', array('label' => 'Event ID:', 'filters' => array('StringTrim'), 'required' => true));
     }
     if ($eventNotificationTemplate instanceof Kaltura_Client_BusinessProcessNotification_Type_BusinessProcessStartNotificationTemplate) {
         $this->addElement('checkbox', 'abort_on_deletion', array('label' => 'Abort on deletion:', 'decorators' => array('ViewHelper', array('Label', array('placement' => 'append')), array('HtmlTag', array('tag' => 'dt')))));
     }
 }
コード例 #10
0
ファイル: NewUser.php プロジェクト: DBezemer/server
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttrib('class', 'inline-form');
     // Add an email address element
     $this->addElement('text', 'email', array('label' => 'Email address:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('EmailAddress')));
     // Add an first name element
     $this->addElement('text', 'first_name', array('label' => 'First Name:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array()));
     // Add an last name element
     $this->addElement('text', 'last_name', array('label' => 'Last Name:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array()));
     $this->addElement('select', 'role', array('label' => 'Role:', 'filters' => array('StringTrim'), 'required' => true));
     $element = $this->getElement('role');
     $client = Infra_ClientHelper::getClient();
     $filter = new Kaltura_Client_Type_UserRoleFilter();
     $filter->tagsMultiLikeAnd = 'admin_console';
     $userRoles = $client->userRole->listAction($filter);
     if ($userRoles && isset($userRoles->objects)) {
         $userRoles = $userRoles->objects;
         foreach ($userRoles as $role) {
             $element->addMultiOption($role->id, $role->name);
         }
     }
     $this->addDisplayGroup(array('email', 'first_name', 'last_name', 'submit', 'role'), 'user_info', array('decorators' => array('Description', 'FormElements', array('Fieldset'))));
     // Add the submit button
     $this->addElement('button', 'submit', array('type' => 'submit', 'ignore' => true, 'label' => 'Create', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit'), 'buttons1', array('decorators' => array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'buttons')))));
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $request = $action->getRequest();
     $page = $this->_getParam('page', 1);
     $pageSize = $this->_getParam('pageSize', 10);
     $form = new Form_PartnerIdFilter();
     $form->populate($request->getParams());
     $newForm = new Form_NewEventNotificationTemplate();
     $actionUrl = $action->view->url(array('controller' => 'plugin', 'action' => 'EventNotificationTemplatesListAction'), null, true);
     $form->setAction($actionUrl);
     // init filter
     $partnerFilter = $this->getPartnerFilterFromRequest($request);
     $client = Infra_ClientHelper::getClient();
     $eventNotificationPlugin = Kaltura_Client_EventNotification_Plugin::get($client);
     // get results and paginate
     $paginatorAdapter = new Infra_FilterPaginator($eventNotificationPlugin->eventNotificationTemplate, "listByPartner", null, $partnerFilter);
     $paginator = new Infra_Paginator($paginatorAdapter, $request);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     if ($partnerFilter) {
         $newForm->getElement('newPartnerId')->setValue($partnerFilter->idIn);
     }
     // set view
     $action->view->form = $form;
     $action->view->newForm = $newForm;
     $action->view->paginator = $paginator;
 }
コード例 #12
0
 /**
  * 
  * @return Kaltura_Client_Client
  */
 public static function getClient()
 {
     if (self::$client) {
         return self::$client;
     }
     if (!class_exists('Kaltura_Client_Client')) {
         throw new Exception('Kaltura client not found, maybe it wasn\'t generated');
     }
     $partnerId = self::getPartnerId();
     $ks = self::getKs();
     $config = new Kaltura_Client_Configuration($partnerId);
     $config->serviceUrl = self::getServiceUrl();
     $config->curlTimeout = self::getCurlTimeout();
     $config->setLogger(new Infra_ClientLoggingProxy());
     $front = Zend_Controller_Front::getInstance();
     $bootstrap = $front->getParam('bootstrap');
     if ($bootstrap) {
         $enviroment = $bootstrap->getApplication()->getEnvironment();
         if ($enviroment === 'development') {
             $config->startZendDebuggerSession = true;
         }
     }
     $client = new Kaltura_Client_Client($config);
     $client->setKs($ks);
     self::$client = $client;
     return $client;
 }
コード例 #13
0
ファイル: XsltTesterAction.php プロジェクト: DBezemer/server
 public function doAction(Zend_Controller_Action $action)
 {
     $entryId = $action->getRequest()->getParam('entry-id');
     $this->client = Infra_ClientHelper::getClient();
     $action->getHelper('layout')->setLayout('layout_empty');
     $action->view->entryId = $entryId;
     $action->view->xml = $this->client->media->getMrss($entryId);
 }
コード例 #14
0
ファイル: PackageNameById.php プロジェクト: DBezemer/server
 private static function loadPackges()
 {
     if (is_null(self::$packages)) {
         $client = Infra_ClientHelper::getClient();
         $systemPartnerPlugin = Kaltura_Client_SystemPartner_Plugin::get($client);
         self::$packages = $systemPartnerPlugin->systemPartner->getPackages();
     }
 }
コード例 #15
0
ファイル: UserIdentity.php プロジェクト: DBezemer/server
 private function initPermissions()
 {
     try {
         $client = Infra_ClientHelper::getClient();
         $permissions = $client->permission->getCurrentPermissions();
         $this->permissions = array_map('trim', explode(',', $permissions));
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage());
         $this->permissions = array(Kaltura_Client_Enum_PermissionName::ALWAYS_ALLOWED_ACTIONS);
     }
 }
コード例 #16
0
ファイル: VarAuthAdapter.php プロジェクト: DBezemer/server
 public function authenticate()
 {
     $result = parent::authenticate();
     if ($result->getCode() != Zend_Auth_Result::SUCCESS) {
         return $result;
     }
     $identity = $result->getIdentity();
     if (!$identity instanceof Kaltura_VarUserIdentity) {
         return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, null, array('Identity is not a multi-publisher identity'));
     }
     $client = Infra_ClientHelper::getClient();
     $client->setKs($identity->getKs());
     $settings = Zend_Registry::get('config')->settings;
     try {
         if (isset($settings->requiredPermissions) && $settings->requiredPermissions) {
             $requiredPermissionsArr = explode(",", $settings->requiredPermissions);
             $hasRequiredPermissions = true;
             foreach ($requiredPermissionsArr as $requiredPermission) {
                 $permissionFilter = new Kaltura_Client_Type_PermissionFilter();
                 $permissionFilter->nameEqual = $requiredPermission;
                 $permissionFilter->statusEqual = Kaltura_Client_Enum_PermissionStatus::ACTIVE;
                 $permissions = $client->permission->listAction($permissionFilter, new Kaltura_Client_Type_FilterPager());
                 if (!$permissions->totalCount) {
                     $hasRequiredPermissions = false;
                     break;
                 }
             }
             if (!$hasRequiredPermissions) {
                 $filter = new Kaltura_Client_VarConsole_Type_VarConsolePartnerFilter();
                 $filter->partnerPermissionsExist = $settings->requiredPermissions;
                 $filter->groupTypeIn = Kaltura_Client_Enum_PartnerGroupType::GROUP . "," . Kaltura_Client_Enum_PartnerGroupType::VAR_GROUP;
                 $userPartners = $client->partner->listPartnersForUser($filter);
                 if (!$userPartners->totalCount) {
                     return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, null);
                 }
                 $authorizedPartnerId = $userPartners->objects[0]->id;
                 $client->setKs(null);
                 $ks = $client->user->loginByLoginId($this->username, $this->password, $authorizedPartnerId);
                 $client->setKs($ks);
                 $user = $client->user->getByLoginId($this->username, $authorizedPartnerId);
                 $identity = $this->getUserIdentity($user, $ks, $authorizedPartnerId);
             }
         }
         return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
     } catch (Exception $ex) {
         if ($ex->getCode() === self::SYSTEM_USER_INVALID_CREDENTIALS || $ex->getCode() === self::SYSTEM_USER_DISABLED || $ex->getCode() === self::USER_WRONG_PASSWORD || $ex->getCode() === self::USER_NOT_FOUND) {
             return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, null);
         } else {
             throw $ex;
         }
     }
 }
コード例 #17
0
 public function exportCsvAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $from = $this->_getParam('from_date', $this->getDefaultFromDate());
     $to = $this->_getParam('to_date', $this->getDefaultToDate());
     $client = Infra_ClientHelper::getClient();
     if ($client->getKs() == null) {
         $client->setKs(self::generateKs());
     }
     $form = new Form_PartnerUsageFilter();
     $form->populate($request->getParams());
     // init filters
     $partnerFilter = $this->getPartnerFilterFromForm($form);
     $usageFilter = new Kaltura_Client_Type_ReportInputFilter();
     $usageFilter->fromDate = DateTime::createFromFormat('m/d/Y', $from)->getTimestamp();
     $usageFilter->toDate = DateTime::createFromFormat('m/d/Y', $to)->getTimestamp();
     $usageFilter->timeZoneOffset = Infra_AuthHelper::getAuthInstance()->getIdentity()->getTimezoneOffset();
     if ($form->getElement('interval')->getValue()) {
         $usageFilter->interval = $form->getElement('interval')->getValue() == 'daily' ? Kaltura_Client_Enum_ReportInterval::DAYS : Kaltura_Client_Enum_ReportInterval::MONTHS;
     }
     $pager = new Kaltura_Client_Type_FilterPager();
     $pager->pageIndex = 1;
     $pager->pageSize = 500;
     $varConsolePlugin = Kaltura_Client_VarConsole_Plugin::get($client);
     $items = array();
     while (true) {
         $response = $varConsolePlugin->varConsole->getPartnerUsage($partnerFilter, $usageFilter, $pager);
         if (count($response->objects) <= 0) {
             break;
         }
         foreach ($response->objects as &$object) {
             $items[] = $object;
         }
         $pager->pageIndex++;
     }
     $format = $this->view->translate('csv date');
     $fileName = 'Usage report ' . $from . ' to ' . $to . '.csv';
     header('Content-type: text/csv');
     header('Content-Disposition: attachment; filename="' . $fileName . '"');
     // echo the csv header
     echo $this->view->translate('partner-usage table timeUnit'), ',', $this->view->translate('partner-usage table partnerStatus'), ',', $this->view->translate('partner-usage table partnerName'), ',', $this->view->translate('partner-usage table partnerId'), ',', $this->view->translate('partner-usage table partnerCreatedAt'), ',', $this->view->translate('partner-usage table bandwidth'), ',', $this->view->translate('partner-usage table averageStorage'), ',', $this->view->translate('partner-usage table peakStorage'), ',', $this->view->translate('partner-usage table storage'), ',', $this->view->translate('partner-usage table deletedStorage'), ',', $this->view->translate('partner-usage table combinedBandwidthStorage'), "\r\n";
     // echo the csv data
     foreach ($items as $item) {
         $d = new Zend_Date($item->partnerCreatedAt);
         $dateId = strlen($item->dateId) == 6 ? DateTime::createFromFormat("Ym", $item->dateId) : DateTime::createFromFormat("Ymd", $item->dateId);
         echo strlen($item->dateId) == 6 ? $dateId->format("M Y") : $dateId->format("d M Y"), ',', $this->view->enumTranslate('Kaltura_Client_Enum_PartnerStatus', $item->partnerStatus), ',', $item->partnerName, ',', $item->partnerId, ',', '"', $d->toString(Zend_Date::DATE_LONG), '",', (int) $item->bandwidth, ',', (int) $item->avgStorage, ',', (int) $item->peakStorage, ',', (int) $item->storage, ',', (int) $item->deletedStorage, ',', (int) $item->combinedStorageBandwidth, ',', "\r\n";
     }
 }
コード例 #18
0
ファイル: Widget.php プロジェクト: DBezemer/server
 public function loadVersions($objType)
 {
     $client = Infra_ClientHelper::getClient();
     $typesInfo = $client->uiConf->getAvailableTypes();
     $versionElement = $this->getElement('version');
     $versionElement->addMultiOption('', '');
     foreach ($typesInfo as $typeInfo) {
         if ($typeInfo->type == $objType) {
             foreach ($typeInfo->versions as $version) {
                 $versionElement->addMultiOption($version->value, $version->value);
             }
         }
     }
 }
コード例 #19
0
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $drmProfileId = $this->_getParam('drmProfileId');
     $client = Infra_ClientHelper::getClient();
     $drmPluginClient = Kaltura_Client_Drm_Plugin::get($client);
     try {
         $updatedDrmProfile = $drmPluginClient->drmProfile->delete($drmProfileId);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
コード例 #20
0
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('viewRenderer')->setNoRender();
     $providerId = $this->_getParam('provider_id');
     $client = Infra_ClientHelper::getClient();
     $contentDistributionPlugin = Kaltura_Client_ContentDistribution_Plugin::get($client);
     try {
         $contentDistributionPlugin->genericDistributionProvider->delete($providerId);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('viewRenderer')->setNoRender();
     $templateId = $this->_getParam('template_id');
     $status = $this->_getParam('status');
     $client = Infra_ClientHelper::getClient();
     $eventNotificationPlugin = Kaltura_Client_EventNotification_Plugin::get($client);
     try {
         $eventNotificationPlugin->eventNotificationTemplate->updateStatus($templateId, $status);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
 public function getDataArray($entryId, $partnerId)
 {
     $client = Infra_ClientHelper::getClient();
     $contentDistributionPlugin = Kaltura_Client_ContentDistribution_Plugin::get($client);
     $fileSyncPlugin = Kaltura_Client_FileSync_Plugin::get($client);
     if (!$client) {
         $errors[] = 'init client failed';
         return;
     }
     $filter = new Kaltura_Client_ContentDistribution_Type_EntryDistributionFilter();
     $filter->entryIdEqual = $entryId;
     $distributions = array();
     $distributionFileSyncs = array();
     $errDescription = null;
     try {
         Infra_ClientHelper::impersonate($partnerId);
         $entryDistributionList = $contentDistributionPlugin->entryDistribution->listAction($filter);
         Infra_ClientHelper::unimpersonate();
         $distributions = $entryDistributionList->objects;
     } catch (Exception $e) {
         $errDescription = $e->getMessage();
     }
     $distributionIds = array();
     if (is_array($distributions)) {
         foreach ($distributions as $distribution) {
             $distributionFileSyncs[$distribution->id] = array();
             $distributionIds[] = $distribution->id;
         }
     }
     if (count($distributionIds)) {
         try {
             $filter = new Kaltura_Client_FileSync_Type_FileSyncFilter();
             $filter->fileObjectTypeEqual = Kaltura_Client_Enum_FileSyncObjectType::ENTRY_DISTRIBUTION;
             $filter->objectIdIn = implode(',', $distributionIds);
             $pager = new Kaltura_Client_Type_FilterPager();
             $pager->pageSize = 100;
             $fileSyncList = $fileSyncPlugin->fileSync->listAction($filter, $pager);
             $fileSyncs = $fileSyncList->objects;
             foreach ($fileSyncs as $fileSync) {
                 $distributionFileSyncs[$fileSync->objectId][] = $fileSync;
             }
         } catch (Exception $e) {
             $errDescription = $e->getMessage();
         }
     }
     return array('distributions' => $distributions, 'distributionFileSyncs' => $distributionFileSyncs, 'errDescription' => $errDescription);
 }
 public function getDataArray($entryId, $partnerId)
 {
     $client = Infra_ClientHelper::getClient();
     if (!$client) {
         $errors[] = 'init client failed';
         return;
     }
     $attachmentPlugin = Kaltura_Client_Attachment_Plugin::get($client);
     $fileSyncPlugin = Kaltura_Client_FileSync_Plugin::get($client);
     $filter = new Kaltura_Client_Attachment_Type_AttachmentAssetFilter();
     $filter->entryIdEqual = $entryId;
     $attachmentAssets = array();
     $attachmentAssetsFileSyncs = array();
     $errDescription = null;
     try {
         Infra_ClientHelper::impersonate($partnerId);
         $attachmentAssetsList = $attachmentPlugin->attachmentAsset->listAction($filter);
         Infra_ClientHelper::unimpersonate();
         $attachmentAssets = $attachmentAssetsList->objects;
     } catch (Exception $e) {
         $errDescription = $e->getMessage();
     }
     $attachmentAssetIds = array();
     if (is_array($attachmentAssets)) {
         foreach ($attachmentAssets as $attachmentAsset) {
             $attachmentAssetsFileSyncs[$attachmentAsset->id] = array();
             $attachmentAssetIds[] = $attachmentAsset->id;
         }
     }
     if (count($attachmentAssetIds)) {
         try {
             $filter = new Kaltura_Client_FileSync_Type_FileSyncFilter();
             $filter->fileObjectTypeEqual = Kaltura_Client_Enum_FileSyncObjectType::FLAVOR_ASSET;
             $filter->objectIdIn = implode(',', $attachmentAssetIds);
             $pager = new Kaltura_Client_Type_FilterPager();
             $pager->pageSize = 100;
             $fileSyncList = $fileSyncPlugin->fileSync->listAction($filter, $pager);
             $fileSyncs = $fileSyncList->objects;
             foreach ($fileSyncs as $fileSync) {
                 $attachmentAssetsFileSyncs[$fileSync->objectId][] = $fileSync;
             }
         } catch (Exception $e) {
             $errDescription = $e->getMessage();
         }
     }
     return array('attachmentAssets' => $attachmentAssets, 'attachmentAssetsFileSyncs' => $attachmentAssetsFileSyncs, 'errDescription' => $errDescription);
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $dropFolderId = $this->_getParam('dropFolderId');
     $newStatus = $this->_getParam('dropFolderStatus');
     $client = Infra_ClientHelper::getClient();
     $dropFolderPluginClient = Kaltura_Client_DropFolder_Plugin::get($client);
     $updatedDropFolder = new Kaltura_Client_DropFolder_Type_DropFolder();
     $updatedDropFolder->status = $newStatus;
     try {
         $updatedDropFolder = $dropFolderPluginClient->dropFolder->update($dropFolderId, $updatedDropFolder);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
コード例 #25
0
 public function doAction(Zend_Controller_Action $action)
 {
     $request = $action->getRequest();
     $action->view->errors = array();
     $formAction = $action->view->url(array('controller' => 'plugin', 'action' => 'AdminConsoleGalleryAction'), null, true);
     $action->view->searchEntriesForm = new Form_Batch_SearchEntries();
     $action->view->searchEntriesForm->setAction($formAction);
     $filter = $action->view->searchEntriesForm->getFilter($request->getParams());
     $action->view->searchEntriesForm->populate($request->getParams());
     $client = Infra_ClientHelper::getClient();
     if (!$client) {
         $action->view->errors[] = 'init client failed';
         return;
     }
     $partnerId = $request->getParam('partnerId');
     if ($partnerId > 0) {
         $paginatorAdapter = new Infra_FilterPaginator($client->media, "listAction", $partnerId, $filter);
         $paginator = new Infra_Paginator($paginatorAdapter, $request, null, 30);
         $paginator->setAvailablePageSizes(array(15, 30, 60, 100));
         $paginator->setAction($formAction);
         $action->view->paginator = $paginator;
         $action->view->playerPartnerId = $partnerId;
         $action->view->uiConf = null;
         $action->view->swfUrl = null;
         $adminConsolePlugin = Kaltura_Client_AdminConsole_Plugin::get($client);
         $uiConfId = Zend_Registry::get('config')->settings->defaultUiConfId;
         if ($uiConfId) {
             $action->view->uiConf = $adminConsolePlugin->uiConfAdmin->get($uiConfId);
         } else {
             $uiConfFilter = new Kaltura_Client_Type_UiConfFilter();
             $uiConfFilter->partnerIdIn = 0;
             $uiConfFilter->objTypeEqual = Kaltura_Client_Enum_UiConfObjType::PLAYER_V3;
             $uiConfFilter->orderBy = Kaltura_Client_Enum_UiConfOrderBy::CREATED_AT_DESC;
             $uiConfPager = new Kaltura_Client_Type_FilterPager();
             $uiConfPager->pageSize = 1;
             $uiConfList = $adminConsolePlugin->uiConfAdmin->listAction($uiConfFilter, $uiConfPager);
             /* @var $uiConfList Kaltura_Client_AdminConsole_Type_UiConfAdminListResponse */
             if (count($uiConfList->objects)) {
                 $action->view->uiConf = reset($uiConfList->objects);
             }
         }
         if ($action->view->uiConf) {
             $action->view->swfUrl = "/index.php/kwidget/wid/_{$partnerId}/cache_st/" . time() . "/uiconf_id/" . $action->view->uiConf->id;
         }
     }
 }
コード例 #26
0
 public function exportCsvAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $from = new Zend_Date($this->_getParam('from_date', $this->getDefaultFromDate()));
     $to = new Zend_Date($this->_getParam('to_date', $this->getDefaultToDate()));
     $client = Infra_ClientHelper::getClient();
     if ($client->getKs() == null) {
         $client->setKs(self::generateKs());
     }
     $form = new Form_PartnerUsageFilter();
     $form->populate($request->getParams());
     // init filters
     $partnerFilter = $this->getPartnerFilterFromForm($form);
     $usageFilter = new Kaltura_Client_SystemPartner_Type_SystemPartnerUsageFilter();
     $usageFilter->fromDate = $from->toString(Zend_Date::TIMESTAMP);
     $usageFilter->toDate = $to->toString(Zend_Date::TIMESTAMP);
     $pager = new Kaltura_Client_Type_FilterPager();
     $pager->pageIndex = 1;
     $pager->pageSize = 500;
     $items = array();
     while (true) {
         $systemPartnerPlugin = Kaltura_Client_SystemPartner_Plugin::get($client);
         $response = $systemPartnerPlugin->systemPartner->getUsage($partnerFilter, $usageFilter, $pager);
         if (count($response->objects) <= 0) {
             break;
         }
         foreach ($response->objects as &$object) {
             $items[] = $object;
         }
         $pager->pageIndex++;
     }
     $format = $this->view->translate('csv date');
     $fileName = 'Usage report ' . $from->toString($format) . ' to ' . $to->toString($format) . '.csv';
     header('Content-type: text/csv');
     header('Content-Disposition: attachment; filename="' . $fileName . '"');
     // echo the csv header
     echo $this->view->translate('partner-usage table partnerStatus'), ',', $this->view->translate('partner-usage table partnerName'), ',', $this->view->translate('partner-usage table partnerId'), ',', $this->view->translate('partner-usage table partnerCreatedAt'), ',', $this->view->translate('partner-usage table partnerPackage'), ',', $this->view->translate('partner-usage table views'), ',', $this->view->translate('partner-usage table plays'), ',', $this->view->translate('partner-usage table entriesCount'), ',', $this->view->translate('partner-usage table totalEntriesCount'), ',', $this->view->translate('partner-usage table videoEntriesCount'), ',', $this->view->translate('partner-usage table imagesEntriesCount'), ',', $this->view->translate('partner-usage table audioEntriesCount'), ',', $this->view->translate('partner-usage table mixEntriesCount'), ',', $this->view->translate('partner-usage table bandwidth'), ',', $this->view->translate('partner-usage table storage'), ',', $this->view->translate('partner-usage table deletedStorage'), ',', $this->view->translate('partner-usage table peakStorage'), ',', $this->view->translate('partner-usage table averageStorage'), ',', $this->view->translate('partner-usage table combinedBandwidthStorage'), ',', $this->view->translate('partner-usage table transcodingUsage'), "\r\n";
     // echo the csv data
     foreach ($items as $item) {
         $d = new Zend_Date($item->partnerCreatedAt);
         echo $this->view->enumTranslate('KalturaPartnerStatus', $item->partnerStatus), ',', $item->partnerName, ',', $item->partnerId, ',', '"', $d->toString(Zend_Date::DATE_LONG), '",', $this->view->translate($this->view->packageNameById($item->partnerPackage)), ',', (int) $item->views, ',', (int) $item->plays, ',', (int) $item->entriesCount, ',', (int) $item->totalEntriesCount, ',', (int) $item->videoEntriesCount, ',', (int) $item->imageEntriesCount, ',', (int) $item->audioEntriesCount, ',', (int) $item->mixEntriesCount, ',', (int) $item->bandwidth, ',', (int) $item->storage, ',', (int) $item->deletedStorage, ',', (int) $item->peakStorage, ',', (int) $item->avgStorage, ',', (int) $item->combinedBandwidthStorage, ',', (int) $item->transcodingUsage, "\r\n";
     }
 }
コード例 #27
0
 public function doAction(Zend_Controller_Action $action)
 {
     $request = $action->getRequest();
     $page = $this->_getParam('page', 1);
     $pageSize = $this->_getParam('pageSize', 10);
     $form = new Form_PartnerIdFilter();
     $form->populate($request->getParams());
     $newForm = new Form_NewDistributionProfile();
     $actionUrl = $action->view->url(array('controller' => 'plugin', 'action' => 'DistributionProfileListAction'), null, true);
     $form->setAction($actionUrl);
     // init filter
     $partnerFilter = $this->getPartnerFilterFromRequest($request);
     $client = Infra_ClientHelper::getClient();
     $contentDistributionPlugin = Kaltura_Client_ContentDistribution_Plugin::get($client);
     // get results and paginate
     $paginatorAdapter = new Infra_FilterPaginator($contentDistributionPlugin->distributionProfile, "listByPartner", null, $partnerFilter);
     $paginator = new Infra_Paginator($paginatorAdapter, $request);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     $providers = array(Kaltura_Client_ContentDistribution_Enum_DistributionProviderType::GENERIC => 'Generic', Kaltura_Client_ContentDistribution_Enum_DistributionProviderType::SYNDICATION => 'Syndication');
     $genericProviders = array();
     $client = Infra_ClientHelper::getClient();
     $contentDistributionClientPlugin = Kaltura_Client_ContentDistribution_Plugin::get($client);
     $providersList = $contentDistributionClientPlugin->distributionProvider->listAction();
     if ($providersList) {
         foreach ($providersList->objects as $provider) {
             if ($provider->type == Kaltura_Client_ContentDistribution_Enum_DistributionProviderType::GENERIC) {
                 $genericProviders[$provider->id] = $provider->name;
             } else {
                 $providers[$provider->type] = $provider->name;
             }
         }
     }
     $newForm->setProviders($providers);
     $newPartnerElement = $newForm->getElement('newPartnerId');
     if ($newPartnerElement) {
         $newPartnerElement->setValue($partnerFilter->idIn);
     }
     // set view
     $action->view->form = $form;
     $action->view->newForm = $newForm;
     $action->view->paginator = $paginator;
     $action->view->providers = $providers;
     $action->view->genericProviders = $genericProviders;
 }
コード例 #28
0
 public function populateActions(Kaltura_Client_ContentDistribution_Type_GenericDistributionProvider $object)
 {
     $this->addProviderActions();
     $client = Infra_ClientHelper::getClient();
     $contentDistributionPlugin = Kaltura_Client_ContentDistribution_Plugin::get($client);
     $filter = new Kaltura_Client_ContentDistribution_Type_GenericDistributionProviderActionFilter();
     $filter->genericDistributionProviderIdEqual = $object->id;
     $actionsList = null;
     try {
         $actionsList = $contentDistributionPlugin->genericDistributionProviderAction->listAction($filter);
     } catch (Exception $e) {
         return;
     }
     $fields = array("protocol", "serverAddress", "remotePath", "remoteUsername", "remotePassword");
     $files = array("mrssTransformer", "mrssValidator", "resultsTransformer");
     foreach ($actionsList->objects as $actionObject) {
         $action = null;
         switch ($actionObject->action) {
             case Kaltura_Client_ContentDistribution_Enum_DistributionAction::SUBMIT:
                 $action = 'submit';
                 break;
             case Kaltura_Client_ContentDistribution_Enum_DistributionAction::UPDATE:
                 $action = 'update';
                 break;
             case Kaltura_Client_ContentDistribution_Enum_DistributionAction::DELETE:
                 $action = 'delete';
                 break;
             case Kaltura_Client_ContentDistribution_Enum_DistributionAction::FETCH_REPORT:
                 $action = 'fetchReport';
                 break;
         }
         $element = $this->getElement("{$action}-enabled");
         $element->setValue(true);
         foreach ($fields as $field) {
             $element = $this->getElement("{$field}-{$action}");
             $element->setValue($actionObject->{$field});
         }
         foreach ($files as $file) {
             if ($actionObject->{$file}) {
                 $this->addElement('hidden', "{$file}-{$action}-data", array('class' => "{$file}-{$action}-data action-data", 'value' => $actionObject->{$file}));
             }
         }
     }
 }
コード例 #29
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttrib('class', 'form');
     $this->loadDefaultDecorators();
     $this->addDecorator('Description', array('placement' => 'prepend'));
     // Add a name element
     $this->addElement('text', 'name', array('label' => 'User Role Name:', 'filters' => array('StringTrim'), 'readonly' => true, 'ignore' => true));
     // Add an email address element
     $this->addElement('text', 'description', array('label' => 'Description:', 'filters' => array('StringTrim'), 'readonly' => true, 'ignore' => true));
     $element = $this->getElement('role');
     $client = Infra_ClientHelper::getClient();
     $filter = new Kaltura_Client_Type_PermissionFilter();
     $filter->statusEqual = Kaltura_Client_Enum_PermissionStatus::ACTIVE;
     $filter->typeEqual = Kaltura_Client_Enum_PermissionType::NORMAL;
     $filter->orderBy = Kaltura_Client_Enum_PermissionOrderBy::NAME_ASC;
     $pager = new Kaltura_Client_Type_FilterPager();
     $pager->pageSize = 1000;
     $permissions = $client->permission->listAction($filter, $pager);
     /* @var $permissions Kaltura_Client_Type_PermissionListResponse */
     if ($permissions && isset($permissions->objects) && count($permissions->objects)) {
         foreach ($permissions->objects as $index => $permission) {
             /* @var $permission Kaltura_Client_Type_Permission */
             $permissionId = str_replace(".", "___", $permission->name);
             $this->addElement('checkbox', $permissionId, array('label' => $permission->friendlyName, 'decorators' => array('ViewHelper', array('Label', array('placement' => 'append')), array('HtmlTag', array('class' => 'partner_configuration_checkbox_field_only')))));
         }
         //			$adminUserRole = $userRoles->objects[0];
         //			$permissions = explode(',', $adminUserRole->permissionNames);
         //			sort($permissions);
         //			foreach ($permissions as $permission)
         //			{
         //				if ($permission != '')
         //				{
         //					$permissionId = str_replace(".", "___", $permission);
         //					$this->addElement('checkbox', $permissionId, array(
         //						'label'=> $permission,
         //						'decorators' => array('ViewHelper', array('Label', array('placement' => 'append')), array('HtmlTag',  array('class' => 'partner_configuration_checkbox_field_only'))
         //					)));
         //				}
         //			}
     }
 }
コード例 #30
0
ファイル: PartnerEmail.php プロジェクト: DBezemer/server
 public function isValid($value)
 {
     $this->_setValue($value);
     $client = Infra_ClientHelper::getClient();
     // get results and paginate
     $filter = new Kaltura_Client_Type_UserLoginDataFilter();
     $filter->loginEmailEqual = $value;
     $otherUsersWithTheSameEmail = $client->user->checkLoginDataExists($filter);
     if ($otherUsersWithTheSameEmail) {
         try {
             // allow to use email of admin console users
             $client->user->getByLoginId($value);
         } catch (Exception $ex) {
             $this->_error();
             return false;
         }
     }
     return true;
 }