/** * Ajout d'une règle de gestion */ public function addrdg() { // Insertion en base d'une regle de gestion $rdg = new RdG_model(); $rdg->rdgnurdg = $this->input->post('number'); $rdg->rdgtyrdg = $this->input->post('type'); $rdg->rdglbeno = $this->input->post('anounce'); $rdg->prjidprj = $this->input->post('project'); $rdg->save($this->db); $this->session->set_flashdata('message', formatInfo('Nouvelle règle ajoutée')); // Recharge la page avec les nouvelles infos redirect('editproject/index/' . $rdg->prjidprj . '#rdg_' . $rdg->rdgidrdg); }
/** * Affichage des regles de gestion */ public function index($cduidcdu, $prjidprj = null) { $cdu = Cdu_model::getCdu($this->db, $cduidcdu); $data['rdgs'] = RdG_model::getAllRdGForProject($this->db, $cdu->prjidprj); $data['cdu'] = $cdu; if ($prjidprj != null) { $data['prjidprj'] = $prjidprj; } $this->load->view('selectRdg_view', $data); }
/** * Suppression d'un schéma sur une règle * @param unknown_type $rdgidrdg * @param unknown_type $schidsch */ public function deleteschema($rdgidrdg, $schidsch, $prjidprj = null) { $rdg = RdG_model::getRdG($this->db, $rdgidrdg); $rdg->removeSchema($this->db, $schidsch); if ($prjidprj != null) { redirect('editrdg/index/' . $rdgidrdg . '/' . $prjidprj); } else { redirect('editrdg/index/' . $rdgidrdg); } }
/** * Ajout d'un schema */ public function save() { $selectionSchidsch = $this->input->post('selectionSchidsch'); $rdgidrdg = $this->input->post('rdgidrdg'); $prjidprj = $this->input->post('prjidprj'); $rdg = RdG_model::getRdG($this->db, $rdgidrdg); // Affectation des schemas en remplacement des anciens schémas $rdg->setSchemasIds($this->db, $selectionSchidsch); $this->session->set_flashdata('message', formatInfo('Modification enregistrée')); // Recharge la page avec les nouvelles infos if ($prjidprj != null && $prjidprj != '') { redirect('editrdg/index/' . $rdgidrdg . '/' . $prjidprj); } else { redirect('editrdg/index/' . $rdgidrdg); } }
/** * Retourne l'objet à partir de l'identifiant * @param database $db * @param integer $rdgidrdg */ static function getRdG($db, $rdgidrdg) { $row = getRdgRow($db, $rdgidrdg); return RdG_model::RdG_modelFromRow($row); }
/** * Retourne la liste des règles de gestion * @param $db * @return RdG_model[] */ public function getRdgs($db) { if ($this->rdgs == null) { $allRdgsIds = getRdGsIdsOfProjectFromDB($db, $this->prjidprj); $this->rdgs = array(); foreach ($allRdgsIds as $row) { $this->rdgs[] = RdG_model::getRdg($db, $row['rdgidrdg']); } } return $this->rdgs; }
/** * Suppression d'une règle de gestion * @param $rdgidrdg identifiant de la règle de gestion à supprimer */ function delete($rdgidrdg) { RdG_model::delete($this->db, $rdgidrdg); $this->session->set_flashdata('message', formatInfo('Règle supprimée')); redirect('listrdgs/index'); }