public function listDestinationsAction()
 {
     $type = (int) $this->_getParam('type');
     $destination = new DataIntegrationDestination($type);
     $destinationIterator = $destination->getIterator();
     $rows = $destinationIterator->toJsonArray('dataIntegrationDestinationId', array('name'));
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
Пример #2
0
 /**
  * Render edit handler page
  */
 public function editAction()
 {
     $id = (int) $this->_getParam('id');
     $type = (int) $this->_getParam('type');
     $this->_handler = new Handler();
     if ($id > 0) {
         $this->_handler->handlerId = $id;
         $this->_handler->populate();
     }
     $this->view->listConditions = array('');
     if (strlen($this->_handler->conditionObject) > 0) {
         $this->_handler->condition = $this->_customKey;
         $this->view->listConditions[$this->_customKey] = $this->_customName;
     }
     foreach (Handler::listConditions() as $id => $name) {
         $this->view->listConditions[$id] = $name;
     }
     $this->_form = new WebVista_Form(array('name' => 'edit'));
     $this->_form->setAction(Zend_Registry::get('baseUrl') . 'handlers.raw/process-edit');
     $this->_form->loadORM($this->_handler, 'handler');
     $this->_form->setWindow('winEditHandlerId');
     $this->view->form = $this->_form;
     $this->view->callback = $this->_getParam('callback', '');
     $dataSource = new DataIntegrationDatasource($type);
     if ($type === Handler::HANDLER_TYPE_HL7) {
         $dataSourceIterator = $dataSource->getIterator();
     } else {
         $dataSourceIterator = $dataSource->getCustomIterator();
     }
     $this->view->listDatasources = array('');
     $dataIntegrationDatasourceName = $this->_handler->dataIntegrationDatasource->name;
     $dataIntegrationDatasourceId = $this->_handler->dataIntegrationDatasource->dataIntegrationDatasourceId;
     if (strlen($dataIntegrationDatasourceName) > 0) {
         $this->view->listDatasources[$dataIntegrationDatasourceId] = $dataIntegrationDatasourceName;
     }
     foreach ($dataSourceIterator as $item) {
         $this->view->listDatasources[$item->dataIntegrationDatasourceId] = $item->name;
     }
     $template = new DataIntegrationTemplate($type);
     if ($type === Handler::HANDLER_TYPE_HL7) {
         $templateIterator = $template->getIterator();
     } else {
         $templateIterator = $template->getCustomIterator();
     }
     $this->view->listTemplates = array('');
     $dataIntegrationTemplateName = $this->_handler->dataIntegrationTemplate->name;
     $dataIntegrationTemplateId = $this->_handler->dataIntegrationTemplate->dataIntegrationTemplateId;
     if (strlen($dataIntegrationTemplateName) > 0) {
         $this->view->listTemplates[$dataIntegrationTemplateId] = $dataIntegrationTemplateName;
     }
     foreach ($templateIterator as $item) {
         $this->view->listTemplates[$item->dataIntegrationTemplateId] = $item->name;
     }
     // lines below are for HL7 only
     if ($type === Handler::HANDLER_TYPE_HL7) {
         $this->view->listDirections = array('');
         foreach (Handler::listDirections() as $id => $name) {
             $this->view->listDirections[$id] = $name;
         }
         $destination = new DataIntegrationDestination($type);
         $destinationIterator = $destination->getIterator();
         $this->view->listDestinations = array('');
         foreach ($destinationIterator as $item) {
             $this->view->listDestinations[$item->dataIntegrationDestinationId] = $item->name;
         }
         $action = new DataIntegrationAction($type);
         $actionIterator = $action->getIterator();
         $this->view->listActions = array('');
         foreach ($actionIterator as $item) {
             $this->view->listActions[$item->dataIntegrationActionId] = $item->name;
         }
     }
     $this->render('edit');
 }