示例#1
0
	$tab = explode(",",$text1); 
	$text2=count($tab);
	
	// SUPPRESSION DES COMMUNES SELECTIONNEE
	if(!empty($_POST['ids'])) $ids = $_POST['ids'];
	if(is_array($ids)) {
		foreach($ids as $id) {
			//print_r($id);
			$obj = new CTableUtilisateur(array('id_ent'=>$id));
			$obj->delete();
		}
	}
	// FIN SUPPRESSION COMMUNE
	
	// VIDAGE GROUPE COMMUNE
	$tgroupe->update();
	
	// INSERTION DES AUTRES COMMUNES
	for ($i=0; $i<$text2 and $text2!=0; $i++){
		if ($tab[$i]!=''){
				
				$xZsql = "SELECT id_ent FROM entreprise WHERE id_ent=".$tab[$i];
				$ident = CBdd::select_one($xZsql,'id_ent');
				if($ident) array_push($tab_user, $ident);
				//echo 'vidage'.$idcom;
				$tab_user_old 	= CTableGroupeUtilisteur::get_array_id_user($_SESSION['id_groupe']);
				$tab_user_new 	= array_unique(array_merge($tab_user_old, $tab_user));
				if($tab_user_new) $liste_user_new = implode("|", $tab_user_new);
				$groupe = new CTableGroupeUtilisateur(array('id'=>$_SESSION['id_groupe'], 'text'=>$liste_user_new));
				$groupe->update();
		}