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;
         }
     }
 }
Beispiel #2
0
 public function getUrlAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $id = $request->getParam('id');
     $partnerId = $request->getParam('partner-id');
     $client = Infra_ClientHelper::getClient();
     $adminConsolePlugin = Kaltura_Client_AdminConsole_Plugin::get($client);
     try {
         $url = $adminConsolePlugin->reportAdmin->getCsvUrl($id, $partnerId);
         $response = array('url' => $url);
     } catch (Exception $ex) {
         $response = array('code' => $ex->getCode(), 'message' => $ex->getMessage());
     }
     echo $this->_helper->json($response, false);
 }
 public function duplicateAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $id = $request->getParam('id');
     $client = Infra_ClientHelper::getClient();
     $adminConsolePlugin = Kaltura_Client_AdminConsole_Plugin::get($client);
     $uiConf = $adminConsolePlugin->uiConfAdmin->get($id);
     $uiConf->id = null;
     $uiConf = $adminConsolePlugin->uiConfAdmin->add($uiConf);
     echo $this->_helper->json('ok', false);
 }
Beispiel #4
0
 private function getPartnerFilterFromRequest(Zend_Controller_Request_Abstract $request)
 {
     $filter = new Kaltura_Client_Type_PartnerFilter();
     $filterType = $request->getParam('filter_type');
     $filterInput = $request->getParam('filter_input');
     $filterIncludActive = $request->getParam('include_active');
     $filterIncludBlocked = $request->getParam('include_blocked');
     $filterIncludRemoved = $request->getParam('include_removed');
     $filterPackage = $request->getParam('partner_package');
     if (!in_array($filterType, array('', 'none'))) {
         $_SESSION['partnerLastSearchValue'] = $filterInput;
     }
     if ($filterType == 'byEntryId') {
         $client = Infra_ClientHelper::getClient();
         $adminConsolePlugin = Kaltura_Client_AdminConsole_Plugin::get($client);
         try {
             $entry = $adminConsolePlugin->entryAdmin->get($filterInput);
             /* @var $entry Kaltura_Client_Type_MediaEntry */
             $filter->idIn = $entry->partnerId;
         } catch (Exception $ex) {
             $filter->idIn = "-99";
         }
     }
     if ($filterType == 'byUIConfId') {
         $client = Infra_ClientHelper::getClient();
         $adminConsolePlugin = Kaltura_Client_AdminConsole_Plugin::get($client);
         try {
             $uiConf = $adminConsolePlugin->uiConfAdmin->get($filterInput);
             /* @var $uiConf Kaltura_Client_Type_UIConf  */
             $filter->idIn = $uiConf->partnerId;
         } catch (Exception $ex) {
             $filter->idIn = "-99";
         }
     }
     if ($filterType == 'byid') {
         $filter->idIn = $filterInput;
     } else {
         if ($filterType == 'byname') {
             $filter->nameLike = $filterInput;
         } elseif ($filterType == 'free' && $filterInput) {
             $filter->partnerNameDescriptionWebsiteAdminNameAdminEmailLike = $filterInput;
         }
     }
     $statuses = array();
     if ($filterIncludActive) {
         $statuses[] = Kaltura_Client_Enum_PartnerStatus::ACTIVE;
     }
     if ($filterIncludBlocked) {
         $statuses[] = Kaltura_Client_Enum_PartnerStatus::BLOCKED;
     }
     if ($filterIncludRemoved) {
         $statuses[] = Kaltura_Client_Enum_PartnerStatus::FULL_BLOCK;
     }
     if ($filterPackage != '') {
         $filter->partnerPackageEqual = $filterPackage;
     }
     $statusIn = implode(',', $statuses);
     if ($statusIn != '') {
         $filter->statusIn = $statusIn;
     } else {
         $filter->statusIn = Kaltura_Client_Enum_PartnerStatus::ACTIVE . ',' . Kaltura_Client_Enum_PartnerStatus::BLOCKED;
     }
     $filter->orderBy = Kaltura_Client_Enum_PartnerOrderBy::ID_DESC;
     return $filter;
 }
