public function modify($lang, $parent, $lien, $online, $title, $chapo, $description, $postscriptum, $urlsuiv, $rewriteurl, $associatedContents, $associatedFeatures, $associatedVariants, $images, $documents, $tab) { if ($this->id == '') { throw new TheliaAdminException("Category not found", TheliaAdminException::CATEGORY_NOT_FOUND); } $rubriquedesc = new Rubriquedesc($this->id, $lang); if ($rubriquedesc->id == '') { CacheBase::getCache()->reset_cache(); $rubriquedesc->rubrique = $this->id; $rubriquedesc->lang = $lang; $rubriquedesc->id = $rubriquedesc->add(); } $this->oldParent = $this->parent; if ($this->parent != $parent) { $this->checkOrder($parent); } $this->parent = $parent; $this->lien = $lien; $this->ligne = $online == 'on' ? 1 : 0; $rubriquedesc->chapo = str_replace("\n", "<br />", $chapo); $rubriquedesc->titre = $title; $rubriquedesc->postscriptum = $postscriptum; $rubriquedesc->description = $description; $this->maj(); $rubriquedesc->maj(); $rubriquedesc->reecrire($rewriteurl); $this->setLang($lang); AssociatedContentAdmin::getInstance()->updateAssociatedContents(0, $this->id, $associatedContents); AssociatedVariantAdmin::getInstance()->updateAssociatedVariants($this->id, $associatedVariants); AssociatedFeatureAdmin::getInstance()->updateAssociatedFeatures($this->id, $associatedFeatures); $this->updateImage($images); $this->getImageFile()->ajouter("photo", array("jpg", "gif", "png", "jpeg"), "uploadimage"); $this->updateDocuments($documents); $this->getDocumentFile()->ajouter("document_", array(), "uploaddocument"); ActionsModules::instance()->appel_module("modrub", new Rubrique($this->id)); if ($urlsuiv) { redirige('parcourir.php?parent=' . $this->rubrique); } else { redirige('rubrique_modifier.php?id=' . $this->id . '&tab=' . $tab . '&lang=' . $lang); } }
function ajouter($parent, $lang, $titre, $chapo, $description, $postscriptum, $lien, $ligne) { $rubrique = new Rubrique(); $rubrique->parent = $parent; $rubrique->lien = $lien; if ($ligne != "") { $rubrique->ligne = 1; } else { $rubrique->ligne = 0; } if ($parent == "") { $parent = 0; } $lastid = $rubrique->add(); $rubrique->charger($lastid); $rubrique->maj(); $rubriquedesc = new Rubriquedesc(); $rubriquedesc->rubrique = $lastid; $rubriquedesc->lang = $lang; $rubriquedesc->titre = $titre; $rubriquedesc->chapo = $chapo; $rubriquedesc->description = $description; $rubriquedesc->postscriptum = $postscriptum; $rubriquedesc->add(); $caracteristique = new Caracteristique(); $query = "select * from {$caracteristique->table}"; $resul = $caracteristique->query($query); $rubcaracteristique = new Rubcaracteristique(); while ($resul && ($row = $caracteristique->fetch_object($resul))) { $rubcaracteristique->rubrique = $lastid; $rubcaracteristique->caracteristique = $row->id; $rubcaracteristique->add(); } $rubriquedesc->reecrire(); ActionsModules::instance()->appel_module("ajoutrub", $rubrique); redirige("" . $_SERVER['PHP_SELF'] . "?id=" . $lastid); }