public function editAction()
 {
     $ormId = (int) $this->_getParam('ormId');
     $enumerationId = (int) $this->_getParam('enumerationId');
     $enumerationsClosure = new EnumerationsClosure();
     $depth = (int) $enumerationsClosure->getDepthById($enumerationId);
     if ($depth === 0) {
         $this->view->message = __('Only appointment template entries can be edited');
     } else {
         $this->_appointmentTemplate = new AppointmentTemplate();
         $this->_appointmentTemplate->appointmentTemplateId = $ormId;
         $this->_appointmentTemplate->populate();
         $breakdowns = array();
         if (strlen($this->_appointmentTemplate->breakdown) > 0) {
             $breakdowns = unserialize($this->_appointmentTemplate->breakdown);
         }
         $this->view->breakdowns = $breakdowns;
         $this->_form = new WebVista_Form(array('name' => 'edit'));
         $this->_form->setAction(Zend_Registry::get('baseUrl') . 'appointment-templates.raw/process-edit');
         $this->_form->loadORM($this->_appointmentTemplate, 'appointmentTemplate');
         $this->_form->setWindow('windowEditORMObjectId');
         $this->view->form = $this->_form;
         $this->view->enumerationId = $enumerationId;
     }
     $this->render('edit');
 }
 public function editAction()
 {
     $ormId = (int) $this->_getParam("ormId");
     $enumerationId = (int) $this->_getParam("enumerationId");
     $this->view->enumerationId = $enumerationId;
     $enumerationsClosure = new EnumerationsClosure();
     $isRole = false;
     $depth = (int) $enumerationsClosure->getDepthById($enumerationId);
     if ($depth > 1) {
         $isRole = true;
     }
     if (!$isRole) {
         if ($depth === 0) {
             $this->view->message = __('Only team member role entries can be edited');
         } else {
             $this->view->message = __('There is nothing to edit on the team definition, add roles beneath it to link users to the team');
         }
     } else {
         $enumeration = new Enumeration();
         $enumeration->enumerationId = $enumerationId;
         $enumeration->populate();
         $enumerationsClosure = new EnumerationsClosure();
         $parentId = $enumerationsClosure->getParentById($enumerationId);
         $enumerationIterator = $enumerationsClosure->getAllDescendants($parentId, 1);
         $this->view->roleList = $enumerationIterator;
         $hasUserParent = false;
         // check if there is a non-user parent
         $depth = $enumerationsClosure->getDepthById($parentId);
         if ($depth > 1) {
             $hasUserParent = true;
         }
         $this->view->hasUserParent = $hasUserParent;
         $teamMember = new TeamMember();
         $teamMember->teamMemberId = $ormId;
         $teamMember->populate();
         $this->view->teamMember = $teamMember;
         $user = new User();
         $user->populateWithPersonId($teamMember->personId);
         $name = array();
         $name[$user->person_id] = '';
         if (strlen($user->username) > 0) {
             $name[$user->person_id] = $user->last_name . ', ' . $user->first_name . ' ' . substr($user->middle_name, 0, 1) . ' (' . $user->username . ")";
         }
         $this->view->defaultUser = $name;
     }
     $this->render();
 }
 public function editVisitTypeAction()
 {
     $ormId = $this->_getParam('ormId');
     $enumerationId = (int) $this->_getParam('enumerationId');
     $enumerationsClosure = new EnumerationsClosure();
     $depth = (int) $enumerationsClosure->getDepthById($enumerationId);
     $ormClasses = Visit::ormClasses();
     if ($depth > 2) {
         $enumeration = new Enumeration();
         $enumeration->enumerationId = $enumerationId;
         $enumeration->populate();
         $ormClass = $enumeration->ormClass;
         if (!in_array($ormClass, $ormClasses)) {
             $ormClass = $ormClasses[0];
             // temporary set to ProcedureCodesCPT as default ORM Class
         }
         $orm = new $ormClass();
         $orm->code = $ormId;
         $orm->populate();
         $form = new WebVista_Form(array('name' => 'visitTypeId'));
         $form->setAction(Zend_Registry::get('baseUrl') . 'visit-details.raw/process-edit-visit-type');
         $form->loadORM($orm, 'visit');
         $form->setWindow('windowEditORMObjectId');
         $this->view->form = $form;
     } else {
         $this->view->message = __('There is nothing to edit on the Visit Type Sections definition, add diagnosis or procedure beneath it');
     }
     $this->view->ormClasses = $ormClasses;
     $this->view->enumerationId = $enumerationId;
     $this->render();
 }