/**
  * 
  * todo : utiliser cette methode pour la gestion des contenus associés aux produit // actuellement uniquement pour rubrique
  */
 public function add($contentToAddId, $type, $object)
 {
     if ($type == 1) {
         $objectInstance = new Produit();
         $objectInstance->charger($object);
     } else {
         $objectInstance = new Rubrique();
         $objectInstance->charger($object);
     }
     $contentToAdd = new Contenu();
     $this->id = '';
     if (!$this->existe($object, $type, $contentToAddId) && $contentToAdd->charger($contentToAddId)) {
         $classement = $this->getMaxRanking($objectInstance->id, $type) + 1;
         $this->objet = $objectInstance->id;
         $this->type = $type;
         $this->contenu = $contentToAdd->id;
         $this->classement = $classement;
         parent::add();
         if ($this->type == 1) {
             ActionsModules::instance()->appel_module("modprod", $objectInstance);
         } else {
             ActionsModules::instance()->appel_module("modrub", $objectInstance);
         }
     }
 }
function substitrubriques($texte)
{
    global $id_rubrique;
    $trubrique = new Rubrique();
    $trubriquedesc = new Rubriquedesc();
    $url = "";
    if ($id_rubrique) {
        if ($trubrique->charger($id_rubrique)) {
            $trubriquedesc->charger($trubrique->id);
            $url = $trubriquedesc->getUrl();
        }
    }
    $racine = new Rubrique();
    $racine->charger($trubrique->id);
    while ($racine->parent) {
        $racine->charger($racine->parent);
    }
    $texte = str_replace("#RUBRIQUE_CHAPO", "{$trubriquedesc->chapo}", $texte);
    $texte = str_replace("#RUBRIQUE_DESCRIPTION", "{$trubriquedesc->description}", $texte);
    $texte = str_replace("#RUBRIQUE_POSTSCRIPTUM", "{$trubriquedesc->postscriptum}", $texte);
    $texte = str_replace("#RUBRIQUE_ID", "{$trubrique->id}", $texte);
    $texte = str_replace("#RUBRIQUE_LIEN", "{$trubrique->lien}", $texte);
    $texte = str_replace("#RUBRIQUE_NOM", "{$trubriquedesc->titre}", $texte);
    $texte = str_replace("#RUBRIQUE_PARENT", "{$trubrique->parent}", $texte);
    $texte = str_replace("#RUBRIQUE_RACINE", "{$racine->id}", $texte);
    $texte = str_replace("#RUBRIQUE_REWRITEURL", $url, $texte);
    $texte = str_replace("#RUBRIQUE_URL", $url, $texte);
    return $texte;
}
 public function add($variantToAddId, $categoryId)
 {
     $category = new Rubrique();
     $variantToAdd = new Declinaison();
     $this->id = '';
     if (!$this->charger($categoryId, $variantToAddId) && $variantToAdd->charger($variantToAddId) && $category->charger($categoryId)) {
         $this->rubrique = $category->id;
         $this->declinaison = $variantToAdd->id;
         parent::add();
         ActionsModules::instance()->appel_module("modrub", $category);
     }
 }
 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);
     }
 }
Esempio n. 5
0
 public function update(Rubrique $rubrique)
 {
     $id = intval();
     $name = mysqli_real_escape_string($this->db, $rubrique->getName());
     $description = mysqli_real_escape_string($this->db, $rubrique->getDescription());
     $image = mysqli_real_escape_string($this->db, $rubrique->getImage());
     $id_author = $rubrique->getIdAuthor();
     $query = "UPDATE rubrique SET name='" . $name . "', description='" . $description . "', image='" . $image . "', WHERE id='" . $id . "'";
     $res = mysqli_query($this->db, $query);
     if ($res) {
         return $this->findById($id);
     } else {
         return "Error";
     }
 }
