Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • bc4d63163835e2034282866009f9ca5579180e7d
  • master par défaut protégée
  • develop
  • feature/demande
  • feature/user_infos
  • feature/connexion
  • feature/match
  • feature/modif_info
  • feature/accueil
  • feature/modifier_mdp
10 résultats

match_script.php

Blame
  • match_script.php 1,92 Kio
    <?php
    function match_script($student, $userRepository){
        $dispoStudent = $student->getDispo();
        $subjectStudent = $student->getSubject();
        $prof = $userRepository->fetchTeacher();
        $matchs = [];
        #$bool = false;
    
        foreach($prof as $p){
            #$firstnameProf = $p->getFirstname();
            #$nameProf = $p->getName();
            $subjectProf = $p->getSubject();
            $dispoProf = $p->getDispo();
            $mailProf = $p->getMail();
    
            foreach($subjectStudent as $ss){
                foreach($subjectProf as $sp){
                    foreach($dispoStudent as $ds){
                        foreach($dispoProf as $dp){
                            if (($ss==$sp)&&($ds==$dp)){
    
                                $match = [
                                    "teacher" => $p,
                                    "subject" => $sp,
                                    "dispo" => $dp,
                                    "mail" => $mailProf
                                ];
    
    
                                $matchs[] = $match;
                                #echo "Le professeur <b>$firstnameProf $nameProf</b> est disponible pour l'élève le <b>$ds</b> pour un cours de <b>$sp</b> </br>";
                                #$bool = true;
                                #echo "Le mail du <b>$firstnameProf $nameProf</b> est <b>$mailProf</b>
                            }
                        }
                    }
                }
            }
        }
    
        return $matchs;
    
        #if (!$bool){
        #    echo "<p>Aucun prof trouvé</p>";
        #}
    }
    
    function print_requests($requests){
    
        $noRequest = true;
    
        foreach($requests as $r){
            $subject = $r->subject;
            $student = $r->student;
            $dispo = $r->dispo;
            $accepted = $r->accepted;
    
            if (!$accepted){
                echo "<p>Vous avez une demande de $student pour un cours de $subject le $dispo</p>";
                $noRequest = false;
            }
        }
    
        if ($noRequest){
            echo "<p>Vous n'avez aucune demande</p>";
        }
    }
    
    ?>