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 editRoomAction() { $id = (int) $this->_getParam('id'); $enumerationId = (int) $this->_getParam('enumerationId'); $enumerationsClosure = new EnumerationsClosure(); $parentId = $enumerationsClosure->getParentById($enumerationId); $enumeration = new Enumeration(); $enumeration->enumerationId = $parentId; $enumeration->populate(); $orm = new Room(); if ($id > 0) { $orm->roomId = $id; $orm->populate(); } $orm->buildingId = $enumeration->ormId; $form = new WebVista_Form(array('name' => 'edit-room')); $form->setAction(Zend_Registry::get('baseUrl') . 'facilities.raw/process-edit-room'); $form->loadORM($orm, 'Room'); $form->setWindow('windowEditRoomId'); $this->view->form = $form; $routingStations = LegacyEnum::getEnumArray('routing_stations'); $routingStations = array_merge(array('' => ''), $routingStations); $this->view->colors = Room::getColorList(); $this->view->routingStations = $routingStations; $this->view->enumerationId = $enumerationId; $this->render('edit-room'); }
public function getTeamByPersonId($personId = null) { $db = Zend_Registry::get('dbAdapter'); $ret = ''; if ($personId === null) { $personId = $this->personId; } $dbSelect = $db->select()->from(array('t' => $this->_table))->joinLeft(array('e' => 'enumerations'), 't.teamMemberId = e.ormId')->where('t.personId = ?', (int) $personId); $row = $db->fetchRow($dbSelect); if (isset($row['enumerationId'])) { $enumerationId = $row['enumerationId']; $enumerationsClosure = new EnumerationsClosure(); $parentId = $enumerationsClosure->getParentById($enumerationId); $enumeration = new Enumeration(); $enumeration->enumerationId = $parentId; $enumeration->populate(); $ret = $enumeration->key; } return $ret; }
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); }