function lister_caracteristiques($critere, $order) { $caracteristique = new Caracteristique(); $query = "select id, classement from {$caracteristique->table} order by {$critere} {$order}"; $resul = $caracteristique->query($query); while ($resul && ($row = $caracteristique->fetch_object($resul))) { $caracteristiquedesc = new Caracteristiquedesc(); $caracteristiquedesc->charger($row->id); $fond = "ligne_" . ($i++ % 2 ? "claire" : "fonce") . "_rub"; ?> <ul class="<?php echo $fond; ?> "> <li style="width:770px;"><span id="<?php echo $row->id; ?> " class="texte_edit"><?php echo $caracteristiquedesc->titre; ?> </span></li> <li style="width:37px;"><a href="<?php echo "caracteristique_modifier.php?id={$row->id}"; ?> "><?php echo trad('editer', 'admin'); ?> </a></li> <li style="width:71px;"> <div class="bloc_classement"> <div class="classement"><a href="caracteristique_modifier.php?id=<?php echo $row->id; ?> &action=modclassement&type=M"><img src="gfx/up.gif" border="0" /></a></div> <div class="classement"><span id="classementcarac_<?php echo $row->id; ?> " class="classement_edit"><?php echo $row->classement; ?> </span></div> <div class="classement"><a href="caracteristique_modifier.php?id=<?php echo $row->id; ?> &action=modclassement&type=D"><img src="gfx/dn.gif" border="0" /></a></div> </div> </li> <li style="width:37px; text-align:center;"><a onclick="return suppr_carac(<?php echo $row->id; ?> );" href="<?php echo "caracteristique_modifier.php?id={$row->id}&action=supprimer"; ?> " ><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li> </ul> <?php } }
function modifier($id, $lang, $titre, $chapo, $description, $tabdisp, $affiche) { if (!$lang) { $lang = 1; } $caracteristique = new Caracteristique(); $caracteristiquedesc = new Caracteristiquedesc(); $caracteristique->charger($id); $res = $caracteristiquedesc->charger($caracteristique->id, $lang); if (!$res) { $temp = new Caracteristiquedesc(); $temp->caracteristique = $caracteristique->id; $temp->lang = $lang; $temp->add(); $caracteristiquedesc->charger($caracteristique->id, $lang); } if ($affiche != "") { $caracteristique->affiche = 1; } else { $caracteristique->affiche = 0; } $caracteristiquedesc->chapo = $chapo; $caracteristiquedesc->description = $description; $caracteristiquedesc->titre = $titre; $caracteristiquedesc->chapo = str_replace("\n", "<br/>", $caracteristiquedesc->chapo); $caracteristiquedesc->description = str_replace("\n", "<br/>", $caracteristiquedesc->description); $caracteristique->maj(); $caracteristiquedesc->maj(); ActionsModules::instance()->appel_module("modcaracteristique", $caracteristique); redirige($_SERVER['PHP_SELF'] . "?id={$id}&lang={$lang}"); }
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; }
</div> </div> <div class="blocs_pliants_prod" id="pliantcaracteristiques"> <?php $rubcaracteristique = new Rubcaracteristique(); $caracteristiquedesc = new Caracteristiquedesc(); $caracdisp = new Caracdisp(); $caracdispdesc = new Caracdispdesc(); $caracteristique = new Caracteristique(); $query = "select * from {$rubcaracteristique->table},{$caracteristique->table} where {$rubcaracteristique->table}.caracteristique={$caracteristique->table}.id and {$rubcaracteristique->table}.rubrique='" . $rubrique . "' order by {$caracteristique->table}.classement"; $resul = mysql_query($query); $caracval = new Caracval(); while ($row = mysql_fetch_object($resul)) { $caracval = new Caracval(); $caracteristiquedesc->charger($row->caracteristique); $caracval->charger($produit->id, $row->caracteristique); $query2 = "select c.* from {$caracdisp->table} c left join {$caracdispdesc->table} cd on cd.caracdisp = c.id and cd.lang = {$lang} where c.caracteristique='{$row->caracteristique}' order by cd.classement"; $resul2 = mysql_query($query2); $nbres = mysql_num_rows($resul2); if (!$nbres) { ?> <ul class="ligne1"> <li class="cellule_designation" style="width:290px;"><?php echo $caracteristiquedesc->titre; ?> </li> <li class="cellule"> <input type="hidden" name="typecaract<?php echo $row->caracteristique;