public function listTemplatesAction() { $type = (int) $this->_getParam('type'); $template = new DataIntegrationTemplate($type); $templateIterator = $template->getIterator(); $rows = $templateIterator->toJsonArray('dataIntegrationTemplateId', array('name')); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array('rows' => $rows)); }
protected function _doProcess(Handler $handler, Audit $audit) { $ret = false; $handlerName = $handler->normalizedName; $datasourceName = $handler->dataIntegrationDatasource->normalizedName; $destinationName = $handler->dataIntegrationDestination->normalizedName; $actionName = $handler->dataIntegrationAction->normalizedName; $classConditionHandler = $handlerName . 'ConditionHandler'; if (!parent::isParentOf($classConditionHandler, 'DataIntegrationConditionHandlerAbstract')) { return false; } if (call_user_func_array(array($classConditionHandler, 'matchAudit'), array($audit))) { do { $classDatasource = $datasourceName . 'DataIntegrationDatasource'; if (!parent::isParentOf($classDatasource, 'DataIntegrationDatasourceAbstract')) { return false; } $data = call_user_func_array(array($classDatasource, 'sourceData'), array($audit)); switch ($handler->direction) { case 'INCOMING': $classAction = $actionName . 'DataIntegrationAction'; if (!parent::isParentOf($classAction, 'DataIntegrationActionAbstract')) { return false; } $ret = call_user_func_array(array($classAction, 'act'), array($audit, $data)); break; case 'OUTGOING': $classDestination = $destinationName . 'DataIntegrationDestination'; if (!parent::isParentOf($classDestination, 'DataIntegrationDestinationAbstract')) { return false; } $template = new DataIntegrationTemplate(); $template->dataIntegrationTemplateId = $handler->dataIntegrationTemplateId; $template->populate(); $data['msh'] = HL7Message::generateMSHData($audit); $template->template = TemplateXSLT::render($data, $template->template); // temporarily override the template $ret = call_user_func_array(array($classDestination, 'transmit'), array($audit, $template, $data)); // temporarily set to true, transmit() skeleton does not provide boolean return $ret = true; break; } } while (false); } return $ret; }
/** * 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'); }