public function delete() { $result = $this->is_deletable(); if ($result === true) { //documents du portfolio $query = "delete from cms_documents_links where document_link_type_object = '" . $this->type . "' and document_link_num_object = " . $this->id; pmb_mysql_query($query); //l'elément $del = "delete from cms_" . $this->type . "s where id_" . $this->type . "='" . $this->id . "'"; pmb_mysql_query($del); //ses descripteurs $del_desc = "delete from cms_" . $this->type . "s_descriptors where num_" . $this->type . " = '" . $this->id . "'"; pmb_mysql_query($del_desc); //ses champs persos $fields_type = new cms_editorial_parametres_perso($this->num_type); $fields_type->delete_values($this->id, $this->type); //indexation $query = "delete from cms_editorial_fields_global_index where num_obj = " . $this->id . " and type='" . $this->type . "'"; pmb_mysql_query($query); $query = "delete from cms_editorial_words_global_index where num_obj = " . $this->id . " and type='" . $this->type . "'"; pmb_mysql_query($query); //ses extensions $query = "delete from cms_modules_extensions_datas where extension_datas_type_element ='" . $this->type . "' and extension_datas_num_element = '" . $this->id . "'"; pmb_mysql_query($query); return true; } else { return $result; } }
public function delete_values($id, $type = "") { if ($type) { //on va chercher les champs génériques $generic_type = $this->get_generic_type($type); if ($generic_type) { $generic = new cms_editorial_parametres_perso($generic_type); $generic->delete_values($id); } } //on récupère la liste des champs associés... $query = "select idchamp from " . $this->prefix . "_custom where num_type = " . $this->num_type; $result = pmb_mysql_query($query); $idchamp = ""; if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { if ($idchamp) { $idchamp .= ","; } $idchamp .= $row->idchamp; } } if (!$idchamp) { $idchamp = "''"; } $requete = "DELETE FROM " . $this->prefix . "_custom_values where " . $this->prefix . "_custom_champ in (" . $idchamp . ") and " . $this->prefix . "_custom_origine={$id}"; $res = pmb_mysql_query($requete); }