예제 #1
0
파일: function.php 프로젝트: rhertzog/lcs
function ajoutMotifsParDefaut() {
    $motif = new AbsenceEleveMotif();
    $motif->setNom("Médical");
    $motif->setCommentaire("L'élève est absent pour raison médicale");
    if (AbsenceEleveMotifQuery::create()->filterByNom($motif->getNom())->find()->isEmpty()) {
	$motif->save();
    }

    $motif = new AbsenceEleveMotif();
    $motif->setNom("Familial");
    $motif->setCommentaire("L'élève est absent pour raison familiale");
    if (AbsenceEleveMotifQuery::create()->filterByNom($motif->getNom())->find()->isEmpty()) {
	$motif->save();
    }

    $motif = new AbsenceEleveMotif();
    $motif->setNom("Sportive");
    $motif->setCommentaire("L'élève est absent pour cause de compétition sportive");
    if (AbsenceEleveMotifQuery::create()->filterByNom($motif->getNom())->find()->isEmpty()) {
	$motif->save();
    }
}
예제 #2
0
	check_token();
    if ($motif != null) {
	$motif->moveDown();
    }
} elseif ($action == 'ajouterdefaut') {
	check_token();
    //include("function.php");
    ajoutMotifsParDefaut();
} else {
    if ($nom_motif != '') {
		check_token();
		$motif = AbsenceEleveMotifQuery::create()->findPk($id_motif);
		if ($motif == null) {
			$motif = new AbsenceEleveMotif();
		}
		$motif->setNom(stripslashes($nom_motif));
		$motif->setCommentaire(stripslashes($com_motif));
		$motif->save();
    }
}

if(isset($_GET['corriger'])) {
	check_token();

	$table="a_motifs";

	$sql="SELECT * FROM $table ORDER BY sortable_rank, nom;";
	//echo "$sql<br />";
	$res=mysqli_query($GLOBALS["mysqli"], $sql);
	$cpt=1;
	while($lig=mysqli_fetch_object($res)) {