📄 projetcontroller.php
字号:
<?phpclass ProjetController extends Zend_Controller_Action { public function indexAction(){ // On affiche la time line du projet // menu gauche, ajout de bug $projet = new Projet(); $this -> view -> recente_activite = $projet -> getRecentActivityFor($this -> _request -> getParam(1)); $this -> view -> projet = $projet -> fetchRow('projet_id ='.$this -> _request -> getParam(1)); // ajout d'un menu bug en haut qui va lister les bugs du projet } public function addAction(){ // Ajout d'un projet $infos = array( 'nom' => '', 'description' => '', 'submit' => 'Ajouter ce projet' ); $this -> view -> form = $form = new Form_Projet(null,$infos); if($this -> _request -> isPost()){ $formData = $this->_request->getPost(); if($form -> isValid($formData)){ unset($formData['submit']); $projet = new Projet(); $projet -> insert($formData); $this -> _redirect(ROOT_URL); } } } public function removeAction(){ // Suppression d'un projet if(Zend_Auth::getInstance()-> getIdentity() -> acl == "admin"){ $projet = new Projet(); $projet -> delete('projet_id = '.$this -> _request -> getParam(1)); $bug = new Bug(); $bug -> delete('projet_id = '.$this -> _request -> getParam(1)); } $this -> _redirect(ROOT_URL); } public function editAction(){ // Edition d'un projet $projet = new Projet(); $pro = $projet -> fetchRow('projet_id = '.$this -> _request -> getParam(1)); $infos = array( 'nom' => $pro -> nom, 'description' => $pro -> description, 'submit' => 'Modifier ce projet' ); $this -> view -> form = $form = new Form_Projet(null,$infos); if($this -> _request -> isPost()){ $formData = $this->_request->getPost(); if($form -> isValid($formData)){ unset($formData['submit']); $projet = new Projet(); $projet -> update($formData,'projet_id = '.$this -> _request -> getParam(1)); // Systeme de log des 関閚ements pour les commentaires $logData['user_id'] = Zend_Auth::getInstance()->getIdentity()->user_id; $logData['projet_id'] = $this -> _request -> getParam(1); $logData['action'] = 'projectUpdate'; $logData['action_id'] = $this -> _request -> getParam(1); $loger = new Loguer(); $loger -> insert($logData); $this -> _redirect(ROOT_URL.'/projet-'.$this -> _request -> getParam(1)); } } } public function bugsAction(){ // On montre les bugs du projet $query = " SELECT pr.priorite_label AS priorite, s.label AS status, t.label AS type, b.titre AS titre, b.bug_id AS bug_id, b.date AS date, u.nom AS nom , u.prenom AS prenom FROM bugs AS b LEFT JOIN projets AS p ON p.projet_id = b.projet_id LEFT JOIN users AS u ON u.user_id = b.affected_to LEFT JOIN priorites AS pr ON pr.priorite_id = b.priority_id LEFT JOIN status AS s ON s.status_id = b.status_id LEFT JOIN types AS t ON t.type_id = b.type_id WHERE b.projet_id = ".$this -> _request -> getParam(1); $this -> view -> form = $form = new Form_Recherche(); if($this -> _request -> isPost()){ $formData = $this->_request->getPost(); if($form -> isValid($formData)){ $query .= " AND (b.titre LIKE '%".$formData['search']."%' OR u.nom LIKE '%".$formData['search']."%' OR u.prenom LIKE '%".$formData['search']."%')"; } } $query .= " ORDER BY priorite DESC"; $registre = Zend_Registry::getInstance() -> get('db'); $stm = $registre -> query($query); $stm -> setFetchMode(Zend_Db::FETCH_OBJ); $this -> view -> liste_bugs = $stm -> fetchAll(); } public function persoAction(){ $query = " SELECT pr.priorite_id AS p_id, pr.priorite_label AS priorite, s.label AS status, t.label AS type, b.titre AS titre, b.bug_id AS bug_id, b.date AS date, u.nom AS nom , u.prenom AS prenom FROM bugs AS b LEFT JOIN projets AS p ON p.projet_id = b.projet_id LEFT JOIN users AS u ON u.user_id = b.affected_to LEFT JOIN priorites AS pr ON pr.priorite_id = b.priority_id LEFT JOIN status AS s ON s.status_id = b.status_id LEFT JOIN types AS t ON t.type_id = b.type_id WHERE b.projet_id = ".$this -> _request -> getParam(1)." AND b.affected_to = ".Zend_Auth::getInstance()->getIdentity() -> user_id; $this -> view -> form = $form = new Form_Recherche(); if($this -> _request -> isPost()){ $formData = $this->_request->getPost(); if($form -> isValid($formData)){ $query .= " AND (b.titre LIKE '%".$formData['search']."%' OR u.nom LIKE '%".$formData['search']."%' OR u.prenom LIKE '%".$formData['search']."%')"; } } $query .= " ORDER BY priorite DESC"; $registre = Zend_Registry::getInstance() -> get('db'); $stm = $registre -> query($query); $stm -> setFetchMode(Zend_Db::FETCH_OBJ); $this -> view -> liste_bugs = $stm -> fetchAll(); } public function feedAction(){ $feed = new Feed(); $feed -> feedForProject('projet_id = '.$this -> _request -> getParam(1)); } /** * Action qui se d閏lenche avant l'action de la page * */ public function preDispatch(){ if(!Zend_Auth::getInstance()->hasIdentity()){ // On v閞ifie que le visiteur est connect
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -