ACTIVE_TABLE = $this->WR_TABLE; $this->ACTIVE_TYPE = 'W'; break; case 'PUBLICATION': $this->ACTIVE_TABLE = $this->P_TABLE; $this->ACTIVE_TYPE = 'P'; break; default: return "error"; } } /** * contents::AddContents() * ajout d'une partie de contenu * * @access public * @param integer $ID identifiant du père (rattachement) * @param array $contents_table tableau contenant les infos ressources * @param string $type 'WORKSHOP' ou 'PUBLICATION' * @param object $ * @return integer $last_id */ function AddContents($ID, $contents_table, $type, $sql_object) { $contents_table=$sql_object->DBescape($contents_table); if ($this->_wichType($type) == "error") exit; $requete = "INSERT INTO " . $this->ACTIVE_TABLE ; if ($type == "WORKSHOP") { $this->WR_TITLE = strip_tags($contents_table[0]); $this->WR_BODY = strip_tags($contents_table[1], ALLOWABLE_TAGS); $requete.= " (workrepcon_title, workrepcon_body, workrepcon_date_crea, workrepcon_last_modify, workrepcon_validity)"; $requete .= " VALUES('" . $this->WR_TITLE . "', '" . $this->WR_BODY . "', NOW(),NOW(), 'Y');"; } if ($type == "PUBLICATION") { $this->P_TITLE = strip_tags($contents_table[0]); $this->P_BODY = strip_tags($contents_table[1], ALLOWABLE_TAGS); $this->P_TEMPLATE = $contents_table[2]; $this->P_PHOTOS_URI = strip_tags($contents_table[3]); $requete.= " (publicon_title, publicon_body, publicon_template, publicon_photos_uri, publicon_date_crea, publicon_last_modify, publicon_validity)"; $requete .= " VALUES('" . $this->P_TITLE . "', '" . $this->P_BODY . "', " . $this->P_TEMPLATE . ", '" . $this->P_PHOTOS_URI . "', NOW(),NOW(), 'Y');"; } $last_id = $sql_object->DBInsert ($requete, 1); if (is_numeric($last_id)) { $requete = "INSERT INTO " . $this->TDB_LIAISON . " VALUES(" . $ID . "," . $last_id . ", '" . $this->ACTIVE_TYPE . "');"; $result = $sql_object->DBInsert ($requete); } return $result; } /** * contents::ModifyContents() * modification d'une partie de contenu * * @access public * @param integer $ID : identifiant de la partie à modifier * @param array $contents_table : tableau contenant les infos ressources * @param string $type 'WORKSHOP' ou 'PUBLICATION' * @param object $sql_object * @return boolean $result */ function ModifyContents($ID, $contents_table, $type, $sql_object) { $contents_table=$sql_object->DBescape($contents_table); if ($this->_wichType($type) == "error") exit; if (!is_numeric($ID)) return false; if ($type == "WORKSHOP") $this->WR_ID = $ID; if ($type == "PUBLICATION") $this->P_ID = $ID; $requete = "UPDATE " . $this->ACTIVE_TABLE . " SET "; if ($type == "WORKSHOP") { $this->WR_TITLE = strip_tags($contents_table[0]); $this->WR_BODY = strip_tags($contents_table[1]); $requete .= "workrepcon_title='" . $this->WR_TITLE . "', workrepcon_body='" . $this->WR_BODY . "' WHERE workrepcon_id='" . $this->WR_ID . "';"; } if ($type == "PUBLICATION") { $this->P_TITLE = strip_tags($contents_table[0]); $this->P_BODY = strip_tags($contents_table[1]); $this->P_TEMPLATE = strip_tags($contents_table[2]); $this->P_PHOTOS_URI = strip_tags($contents_table[3]); $requete .= "publicon_title='" . $this->P_TITLE . "', publicon_body='" . $this->P_BODY . "', publicon_template='" . $this->P_TEMPLATE . "', publicon_photos_uri='" . $this->P_PHOTOS_URI . "' WHERE publicon_id='" . $this->P_ID . "';"; } $result = $sql_object->DBQuery($requete); return $result; } /** * contents::DeleteContents() * suppression d'une partie * * @access public * @param integer $ID : identifiant du contents a supprimer * @param string $type : 'WORKSHOP' ou 'PUBLICATION' * @param object $sql_object * @return boolean $result */ function DeleteContents($ID, $type, $sql_object) { if (is_numeric($ID)) { if ($type == "WORKSHOP") { $champ1 = "workrepcon_id"; $champ2 = "jwp_contents_id"; $champ3 = "workrepcon_validity"; } if ($type == "PUBLICATION") { $champ1 = "publicon_id"; $champ2 = "jpp_contents_id"; $champ3 = "publicon_validity"; } } else return false; if ($this->_wichType($type) == "error") return false; $requete = "UPDATE " . $this->ACTIVE_TABLE . " SET " . $champ3 . "='N' WHERE " . $champ1 . "='" . $ID . "';"; $result = $sql_object->DBQuery($requete); return $result; } } ?>