Esempio n. 1
0
 public function setIdProject($value)
 {
     $model = new Default_Model_Projects();
     $model->find($value);
     if ($model->getId() != NULL) {
         $this->setProjectName($model);
     }
     $this->_idProject = !empty($value) ? (int) $value : '0';
     return $this;
 }
 public function getProject()
 {
     if ($this->_project === null) {
         $Projects = new Default_Model_Projects();
         $Projects->filter->id->equals($this->getProjectID());
         if ($Projects->count() > 0) {
             $this->_project = $Projects->items[0];
         }
     }
     return $this->_project;
 }
Esempio n. 3
0
File: Roles.php Progetto: valizr/MMA
 public static function hasAccesToProjectStatus($userId, $roleId, $projectId, $financiar = false)
 {
     $resourceModel = new Default_Model_ResourceRole();
     $subSql = $resourceModel->getMapper()->getDbTable()->select()->setIntegrityCheck(false)->from(array('resource_role'), array('existaId' => 'resource_role.id'))->joinInner(array('r' => 'resource'), 'r.id=resource_role.idResource', array('r.resource'))->where('resource_role.idRole= ?', $roleId);
     $projects = new Default_Model_Projects();
     $select = $projects->getMapper()->getDbTable()->select()->setIntegrityCheck(false)->from(array('p' => 'projects'), array('p.id', 'p.idUser', 'p.idDepartment', 'p.idType', 'p.idProjectManager', 'p.idChiefDepartment', 'p.idProjectStatus', 'p.name', 'p.description', 'p.executionTerm', 'p.noVatValue', 'p.deadlinePayment', 'p.attachedFiles', 'p.startDate', 'delivery' => 'p.deliveryDate', 'p.created', 'p.deleted', 'deliveryDate' => $conditions['userType']));
     $select->joinLeft(array('rr' => new Zend_Db_Expr('(' . $subSql . ')')), 'rr.resource=CONCAT(\'view_projects_status_\',p.idProjectStatus)', array('rr.existaId'));
     if (!$financiar) {
         $select->where("p.idUser='******' OR p.`idProjectManager`='" . $userId . "' OR p.`idChiefDepartment`='" . $userId . "'");
     }
     $select->where('NOT p.deleted')->where('p.id = ?', $projectId)->having('IFNULL(rr.existaId,0)>0');
     $projects->fetchRow($select);
     if ($projects->getId()) {
         return true;
     }
     return false;
 }