Accueil
Forum
Download
Livre d'or
Contact
Liens Web
|
Forum :
Masquer l’entête
|
Accès rapide :
|
|
Effectuer une Recherche avancée OU |
Veuillez patientez, la recherche est en cours...
[Résolu] Pb administration des colonnes [25 réponses]
mercredi 14 novembre 2018 à 21:25 

)
Message Automatique
mercredi 14 novembre 2018 à 23:08 <?php// ---------------------------------------------------------------// KwsPHP kOoGar Web System// $Id: class_modules.php 1050 2017-08-08 16:03:25Z mike007 $// ---------------------------------------------------------------// Mise a jour : 09/01/07 par Ditch// Mise a jour : 16/07/2008 par Garveur// Gestion du Drag'N'Drop dans la gestion des colonnes// ---------------------------------------------------------------if (!(defined('__KWS__'))) {die ('Erreur d\'appel de fichier.');}class mod_admin_bloc{ ######################################### ## initialisation de la class module ## ######################################### //function mod_admin_bloc ($id, $action, $emplacement, $module) function __construct ($id, $action, $emplacement, $module) { $this->action = $action; $this->id = $id; $this->emplacement = $emplacement; $this->module = $module; //on ouvre un tableau html bloc_head ('Administration des colonnes'); if (empty ($action)) { $this->admin_bloc (); } else { $this->action_bloc (); } //on ferme le tableau html close_table (); } function admin_bloc () { //on interroge la bdd pour connaitre les differents blocs $this->req_mod = reqmysql(' SELECT `id`, `type`, `emplacement`, `position`, `module`, `parametre1`, `parametre2`, `parametre3`, `parametre4`, `parametre5`, `afficher` FROM `modules` WHERE `type` = "bloc" ORDER BY `emplacement`, `position` ASC '); //on verifie si des blocs existe if (Kws_mysql_num_rows ($this->req_mod) > 0) { //on creer 1 tableau array avec les differents blocs $blocs = $this->bloc (); // Chargement Hack Garveur Drag'N'Drop echo ' <script language="javascript" type="text/javascript"> // <![CDATA[ var id_name_arrayDrag = new Array(Array("dragLeft","sql_positionDragLeft"),Array("dragRight","sql_positionDragRight")); // ]]> </script>'; include './includes/dragndrop/dragndrop.php'; // Fin chargement Hack Garveur Drag'N'Drop echo ' <table style="width:100%" summary="class_modules"> <tr> <td style="vertical-align:top; width:30%;">'; //on affiche la colonne de gauche echo '<ul id="dragLeft" class="sortable boxy">'; // Garveur Drag'N'Drop : <Début> liste modifiable gauche $this->array_blocs ($blocs, 0); echo '</ul>'; // Garveur Drag'N'Drop : < Fin > liste modifiable gauche //on affiche la colonne centrale $this->bloc_centre (); echo ' </td> <td style="vertical-align:top; width:30%;">'; //on affiche la colonne de droite echo '<ul id="dragRight" class="sortable boxy">'; // Garveur Drag'N'Drop : Début liste modifiable droite $this->array_blocs ($blocs, 1); echo '</ul>'; // Garveur Drag'N'Drop : Fin liste modifiable droite echo '<div style="text-align:center"> <a href="index.php?mod=admin&ac=modules&action=new&emplacement=1">Ajouter un module</a> </div> </td> </tr> </table> <hr/> <div style="text-align:center"> <span id="help">Cliquez sur un paramètre pour le modifier</span> </div>' ; } else { //si pas de blocs existants echo 'Pas de blocs <br /><div style="text-align:center"> <a href="index.php?mod=admin&ac=modules&action=new">Ajouter un module</a> </div>'; } } ############################################## ## creation de tableaux array par colonne ## ############################################## function bloc () { //on initialise les vars $i = $j = 0; while ($result = Kws_mysql_fetch_array ($this->req_mod)) { //si l'emplacement du bloc est à gauche if ($result['emplacement'] == 0) { $nb = $i; $i ++; $bloc = 'bloc_left'; //si l'emplacement du bloc est à droite } else { $nb = $j; $j++; $bloc = 'bloc_right'; } //remplissage des tableaux ${$bloc}[$nb]['id'] = $result['id']; ${$bloc}[$nb]['position'] = $result['position']; ${$bloc}[$nb]['emplacement'] = $result['emplacement']; ${$bloc}[$nb]['module'] = $result['module']; ${$bloc}[$nb]['parametre1'] = $result['parametre1']; ${$bloc}[$nb]['parametre2'] = $result['parametre2']; ${$bloc}[$nb]['parametre3'] = $result['parametre3']; ${$bloc}[$nb]['parametre4'] = $result['parametre4']; ${$bloc}[$nb]['parametre5'] = $result['parametre5']; ${$bloc}[$nb]['afficher'] = $result['afficher']; } //creation d'un tableau array avec les 2 tableaux de gauche et de droite $blocs = array ($bloc_left, $bloc_right); //on retourne le tableau creer return $blocs; } ########################################### ## on affiche les informations du bloc ## ########################################### function blocs ($blocs, $pos) { global $K_theme,$K_IN_DEMO; $temp.= str_replace('[Editer]', '<img src="themes/'.$K_theme.'/images/gestion/edit.png" style="border:none;vertical-align:middle;" alt="edit" title="Éditer" />', $this->infos).'<a href="index.php?mod=admin&ac=modules&action=infos&id='.$blocs[$pos]['id'].'"><img src="images/admin/notice.png" border="0" alt="info sur le module" title="Infos sur le module" /></a>'; $temp .= (($pos > 0) ? ' <a href="index.php?mod=admin&ac=modules&action=up&id='.$blocs[$pos]['id'].'"><img src="images/admin/up.png" border="0" alt="up" title="Monter le bloc d\'un cran" /></a>' : ' <img src="images/admin/up2.png" border="0" alt="up2" />'); $temp .= (($pos < count ($blocs)-1) ? ' <a href="index.php?mod=admin&ac=modules&action=down&id='.$blocs[$pos]['id'].'"><img src="images/admin/down.png" border="0" alt="down" title="Descendre le bloc d\'un cran" /></a>' : ' <img src="images/admin/down2.png" border="0" alt="down2" />'); $temp .= (($blocs[$pos]['emplacement'] == 0) ? ' <a href="index.php?mod=admin&ac=modules&action=right&id='.$blocs[$pos]['id'].'"><img src="images/admin/right.png" border="0" alt="right" title="Faire passer le bloc dans la colonne de droite" /></a>' : ' <a href="index.php?mod=admin&ac=modules&action=left&id='.$blocs[$pos]['id'].'"><img src="images/admin/left.png" border="0" alt="left" title="Faire passer le bloc dans la colonne de gauche" /></a>'); if (!$K_IN_DEMO OR ($blocs[$pos]['module']!='menu' AND $blocs[$pos]['module']!='espace_membre')) { $temp .= ' <a href="index.php?mod=admin&ac=modules&action=del&id='.$blocs[$pos]['id'].'"><img src="images/admin/del.png" border="0" alt="del" title="Supprimer ce bloc" /></a>'; $temp .= (($blocs[$pos]['afficher'] == 1) ? ' <a href="index.php?mod=admin&ac=modules&action=hide&id='.$blocs[$pos]['id'].'"><img src="images/admin/aff2.png" border="0" alt="hide" title="Masquer ce bloc" /></a>' : ' <a href="index.php?mod=admin&ac=modules&action=aff&id='.$blocs[$pos]['id'].'"><img src="images/admin/aff1.png" border="0" alt="aff" title="Afficher ce bloc" /></a>'); } return $temp; } ############################################################ ## on selectionne les blocs par emplacement et position ## ############################################################ function array_blocs ($blocs, $pos) { $noBlocs = 0; // Garveur Drag'N'Drop : < Init > Définition du bloc référence for($i = 0; $i<count ($blocs[$pos]); $i ++) { $noBlocs = 1; // Garveur Drag'N'Drop : < Alim > Définition du bloc référence //on affiche le bloc echo '<li id="drag_'.$blocs[$pos][$i]['id'].'">'; // Garveur Drag'N'Drop : <Début> Définition du bloc deplaçable bloc_head ($blocs[$pos][$i]['module'].(($blocs[$pos][$i]['module']=='menu' OR $blocs[$pos][$i]['module']=='menuD')?' N°:'.$blocs[$pos][$i]['id']:'')); //on verifie si le module existe if($this->verif_module ($blocs[$pos][$i])) { echo $this->blocs ($blocs[$pos], $i); } else { echo ' <span style="font-size:large;font-variant:small-caps;">Erreur !!!</span> <a href="./index.php?mod=admin&ac=modules&action=del&id='.$blocs[$pos][$i]['id'].'"> <img style="float:right" src="images/admin/del.png" border="0" alt="del" title="Supprimer ce bloc" /> </a> <br /><br /> <strong>Le bloc « '.$blocs[$pos][$i]['module'].' » est introuvable.</strong><br />Le module est certainement absent ou <a href="./index.php?mod=admin&ac=gestion_module">désactivé</a>.'; } close_table(); echo '</li>'; // Garveur Drag'N'Drop : < Fin > Définition du bloc deplaçable } // Garveur Drag'N'Drop : <Début> Définition du bloc de référence if($noBlocs == 0) { echo '<li id="drag_-1"><br /><div style="text-align:center">Position de la colonne de '.(($pos==0)?'gauche':'droite').'<br />Faire Glisser ici.</div><br /></li>'; } // Garveur Drag'N'Drop : < Fin > Définition du bloc référence } ################################## ## on affiche le bloc central ## ################################## function bloc_centre() { global $K_mod_dem, $K_edito_aff, $K_mod; $K_mod_dem = unserialize($K_mod_dem); echo ' <div style="text-align:center"> <a href="index.php?mod=admin&ac=modules&action=new&emplacement=0">Ajouter un module</a> </div> </td> <td valign="top">'; $dirs = ScannerRepertoire ('modules','dir', false); $mods = ''; foreach ($dirs as $dir) { if (file_exists('./modules/'.$dir.'/index.php') and $dir != 'admin' and $dir != 'alerte' and $dir != 'bbcode_sup' and $dir != 'debug' and $dir != 'generateur' and $dir != 'infoZ' and $dir != 'ip' and $dir != 'maintenance' and $dir != 'menu' and $dir != 'menuD' and $dir != 'newsletter' and $dir != 'smileys' and $dir != 'theme_pour_tous' and $dir != 'eskuel' and is_module($dir)) { $mods .= '<option value="'.$dir.'" '.($dir==$K_mod_dem['nom']?'selected="selected"':'').'>'.$dir.'</option>'."\n"; } } bloc_head('Edito'); echo ' <div style="text-align:center"> <a href="index.php?mod=admin&ac=modules&action=edito">Changer l\'édito</a><br /><br /> <a href="index.php?mod=admin&ac=modules&action=aff_edito">'.($K_edito_aff=='oui' ? '<img src="images/admin/aff2.png" border="0" alt="masquer" title="Masquer l\'edito" />' : '<img src="images/admin/aff1.png" border="0" alt="afficher" title="Afficher l\'edito" />').'</a> </div>'; close_table(); bloc_head('Démarrage'); if (is_module('page')) { $req_page=reqmysql(' SELECT `id`, `titre` FROM `page` ORDER BY `id` DESC '); if (Kws_mysql_num_rows($req_page)>0) { while($rep_page = Kws_mysql_fetch_object($req_page)) { $pages .= '<option value="page_'.$rep_page->id.'">[id='.$rep_page->id.'] - '.substr($rep_page->titre,0,20).'...</option>'."\n"; } } } if (is_module('articles')) { $req_art = reqmysql(' SELECT `articles`.`id`, `articles`.`titre` FROM `articles` WHERE `validation` = "0" ORDER BY `articles`.`ref` ASC, `articles`.`date` DESC '); if (Kws_mysql_num_rows($req_art)>0) { while($rep_art = Kws_mysql_fetch_object($req_art)) { $arts .= '<option value="articles_'.$rep_art->id.'">[id='.$rep_art->id.'] - '.substr($rep_art->titre,0,20).'...</option>'."\n"; } } } if (is_module('news')) { $req_news = reqmysql(' SELECT `news`.`id`, `news`.`titre` FROM `news` WHERE `validation` = "0" ORDER BY `news`.`ref` ASC, `news`.`date` DESC '); if (Kws_mysql_num_rows($req_news)>0) { while($rep_news = Kws_mysql_fetch_object($req_news)) { $news .= '<option value="news_'.$rep_news->id.'">[id='.$rep_news->id.'] - '.substr($rep_news->titre,0,20).'...</option>'."\n"; } } } if (is_module('ajash00t')) { global $K_ajash00t_options; $K_ajash00t_options = unserialize($K_ajash00t_options); $shoot = ''; foreach ($K_ajash00t_options as $key => $val) { $shoot .= '<option value="ajash00t_'.$key.'">[id'.$key.'] - Titre: "'.$K_ajash00t_options[$key]['titre'].'"</option>'."\n"; } $K_ajash00t_options = serialize($K_ajash00t_options); } echo ' <script type="text/javascript"> // <![CDATA[ function select_mod(nom_mod) { document.getElementById("page_dem").style.display="none"; document.getElementById("select_page_dem").name=""; document.getElementById("art_dem").style.display="none"; document.getElementById("select_art_dem").name=""; document.getElementById("news_dem").style.display="none"; document.getElementById("select_news_dem").name=""; document.getElementById("shoot_dem").style.display="none"; document.getElementById("select_shoot_dem").name=""; if (nom_mod=="page") { document.getElementById("page_dem").style.display="block"; document.getElementById("select_page_dem").name="module"; } else if (nom_mod=="articles") { document.getElementById("art_dem").style.display="block"; document.getElementById("select_art_dem").name="module"; } else if (nom_mod=="news") { document.getElementById("news_dem").style.display="block"; document.getElementById("select_news_dem").name="module"; } else if (nom_mod=="ajash00t") { document.getElementById("shoot_dem").style.display="block"; document.getElementById("select_shoot_dem").name="module"; } } // ]]> </script> <form style="text-align:center" action="index.php?mod=admin&ac=modules&action=mod_dem" method="post"> Modules de démarrage <br />'; if (empty($K_mod_dem)) { echo '<p style="text-align:center">Aucun module</p>'; } else { echo '<input name="submit_mod_dem" type="submit" value="Tout supprimer" /><br />'; } $mod_dem_nbr = count($K_mod_dem); $i=0; foreach($K_mod_dem as $pos => $nom_mod_dem) { echo '<div style="float:left;width:75%;text-align:left">'.ucfirst($nom_mod_dem).'</div> <input name="sql_mod_dem'.$i.'" type="hidden" value="'.$nom_mod_dem.'" /> <div style="float:right;width:25%;text-align:left"> <select style="text-align:right" name="int_position'.$i.'">'; for ($j=1 ; $j<= $mod_dem_nbr ; $j++ ) { echo'<option '.($j==($pos+1) ? 'selected="selected"':'').' value="'.$j.'">'.$j.' </option>'."\n"; } echo'</select></div><br style="clear:both" /> '; $i++; } echo '<br style="clear:both" /><hr />'; if ($mod_dem_nbr>1) { echo '<input name="submit_mod_dem" type="submit" value="Modifier positions" />'.$_SESSION['erreur_mod_dem_pos'].'<hr />'; unset($_SESSION['erreur_mod_dem_pos']); } echo '<select name="module" onchange="select_mod(this.options[this.selectedIndex].value)"> <option value="">Choisissez...</option> '.$mods.' </select> <div id="page_dem" style="display:none"> <select id="select_page_dem" > <option value="page">Choisissez ou laissez vide...</option> '.$pages.' </select> </div> <div id="art_dem" style="display:none"> <select id="select_art_dem" > <option value="articles">Choisissez ou laissez vide...</option> '.$arts.' </select> </div> <div id="news_dem" style="display:none"> <select id="select_news_dem" > <option value="news">Choisissez ou laissez vide...</option> '.$news.' </select> </div> <div id="shoot_dem" style="display:none"> <select id="select_shoot_dem" > <option value="ajash00t">Choisissez la sh00t...</option> '.$shoot.' </select> </div> <br /><br /> <input name="submit_mod_dem" type="submit" value="Ajouter" />'.(empty($K_mod_dem) ? '':' <input type="submit" value="Supprimer" />').' </form><br />'; close_table(); bloc_head('Pied de module'); echo ' <p style="text-align:center"> Gérer le paramètre virtuel<br /> <a href="index.php?mod=droit&ac=gestion&module='.$K_mod.'">piedModule dans le module droit</a></p>'; close_table(); bloc_head('Copyrights'); echo '<div style="text-align:center"><a href="index.php?mod=admin&ac=modules&action=copyrights">Modifier les copyrights</a></div>'; close_table(); // Garveur Drag'N'Drop : Début Formulaire Enregistrement des positions echo '<br /><br /><div style="text-align:center"><form name="EnregistrementPosition" method="post" action="index.php?mod=admin&ac=modules&action=SavePosition"> <input type="hidden" id="sql_positionDragLeft" name="sql_positionDragLeft" value="Position colonne de gauche" /> <input type="hidden" id="sql_positionDragRight" name="sql_positionDragRight" value="Position colonne de droite" /> <input type="submit" value="Enregistrer les positions des Blocs" onclick="DragCopyPosition(id_name_arrayDrag)" /> </form></div>'; // Garveur Drag'N'Drop : Fin Formulaire Enregistrement des positions } ####################################################### ## on verifie si le module existe puis on l'inclus ## ####################################################### function verif_module($modd) { settype($modd, 'object'); $module=$modd->module; if (file_exists('./modules/'.$modd->module.'/admin.php') and file_exists('./modules/'.$modd->module.'/bloc.php') and is_module($modd->module)) { $result_blocs = $modd; include './modules/'.$modd->module.'/admin.php' ; $this->infos = str_replace("ac=param", "ac=modules&action=edit", $infos); $this->informations = $informations; $this->new = $new; $this->edit = $edit; return true; } else { return false; } } function info_bloc() { open_table() ; $req_blocs=reqmysql(' SELECT `module` FROM `modules` WHERE `modules`.`id` = "'.$this->id.'" '); $result_blocs = Kws_mysql_fetch_object($req_blocs) ; require 'modules/'.$result_blocs->module.'/admin.php'; echo $informations; close_table() ; echo '<p style="text-align:center;"><a href="index.php?mod=admin&ac=modules">Retour à l\'administration des colonnes</a></p>'; } function move_bloc_vertical() { $req_blocs=reqmysql(' SELECT `position`, `emplacement` FROM `modules` WHERE `id` = "'.$this->id.'" '); $result_blocs = Kws_mysql_fetch_object($req_blocs) ; $pos_down = $result_blocs->position ; $var = $this->action == down ? ' AND `position` > "'.$pos_down.'" ORDER BY `position` ASC ' : ' AND `position` < "'.$pos_down.'" ORDER BY `position` DESC '; $req_blocs=reqmysql(' SELECT `id`, `position` FROM `modules` WHERE `emplacement` = "'.$result_blocs->emplacement.'" AND `type` = "bloc" '.$var.' LIMIT 0,1 '); $result_blocs = Kws_mysql_fetch_object($req_blocs) ; $id_up = $result_blocs->id ; $pos_up = $result_blocs->position ; reqmysql(' UPDATE `modules` SET `position` = "'.$pos_down.'" WHERE `id` = "'.$id_up.'" '); reqmysql(' UPDATE `modules` SET `position` = "'.$pos_up.'" WHERE `id` = "'.$this->id.'" '); $this->redirection(); } function move_bloc_horizontal() { if($this->action == 'left') { $new_place = 0; $last_place = 1; $sql = ''; } else { $new_place = 1; $last_place = 0; $sql = 'AND `id` != "'.$this->id.'"'; } $req_blocs=reqmysql(' SELECT `position` FROM `modules` WHERE `id` = "'.$this->id.'" '); $result_blocs = Kws_mysql_fetch_object($req_blocs) ; $pos = $result_blocs->position ; $req_blocs=reqmysql(' SELECT * FROM `modules` WHERE `type`="bloc" AND `emplacement` = "'.$new_place.'" ORDER BY `position` DESC '); $result_blocs = Kws_mysql_fetch_object($req_blocs); $new_pos = $result_blocs->position + 1; reqmysql(' UPDATE `modules` SET `emplacement` = "'.$new_place.'", `position` = "'.$new_pos.'" WHERE `id` = "'.$this->id.'" '); $req_blocs=reqmysql(' SELECT * FROM `modules` WHERE `position` > "'.$pos.'" AND `type` = "bloc" AND `emplacement` = "'.$last_place.'" ORDER BY `position` ASC '); while ($result_blocs = Kws_mysql_fetch_object($req_blocs)) { reqmysql(' UPDATE `modules` SET `position`="'.($result_blocs->position - 1).'" WHERE `id`="'.$result_blocs->id.'" '.$sql ); } $this->redirection(); } function aff_bloc() { if($this->action == 'aff') { reqmysql(' UPDATE `modules` SET `afficher`="1" WHERE `id`="'.$this->id.'" '); } else { reqmysql(' UPDATE `modules` SET `afficher`="0" WHERE `id`="'.$this->id.'" '); } $this->redirection(); } function new_bloc() { $dirs = ScannerRepertoire('modules','dir', false); $bloc = ''; foreach ($dirs as $dir) { if (file_exists('./modules/'.$dir.'/bloc.php') && is_module($dir)) { $img_bloc_exist = './modules/admin/images/desactive2.png'; $req_new_bloc = reqmysql(' SELECT `emplacement` FROM `modules` WHERE `type`="bloc" AND `module`="'.$dir.'" '); $result_new_bloc = Kws_mysql_fetch_object($req_new_bloc); if (Kws_mysql_num_rows($req_new_bloc)>0) $img_bloc_exist = './modules/admin/images/active.png'; $bloc .= ' <li style="cursor:help; list-style-image:url(\''.$img_bloc_exist.'\')" title="Le bloc « '.$dir.' » est : '.(isset($result_new_bloc->emplacement)? 'Actif à '.($result_new_bloc->emplacement==0? 'gauche':'droite') : 'Inactif').'"> <a href="index.php?mod=admin&ac=modules&action=new2&module='.$dir.'&emplacement='.$this->emplacement.'">'.$dir.'</a> </li>'; } } open_table() ; echo ' <p>Sélectionnez le module à ajouter à '.($_GET['emplacement']==0 ? 'gauche' : 'droite').' :</p> <ul> '.$bloc.' </ul>';/* $file = ''; $rep = opendir('modules'); while (($file = readdir($rep)) != false) { if($file != '..' && $file !='.' && $file !='') { if (is_dir('modules/'.$file) and file_exists('modules/'.$file.'/bloc.php')==1 and is_module($file)) { echo '<img src="images/admin/puce.png" alt="puce" /> <a href="index.php?mod=admin&ac=modules&action=new2&module='.$file.'&emplacement='.$this->emplacement.'">'.$file.'</a><br />'; } } } closedir($rep); clearstatcache();*/ close_table(); echo ' <p style="text-align:center;"><a href="index.php?mod=admin&ac=modules">Retour à l\'administration des colonnes</a></p>'; } function new2_bloc() { global $module, $emplacement; open_table() ; require 'modules/'.$module.'/admin.php'; echo ' <form name="FormName" action="index.php?mod=admin&ac=modules&action=new3" method="post">'.preg_replace("@<form(.*?)>(.*?)</form>@si", "\\2",$new).'</form>'; close_table() ; echo ' <p style="text-align:center;"><a href="index.php?mod=admin&ac=modules">Retour à l\'administration des colonnes</a></p>'; } function new3_bloc() { $req_blocs=reqmysql(' SELECT `position` FROM `modules` WHERE `type` = "bloc" AND `emplacement` = "'.$this->emplacement.'" ORDER BY `position` DESC '); $result_blocs = Kws_mysql_fetch_object($req_blocs) ; $new_pos = $result_blocs->position + 1 ; reqmysql(' INSERT INTO `modules` SET `type` = "bloc", `emplacement` = "'.$this->emplacement.'", `position` = "'.$new_pos.'", `module` = "'.$_POST['module'].'", `parametre1` = "'.$_POST['parametre1'].'", `parametre2` = "'.$_POST['parametre2'].'", `parametre3` = "'.$_POST['parametre3'].'", `parametre4` = "'.$_POST['parametre4'].'", `parametre5` = "'.$_POST['parametre5'].'", `afficher` = "1" ') or die('erreur') ; $this->redirection(); } function edit_bloc() { open_table(); $req_blocs=reqmysql(' SELECT `id`, `module`, `parametre1`, `parametre2`, `parametre3`, `parametre4`, `parametre5` FROM `modules` WHERE `id` = "'.$this->id.'" '); $result_blocs = Kws_mysql_fetch_object($req_blocs); require 'modules/'.$result_blocs->module.'/admin.php'; echo ' <form name="FormName" action="index.php?mod=admin&ac=modules&action=save_edit" method="post">'.preg_replace('@<form(.*?)>(.*?)</form>@si', '\\2',$edit).'</form>'; close_table(); echo ' <p style="text-align:center;"><a href="index.php?mod=admin&ac=modules">Retour à l\'administration des colonnes</a></p>'; } function save_edit_bloc() { reqmysql(' UPDATE `modules` SET `parametre1`= "'.$_POST['parametre1'].'", `parametre2`= "'.$_POST['parametre2'].'", `parametre3`= "'.$_POST['parametre3'].'", `parametre4`= "'.$_POST['parametre4'].'", `parametre5`= "'.$_POST['parametre5'].'" WHERE `id` = "'.$this->id.'" '); /*reqmysql(' UPDATE `modules` SET `afficher` = "'.$_POST['parametre3'].'" WHERE `type` = "menu" AND `emplacement`= "'.$this->id.'" ');*/ $this->redirection(); } function del_bloc() { reqmysql(' DELETE FROM `modules` WHERE `id`="'.$this->id.'" '); reqmysql(' DELETE FROM `modules` WHERE `type`="menu" AND `emplacement`="'.$this->id.'" '); reqmysql(' DELETE FROM `modules` WHERE `type`="menuD" AND `emplacement`="'.$this->id.'" '); $this->redirection(); } function mod_dem() { global $K_mod_dem; $K_mod_dem = unserialize($K_mod_dem); $mod_dem_nbr = count($K_mod_dem); $mod_dem_maj = true; if ($_POST['submit_mod_dem']=='Modifier positions') { for ($i=0 ; $i < $mod_dem_nbr ; $i++) { $trouv = false; while (!$trouv) { for ($j=0 ; ($j < $mod_dem_nbr and $i!=$j); $j++) { if ($_POST['int_position'.$i]==$_POST['int_position'.$j]) { $mod_dem_maj = false; break; } } if (!$trouv) { $trouv=true; } } } if ($mod_dem_maj) { for ($i=0 ; $i < $mod_dem_nbr ; $i++) { $K_mod_dem[($_POST['int_position'.$i]-1)] = $_POST['sql_mod_dem'.$i]; $_SESSION['erreur_mod_dem_pos']='<p style="font-weight:bold">Positions mises à jour</p>'; } } else { $_SESSION['erreur_mod_dem_pos']='<p style="font-weight:bold">Positions non mises à jour : Doublon(s)</p>'; } } elseif ($_POST['submit_mod_dem']=='Ajouter') { $pretmp=array_keys($K_mod_dem); $tmp=array_pop($pretmp); if(is_numeric($tmp)) $tmp++ ; else $tmp=0; if ($this->module!='') $K_mod_dem[$tmp] = $this->module; } elseif ($_POST['submit_mod_dem']=='Tout supprimer') { $K_mod_dem = array(); } else { if (in_array($this->module, $K_mod_dem)) { unset($K_mod_dem[array_search($this->module, $K_mod_dem)]); } } if (!empty ($K_mod_dem)) $K_mod_dem = array_values($K_mod_dem); $K_mod_dem = serialize($K_mod_dem); reqmysql(' UPDATE `parametres` SET `valeur`= "'.sp($K_mod_dem).'" WHERE `nom` = "K_mod_dem" '); $this->redirection(); } function edito() { global $K_edito, $tiny_mce_confType, $tiny_mce_skin; if (is_module('tiny_mce')) { include './modules/tiny_mce/kwsphp.php'; } open_table(); echo 'Edito :<br /> <br /> <div style="text-align:center;"> <form style="text-align:center" action="index.php?mod=admin&ac=modules&action=save_edito" method="post"> L’edito est un texte d’introduction pour votre site. Vous pouvez mettre du code HTML pour y inclure des tableaux, des images, ...<br /> <br /> <center><textarea name="sql_edito2" cols="100" rows="30">'.ax($K_edito,true).'</textarea></center><br /> <br /> <input type="submit" name="submit" id="submit" value="Enregistrer" /> </form> </div>'; close_table() ; echo '<p style="text-align:center;"><a href="index.php?mod=admin&ac=modules">Retour à l\'administration des colonnes</a></p>'; } function aff_edito() { global $K_edito_aff; if ($K_edito_aff== 'oui') $K_edito_aff='non'; else $K_edito_aff='oui'; reqmysql(' UPDATE `parametres` SET `valeur` = "'.$K_edito_aff.'" WHERE `nom` = "K_edito_aff" '); $this->redirection(); } function save_edito() { reqmysql(' UPDATE `parametres` SET `valeur` = "'.$_POST['sql_edito2'].'" WHERE `nom` = "edito" '); $this->redirection(); } function copyrights() { global $K_copyrights, $tiny_mce_confType, $tiny_mce_skin; if (is_module('tiny_mce')) { include './modules/tiny_mce/kwsphp.php'; } open_table(); echo 'Copyrights :<br /> <br /> <div style="text-align:center;"> <form style="text-align:center" action="index.php?mod=admin&ac=modules&action=save_copyrights" method="post"> Les copyrights sont situés à la fin, et sont affichés sur toutes les pages. Vous pouvez mettre du code HTML pour y inclure des tableaux, des images, ...<br /> <br /> <center><textarea name="sql_copyrights2" cols="100" rows="15">'.ax($K_copyrights,true).'</textarea></center><br /> <br /> <input type="submit" name="submit" id="submit" value="Enregistrer" /> </form> </div>'; close_table(); echo '<p style="text-align:center;"><a href="index.php?mod=admin&ac=modules">Retour à l\'administration des colonnes</a></p>'; } function save_copyrights() { reqmysql(' UPDATE `parametres` SET `valeur` = "'.$_POST['sql_copyrights2'].'" WHERE `nom` = "copyrights" '); $this->redirection(); } // Garveur Drag'N'Drop : <Début> Fonction d'enregistrement des positions function SavePosition() { $positionDragLeft = $_POST['sql_positionDragLeft']; $positionDragRight = $_POST['sql_positionDragRight']; // Enregistrements des positions de la colonne de gauche $idBloc = strtok($positionDragLeft,"|drag_"); $posBloc=0; while ($idBloc) { reqmysql('UPDATE `modules` SET `emplacement` = "0", `position` = "'.$posBloc.'" WHERE `id` = "'.$idBloc.'"'); $idBloc = strtok("|drag_"); $posBloc++; } // Enregistrements des positions de la colonne de droite $idBloc = strtok($positionDragRight,"|drag_"); $posBloc=0; while ($idBloc) { reqmysql('UPDATE `modules` SET emplacement = "1", `position` = "'.$posBloc.'" WHERE `id` = "'.$idBloc.'"'); $idBloc = strtok("|drag_"); $posBloc++; } $this->redirection(); } // Garveur Drag'N'Drop : < Fin > Fonction d'enregistrement des positions function redirection() { echo '<script type="text/javascript">window.location="index.php?mod=admin&ac=modules";</script>'; } function action_bloc() { switch($this->action) { case 'infos': $this->info_bloc(); break; case 'up': case 'down': $this->move_bloc_vertical(); break; case 'left': case 'right': $this->move_bloc_horizontal(); break; case 'aff': case 'hide': $this->aff_bloc(); break; case 'new': $this->new_bloc(); break; case 'new2': $this->new2_bloc(); break; case 'new3': $this->new3_bloc(); break; case 'edit': $this->edit_bloc(); break; case 'save_edit': $this->save_edit_bloc(); break; case 'del': $this->del_bloc(); break; case 'mod_dem': $this->mod_dem(); break; case 'edito': $this->edito(); break; case 'aff_edito': $this->aff_edito(); break; case 'save_edito': $this->save_edito(); break; // Garveur Drag'N'Drop : Appel de l'enregistrement des positions case 'SavePosition': $this->SavePosition(); break; case 'copyrights': $this->copyrights(); break; case 'save_copyrights': $this->save_copyrights(); break; } }}?>
jeudi 15 novembre 2018 à 09:33
[Résolu] Pb administration des colonnes [25 réponses]
Réponse rapide