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 = Kaltura_ClientHelper::getClient();
     $form = new Form_PartnerUsageFilter();
     $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 KalturaSystemPartnerUsageFilter();
     $usageFilter->fromDate = $from->toString(Zend_Date::TIMESTAMP);
     $usageFilter->toDate = $to->toString(Zend_Date::TIMESTAMP);
     // get results and paginate
     $paginatorAdapter = new Kaltura_FilterPaginator("systemPartner", "getUsage", null, $partnerFilter, $usageFilter);
     $paginator = new Kaltura_Paginator($paginatorAdapter, $request);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     // set view
     $this->view->from = $from;
     $this->view->to = $to;
     $this->view->form = $form;
     $this->view->paginator = $paginator;
 }
Example #2
0
 public function indexAction()
 {
     $page = $this->_getParam('page', 1);
     $pageSize = $this->_getParam('pageSize', 10);
     $settings = Zend_Registry::get('config')->settings;
     $adminConsolePartnerId = $settings->partnerId;
     $filter = new KalturaUserFilter();
     $filter->partnerIdEqual = $adminConsolePartnerId;
     $filter->orderBy = KalturaUserOrderBy::CREATED_AT_DESC;
     $paginatorAdapter = new Kaltura_FilterPaginator("user", "listAction", null, $filter);
     $paginator = new Kaltura_Paginator($paginatorAdapter);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     $this->view->myEmail = Zend_Auth::getInstance()->getIdentity()->getUser()->email;
     $this->view->paginator = $paginator;
 }
 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 KalturaGenericDistributionProviderFilter();
     // get results and paginate
     $paginatorAdapter = new Kaltura_FilterPaginator("genericDistributionProvider", "listAction", null, $genericProviderFilter);
     $paginator = new Kaltura_Paginator($paginatorAdapter, $request);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     // set view
     $action->view->newForm = $newForm;
     $action->view->paginator = $paginator;
 }
Example #4
0
 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();
     $form = new Form_WidgetFilter();
     $form->setAction($action);
     $form->populate($request->getParams());
     $uiConfFilter = $this->getUiConfFilterFromRequest($request);
     $uiConfFilter->orderBy = KalturaUiConfOrderBy::CREATED_AT_DESC;
     // get results and paginate
     $paginatorAdapter = new Kaltura_FilterPaginatorWithPartnerLoader(null, $uiConfFilter);
     $paginator = new Kaltura_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)
 {
     $request = $action->getRequest();
     $page = $this->_getParam('page', 1);
     $pageSize = $this->_getParam('pageSize', 10);
     $form = new Form_PartnerFilter();
     $newForm = new Form_NewDistributionProfile();
     $actionUrl = $action->view->url(array('controller' => 'plugin', 'action' => 'DistributionProfileListAction'), null, true);
     $form->setAction($actionUrl);
     // init filter
     $partnerFilter = $this->getPartnerFilterFromRequest($request);
     // get results and paginate
     $paginatorAdapter = new Kaltura_FilterPaginator("distributionProfile", "listByPartner", null, $partnerFilter);
     $paginator = new Kaltura_Paginator($paginatorAdapter, $request);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     $providers = array(KalturaDistributionProviderType::GENERIC => 'Generic', KalturaDistributionProviderType::SYNDICATION => 'Syndication');
     $genericProviders = array();
     $client = Kaltura_ClientHelper::getClient();
     $contentDistributionClientPlugin = KalturaContentDistributionClientPlugin::get($client);
     $providersList = $contentDistributionClientPlugin->distributionProvider->listAction();
     if ($providersList) {
         foreach ($providersList->objects as $provider) {
             if ($provider->type == KalturaDistributionProviderType::GENERIC) {
                 $genericProviders[$provider->id] = $provider->name;
             } else {
                 $providers[$provider->type] = $provider->name;
             }
         }
     }
     $newForm->setProviders($providers);
     // set view
     $action->view->form = $form;
     $action->view->newForm = $newForm;
     $action->view->paginator = $paginator;
     $action->view->providers = $providers;
     $action->view->genericProviders = $genericProviders;
 }
Example #6
0
 public static function setIndex($index)
 {
     self::$index = $index;
 }
Example #7
0
 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 KalturaUserFilter();
     $filter->isAdminEqual = true;
     $filter->partnerIdEqual = $partnerId;
     $filter->statusEqual = KalturaUserStatus::ACTIVE;
     $paginatorAdapter = new Kaltura_FilterPaginator("user", "listAction", $partnerId, $filter);
     $paginator = new Kaltura_Paginator($paginatorAdapter);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($pageSize);
     $paginator->setIndex(2);
     $this->view->partnerId = $partnerId;
     $this->view->paginator = $paginator;
 }
Example #8
0
 public function failedTasksAction()
 {
     $defaultJobTypes = array(KalturaBatchJobType::CONVERT, KalturaBatchJobType::IMPORT, KalturaBatchJobType::BULKUPLOAD);
     $oClass = new ReflectionClass('KalturaConversionEngineType');
     $convertSubTypes = $oClass->getConstants();
     $oClass = new ReflectionClass('KalturaBatchJobType');
     $jobTypes = array_flip($oClass->getConstants());
     $jobTypes[KalturaBatchJobType::CONVERT] = $convertSubTypes;
     $oClass = new ReflectionClass('KalturaBatchJobErrorTypes');
     $errorTypes = $oClass->getConstants();
     $oClass = new ReflectionClass('KalturaBatchJobStatus');
     $statuses = array_flip($oClass->getConstants());
     $statuses[KalturaBatchJobStatus::FAILED] = $errorTypes;
     $request = $this->getRequest();
     $this->view->errors = array();
     $client = Kaltura_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') {
                 Kaltura_AclHelper::validateAccess('batch', 'failed-retry-delete');
                 $client->jobs->retryJob($jobId, $jobType);
             } elseif ($submitAction == 'delete') {
                 Kaltura_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 Kaltura_BatchJobFilter();
     $filter->orderBy = KalturaBaseJobOrderBy::CREATED_AT_DESC;
     //		$filter->jobTypeNotIn = KalturaBatchJobType::DELETE;
     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(KalturaBatchJobStatus::FAILED, KalturaBatchJobStatus::ABORTED, KalturaBatchJobStatus::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 Kaltura_FilterPaginator("jobs", "listBatchJobs", null, $filter);
     $paginator = new Kaltura_Paginator($paginatorAdapter, $request);
     $paginator->setCurrentPageNumber($this->_getParam($paginator->pageFieldName));
     $paginator->setItemCountPerPage($this->_getParam('pageSize', 10));
     $paginator->setAction($action);
     $this->view->paginator = $paginator;
 }