public function deliveryProfilesConfigurationAction() { $request = $this->getRequest(); $page = $this->_getParam('page', 1); $pageSize = $this->_getParam('pageSize', 10); $client = Infra_ClientHelper::getClient(); $form = new Form_PartnerIdFilter(); $form->populate($request->getParams()); $newForm = new Form_NewDeliveryProfile(); $newForm->populate($request->getParams()); $action = $this->view->url(array('controller' => 'delivery', 'action' => 'delivery-profiles-configuration'), null, true); $form->setAction($action); $partnerId = null; if ($request->getParam('filter_input') != '') { $partnerId = $request->getParam('filter_input'); $newForm->getElement('newPartnerId')->setValue($partnerId); } $filter = new Kaltura_Client_Type_DeliveryProfileFilter(); $filter->partnerIdEqual = $partnerId; // get results and paginate $paginatorAdapter = new Infra_FilterPaginator($client->deliveryProfile, "listAction", $partnerId, $filter); $paginator = new Infra_Paginator($paginatorAdapter, $request); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($pageSize); // popule the form $form->populate($request->getParams()); // set view $this->view->form = $form; $this->view->newForm = $newForm; $this->view->paginator = $paginator; }
public function listAction() { $request = $this->getRequest(); $page = $this->_getParam('page', 1); $pageSize = $this->_getParam('pageSize', 10); $action = $this->view->url(array('controller' => $request->getControllerName(), 'action' => $request->getActionName()), null, true); $newButton = new Form_NewButton(); $newButton->populate($request->getParams()); $form = new Form_ReportFilter(); $form->setAction($action); $form->populate($request->getParams()); $reportFilter = $this->getReportFilterFromRequest($request); $reportFilter->orderBy = Kaltura_Client_Enum_ReportOrderBy::CREATED_AT_DESC; $newButton->getElement('newPartnerId')->setValue($reportFilter->partnerIdIn); // get results and paginate $client = Infra_ClientHelper::getClient(); $adminConsolePlugin = Kaltura_Client_AdminConsole_Plugin::get($client); $paginatorAdapter = new Kaltura_FilterPaginatorWithPartnerLoader($adminConsolePlugin->reportAdmin, "listAction", null, $reportFilter); $paginator = new Infra_Paginator($paginatorAdapter, $request); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($pageSize); // set view $this->view->form = $form; $this->view->newButton = $newButton; $this->view->paginator = $paginator; }
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; }
public function indexAction() { $request = $this->getRequest(); $page = $this->_getParam('page', 1); $pageSize = $this->_getParam('pageSize', 10); $client = Infra_ClientHelper::getClient(); // reset form url $action = $this->view->url(array('controller' => $request->getParam('controller'), 'action' => $request->getParam('action')), null, true); $form = new Form_UserFilter(); $form->setAction($action); $userRoles = $client->userRole->listAction(); $config = Zend_Registry::get('config'); // init filter $userFilter = $this->getUserFilterFromRequest($request); $userFilter->partnerIdEqual = $config->settings->partnerId; $userFilter->orderBy = Kaltura_Client_Enum_UserOrderBy::CREATED_AT_DESC; $paginatorAdapter = new Infra_FilterPaginator($client->user, "listAction", null, $userFilter); $paginator = new Infra_Paginator($paginatorAdapter); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($pageSize); $this->view->myEmail = Infra_AuthHelper::getAuthInstance()->getIdentity()->getUser()->email; $this->view->paginator = $paginator; // populate the form $form->populate($request->getParams()); // set view $this->view->form = $form; }
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; }
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; }
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; } } }
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; }
public function doAction(Zend_Controller_Action $action) { $request = $action->getRequest(); $page = $this->_getParam('page', 1); $pageSize = $this->_getParam('pageSize', 10); $newForm = new Form_NewGenericProvider(); // init filter $genericProviderFilter = new Kaltura_Client_ContentDistribution_Type_GenericDistributionProviderFilter(); $client = Infra_ClientHelper::getClient(); $contentDistributionPlugin = Kaltura_Client_ContentDistribution_Plugin::get($client); // get results and paginate $paginatorAdapter = new Infra_FilterPaginator($contentDistributionPlugin->genericDistributionProvider, "listAction", null, $genericProviderFilter); $paginator = new Infra_Paginator($paginatorAdapter, $request); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($pageSize); // set view $action->view->newForm = $newForm; $action->view->paginator = $paginator; }
public function indexAction() { $request = $this->getRequest(); $page = $this->_getParam('page', 1); $pageSize = $this->_getParam('pageSize', 10); $from = new Zend_Date($this->_getParam('from_date', $this->getDefaultFromDate())); $to = new Zend_Date($this->_getParam('to_date', $this->getDefaultToDate())); $client = Infra_ClientHelper::getClient(); $systemPartnerPlugin = Kaltura_Client_SystemPartner_Plugin::get($client); $form = new Form_PartnerUsageFilter(); $partnerPackages = $systemPartnerPlugin->systemPartner->getPackages(); Form_PackageHelper::addPackagesToForm($form, $partnerPackages, 'partner_package'); $this->view->partnerPackages = array(); foreach ($partnerPackages as $package) { $this->view->partnerPackages[$package->id] = $package->name; } $form->populate($request->getParams()); // when no statuses selected if (!$form->getElement('include_active')->getValue() && !$form->getElement('include_blocked')->getValue() && !$form->getElement('include_removed')->getValue()) { $form->getElement('include_active')->setValue(1); $form->getElement('include_blocked')->setValue(1); $form->getElement('include_removed')->setValue(1); } // 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); $usageFilter->timezoneOffset = Infra_AuthHelper::getAuthInstance()->getIdentity()->getTimezoneOffset(); // get results and paginate $paginatorAdapter = new Infra_FilterPaginator($systemPartnerPlugin->systemPartner, "getUsage", null, $partnerFilter, $usageFilter); $paginator = new Infra_Paginator($paginatorAdapter, $request); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($pageSize); Form_PackageHelper::addPackagesToForm($form, $systemPartnerPlugin->systemPartner->getPackages(), 'partner_package', true, 'All Service Editions'); // set view $this->view->from = $from; $this->view->to = $to; $this->view->form = $form; $this->view->paginator = $paginator; }
public function userRoleAction() { $client = Infra_ClientHelper::getClient(); $page = $this->_getParam('page', 1); $pageSize = $this->_getParam('pageSize', 10); $config = Zend_Registry::get('config'); $filter = new Kaltura_Client_Type_UserRoleFilter(); $filter->partnerIdEqual = $config->settings->partnerId; $filter->orderBy = Kaltura_Client_Enum_UserOrderBy::CREATED_AT_DESC; $paginatorAdapter = new Infra_FilterPaginator($client->userRole, "listAction", null, $filter); $paginator = new Infra_Paginator($paginatorAdapter); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($pageSize); $this->view->myEmail = Infra_AuthHelper::getAuthInstance()->getIdentity()->getUser()->email; $this->view->paginator = $paginator; }
public static function setIndex($index) { self::$index = $index; }
public function kmcUsersAction() { $this->_helper->layout->disableLayout(); $partnerId = $this->_getParam('partner_id'); if (!$partnerId) { //TODO: error } $page = $this->_getParam('page', 1); $pageSize = $this->_getParam('pageSize', 10); $filter = new Kaltura_Client_Type_UserFilter(); $filter->isAdminEqual = true; $filter->partnerIdEqual = $partnerId; $filter->statusEqual = Kaltura_Client_Enum_UserStatus::ACTIVE; $client = Infra_ClientHelper::getClient(); $paginatorAdapter = new Infra_FilterPaginator($client->user, "listAction", $partnerId, $filter); $paginator = new Infra_Paginator($paginatorAdapter); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($pageSize); $paginator->setIndex(2); $this->view->partnerId = $partnerId; $this->view->paginator = $paginator; }
public function failedTasksAction() { $defaultJobTypes = array(Kaltura_Client_Enum_BatchJobType::CONVERT, Kaltura_Client_Enum_BatchJobType::IMPORT, Kaltura_Client_Enum_BatchJobType::BULKUPLOAD); $oClass = new ReflectionClass('Kaltura_Client_Enum_ConversionEngineType'); $convertSubTypes = $oClass->getConstants(); $oClass = new ReflectionClass('Kaltura_Client_Enum_BatchJobType'); $jobTypes = array_flip($oClass->getConstants()); $jobTypes[Kaltura_Client_Enum_BatchJobType::CONVERT] = $convertSubTypes; $oClass = new ReflectionClass('Kaltura_Client_Enum_BatchJobErrorTypes'); $errorTypes = $oClass->getConstants(); $oClass = new ReflectionClass('Kaltura_Client_Enum_BatchJobStatus'); $statuses = array_flip($oClass->getConstants()); $statuses[Kaltura_Client_Enum_BatchJobStatus::FAILED] = $errorTypes; $request = $this->getRequest(); $this->view->errors = array(); $client = Infra_ClientHelper::getClient(); if (!$client) { $this->view->errors[] = 'init client failed'; return; } $submitAction = $request->getParam('submitAction', false); if ($submitAction && strlen($submitAction)) { $actionJobs = $request->getParam('actionJobs', array()); $jobsArr = explode(';', $actionJobs); $jobs = array(); foreach ($jobsArr as $jobData) { list($jobId, $jobType) = explode(',', $jobData); $jobs[$jobId] = $jobType; } $client->startMultiRequest(); foreach ($jobs as $jobId => $jobType) { if ($submitAction == 'retry') { Infra_AclHelper::validateAccess('batch', 'failed-retry-delete'); $client->jobs->retryJob($jobId, $jobType); } elseif ($submitAction == 'delete') { Infra_AclHelper::validateAccess('batch', 'failed-retry-delete'); $client->jobs->deleteJob($jobId, $jobType); } } $results = $client->doMultiRequest(); } $action = $this->view->url(array('controller' => 'batch', 'action' => 'failed-tasks'), null, true); $this->view->tasksFailedForm = new Form_Batch_TasksFailed(); $this->view->tasksFailedForm->populate($request->getParams()); $this->view->tasksFailedForm->setAction($action); $submitAction = $this->view->tasksFailedForm->getElement('submitAction'); $submitAction->setValue(''); $filter = new Infra_BatchJobFilter(); $filter->orderBy = Kaltura_Client_Enum_BatchJobOrderBy::CREATED_AT_DESC; if ($request->getParam('createdAtFrom', false)) { $createdAtFrom = new Zend_Date($this->_getParam('createdAtFrom', $this->getDefaultFromDate())); $filter->createdAtGreaterThanOrEqual = $createdAtFrom->toString(Zend_Date::TIMESTAMP); } else { $createdAtFrom = $this->view->tasksFailedForm->getElement('createdAtFrom'); $createdAtFrom->setValue(date('m/d/Y', $this->getDefaultFromDate())); $filter->createdAtGreaterThanOrEqual = $this->getDefaultFromDate(); } if ($request->getParam('createdAtTo', false)) { $createdAtTo = new Zend_Date($this->_getParam('createdAtTo', $this->getDefaultToDate())); $filter->createdAtLessThanOrEqual = $createdAtTo->toString(Zend_Date::TIMESTAMP); } else { $createdAtTo = $this->view->tasksFailedForm->getElement('createdAtTo'); $createdAtTo->setValue(date('m/d/Y', $this->getDefaultToDate())); $filter->createdAtLessThanOrEqual = $this->getDefaultToDate(); } $entryId = $request->getParam('entryId', null); if ($entryId && strlen($entryId)) { $filter->entryIdEqual = $entryId; } $partnerId = $request->getParam('partnerId', null); if ($partnerId && is_numeric($partnerId)) { $filter->partnerIdEqual = $partnerId; } $inFailedStatuses = array(); if ($request->getParam('allReasons', false) == '0') { $inErrorTypes = array(); foreach ($statuses as $status => $errTypes) { $statusChecked = $request->getParam("status_{$status}", false); if ($statusChecked) { $inFailedStatuses[] = $status; } if (is_array($errTypes)) { foreach ($errTypes as $errType) { if (!$statusChecked && $request->getParam("status_{$status}_{$errType}", false)) { $inFailedStatuses[] = $status; $inErrorTypes[] = $errType; } } } } if (count($inErrorTypes)) { $filter->errTypeIn = implode(',', $inErrorTypes); } } if (!count($inFailedStatuses)) { $inFailedStatuses = array(Kaltura_Client_Enum_BatchJobStatus::FAILED, Kaltura_Client_Enum_BatchJobStatus::ABORTED, Kaltura_Client_Enum_BatchJobStatus::FATAL); } $filter->statusIn = implode(',', $inFailedStatuses); // $allJobs = $request->getParam('allJobs', false); // if($allJobs == '0') // { foreach ($jobTypes as $jobType => $jobSubTypes) { if (is_array($jobSubTypes)) { $inJobSubTypes = array(); foreach ($jobSubTypes as $jobSubType) { $fieldName = 'job_' . str_replace('.', '_', $jobType) . '_' . str_replace('.', '_', $jobSubType); if ($request->getParam($fieldName, false)) { $inJobSubTypes[] = $jobSubType; } } if (count($inJobSubTypes)) { $filter->addJobType($jobType, $inJobSubTypes); } } else { $fieldName = 'job_' . str_replace('.', '_', $jobType); if ($request->getParam($fieldName, false)) { $filter->addJobType($jobType); } } } // } // if(!$allJobs && is_bool($allJobs)) if (!$filter->hasJobTypeFilter()) { $filter->jobTypeIn = implode(',', $defaultJobTypes); } $paginatorAdapter = new Infra_FilterPaginator($client->jobs, "listBatchJobs", null, $filter); $paginator = new Infra_Paginator($paginatorAdapter, $request); $paginator->setAction($action); $this->view->paginator = $paginator; }