public function processEditAction() { $enumerationId = (int) $this->_getParam('enumerationId'); $params = $this->_getParam('diagnosis'); $diagnosis = new DiagnosisCodesICD(); $diagnosis->populateWithArray($params); $diagnosis->persist(); if ($enumerationId > 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormId = $diagnosis->code; $enumeration->persist(); } $data = true; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
public function processEditAction() { $this->editAction(); $enumerationId = (int) $this->_getParam('enumerationId'); $params = $this->_getParam('appointmentTemplate'); $appointmentTemplateId = (int) $params['appointmentTemplateId']; $this->_appointmentTemplate->populateWithArray($params); $breakdownNames = $this->_getParam('breakdownName'); $breakdownLength = $this->_getParam('breakdownLength'); $breakdownType = $this->_getParam('breakdownType'); $breakdowns = array(); if (is_array($breakdownNames) && is_array($breakdownLength) && is_array($breakdownType)) { foreach ($breakdownNames as $key => $value) { if (!isset($breakdownLength[$key]) || !isset($breakdownType[$key])) { continue; } $data = array(); $data['n'] = $value; $data['l'] = (int) $breakdownLength[$key]; $data['t'] = $breakdownType[$key]; $breakdowns[] = $data; } if (count($breakdowns) > 0) { $this->_appointmentTemplate->breakdown = serialize($breakdowns); } } $this->_appointmentTemplate->persist(); if ($appointmentTemplateId === 0 && $enumerationId !== 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormId = $this->_appointmentTemplate->appointmentTemplateId; $enumeration->persist(); } $this->view->message = __("Record saved successfully"); $this->render('edit'); }
private function _populateAndPersist($class, $id, $data, $enumerationId) { // this method assumes that is being called in this controller only and that $class is valid and exists $orm = new $class(); if ($id > 0) { $orm->id = $id; $orm->populate(); } $orm->populateWithArray($data); $orm->persist(); if (!$id > 0 && $enumerationId > 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormId = $orm->id; $enumeration->persist(); } return $orm; }
public function processEditAction() { $enumerationId = (int) $this->_getParam("enumerationId"); $params = $this->_getParam("team"); $teamMemberId = (int) $params['teamMemberId']; $teamMember = new TeamMember(); if ($teamMemberId !== 0) { $teamMember->teamMemberId = $teamMemberId; $teamMember->populate(); } $teamMember->populateWithArray($params); $teamMember->persist(); if ($teamMemberId === 0 && $enumerationId !== 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormId = $teamMember->teamMemberId; $enumeration->persist(); } $data = array(); $data['msg'] = __("Record saved successfully"); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
function editProcessAction() { $enumerationId = (int) $this->_getParam('enumerationId'); $menuParams = $this->_getParam('menuItem'); $menuId = (int) $menuParams['menuId']; $origMenuId = $menuId; $menuParams['menuId'] = $menuId; $objMenu = new MenuItem(); if ($menuId !== 0) { $objMenu->menuId = $menuId; $objMenu->populate(); } $menuParams['action'] = ''; if (isset($menuParams['type'])) { switch ($menuParams['type']) { case 'freeform': if ($this->_getParam('typefreeform') !== NULL) { $menuParams['action'] = $this->_getParam('typefreeform'); } break; case 'report': if ($this->_getParam('typereport') !== NULL) { $x = explode('-', $this->_getParam('typereport')); $x[0] = (int) $x[0]; $x[1] = (int) $x[1]; $menuParams['action'] = "Report/report?reportId={$x[0]}&templateId={$x[1]}"; } break; case 'form': if ($this->_getParam('typeform') !== NULL) { $typeForm = (int) $this->_getParam('typeform'); $menuParams['action'] = "Form/fillout?formId={$typeForm}"; } break; } } $menuParams['active'] = (int) $this->_getParam('active'); if ($this->_getParam('chSiteSection') !== NULL) { $menuParams['siteSection'] = $this->_getParam('chSiteSection'); } $menuParams['parentId'] = (int) $menuParams['parentId']; $objMenu->populateWithArray($menuParams); if ($enumerationId !== 0) { // update its parent $enumerationsClosure = new EnumerationsClosure(); $objMenu->parentId = $enumerationsClosure->getParentById($enumerationId); } $objMenu->persist(); if ($menuId === 0 && $enumerationId !== 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormId = $objMenu->menuId; $enumeration->persist(); } $msg = __("Record Saved for Menu: " . ucfirst($objMenu->title)); $data = array(); $data['msg'] = $msg; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
public function processEditSingleItemAction() { $field = $this->_getParam("field"); $enumerationId = (int) $this->_getParam("enumerationId"); $value = preg_replace('/[^a-z_0-9- ]/i', '', $this->_getParam("value", "")); $enumeration = new Enumeration(); $data = ''; if ($enumerationId > 0 && in_array($field, $enumeration->ormFields())) { $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->{$field} = $value; $enumeration->persist(); $enum = new Enumeration(); $enum->enumerationId = $enumerationId; $enum->populate(); $data = $enum->{$field}; } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
public function processEditVisitTypeAction() { $enumerationId = (int) $this->_getParam('enumerationId'); $ormClass = $this->_getParam('ormClass'); $ormClasses = Visit::ormClasses(); $data = false; if (in_array($ormClass, $ormClasses)) { $params = $this->_getParam('visit'); $diagnosis = new $ormClass(); $diagnosis->populateWithArray($params); $diagnosis->persist(); if ($enumerationId > 0) { $enumeration = new Enumeration(); $enumeration->enumerationId = $enumerationId; $enumeration->populate(); $enumeration->ormClass = $ormClass; $enumeration->ormId = $diagnosis->code; $enumeration->persist(); } $data = true; } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
public static function generateMenuEnum($force = false) { $ret = false; do { $name = 'Menu'; $key = 'MENU'; $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); // check for key existence if (strlen($enumeration->key) > 0 && $enumeration->key == $key) { if (!$force) { break; } $enumerationClosure = new EnumerationsClosure(); $enumerationClosure->deleteEnumeration($enumeration->enumerationId); } $enums = array('file' => array('key' => 'FILE', 'name' => 'File', 'active' => 1, 'guid' => '2fa74ea6-27f3-402d-a236-88b0405f0ae6', 'data' => array('addPatient' => array('key' => 'ADDPATIENT', 'name' => 'Add Patient', 'active' => 1, 'guid' => 'eed5c430-b4b2-4f73-9e05-e5a619af711e'), 'selectPatient' => array('key' => 'SELPATIENT', 'name' => 'Select Patient', 'active' => 1, 'guid' => '56fb669b-e235-4ef2-9068-117f0b9adf8c'), 'reviewSignChanges' => array('key' => 'RSC', 'name' => 'Review / Sign Changes', 'active' => 1, 'guid' => '8d994911-30f2-42aa-afe0-21740a1b32c2'), 'changePassword' => array('key' => 'CHANGEPW', 'name' => 'Change Password', 'active' => 1, 'guid' => 'd47b2b1a-916b-40ee-9a99-392e695a3819'), 'editSigningKey' => array('key' => 'SIGNINGKEY', 'name' => 'Edit Signing Key', 'active' => 1, 'guid' => '8a5f6413-fdac-450f-841e-15ef5aceb2eb'), 'myPreferences' => array('key' => 'MYPREF', 'name' => 'My Preferences', 'active' => 1, 'guid' => '33a1cd9e-18d2-4e04-86c9-26b189811a01'), 'quit' => array('key' => 'QUIT', 'name' => 'Quit', 'active' => 1, 'guid' => 'c4bd0198-671b-4dd2-b3ac-dfce2fa31cc1'))), 'action' => array('key' => 'ACTION', 'name' => 'Action', 'active' => 1, 'guid' => '377126cf-02b9-4697-a65d-7c4236bf55d8', 'data' => array('addVitals' => array('key' => 'ADDVITALS', 'name' => 'Add Vitals', 'active' => 1, 'guid' => '7f04b6ba-9f16-44f6-bc75-85808310dadb'), 'print' => array('key' => 'PRINT', 'name' => 'Print', 'active' => 1, 'guid' => '90de6df2-2916-4851-8447-9447fcb11c13', 'data' => array('flowSheet' => array('key' => 'FLOWSHEET', 'name' => 'Flow Sheet', 'active' => 1, 'guid' => '9decd97b-8462-4b89-89fc-991f53765e38'))), 'manageSchedule' => array('key' => 'MANSCHED', 'name' => 'Manage Schedules', 'active' => 1, 'guid' => '78dd7937-c0c6-407f-848f-192ebac2ac86')))); $level = array(); $level['guid'] = '33fb13cb-577f-4a00-8765-b4a5334434c0'; $level['key'] = $key; $level['name'] = $name; $level['category'] = 'System'; $level['active'] = 1; $level['ormClass'] = 'MenuItem'; $level['ormEditMethod'] = 'ormEditMethod'; $level['data'] = $enums; $data = array($level); self::_saveEnumeration($data); $enumeration = new Enumeration(); $enumeration->populateByEnumerationName($name); $menu = new MenuItem(); $menu->siteSection = 'All'; $menu->type = 'freeform'; $menu->active = 1; $menu->title = $enumeration->name; $menu->displayOrder = 0; $menu->parentId = 0; $menu->persist(); $enumeration->ormId = $menu->menuId; $enumeration->persist(); self::_generateMenuEnumerationTree($enumeration); $ret = true; } while (false); return $ret; }
public static function generateMenuEnum($force = false) { $ret = false; do { $name = 'Menu'; $key = 'MENU'; $enumeration = new Enumeration(); $enumeration->populateByUniqueName($name); // check for key existence if (strlen($enumeration->key) > 0 && $enumeration->key == $key) { if (!$force) { break; } $enumerationClosure = new EnumerationsClosure(); $enumerationClosure->deleteEnumeration($enumeration->enumerationId); } $enums = array('file' => array('key' => 'FILE', 'name' => 'File', 'active' => 1, 'guid' => '2fa74ea6-27f3-402d-a236-88b0405f0ae6', 'data' => array('addPatient' => array('key' => 'ADDPATIENT', 'name' => 'Add Patient', 'active' => 1, 'guid' => 'eed5c430-b4b2-4f73-9e05-e5a619af711e'), 'selectPatient' => array('key' => 'SELPATIENT', 'name' => 'Select Patient', 'active' => 1, 'guid' => '56fb669b-e235-4ef2-9068-117f0b9adf8c'), 'reviewSignChanges' => array('key' => 'RSC', 'name' => 'Review / Sign Changes', 'active' => 1, 'guid' => '8d994911-30f2-42aa-afe0-21740a1b32c2'), 'changePassword' => array('key' => 'CHANGEPW', 'name' => 'Change Password', 'active' => 1, 'guid' => 'd47b2b1a-916b-40ee-9a99-392e695a3819'), 'editSigningKey' => array('key' => 'SIGNINGKEY', 'name' => 'Edit Signing Key', 'active' => 1, 'guid' => '8a5f6413-fdac-450f-841e-15ef5aceb2eb'), 'myPreferences' => array('key' => 'MYPREF', 'name' => 'My Preferences', 'active' => 1, 'guid' => '33a1cd9e-18d2-4e04-86c9-26b189811a01'), 'quit' => array('key' => 'QUIT', 'name' => 'Quit', 'active' => 1, 'guid' => 'c4bd0198-671b-4dd2-b3ac-dfce2fa31cc1'))), 'action' => array('key' => 'ACTION', 'name' => 'Action', 'active' => 1, 'guid' => '377126cf-02b9-4697-a65d-7c4236bf55d8', 'data' => array('addVitals' => array('key' => 'ADDVITALS', 'name' => 'Add Vitals', 'active' => 1, 'guid' => '7f04b6ba-9f16-44f6-bc75-85808310dadb'), 'print' => array('key' => 'PRINT', 'name' => 'Print', 'active' => 1, 'guid' => '90de6df2-2916-4851-8447-9447fcb11c13', 'data' => array('flowSheet' => array('key' => 'FLOWSHEET', 'name' => 'Flow Sheet', 'active' => 1, 'guid' => '9decd97b-8462-4b89-89fc-991f53765e38'))), 'manageSchedule' => array('key' => 'MANSCHED', 'name' => 'Manage Schedules', 'active' => 1, 'guid' => '78dd7937-c0c6-407f-848f-192ebac2ac86'), 'generalEncryption' => array('key' => 'GENCRYPT', 'name' => 'General Encryption', 'active' => 1, 'guid' => '29949f5c-eec0-4567-a030-d2f2c79e734e'), 'export' => array('key' => 'EXPORT', 'name' => 'Export', 'active' => 1, 'guid' => '26ef871f-e164-4788-bb1d-ce25cfff9bad', 'data' => array('cqm' => array('key' => 'CQM', 'name' => 'CQM', 'active' => 0, 'guid' => 'f906f8b6-1320-40c7-b6ee-f64bab1e3a56'), 'hl7Immunizations' => array('key' => 'HL7IMM', 'name' => 'HL7 Immunizations', 'active' => 1, 'guid' => 'c65dd3de-5da6-4486-84b7-5c3be7dfd845'), 'hl7LabTest' => array('key' => 'HL7LABTEST', 'name' => 'HL7 LabTest Results', 'active' => 1, 'guid' => '94127ad8-886e-440b-8f4a-ed3670c00267'), 'publicHealth' => array('key' => 'PUBHEALTH', 'name' => 'Public Health', 'active' => 1, 'guid' => '9e078b42-74c6-45fa-8bdb-0401186972f6'))), 'auditLogViewer' => array('key' => 'AUDITLOG', 'name' => 'Audit Log Viewer', 'active' => 1, 'guid' => 'fe6dac7f-25b7-45a8-bfb0-a2b500a575bb'), 'ccd' => array('key' => 'CCD', 'name' => 'CCD', 'active' => 1, 'guid' => '40a3a3a8-aabd-4029-8155-ec4ce17ee421', 'data' => array('viewHL7CCD' => array('key' => 'VIEWHL7CCD', 'name' => 'View HL7 CCD/ASTM CCR', 'active' => 1, 'guid' => '67ee9875-73fa-462c-be97-50912b968aa3'), 'allXML' => array('key' => 'ALLXML', 'name' => 'All XML', 'active' => 1, 'guid' => 'ad7f189e-d7f0-45c8-a906-94daf3fe2b52'), 'visitXML' => array('key' => 'VISITXML', 'name' => 'Visit XML', 'active' => 1, 'guid' => '0d803438-e895-4407-8773-5af6c368965d'), 'allView' => array('key' => 'ALLVIEW', 'name' => 'All View', 'active' => 1, 'guid' => '4c86f48a-cea7-4fea-a183-52cb435589b6'), 'visitView' => array('key' => 'VISITVIEW', 'name' => 'Visit View', 'active' => 1, 'guid' => '657e81f6-0f62-4c48-8f0f-321826ea7d63'), 'allPrint' => array('key' => 'ALLPRINT', 'name' => 'All Print', 'active' => 1, 'guid' => '65b98451-db43-4819-83c8-186a05a4fae0'), 'visitPrint' => array('key' => 'VISITPRINT', 'name' => 'Visit Print', 'active' => 1, 'guid' => '719883f1-f552-4327-9e8b-7e89d7203a7d'))), 'patientList' => array('key' => 'PATLISTS', 'name' => 'Patient Lists', 'active' => 1, 'guid' => '5ca70027-1e5c-4257-a136-dca0524b2115'), 'patientReminders' => array('key' => 'PATREMIND', 'name' => 'Patient Reminders', 'active' => 1, 'guid' => 'a47b7c3d-f23c-46b5-9919-77a5ffbf6dc8'), 'emergencyAccess' => array('key' => 'EMERACCESS', 'name' => 'Emergency Access', 'active' => 1, 'guid' => '9625119d-eb1e-4c00-bf8d-3fc0ec5ad607'), 'importLabHL7' => array('key' => 'IMPORTLAB', 'name' => 'Import Lab HL7', 'active' => 1, 'guid' => 'd8776b4a-743b-4d4c-81d1-9eaa23471972'), 'appointmentHistory' => array('key' => 'APPHISTORY', 'name' => 'Appointment History', 'active' => 1, 'guid' => 'ad390c48-e73b-4834-aa14-f54a72a5dc95'), 'patientAccount' => array('key' => 'PATIENTACC', 'name' => 'Patient Account', 'active' => 1, 'guid' => '8c13cad0-ff49-442b-94d3-f9169a0d4e85'), 'unallocatedPayment' => array('key' => 'UNALLOCPAY', 'name' => 'Unallocated Payment', 'active' => 1, 'guid' => 'c6e2259b-b659-44c2-8bd4-33ecd7f4da1a'), 'manualJournal' => array('key' => 'MANJOURNAL', 'name' => 'Manual Journal', 'active' => 1, 'guid' => '2087ff6d-0140-478c-8ff2-57f6b0429151')))); $level = array(); $level['guid'] = '33fb13cb-577f-4a00-8765-b4a5334434c0'; $level['key'] = $key; $level['name'] = $name; $level['category'] = 'System'; $level['active'] = 1; $level['ormClass'] = 'MenuItem'; $level['ormEditMethod'] = 'ormEditMethod'; $level['data'] = $enums; $data = array($level); self::_saveEnumeration($data); $enumeration = new Enumeration(); $enumeration->populateByUniqueName($name); $menu = new MenuItem(); $menu->siteSection = 'All'; $menu->type = 'freeform'; $menu->active = 1; $menu->title = $enumeration->name; $menu->displayOrder = 0; $menu->parentId = 0; $menu->persist(); $enumeration->ormId = $menu->menuId; $enumeration->persist(); self::_generateMenuEnumerationTree($enumeration); $ret = true; } while (false); return $ret; }
public function insertEnumeration($data, $parentId = 0) { $db = Zend_Registry::get("dbAdapter"); $enumParent = new Enumeration(); $enumParent->enumerationId = $parentId; $enumParent->populate(); $enumeration = new Enumeration(); $fields = $enumeration->ormFields(); foreach ($data as $key => $value) { if (!in_array($key, $fields)) { continue; } $enumeration->{$key} = $value; } if (!strlen($enumeration->ormClass) > 0) { // check if parent item has an ormClass and id defined and use that to its child if (strlen($enumParent->ormClass) > 0) { $enumeration->ormClass = $enumParent->ormClass; // we only need to use the parent ormId if child's ormId less than or equal to 0 if ($enumeration->ormId <= 0) { // temporarily comment out //$enumeration->ormId = $enumParent->ormId; } } } // we only need to use the parent ormEditMethod if child's ormEditMethod not defined if (!strlen($enumeration->ormEditMethod) > 0) { $enumeration->ormEditMethod = $enumParent->ormEditMethod; } $enumeration->persist(); $enumerationId = $enumeration->enumerationId; $sql = "INSERT INTO enumerationsClosure (ancestor,descendant,depth)\n\t\t\t SELECT ancestor,{$enumerationId},depth+1 FROM enumerationsClosure\n\t\t\t WHERE descendant = {$parentId}\n\t\t\t UNION ALL\n\t\t\t SELECT {$enumerationId},{$enumerationId},0"; $db->query($sql); return $enumerationId; }