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')))));
     }
 }
Example #2
0
 protected function getDataArray()
 {
     $client = Infra_ClientHelper::getClient();
     $eventNotificationPlugin = Kaltura_Client_EventNotification_Plugin::get($client);
     $businessProcessNotificationPlugin = Kaltura_Client_BusinessProcessNotification_Plugin::get($client);
     $errDescriptions = array();
     $businessProcessCases = array();
     try {
         Infra_ClientHelper::impersonate($this->partnerId);
         $objectType = Kaltura_Client_EventNotification_Enum_EventNotificationEventObjectType::ENTRY;
         $businessProcessCases = $businessProcessNotificationPlugin->businessProcessCase->listAction($objectType, $this->entryId);
         Infra_ClientHelper::unimpersonate();
     } catch (Exception $e) {
         $errDescriptions[] = $e->getMessage();
     }
     $templateIds = array();
     $businessProcesses = array();
     $businessProcessCasesUrls = array();
     if (count($businessProcessCases)) {
         foreach ($businessProcessCases as $businessProcessCase) {
             $businessProcessCasesUrls[$businessProcessCase->businessProcessStartNotificationTemplateId] = $businessProcessNotificationPlugin->businessProcessCase->serveDiagram($objectType, $this->entryId, $businessProcessCase->businessProcessStartNotificationTemplateId);
             $businessProcesses[$businessProcessCase->businessProcessStartNotificationTemplateId] = $businessProcessCase;
             $templateIds[] = $businessProcessCase->businessProcessStartNotificationTemplateId;
         }
     }
     $eventNotificationTemplates = array();
     if (count($templateIds)) {
         $filter = new Kaltura_Client_EventNotification_Type_EventNotificationTemplateFilter();
         $filter->idIn = implode(',', $templateIds);
         try {
             Infra_ClientHelper::impersonate($this->partnerId);
             $eventNotificationTemplateList = $eventNotificationPlugin->eventNotificationTemplate->listAction($filter);
             Infra_ClientHelper::unimpersonate();
             $eventNotificationTemplates = $eventNotificationTemplateList->objects;
         } catch (Exception $e) {
             $errDescriptions[] = $e->getMessage();
         }
     }
     return array('businessProcessCases' => $businessProcesses, 'businessProcessCasesUrls' => $businessProcessCasesUrls, 'eventNotificationTemplates' => $eventNotificationTemplates, 'errDescriptions' => $errDescriptions);
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('viewRenderer')->setNoRender();
     $serverId = $this->_getParam('server_id');
     $client = Infra_ClientHelper::getClient();
     $businessProcessNotificationPlugin = Kaltura_Client_BusinessProcessNotification_Plugin::get($client);
     $partnerId = $this->_getParam('partner_id');
     if ($partnerId) {
         Infra_ClientHelper::impersonate($partnerId);
     }
     try {
         $server = $businessProcessNotificationPlugin->businessProcessServer->get($serverId);
         /* @var $server Kaltura_Client_BusinessProcessNotification_Type_BusinessProcessServer */
         $businessProcessProvider = kBusinessProcessProvider::get($server);
         $processes = $businessProcessProvider->listBusinessProcesses();
         asort($processes);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
     echo $action->getHelper('json')->sendJson($processes, false);
 }