public function items($id, $fetch) { $pcOBJ = new Application_Model_DbTable_ProjectClients(); $q = $pcOBJ->select(); $q->where($fetch . " = ?", $id); $res = $pcOBJ->fetchAll($q); return $res; }
public function indexAction() { $acUser = new Zend_Session_Namespace(); if (!$this->getRequest()->isXmlHttpRequest()) { $this->_helper->layout()->enableLayout(); } else { $this->_helper->layout()->disableLayout(); } $pObj = new Application_Model_DbTable_Projects(); $clientObj = new Application_Model_DbTable_ProjectClients(); $acUser->level == 'admin' ? $res = $pObj->getProjects() : ($res = $clientObj->getClientProject($acUser->userID)); $this->view->projectList = $res; $this->view->noAJpre = true; }
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; } }
private function iniAttachment($targetID, $attVals, $aType) { $attObj = new Application_Model_DbTable_ProjectClients(); if (!empty($attVals)) { $idEX = explode(',', $attVals); switch ($aType) { case "projects": $attObj->detachAll($targetID, "user_ID"); for ($i = 0; $i < count($idEX); $i++) { if (!empty($idEX[$i])) { $attObj->attachIt($targetID, $idEX[$i]); } } return 1; break; case "clients": $attObj->detachAll($targetID, "project_ID"); for ($i = 0; $i < count($idEX); $i++) { if (!empty($idEX[$i])) { $attObj->attachIt($idEX[$i], $targetID); } } return 1; break; default: return 0; } } else { switch ($aType) { case "projects": $attObj->detachAll($targetID, "user_ID"); return 1; break; case "clients": $attObj->detachAll($targetID, "project_ID"); return 1; break; default: return 0; } } }