static function select($istart=0,$ioffset=1000,$igrp=0,$order = 'mlt_iListId') { $tGrps = array(); $zSql = " "; $zSql .= " SELECT DISTINCT mlt_iListId FROM moul_tables "; $zSql .= " INNER JOIN moul_listes ON (moul_listes.id=moul_tables.mlt_iListId)"; if($igrp == 1000) { $grp = CTableMoulGpFic::get_elms_of_grp(0); foreach($grp as $i=>$grps){ if($grps['fic']!='') $tGrps[$i] = $grps['fic']; } if($grps['fic']!=''){ $zSql .= " WHERE mlt_iListId NOT IN ("; for($i=0;$i<count($tGrps)-1;$i++) $zSql .= $tGrps[$i].","; $zSql .= $tGrps[$i].") "; } } if($igrp == 1001){ $grp = CTableMoulGpFic::get_elms_of_grp(); foreach($grp as $i=>$grps){ if($grps['fic']!='') $tGrps[$i] = $grps['fic']; } if($grps['fic']!=''){ $zSql .= " WHERE mlt_iListId IN ("; for($i=0;$i<count($tGrps)-1;$i++) $zSql .= $tGrps[$i].","; $zSql .= $tGrps[$i].") "; } } if(($igrp != 0) && ($igrp != 1000) && ($igrp != 1001)) { $grp = CTableMoulGpFic::get_elms_of_grp($igrp); foreach($grp as $i=>$grps){ if($grps['fic']!='') $tGrps[$i] = $grps['fic']; } if($grps['fic']!=''){ $zSql .= " WHERE mlt_iListId IN ("; for($i=0;$i<count($tGrps)-1;$i++) $zSql .= $tGrps[$i].","; $zSql .= $tGrps[$i].") "; } } $zSql .= " ORDER BY " . COrder::formate($order) ; $zSql .= " LIMIT " . $istart ."," . $ioffset; $toRes = CBdd::select($zSql); $tFichiers = array(); while($toItm = mysql_fetch_assoc($toRes)){ array_push($tFichiers,$toItm); } return $tFichiers; }
if($tst == 0){ CTableGrpMl::insert_grp($nom_grp,$iNbFic,$iNbMails); $msginfo = "Votre groupe a été bien ajouté"; CFunction::redirection("moul_groupe_mail.php?a=0"); } else { $msginfo = "Ce nom de groupe '" . $nom_grp . "' est déjà prise !"; $a = 4; } break; case 5 : // Modif if(!empty($_GET['id'])) $id = $_GET['id']; $_SESSION['id'] = $id; CTableMoulGrpTmp::deletes(); $tFics = CTableMoulGpFic::get_elms_of_grp($id); foreach($tFics as $fics){ CTableMoulGrpTmp::insert($fics['idgf'],$fics['grp'],$fics['fic'],$fics['dateCreation']); } CFunction::redirection("moul_groupe_mail.php?a=5555&id=".$_SESSION['id']); break; case 55 : //Modif valid if(!empty($_GET['id'])) $igp = $_GET['id']; $iNbFic = 0; $iNbMails = 0; $oFics = CTableMoulGrpTmp::select(); $inb = count($oFics); foreach($oFics as $fics){ if($fics['tmp_grp']==0){ CTableMoulGpFic::delete_elm_by_id($fics['tmp_id']);