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); } }
/** * * @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 supprimer($id) { $caracteristique = new Caracteristique($id); $caracteristique->delete(); ActionsModules::instance()->appel_module("suppcaracteristique", $caracteristique); redirige("caracteristique.php"); }
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 }
$obj = new Produit(); $obj->modifier_classement($id, $classement); echo "produit|"; } else { if ($modif == "classementdossier" && est_autorise("acces_catalogue")) { $obj = new Dossier(); $obj->modifier_classement($id, $classement); echo "..."; } else { if ($modif == "classementcontenu" && est_autorise("acces_catalogue")) { $obj = new Contenu(); $obj->modifier_classement($id, $classement); echo "..."; } else { if ($modif == "classementcarac" && est_autorise("acces_configuration")) { $obj = new Caracteristique(); $obj->modifier_classement($id, $classement); echo "..."; } else { if ($modif == "classementdecli" && est_autorise("acces_configuration")) { $obj = new Declinaison(); $obj->modifier_classement($id, $classement); echo "..."; } else { if ($modif == "classementplugin" && est_autorise("acces_configuration")) { $obj = new Modules(); $obj->modifier_classement($id, $classement); echo "..."; } } }
function boucleCaracteristique($texte, $args) { global $caracteristique; $id = lireTag($args, "id", "int_list"); $rubrique = lireTag($args, "rubrique", "int"); $affiche = lireTag($args, "affiche", "int"); $produit = lireTag($args, "produit", "int"); $courante = lireTag($args, "courante", "int"); $exclusion = lireTag($args, "exclusion", "int_list"); $search = ""; $res = ""; // preparation de la requete if ($produit != "") { $tprod = new Produit(); $tprod->charger_id($produit); $rubrique = $tprod->rubrique; } if ($rubrique != "") { $search .= " and rubrique=\"{$rubrique}\""; } if ($id != "") { $search .= " and caracteristique in({$id})"; } if ($exclusion != "") { $search .= " and caracteristique not in({$exclusion})"; } $rubcaracteristique = new Rubcaracteristique(); $tmpcaracteristique = new Caracteristique(); $tmpcaracteristiquedesc = new Caracteristiquedesc(); $order = "order by {$tmpcaracteristique->table}.classement"; $query = "select DISTINCT(caracteristique) from {$rubcaracteristique->table},{$tmpcaracteristique->table} where 1 {$search} and {$rubcaracteristique->table}.caracteristique={$tmpcaracteristique->table}.id {$order}"; //if($id != "") $query = "select * from $tmpcaracteristique->table where 1 $search"; $resul = CacheBase::getCache()->query($query); if (empty($resul)) { return ""; } $compt = 1; foreach ($resul as $row) { if ($courante == "1" && ($id != $caracteristique && !strstr($caracteristique, $id . "-"))) { continue; } else { if ($courante == "0" && ($id == $caracteristique || strstr($caracteristique, $id . "-"))) { continue; } } $tmpcaracteristiquedesc->charger($row->caracteristique); $temp = str_replace("#ID", "{$row->caracteristique}", $texte); $tmpcaracteristique->charger($tmpcaracteristiquedesc->caracteristique); if ($tmpcaracteristique->affiche == "0" && $affiche == "1") { continue; } $temp = str_replace("#TITRE", "{$tmpcaracteristiquedesc->titre}", $temp); $temp = str_replace("#CHAPO", "{$tmpcaracteristiquedesc->chapo}", $temp); $temp = str_replace("#DESCRIPTION", "{$tmpcaracteristiquedesc->description}", $temp); $temp = str_replace("#PRODUIT", "{$produit}", $temp); $temp = str_replace("#COMPT", "{$compt}", $temp); $compt++; $res .= $temp; } return $res; }
require_once "auth.php"; require_once "../fonctions/divers.php"; if (!est_autorise("acces_configuration")) { exit; } $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); try { ActionsAdminCaracteristique::getInstance()->action($request); } catch (TheliaAdminException $e) { Tlog::error($e->getMessage()); } if (false === ($lang = $request->get("lang", false))) { $lang = ActionsAdminLang::instance()->get_id_langue_courante(); } $caract = new Caracteristique($request->get("id")); $caractDisp = new Caracteristiquedesc($caract->id, $lang); ?> <!DOCTYPE html> <html lang="fr"> <head> <?php require_once "title.php"; ?> </head> <body> <?php ActionsAdminModules::instance()->inclure_module_admin("caracteristique_modifier_top"); $menu = "configuration"; $breadcrumbs = Breadcrumb::getInstance()->getCaracList($caractDisp->titre); require_once "entete.php";
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); }