Exemple #1
0
					$pb_record = 'yes';
				}
			}
		}

		if ($pb_record == 'no') {
			//$affiche_message = 'yes';
			$msg="Les modifications ont été enregistrées !";
		}
	}
}
elseif((isset($_POST['action']))&&($_POST['action']=='upload_file')&&(isset($id_groupe))) {
	check_token();

	if($_SESSION['statut']=='professeur') {
		if(!verif_groupe_appartient_prof($id_groupe)) {
			header("Location: ../accueil.php?msg=Accès non autorisé.");
			die();
		}
	}

	// A FAIRE : Ajouter des tests sur l'association matiere_notanet/id_groupe/matiere_gepi

	$current_group=get_group($id_groupe);

	$type_csv = isset($_POST["type_csv"]) ? $_POST["type_csv"] : NULL;
	$csv_file = isset($_FILES["csv_file"]) ? $_FILES["csv_file"] : NULL;
	if((isset($csv_file))&&(isset($type_csv))) {
		$fp=fopen($csv_file['tmp_name'],"r");

		if(!$fp) {
Exemple #2
0
function get_dates_notices_et_dev($id_groupe, $date_debut, $date_fin, $timestamp_debut, $timestamp_fin, $avec_notices = "y", $avec_dev = "y")
{
    // Passer en paramètres $date_debut et $date_fin (au format jj/mm/aaa) ou bien directement les $timestamp_debut et $timestamp_fin
    global $current_ordre;
    $tab_dates = array();
    $tab_dates2 = array();
    $tab_notices = array();
    $tab_dev = array();
    if ($timestamp_debut == "") {
        $tmp_tab = explode("/", $date_debut);
        $jour = $tmp_tab[0];
        $mois = $tmp_tab[1];
        $annee = $tmp_tab[2];
        $timestamp_debut = mktime(0, 0, 0, $mois, $jour, $annee);
    }
    if ($timestamp_fin == "") {
        $tmp_tab = explode("/", $date_fin);
        $jour = $tmp_tab[0];
        $mois = $tmp_tab[1];
        $annee = $tmp_tab[2];
        $timestamp_fin = mktime(0, 0, 0, $mois, $jour, $annee);
    }
    if ($avec_notices == "y") {
        $sql = "SELECT cte.* FROM ct_entry cte WHERE (contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct >= '" . $timestamp_debut . "'\n\t\t\t\tAND date_ct <= '" . $timestamp_fin . "'\n\t\t\t\tAND id_groupe='" . $id_groupe . "'\n\t\t\t\t) ORDER BY date_ct DESC, heure_entry DESC;";
        //echo "$sql<br />";
        $res = mysqli_query($GLOBALS["mysqli"], $sql);
        $cpt = 0;
        while ($lig = mysqli_fetch_object($res)) {
            //echo "$lig->date_ct<br />";
            $date_notice = strftime("%a %d %b %y", $lig->date_ct);
            if (!in_array($date_notice, $tab_dates)) {
                $tab_dates[] = $date_notice;
                $tab_dates2[] = $lig->date_ct;
            }
            $tab_notices[$date_notice][$cpt]['id_ct'] = $lig->id_ct;
            $tab_notices[$date_notice][$cpt]['id_login'] = $lig->id_login;
            $tab_notices[$date_notice][$cpt]['contenu'] = $lig->contenu;
            //echo " <span style='color:red'>\$tab_notices[$date_notice][$cpt]['contenu']=$lig->contenu</span><br />";
            $cpt++;
        }
    }
    if ($avec_dev == "y") {
        $sql = "SELECT ctd.* FROM ct_devoirs_entry ctd WHERE (contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct >= '" . $timestamp_debut . "'\n\t\t\t\tAND date_ct <= '" . $timestamp_fin . "'\n\t\t\t\tAND id_groupe='" . $id_groupe . "'\n\t\t\t\t) ORDER BY date_ct DESC;";
        //echo "$sql<br />";
        $res = mysqli_query($GLOBALS["mysqli"], $sql);
        $cpt = 0;
        $timestamp_courant = time();
        while ($lig = mysqli_fetch_object($res)) {
            if ($lig->date_visibilite_eleve == "" || $lig->date_visibilite_eleve != "" && mysql_date_to_unix_timestamp($lig->date_visibilite_eleve) <= $timestamp_courant || verif_groupe_appartient_prof($lig->id_groupe) == 1) {
                //echo "$lig->date_ct<br />";
                $date_dev = strftime("%a %d %b %y", $lig->date_ct);
                if (!in_array($date_dev, $tab_dates)) {
                    $tab_dates[] = $date_dev;
                    $tab_dates2[] = $lig->date_ct;
                }
                $tab_dev[$date_dev][$cpt]['id_ct'] = $lig->id_ct;
                $tab_dev[$date_dev][$cpt]['id_login'] = $lig->id_login;
                $tab_dev[$date_dev][$cpt]['contenu'] = $lig->contenu;
                //echo " <span style='color:green'>\$tab_dev[$date_dev][$cpt]['contenu']=$lig->contenu</span><br />";
                $cpt++;
            }
        }
    }
    //echo "\$current_ordre=$current_ordre<br />";
    //sort($tab_dates);
    if ($current_ordre == 'ASC') {
        array_multisort($tab_dates, SORT_DESC, SORT_NUMERIC, $tab_dates2, SORT_ASC, SORT_NUMERIC);
    } else {
        array_multisort($tab_dates, SORT_ASC, SORT_NUMERIC, $tab_dates2, SORT_DESC, SORT_NUMERIC);
    }
    return array($tab_dates, $tab_notices, $tab_dev);
}
Exemple #3
0
         $type_notice = "devoir";
     } else {
         // Plus rien à afficher, on sort de la boucle
         break;
     }
 }
 /*
 if($type_notice=="devoir") {
 	echo "<p>".$not_dev->date_visibilite_eleve."<br />";
 	echo mysql_date_to_unix_timestamp($not_dev->date_visibilite_eleve)."<br />";
 	echo $timestamp_courant."<br />";
 	echo $not_dev->contenu."<br />";
 	echo "</p>";
 }
 */
 if ($type_notice != "devoir" || $not_dev->date_visibilite_eleve == "" || $not_dev->date_visibilite_eleve != "" && mysql_date_to_unix_timestamp($not_dev->date_visibilite_eleve) <= $timestamp_courant || verif_groupe_appartient_prof($id_groupe) == 1) {
     // Passage en HTML
     // INSERT INTO setting SET name='depolluer_MSOffice', value='y';
     if (getSettingValue('depolluer_MSOffice') == 'y') {
         $content =& preg_replace('#.*<\\!\\[endif\\]-->#', "", $not_dev->contenu);
     } else {
         $content =& $not_dev->contenu;
     }
     $content .= affiche_docs_joints($not_dev->id_ct, $not_dev->type);
     echo "<h3 class='see_all_h3'>\n<strong>\n";
     if ($not_dev->type == "t") {
         echo "<a name='travail_" . $not_dev->id_ct . "'></a>";
         echo "A faire pour le : ";
     } else {
         echo "<a name='compte_rendu_" . $not_dev->id_ct . "'></a>";
     }
Exemple #4
0
/**
 * Verifie si un élève appartient à un groupe
 *
 * @deprecated La requête SQL n'est plus possible
 * @param integer $id_eleve
 * @param integer $id_groupe
 * @return boolean 0/1
 */
function verif_eleve_dans_groupe($id_eleve, $id_groupe)
{
    if ($id_groupe != "-1") {
        // On verifie l'appartenance de id_eleve au groupe id_groupe
        if (!verif_groupe_appartient_prof($id_groupe)) {
            return 0;
            exit;
        }
        $test = mysqli_query($GLOBALS["mysqli"], "select id_eleve from groupe_eleve where (id_eleve='{$id_eleve}' and id_groupe = '{$id_groupe}')");
        if (mysqli_num_rows($test) == 0) {
            return 0;
        } else {
            return 1;
        }
    } else {
        // On verifie l'appartenance de id_eleve à un groupe quelconque du professeur connecté
        $test = mysqli_query($GLOBALS["mysqli"], "select id_eleve from groupe_eleve ge, groupes g where (ge.id_eleve='{$id_eleve}' and ge.id_groupe = g.id and g.login_user='******'login'] . "')");
        if (mysqli_num_rows($test) == 0) {
            return 0;
        } else {
            return 1;
        }
    }
}