/** * Load the contacts for a given client id * */ public function contactlistAction() { $client = $this->clientService->getClient((int) $this->_getParam('clientid')); if (!$client) { echo "Failed loading contacts"; return; } $this->view->client = $client; $this->view->contacts = $this->clientService->getContacts($client); $this->renderRawView('contact/ajax-list.php'); }
/** * Edit a user object. * */ public function editAction() { $id = (int) $this->_getParam('id'); $userToEdit = za()->getUser(); // If an ID is passed, we need to have a higher role than that user // to be able to edit them an admin to be // able to edit this user if ($id > 0) { $selectedUser = $this->userService->getUser($id); // now, if the selectedUser has a role less than mine, we can // edit them if ($selectedUser->getRoleValue() < za()->getUser()->getRoleValue() || za()->getUser()->isPower()) { $userToEdit = $selectedUser; } } // if the user's an admin, give them the list of contacts // to bind for this user if (za()->getUser()->hasRole(User::ROLE_USER)) { // get all the contacts $this->view->contacts = $this->clientService->getContacts(); } $this->view->leave = $this->userService->getLeaveForUser($userToEdit); $this->view->accruedLeave = $this->userService->calculateLeave($userToEdit); $this->view->leaveApplications = $this->userService->getLeaveApplicationsForUser($userToEdit); $this->view->model = $userToEdit; $this->view->themes = $this->getThemes(); $this->renderView('user/edit.php'); }