function lister_contenuassoc($type, $objet)
{
    if ($type == 1) {
        $obj = new Produit();
        $obj->charger($objet);
    } else {
        $obj = new Rubrique();
        $obj->charger($objet);
    }
    $contenuassoc = new Contenuassoc();
    $contenua = new Contenu();
    $contenuadesc = new Contenudesc();
    $query = "select * from {$contenuassoc->table} where type='{$type}' and objet='{$obj->id}' order by classement";
    $resul = $contenuassoc->query($query);
    $i = 0;
    while ($resul && ($row = $contenuassoc->fetch_object($resul))) {
        $fond = $i++ % 2 ? "fonce" : "claire";
        $contenua->charger($row->contenu);
        $contenuadesc->charger($contenua->id);
        $dossierdesc = new Dossierdesc();
        $dossierdesc->charger($contenua->dossier);
        ?>
		<li class="<?php 
        echo $fond;
        ?>
">
				<div class="cellule" style="width:260px;"><?php 
        echo $dossierdesc->titre;
        ?>
</div>
				<div class="cellule" style="width:260px;"><?php 
        echo $contenuadesc->titre;
        ?>
</div>
				<div class="cellule_supp"><a href="javascript:contenuassoc_supprimer(<?php 
        echo $row->id;
        ?>
, <?php 
        echo $type;
        ?>
,'<?php 
        echo $objet;
        ?>
')"><img src="gfx/supprimer.gif" /></a></div>
		</li>
<?php 
    }
}
 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);
     }
 }
Esempio n. 8
0
function ancien_rewrite_rub($id, $lang = 1)
{
    $rub = new Rubrique();
    $rub->charger($id);
    $chem = chemin_rub($id);
    if (!empty($chem)) {
        $rubriquedesc = new Rubriquedesc();
        $listrub = "";
        if (!$rubriquedesc->charger($chem[count($chem) - 1]->rubrique, $lang)) {
            return "";
        }
        $listrub .= $rubriquedesc->titre . "_";
        $rubriquedesc->charger($chem[0]->rubrique, $lang);
        $listrub .= $rubriquedesc->rubrique . "_";
        for ($i = count($chem) - 2; $i >= 0; $i--) {
            $rubriquedesc->charger($chem[$i]->rubrique, $lang);
            $listrub .= $rubriquedesc->titre . "_";
        }
        $listrub .= ".html";
        return eregurl($listrub);
    } else {
        return "";
    }
}
 public function contentAction($param1, $param2 = "")
 {
     if ($param1 == "main") {
         $id = $param2;
     } else {
         $id = $param1;
     }
     $id = $this->int($id);
     $rubriques = Rubrique::find(array("idDomaine = " . $id, "order" => "ordre"));
     foreach ($rubriques as $rubrique) {
         echo "<h1>" . $rubrique->getTitre() . "</h1>";
         echo $rubrique->getDescription();
         ob_start();
         $exemples = $rubrique->getExemples(['order' => 'ordre']);
         foreach ($exemples as $exemple) {
             echo $this->replaceTitre($exemple->getTitre());
             echo $this->replaceAlerts($exemple->getDescription());
             $header = NULL;
             if (StrUtils::isNotNull($exemple->getHeader())) {
                 $header = $exemple->getHeader();
             }
             $footer = NULL;
             if (StrUtils::isNotNull($exemple->getCode())) {
                 $footer = "<pre><code class='language-" . $exemple->getLanguage() . "'>" . htmlentities($exemple->getCode()) . "</code></pre>";
             }
             $p = $this->jquery->bootstrap()->htmlPanel("id-" . $exemple->getId(), null, $header, $footer);
             echo $p->compile();
         }
         $all = ob_get_contents();
         ob_end_clean();
         if (count($this->anchors) > 2) {
             $ddAnchors = new HtmlDropdown("anchors", "Accès rapide");
             $ddAnchors->setStyle("btn-default");
             $ddAnchors->asButton();
             foreach ($this->anchors as $kAnchor => $vAnchor) {
                 $ddAnchors->addItem($vAnchor, "#" . $kAnchor);
             }
             echo $ddAnchors->compile();
         }
         echo $all;
     }
     $this->jquery->exec("Prism.highlightAll();", true);
     if ($param1 == "main") {
         $this->jquery->get("index/menu/" . $id, ".col-md-3");
     }
     echo $this->jquery->compile();
     $this->view->disable();
 }
