$form_filtrecat = $_GET['form_filtrecat']; $_SESSION['form_filtrecat'] = $form_filtrecat; $filtre_id_groupe = $_SESSION['id_groupe']; if(isset($_REQUEST['id_groupe']) && $_REQUEST['id_groupe']==0) { $liste_user_all_groupe = trim(implode(',',CTableGroupeCommune::get_array_id_user_all_groupe()), ','); if(empty($liste_user_all_groupe)) { $filtre_groupe = ''; } else { $filtre_groupe = " WHERE id_com NOT IN (" . $liste_user_all_groupe . ")"; } } else { $listeGroupe = '('.implode(',',CTableGroupeCommune::get_array_id_user($filtre_id_groupe)).')'; $listeGroupe__ = str_replace(array('(,', ',)',',,'), array('(', ')',''), ($listeGroupe)); $filtre_groupe = " WHERE id_com IN ".$listeGroupe__; } $filtre = $filtre_groupe; $zSql = "" ; $zSql .= " SELECT * FROM commune " ; $zSql .= $filtre ; if (($_GET['alphaA']) ||($_SESSION['alphaA'])){ if ($_GET['alphaA'] != '') $zSql .=" AND nom_com LIKE '" . $_GET['alphaA'] ."%'"; } if ($_GET['order']) $zSql .= " ORDER BY ".COrder::formate($_GET['order']);
if(isset($_POST['id_groupe'])) $id_groupe = $_POST['id_groupe']; if(isset($_POST['tab_user'])) $tab_user = $_POST['tab_user']; if(isset($_POST['aleatR'])) $aleatR = $_POST['aleatR']; if(isset($_POST['nbTextNb'])) $nombreText = $_POST['nbTextNb']; //echo 'aleatoire'.$aleatR.'nbtext'.$nombreText; $_SESSION['tabl_user'] = $_POST['tab_user']; if (empty($id_groupe)) { $error_type = 1; } if ($error_type > 0) { $msginfo = "Veuillez spécifier le groupe"; break; } $tab_user_old = CTableGroupeCommune::get_array_id_user($id_groupe); $tab_user_new = array_unique(array_merge($tab_user_old, $tab_user)); $produit = array(); if($nombreText!='') { $nombre = $nombreText; }else $nombre = count($tab_user_new); //echo $nombre; for($a=0; $a<$nombre; $a++){ if ($aleatR == 2) $produit[] = $tab_user_new[array_rand($tab_user_new)]; else $produit[] = $tab_user_new[$a]; }