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 modifier($id, $parent, $lang, $titre, $chapo, $description, $postscriptum, $lien, $ligne, $urlsuiv, $urlreecrite) { $rubrique = new Rubrique(); $rubriquedesc = new Rubriquedesc(); $rubrique->charger($id); $res = $rubriquedesc->charger($id, $lang); if (!$res) { CacheBase::getCache()->reset_cache(); $temp = new Rubriquedesc(); $temp->rubrique = $rubrique->id; $temp->lang = $lang; $lastid = $temp->add(); $rubriquedesc = new Rubriquedesc(); $rubriquedesc->charger_id($lastid); } $parent_tmp = $rubrique->parent; if ($parent != $parent_tmp) { $trouve = 0; $test = chemin_rub($parent); for ($i = 0; $i < count($test); $i++) { if ($test[$i]->rubrique == $id) { $trouve = 1; break; } } if (!$trouve) { $rubrique->parent = $parent; $rubrique->classement = $rubrique->prochain_classement(); } } $rubrique->lien = $lien; $rubriquedesc->titre = $titre; $rubriquedesc->chapo = $chapo; $rubriquedesc->description = $description; $rubriquedesc->postscriptum = $postscriptum; if ($ligne != "") { $rubrique->ligne = 1; } else { $rubrique->ligne = 0; } $rubrique->maj(); $rubriquedesc->maj(); if ($parent_tmp != $parent) { $queryclass = "select * from {$rubrique->table} where parent={$parent_tmp} order by classement"; $resclass = $rubrique->query($queryclass); if ($rubrique->num_rows($resclass) > 0) { $i = 1; while ($rowclass = $rubrique->fetch_object($resclass)) { $rub = new Rubrique(); $rub->charger($rowclass->id); $rub->classement = $i; $rub->maj(); $i++; } } } $rubriquedesc->reecrire($urlreecrite); ActionsModules::instance()->appel_module("modrub", $rubrique); if ($urlsuiv) { redirige("parcourir.php?parent=" . $rubrique->parent); } else { redirige("" . $_SERVER['PHP_SELF'] . "?id=" . $rubrique->id . "&lang=" . $lang); } exit; }