Esempio n. 10
0
/*                                                                                   */
/*      You should have received a copy of the GNU General Public License            */
/*	    along with this program. If not, see <http://www.gnu.org/licenses/>.         */
/*                                                                                   */
/*************************************************************************************/
require_once __DIR__ . "/../pre.php";
require_once __DIR__ . "/../auth.php";
if (!est_autorise("acces_configuration")) {
    exit;
}
require_once "../../fonctions/modules.php";
header('Content-Type: text/html; charset=utf-8');
list($modif, $id) = explode("_", $_POST['id']);
$classement = $_POST["value"];
if ($modif == "classementrub" && est_autorise("acces_catalogue")) {
    $obj = new Rubrique();
    $obj->modifier_classement($id, $classement);
    echo "rubrique|";
} else {
    if ($modif == "classementprod" && est_autorise("acces_catalogue")) {
        $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();
Esempio n. 11
0
function arbreOptionRub($depart, $niveau, $prubrique, $nbprod = 0, $ok = 1, $lang = false)
{
    $rec = "";
    $espace = "";
    $niveau++;
    $trubrique = new Rubrique();
    $query = "select * from {$trubrique->table} where parent=\"{$depart}\"";
    $resul = CacheBase::getCache()->query($query);
    for ($i = 0; $i < $niveau; $i++) {
        $espace .= "&nbsp;&nbsp;&nbsp;";
    }
    if ($resul == "" || count($resul) == 0) {
        return "";
    }
    foreach ($resul as $row) {
        $trubriquedesc = new Rubriquedesc();
        $trubriquedesc->charger($row->id, $lang);
        if (!$trubriquedesc->affichage_back_office_permis()) {
            continue;
        }
        $trubrique->charger($trubriquedesc->rubrique);
        $courante = new Rubrique();
        $courante->charger($prubrique);
        if ($courante->parent == $row->id) {
            $selected = "selected";
        } else {
            $selected = "";
        }
        if ($ok == 0 || $row->id == $prubrique && $ok != -1) {
            $disabled = "disabled=\"disabled\"";
        } else {
            $disabled = "";
        }
        if ($nbprod && $trubrique->nbprod() || !$nbprod) {
            $rec .= "<option value=\"{$row->id}\" {$disabled} {$selected}>" . $espace . $trubriquedesc->titre . "</option>";
        }
        if ($prubrique == $row->id && $ok != -1 || $ok == 0) {
            $rec .= arbreOptionRub($row->id, $niveau, $prubrique, $nbprod, 0, $lang);
        } else {
            $rec .= arbreOptionRub($row->id, $niveau, $prubrique, $nbprod, $ok, $lang);
        }
    }
    return $rec;
}
function supprimer($id, $parent)
{
    $rubrique = new Rubrique($id);
    $rubrique->delete();
    ActionsModules::instance()->appel_module("suprub", $rubrique);
    redirige("parcourir.php?parent=" . $parent);
}
Esempio n. 13
0
function boucleChemin($texte, $args)
{
    global $id_rubrique;
    // récupération des arguments
    $rubrique = lireTag($args, "rubrique", "int");
    $profondeur = lireTag($args, "profondeur", "int");
    $niveau = lireTag($args, "niveau", "int");
    if ($rubrique == "") {
        return "";
    }
    $res = "";
    $trubrique = new Rubrique();
    $trubrique->charger($rubrique);
    $trubriquedesc = new Rubriquedesc();
    $i = 0;
    if (!$trubrique->parent) {
        return "";
    }
    $rubtab = "";
    $tmp = new Rubrique();
    $tmp->charger($trubrique->parent);
    $rubtab[$i] = new Rubrique();
    $rubtab[$i++] = $tmp;
    while ($tmp->parent != 0) {
        $tmp = new Rubrique();
        $tmp->charger($rubtab[$i - 1]->parent);
        $rubtab[$i] = new Rubrique();
        $rubtab[$i++] = $tmp;
    }
    $compt = 0;
    for ($i = count($rubtab) - 1; $i >= 0; $i--) {
        if ($profondeur != "" && $compt == $profondeur) {
            break;
        }
        if ($niveau != "" && $niveau != $compt + 1) {
            $compt++;
            continue;
        }
        $trubriquedesc->charger($rubtab[$i]->id);
        $temp = str_replace("#ID", $rubtab[$i]->id, $texte);
        $temp = str_replace("#TITRE", "{$trubriquedesc->titre}", $temp);
        $temp = str_replace("#URL", $trubriquedesc->getUrl(), $temp);
        $temp = str_replace("#REWRITEURL", $trubriquedesc->getUrl(), $temp);
        $compt++;
        $res .= $temp;
    }
    return $res;
}
Esempio n. 14
0
/*      GNU General Public License for more details.                                 */
/*                                                                                   */
/*      You should have received a copy of the GNU General Public License            */
/*	    along with this program. If not, see <http://www.gnu.org/licenses/>.         */
/*                                                                                   */
/*************************************************************************************/
require_once __DIR__ . "/../pre.php";
require_once __DIR__ . "/../auth.php";
require_once __DIR__ . "/../../fonctions/divers.php";
if (!est_autorise("acces_catalogue")) {
    exit;
}
header('Content-Type: text/html; charset=utf-8');
list($modif, $id) = explode("_", lireParam("id", "string"));
if (strstr($modif, "rub") !== false) {
    $obj = new Rubrique();
    $obj->charger($id);
    $objdesc = new Rubriquedesc();
    $objdesc->charger($obj->id);
    $point_entree = "modrub";
    $champ_parent = "parent";
} else {
    $obj = new Produit();
    $obj->charger_id($id);
    $obj->datemodif = date('Y-m-d H:i:s');
    $objdesc = new Produitdesc();
    $objdesc->charger($obj->id);
    $point_entree = "modprod";
    $champ_parent = "rubrique";
}
switch ($modif) {
function liste_parent($parent, $niveau, $commande, $grandParent, $debutLie = 0)
{
    global $deco, $listePassee;
    $venteprod = new Venteprod();
    $query = "select * from {$venteprod->table} where commande='{$commande->id}' AND parent='{$parent}'";
    $resul = $venteprod->query($query);
    $memFin = "";
    while ($resul && ($row = $venteprod->fetch_object($resul))) {
        $venteprod->charger($row->id);
        $baseIndentation = 25;
        $paddingIndentation = 5;
        //base
        $largeurDesignation = 399;
        $indentation = "";
        if ($debutLie) {
            $indentation = "╓";
        } elseif ($grandParent != 0 && $grandParent == $venteprod->id) {
            $indentation = "╙";
        } elseif ($niveau > 0) {
            /*for($niv=0;$niv<$niveau;$niv++)
            		{
            			$indentation .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            		}*/
            $paddingIndentation += $baseIndentation * $niveau;
            $indentation .= "↳";
        }
        $largeurDesignation -= $paddingIndentation;
        $produit = new Produit();
        $produitdesc = new Produitdesc();
        $produit->charger($venteprod->ref);
        $produitdesc->charger($produit->id);
        $rubrique = new Rubrique();
        $rubrique->charger($produit->rubrique);
        $rubriquedesc = new Rubriquedesc();
        $rubriquedesc->charger($rubrique->id);
        if ($rubriquedesc->titre != "") {
            $titrerub = $rubriquedesc->titre;
        } else {
            $titrerub = "//";
        }
        if (!($deco % 2)) {
            $fond = "ligne_fonce_BlocDescription";
        } else {
            $fond = "ligne_claire_BlocDescription";
        }
        $listePassee[] = $venteprod->id;
        if ($grandParent != 0 && $grandParent == $venteprod->id) {
            $memFin = "<ul class=\"__COULEUR_FOND__\">\n\t\t\t\t<li style=\"width:" . $largeurDesignation . "px;padding-left:" . $paddingIndentation . "px\">{$indentation} {$venteprod->ref} - {$titrerub} - " . str_replace("\n", "<br />", $venteprod->titre) . "</li>\n\t\t\t\t<li style=\"width:73px;\">" . round($venteprod->prixu, 2) . "</li>\n\t\t\t\t<li style=\"width:23px;\">" . $venteprod->quantite . "</li>\n\t\t\t\t<li style=\"width:20px;\">" . round($venteprod->quantite * $venteprod->prixu, 2) . "</li>\n\t\t\t\t</ul>";
        } else {
            $deco++;
            ?>
				<ul class="<?php 
            echo $fond;
            ?>
">
				<li style="width:<?php 
            echo $largeurDesignation;
            ?>
px; padding-left:<?php 
            echo $paddingIndentation;
            ?>
px;"><?php 
            echo $indentation . " " . $venteprod->ref . " - " . $titrerub;
            ?>
 - <?php 
            echo str_replace("\n", "<br />", $venteprod->titre);
            ?>
</li>
				<li style="width:73px;"><?php 
            echo round($venteprod->prixu, 2);
            ?>
</li>
				<li style="width:23px;"><?php 
            echo $venteprod->quantite;
            ?>
</li>
				<li style="width:20px;"><?php 
            echo round($venteprod->quantite * $venteprod->prixu, 2);
            ?>
</li>
				</ul>

		<?php 
        }
        if ($grandParent != $venteprod->id) {
            liste_parent($venteprod->id, $niveau + 1, $commande, $parent);
        }
    }
    if ($memFin != "") {
        if (!($deco % 2)) {
            $fond = "ligne_fonce_BlocDescription";
        } else {
            $fond = "ligne_claire_BlocDescription";
        }
        $deco++;
        echo str_replace("__COULEUR_FOND__", $fond, $memFin);
    }
}
 public function searchAction()
 {
     $text = $_POST["text"];
     if (Text::startsWith($this->translateEngine->getLanguage(), "en", true)) {
         $domaines = Domaine::find("libelle LIKE '%" . $text . "%'");
         $rubriques = Rubrique::find("titre LIKE '%" . $text . "%' OR description LIKE '%" . $text . "%'");
         $exemples = Exemple::find("titre LIKE '%" . $text . "%' OR description LIKE '%" . $text . "%'");
     } else {
         $domaines = array();
         $rubriques = array();
         $exemples = array();
         $translations = $this->translateEngine->getTranslations();
         if ($text != "") {
             $arrayTranslations = $translations->filter(function ($object) use($text) {
                 if ($object->getName() == "domaine.libelle" && stristr($object->getText(), $text) !== false) {
                     return $object;
                 }
             });
             if (sizeof($arrayTranslations) > 0) {
                 $domaines = Domaine::find($this->_getCondition($arrayTranslations));
             }
             $arrayRubriques = $translations->filter(function ($object) use($text) {
                 if (Text::startsWith($object->getName(), "rubrique" && stristr($object->getText(), $text) !== false)) {
                     return $object;
                 }
             });
             if (sizeof($arrayRubriques) > 0) {
                 $rubriques = Rubrique::find($this->_getCondition($arrayRubriques));
             }
             $arrayExemples = $translations->filter(function ($object) use($text) {
                 if (Text::startsWith($object->getName(), "exemple")) {
                     if (stristr($object->getText(), $text) !== false) {
                         return $object;
                     }
                 }
             });
             if (sizeof($arrayExemples) > 0) {
                 $exemples = Exemple::find($this->_getCondition($arrayExemples));
             }
         }
     }
     $this->_searchResults($text, $domaines, $rubriques, $exemples);
 }
Esempio n. 17
0
function liste_rubriques($parent, $critere, $order, $alpha)
{
    $rubrique = new Rubrique();
    $rubriquedesc = new Rubriquedesc();
    if ($alpha == "alpha") {
        $query = "select r.id, r.ligne, r.classement from {$rubrique->table} r LEFT JOIN {$rubriquedesc->table} rd ON rd.rubrique=r.id and lang=" . ActionsLang::instance()->get_id_langue_courante() . " where r.parent=\"{$parent}\" order by rd.{$critere} {$order}";
    } else {
        $query = "select id, ligne, classement from {$rubrique->table} where parent=\"{$parent}\" order by {$critere} {$order}";
    }
    $resul = $rubrique->query($query);
    $i = 0;
    while ($resul && ($row = $rubrique->fetch_object($resul))) {
        $rubriquedesc = new Rubriquedesc();
        $rubriquedesc->charger($row->id);
        if (!$rubriquedesc->affichage_back_office_permis()) {
            continue;
        }
        $fond = "ligne_" . ($i++ % 2 ? "claire" : "fonce") . "_rub";
        ?>

<ul class="<?php 
        echo $fond;
        ?>
">
	<li style="width:623px;"><span id="titrerub_<?php 
        echo $row->id;
        ?>
" <?php 
        if ($rubriquedesc->est_langue_courante()) {
            echo 'class="texte_edit"';
        }
        ?>
><?php 
        echo substr($rubriquedesc->titre, 0, 80);
        if (strlen($rubriquedesc->titre) > 80) {
            echo " ...";
        }
        ?>
</span></li>
	<li style="width:53px;"><input type="checkbox" id="rub_ligne_<?php 
        echo $row->ref;
        ?>
" name="ligne[]" class="sytle_checkbox" onchange="checkvalues('lignerub','<?php 
        echo $row->id;
        ?>
')" <?php 
        if ($row->ligne) {
            ?>
 checked="checked" <?php 
        }
        ?>
/></li>
	<li style="width:54px;"><?php 
        if ($rubriquedesc->rubrique) {
            ?>
<a href="parcourir.php?parent=<?php 
            echo $row->id;
            ?>
" ><?php 
            echo trad('parcourir', 'admin');
            ?>
</a><?php 
        }
        ?>
</li>
	<li style="width:34px;"><a href="rubrique_modifier.php?id=<?php 
        echo $row->id;
        ?>
" class="txt_vert_11"><?php 
        echo trad('editer', 'admin');
        ?>
</a></li>

	<li style="width:71px;">
	 <div class="bloc_classement">
	    <div class="classement"><a href="rubrique_modifier.php?id=<?php 
        echo $row->id;
        ?>
&action=modclassement&parent=<?php 
        echo $parent;
        ?>
&type=M"><img src="gfx/up.gif" border="0" /></a></div>
	    <div class="classement"><span id="classementrub_<?php 
        echo $row->id;
        ?>
" class="classement_edit"><?php 
        echo $row->classement;
        ?>
</span></div>
	    <div class="classement"><a href="rubrique_modifier.php?id=<?php 
        echo $row->id;
        ?>
&action=modclassement&parent=<?php 
        echo $parent;
        ?>
&type=D"><img src="gfx/dn.gif" border="0" /></a></div>
	 </div>
	</li>
	<li style="width:37px; text-align:center;"><a href="javascript:supprimer_rubrique('<?php 
        echo $row->id;
        ?>
','<?php 
        echo $parent;
        ?>
')"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li>
</ul>

		<?php 
    }
}
function ajouter($lang, $id, $titre, $chapo, $description, $tabdisp, $ajoutrub)
{
    $json = new Services_JSON();
    $tabdisp = stripslashes($tabdisp);
    $tabdisp = $json->decode($tabdisp);
    $declinaison = new Declinaison();
    $declinaison->charger($id);
    if ($declinaison->id) {
        return;
    }
    $declinaison = new Declinaison();
    $query = "select max(classement) as maxClassement from {$declinaison->table}";
    $resul = $declinaison->query($query);
    $maxClassement = $resul ? $declinaison->get_result($resul, 0, "maxClassement") : 0;
    $declinaison->id = $id;
    $declinaison->classement = $maxClassement + 1;
    $lastid = $declinaison->add();
    $declinaison->id = $lastid;
    $declinaisondesc = new Declinaisondesc();
    $declinaisondesc->chapo = $chapo;
    $declinaisondesc->description = $description;
    $declinaisondesc->declinaison = $lastid;
    $declinaisondesc->lang = $lang;
    $declinaisondesc->titre = $titre;
    $declinaisondesc->chapo = str_replace("\n", "<br/>", $declinaisondesc->chapo);
    $declinaisondesc->description = str_replace("\n", "<br/>", $declinaisondesc->description);
    $declinaisondesc->add();
    $declidisp = new Declidisp();
    $declidispdesc = new Declidispdesc();
    for ($i = 0; $i < count($tabdisp); $i++) {
        $declidisp->declinaison = $lastid;
        $lastidc = $declidisp->add();
        $declidispdesc->declidisp = $lastidc;
        $declidispdesc->lang = $lang;
        $declidispdesc->titre = $tabdisp[$i]->texte;
        $declidispdesc->add();
    }
    if (intval($ajoutrub) == 1) {
        $rubrique = new Rubrique();
        $query = "select * from {$rubrique->table}";
        $resul = $rubrique->query($query);
        while ($resul && ($row = $rubrique->fetch_object($resul))) {
            $rubdeclinaison = new Rubdeclinaison();
            $rubdeclinaison->rubrique = $row->id;
            $rubdeclinaison->declinaison = $lastid;
            $rubdeclinaison->add();
        }
    }
    ActionsModules::instance()->appel_module("ajdeclinaison", $declinaison);
    redirige($_SERVER['PHP_SELF'] . "?id=" . $lastid);
}
 public function showMainDomaine($id, $domaines)
 {
     $jquery = $this->controller->jquery;
     $grid = $jquery->semantic()->htmlGrid("my-Grid-main");
     foreach ($domaines as $domaine) {
         $col = $grid->addCol(4);
         $idDom = "ss-item-" . $domaine->getId();
         $col->addContent(new HtmlHeader("", 3, "<a href='#' id='" . $idDom . "'>" . $domaine->getLibelle() . "</a>", "page"));
         $rubrique = \Rubrique::findFirst(array("idDomaine = " . $domaine->getId(), "order" => "ordre"));
         if ($rubrique !== false) {
             $exemple = \Exemple::findFirst(array("idRubrique = " . $rubrique->getId(), "order" => "demo DESC"));
             if ($exemple !== false && $exemple->getDemo() > 0) {
                 $exec = "";
                 $col->setWidth(4 * $exemple->getDemo());
                 if ($exemple->getExecPHP()) {
                     $startPoint = '<hidden>';
                     $endPoint = '</hidden>';
                     ob_start();
                     $this->jquery = $jquery;
                     $php = str_ireplace([$startPoint, $endPoint], "", $exemple->getPhp());
                     eval($this->initPHP() . $php);
                     $exec = ob_get_clean();
                     $col->addContent($exec);
                 }
             }
         }
     }
     $jquery->getOnClick(".ui.header>a", "Index/content/", "#response");
     echo $grid;
 }
Esempio n. 20
0
function contenuassoc_supprimer()
{
    $contenuassoc = new Contenuassoc();
    $contenuassoc->charger($_GET['id']);
    $contenuassoc->delete();
    if ($contenuassoc->type == 1) {
        $objet = new Produit();
    } else {
        $objet = new Rubrique();
    }
    $objet->charger($contenuassoc->objet);
    if ($contenuassoc->type == 1) {
        ActionsModules::instance()->appel_module("modprod", $objet);
    } else {
        ActionsModules::instance()->appel_module("modrub", $objet);
    }
    lister_contenuassoc($_GET['type'], $_GET['objet']);
}
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}");
}
Esempio n. 22
0
function contenuassoc_supprimer($request)
{
    $contenuassoc = new Contenuassoc();
    $contenuassoc->charger($request->query->get('id'));
    $contenuassoc->delete();
    if ($contenuassoc->type == 1) {
        $objet = new Produit();
    } else {
        $objet = new Rubrique();
    }
    $objet->charger($contenuassoc->objet);
    if ($contenuassoc->type == 1) {
        ActionsModules::instance()->appel_module("modprod", $objet);
    } else {
        ActionsModules::instance()->appel_module("modrub", $objet);
    }
    lister_contenuassoc($request->query->get('type'), $request->query->get('objet'));
}
Esempio n. 23
0
         $reecriture->charger($a->url);
         $reecriture->actif = 0;
         $reecriture->maj();
         $reecriture_new = new Reecriture();
         $reecriture_new->url = $reecriture->url;
         $reecriture_new->fond = 'nexisteplus';
         $reecriture_new->param = $reecriture->param . '&ancienfond=' . $reecriture->fond;
         $reecriture_new->actif = 1;
         $reecriture_new->lang = $reecriture->lang;
         $reecriture_new->add();
     }
     break;
 case 'rubrique':
     preg_match("#id_rubrique=([0-9]+)([^[0-9]])*#", $a->param, $match);
     $id = $match[1];
     $rubrique = new Rubrique();
     if (!$rubrique->charger($id)) {
         $reecriture = new Reecriture();
         $reecriture->charger($a->url);
         $reecriture->actif = 0;
         $reecriture->maj();
         $reecriture_new = new Reecriture();
         $reecriture_new->url = $reecriture->url;
         $reecriture_new->fond = 'nexisteplus';
         $reecriture_new->param = $reecriture->param . '&ancienfond=' . $reecriture->fond;
         $reecriture_new->actif = 1;
         $reecriture_new->lang = $reecriture->lang;
         $reecriture_new->add();
     }
     break;
 case 'dossier':
Esempio n. 24
0
 public function setRubrique(Rubrique $rubrique)
 {
     $this->id_rubrique = $rubrique->getId();
     return true;
 }