/** * Sauvegarde des modifications */ public function save() { // Mise a jour des donnees en base $model = new Champ_model(); $model->chpidchp = $this->input->post('identifiant'); $model->chplbcde = $this->input->post('code'); $model->chplbnom = $this->input->post('Nom'); $model->chpfgnul = $this->input->post('peutEtreNull'); $model->chpfgcle = $this->input->post('estCle'); $model->chpcdtyp = $this->input->post('type'); $model->chplbdes = $this->input->post('description'); $model->objidobj = $this->input->post('idObjet'); $model->update($this->db); $this->session->set_userdata('message', formatInfo('Champ mis a jour')); redirect('listchamps/index'); }
/** * Suppression d'un Champ * @param $chpidchp identifiant a supprimer */ function delete($chpidchp) { Champ_model::delete($this->db, $chpidchp); $this->session->set_userdata('message', formatInfo('Champ supprime')); redirect('listchamps/index'); }
/** * Recupere les champs de l'objet * @param $db * @return array */ public function getAllChamps($db) { $allChampsIds = getChampsIdsOfObjetFromDB($db, $this->objidobj); $allChamps = array(); foreach ($allChampsIds as $chpidchp) { $allChamps[] = Champ_model::getChamp($db, $chpidchp); } return $allChamps; }
/** * Suppression d'un champ * @param int $chpidchp * @param int $objidobj * @param int $idProjet */ public function deleteChamp($chpidchp, $objidobj, $idProjet) { Champ_model::delete($this->db, $chpidchp); $this->session->set_flashdata('message', formatInfo('Champ supprimé')); redirect('editobjet/index/' . $objidobj . '/' . $idProjet); }
/** * Recupere l'enregistrement a partir de son id * @param $db database * @param $chpidchp identifiant de l'enregistrement a recuperer */ static function getChamp($db, $chpidchp) { $row = getChampRow($db, $chpidchp); return Champ_model::Champ_modelFromRow($row); }