public function add($title, $parent) { $rubriquedesc = new Rubriquedesc(); $rubriquedesc->titre = $title; if ($rubriquedesc->titre !== '') { if (!is_numeric($parent) && $parent < 1) { $parent = 0; } $this->parent = $parent; $this->ligne = 1; $this->classement = $this->getMaxRanking($parent) + 1; $this->id = parent::add(); $rubriquedesc->rubrique = $this->id; $rubriquedesc->lang = ActionsLang::instance()->get_id_langue_courante(); $rubriquedesc->chapo = ''; $rubriquedesc->description = ''; $rubriquedesc->postscriptum = ''; $rubriquedesc->id = $rubriquedesc->add(); $caracteristique = new Caracteristique(); $qCarac = "select * from {$caracteristique->table}"; $rCarac = $caracteristique->query($qCarac); while ($rCarac && ($theCarac = $caracteristique->fetch_object($rCarac))) { $rubcaracteristique = new Rubcaracteristique(); $rubcaracteristique->rubrique = $this->id; $rubcaracteristique->caracteristique = $theCarac->id; $rubcaracteristique->add(); } $rubriquedesc->reecrire(); ActionsModules::instance()->appel_module("ajoutrub", new Rubrique($this->id)); redirige("rubrique_modifier.php?id=" . $this->id); } else { throw new TheliaAdminException("impossible to add new category", TheliaAdminException::CATEGORY_ADD_ERROR, null, $rubriquedesc); } }
public function add($featureToAddId, $categoryId) { $category = new Rubrique(); $featureToAdd = new Caracteristique(); $this->id = ''; if (!$this->charger($categoryId, $featureToAddId) && $featureToAdd->charger($featureToAddId) && $category->charger($categoryId)) { $this->rubrique = $category->id; $this->caracteristique = $featureToAdd->id; parent::add(); ActionsModules::instance()->appel_module("modrub", $category); } }
function ajouter($lang, $id, $titre, $chapo, $description, $tabdisp, $affiche, $ajoutrub) { $caracteristique = new Caracteristique(); $caracteristique->charger($id); if ($caracteristique->id) { return; } $caracteristique = new Caracteristique(); $query = "select max(classement) as maxClassement from {$caracteristique->table}"; $resul = $caracteristique->query($query); $maxClassement = $resul ? $caracteristique->get_result($resul, 0, "maxClassement") : 0; $caracteristique->id = $id; if ($affiche != "") { $caracteristique->affiche = 1; } else { $caracteristique->affiche = 0; } $caracteristique->classement = $maxClassement + 1; $lastid = $caracteristique->add(); $caracteristique->id = $lastid; $caracteristiquedesc = new Caracteristiquedesc(); $caracteristiquedesc->chapo = $chapo; $caracteristiquedesc->description = $description; $caracteristiquedesc->caracteristique = $lastid; $caracteristiquedesc->lang = $lang; $caracteristiquedesc->titre = $titre; $caracteristiquedesc->chapo = str_replace("\n", "<br/>", $caracteristiquedesc->chapo); $caracteristiquedesc->description = str_replace("\n", "<br/>", $caracteristiquedesc->description); $caracteristiquedesc->add(); if (intval($ajoutrub) == 1) { $rubrique = new Rubrique(); $query = "select * from {$rubrique->table}"; $resul = $rubrique->query($query); while ($resul && ($row = $rubrique->fetch_object($resul))) { $rubcaracteristique = new Rubcaracteristique(); $rubcaracteristique->rubrique = $row->id; $rubcaracteristique->caracteristique = $lastid; $rubcaracteristique->add(); } } ActionsModules::instance()->appel_module("ajcaracteristique", $caracteristique); redirige($_SERVER['PHP_SELF'] . "?id={$lastid}&lang={$lang}"); }
function caracteristique_liste_select($idrubrique) { $rubcaracteristique = new Rubcaracteristique(); $query = "select * from {$rubcaracteristique->table} where rubrique={$idrubrique}"; $resul = $rubcaracteristique->query($query); $listeid = ""; while ($resul && ($row = $rubcaracteristique->fetch_object($resul))) { $listeid .= $row->caracteristique . ","; } if (strlen($listeid) > 0) { $listeid = substr($listeid, 0, strlen($listeid) - 1); $caracteristique = new Caracteristique(); $query = "select * from {$caracteristique->table} where id NOT IN({$listeid})"; $resul = $caracteristique->query($query); } else { $caracteristique = new Caracteristique(); $query = "select * from {$caracteristique->table}"; $resul = $caracteristique->query($query); } ?> <select class="form_select" id="prod_caracteristique"> <option value=""> </option> <?php while ($resul && ($row = $caracteristique->fetch_object($resul))) { $caracteristiquedesc = new Caracteristiquedesc($row->id); ?> <option value="<?php echo $row->id; ?> "><?php echo $caracteristiquedesc->titre; ?> </option> <?php } ?> </select> <?php }
/** * * @param string $title Caracteristique title * @param string $display display caracteristique in boucle function * @param int $addAuto add automatically this caracteristique to all category */ public function add($title, $display, $addAuto) { $title = trim($title); if (empty($title)) { throw new TheliaAdminException("Title caracteristique empty", TheliaAdminException::CARAC_TITLE_EMPTY); } $this->classement = $this->getMaxRank() + 1; $this->affiche = $display != "" ? 1 : 0; $this->id = parent::add(); $caracdesc = new Caracteristiquedesc(); $caracdesc->caracteristique = $this->id; $caracdesc->titre = $title; $caracdesc->lang = ActionsAdminLang::instance()->get_id_langue_courante(); $caracdesc->add(); if (intval($addAuto) == 1) { $query = "SELECT id FROM " . Rubrique::TABLE; foreach (CacheBase::getCache()->query($query) as $rub) { $rubcaracteristique = new Rubcaracteristique(); $rubcaracteristique->rubrique = $rub->id; $rubcaracteristique->caracteristique = $this->id; $rubcaracteristique->add(); } } ActionsModules::instance()->appel_module("ajcaracteristique", new Caracteristique($this->id)); redirige("caracteristique_modifier.php?id=" . $this->id); }
function caracteristique_supprimer($caracteristique, $rubrique) { $rubcaracteristique = new Rubcaracteristique($rubrique, $caracteristique); $rubcaracteristique->delete(); lister_caracteristiques_rubrique($rubrique); }
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); }