public function readAction() { $targetID = $this->_getParam('t'); $getWhat = $this->_getParam('g'); if (!empty($targetID) && !empty($getWhat)) { $rObj = new Application_Model_DbTable_Reviews(); switch ($getWhat) { case "client": $userOBJ = new Application_Model_DbTable_Users(); $userInfo = $userOBJ->getUser($targetID); $pRes = $rObj->getReviews($targetID, 'user_ID'); if ($pRes) { $this->view->projectsReviews = $pRes; } $this->view->success = 1; $this->view->targetName = $userInfo->fullName . " - " . $userInfo->email; $this->view->targetType = "client"; break; case "project": $projectObj = new Application_Model_DbTable_Projects(); $pinfo = $projectObj->getById($targetID); $pRes = $rObj->getReviews($targetID, 'project_ID'); if ($pRes) { $this->view->projectsReviews = $pRes; } $this->view->success = 1; $this->view->targetName = $pinfo->projectName; break; default: $this->view->success = 0; } } }
public function settingsAction() { if (!$this->getRequest()->isXmlHttpRequest()) { $this->_helper->layout()->enableLayout(); } $acUser = new Zend_Session_Namespace(); $this->view->noAJsettings = true; $userObj = new Application_Model_DbTable_Users(); $uRes = $userObj->getUser($acUser->userID); $this->view->fName = $uRes->fullName; $this->view->notes = $uRes->notes; }
public function clientsAction() { $this->view->noAJclients = true; $task = $this->_getParam("task"); $targetActionID = $this->_getParam("t"); switch ($task) { case "attach": $this->view->dis = "attach"; $cu = new Application_Model_DbTable_Users(); $projectA = new Application_Model_DbTable_Projects(); $pInfo = $cu->getUser($targetActionID); $cRes = $projectA->getProjects(); $this->view->projects = $cRes; $this->view->userID = $targetActionID; $this->view->clientName = $pInfo->fullName; $this->view->clientEmail = $pInfo->email; break; case "new": $this->view->dis = "new"; break; case "del": $this->view->dis = "del"; $t = $this->_request->getPost('target-id'); if ($this->getRequest()->isPost() && !empty($t)) { $this->_helper->layout()->disableLayout(); $c = new Application_Model_DbTable_Users(); $c->delete("id = " . $t); $reviewsObj = new Application_Model_DbTable_Reviews(); $DetachObj = new Application_Model_DbTable_ProjectClients(); $reviewsObj->deleteUser($t); $DetachObj->deleteUser($t); } break; default: $this->view->dis = "list"; $usrObj = new Application_Model_DbTable_Users(); $res = $usrObj->fetchAll(); $this->view->clients = $res; } }
/** * 批量从角色组删除员工 */ public function remRoleHave($UserIDs) { $ids = $this->formatID($UserIDs); if (empty($ids)) { return false; } $staffTable = new Application_Model_DbTable_Users(); foreach ($ids as $UserID) { $staff = $staffTable->getUser($UserID); //删除,可以非空检测 if (!empty($staff->RoleIDs)) { $temp = explode(',', $staff->RoleIDs); $roles = array(); foreach ($temp as $rid) { $roles[$rid] = $rid; } if (isset($roles[$this->relatedid])) { unset($roles[$this->relatedid]); } $staff->RoleIDs = implode(',', $roles); $staff->save(); } } return false; }