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(); } }
<br/><br/> <table cellpadding="0" cellspacing="1" class="menu"> <tr> <td>Nom</td> <td>Commentaire</td> <td style="width: 25px;"></td> <td style="width: 25px;"></td> </tr> <?php $motif_collection = new PropelCollection(); $motif_collection = AbsenceEleveMotifQuery::create()->findList(); $motif = new AbsenceEleveMotif(); $i = '1'; foreach ($motif_collection as $motif) { ?> <tr> <td><?php echo $motif->getNom(); ?></td> <td><?php echo $motif->getCommentaire(); ?></td> <td><a href="admin_motifs_absences.php?action=modifier&id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>"><img src="../../images/icons/configure.png" title="Modifier" border="0" alt="" /></a></td> <td><a href="admin_motifs_absences.php?action=supprimer&id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>" onClick="return confirm('Etes-vous sûr de vouloir supprimer ce motif ?')"><img src="../../images/icons/delete.png" width="22" height="22" title="Supprimer" border="0" alt="" /></a></td> <td><a href="admin_motifs_absences.php?action=monter&id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>"><img src="../../images/up.png" width="22" height="22" title="monter" border="0" alt="" /></a></td> <td><a href="admin_motifs_absences.php?action=descendre&id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>"><img src="../../images/down.png" width="22" height="22" title="descendre" border="0" alt="" /></a></td> </tr> <?php } ?> </table> <br/><br/> </div> <?php echo check_sortable_rank_trouble('a_motifs', 'motifs'); require("../../lib/footer.inc.php"); ?>