Beispiel #5
0
 public function entryInvestigationAction()
 {
     $request = $this->getRequest();
     $this->view->errors = array();
     $this->view->investigateData = null;
     $this->view->enableActions = false;
     $action = $this->view->url(array('controller' => 'batch', 'action' => 'entry-investigation'), null, true);
     $this->view->searchEntryForm = new Form_Batch_SearchEntry();
     $this->view->searchEntryForm->populate($request->getParams());
     $this->view->searchEntryForm->setAction($action);
     $submitAction = $this->view->searchEntryForm->getElement('submitAction');
     $submitAction->setValue('');
     if (Infra_Support::isAdminEnabled()) {
         $upload = new Zend_File_Transfer_Adapter_Http();
         $files = $upload->getFileInfo();
         if (count($files) && isset($files['entryFile']) && $files['entryFile']['size']) {
             $file = $files['entryFile'];
             $investigateData = unserialize(base64_decode(file_get_contents($file['tmp_name'])));
             $entryIdField = $this->view->searchEntryForm->getElement('entryId');
             $entryIdField->setValue($investigateData->entry->id);
             $this->view->investigateData = $investigateData;
             $this->view->enableActions = false;
             return;
         }
     }
     $entryId = $request->getParam('entryId', false);
     if (!$entryId) {
         return;
     }
     $client = Infra_ClientHelper::getClient();
     if (!$client) {
         $this->view->errors[] = 'init client failed';
         return;
     }
     $adminConsolePlugin = Kaltura_Client_AdminConsole_Plugin::get($client);
     if ($request->getParam('searchType') == 'by-flavor-asset-id') {
         try {
             // $entryId is actually flavor id in this case
             $entry = $adminConsolePlugin->entryAdmin->getByFlavorId($entryId);
         } catch (Exception $e) {
             $this->view->errors[] = 'Flavor asset not found: ' . $e->getMessage();
             return;
         }
         $entryId = $entry->id;
     }
     $submitAction = $request->getParam('submitAction', false);
     if ($submitAction && strlen($submitAction)) {
         $partnerId = $request->getParam('partnerId', 0);
         Infra_ClientHelper::impersonate($partnerId);
         if ($submitAction == 'retry') {
             $jobId = $request->getParam('actionJobId', 0);
             $jobType = $request->getParam('actionJobType', 0);
             try {
                 $client->jobs->retryJob($jobId, $jobType);
             } catch (Exception $e) {
                 $this->view->errors[] = "Retry job [{$jobId}] error: " . $e->getMessage();
             }
         }
         if ($submitAction == 'boostEntryJobs') {
             try {
                 $client->jobs->boostEntryJobs($entryId);
             } catch (Exception $e) {
                 $this->view->errors[] = "Boost entry [{$entryId}] jobs error: " . $e->getMessage();
             }
         }
         if ($submitAction == 'reconvertEntry') {
             try {
                 $client->jobs->addConvertProfileJob($entryId);
             } catch (Exception $e) {
                 $this->view->errors[] = "Reconvert entry [{$entryId}] error: " . $e->getMessage();
             }
         }
         if ($submitAction == 'reconvert') {
             $flavorAssetId = $request->getParam('actionFlavorAssetId', 0);
             try {
                 $client->flavorAsset->reconvert($flavorAssetId);
             } catch (Exception $e) {
                 $this->view->errors[] = "Reconvert flavor [{$flavorAssetId}] error: " . $e->getMessage();
             }
         }
         if ($submitAction == 'regenerate') {
             $thumbAssetId = $request->getParam('actionFlavorAssetId', 0);
             try {
                 $client->thumbAsset->regenerate($thumbAssetId);
             } catch (Exception $e) {
                 $this->view->errors[] = "Regenerate thumbnail [{$thumbAssetId}] error: " . $e->getMessage();
             }
         }
         Infra_ClientHelper::unimpersonate();
     }
     $this->view->investigateData = $this->getEntryInvestigationData($entryId, $this->view->errors);
     $this->view->enableActions = true;
     if (!$this->view || !$this->view->investigateData) {
         return;
     }
     $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaApplicationPartialView');
     foreach ($pluginInstances as $pluginInstance) {
         $entryInvestigatePlugins = $pluginInstance->getApplicationPartialViews('batch', 'entryInvestigation');
         if (!$entryInvestigatePlugins) {
             continue;
         }
         foreach ($entryInvestigatePlugins as $plugin) {
             /* @var $plugin Kaltura_View_Helper_PartialViewPlugin */
             $plugin->plug($this->view);
         }
     }
 }