/** * Retourne true ou false selon que l'utilisateur a acces a la fiche de cette eleve * * @param Eleve $eleve * * @return Boolean */ public function getAccesFicheEleve(Eleve $eleve) { global $mysqli; if ($eleve === null) return false; if ($this->getStatut() == "admin") { return true; } else if ($this->getStatut() == "secours") { return true; } else if ($this->getStatut() == "scolarite") { if (getSettingValue("GepiAccesTouteFicheEleveScolarite")=='yes') { return true; } else { if (!isset($this->collAccesFicheEleves[$eleve->getPrimaryKey()])) { $this->collAccesFicheEleves[$eleve->getPrimaryKey()] = $this->getEleves()->contains($eleve); } return $this->collAccesFicheEleves[$eleve->getPrimaryKey()]; } } else if ($this->getStatut() == "cpe") { if (getSettingValue("GepiAccesTouteFicheEleveCpe")=='yes') { return true; } else { if (!isset($this->collAccesFicheEleves[$eleve->getPrimaryKey()])) { $this->collAccesFicheEleves[$eleve->getPrimaryKey()] = $this->getEleves()->contains($eleve); } return $this->collAccesFicheEleves[$eleve->getPrimaryKey()]; } } else if ($this->getStatut() == "professeur") { if (isset($this->collAccesFicheEleves[$eleve->getPrimaryKey()])) { return $this->collAccesFicheEleves[$eleve->getPrimaryKey()]; } if (getSettingValue("GepiAccesGestElevesProfP")=='yes') { if ($this->getEleves()->contains($eleve)) { $this->collAccesFicheEleves[$eleve->getPrimaryKey()] = true; return true; } } if (getSettingValue("GepiAccesGestElevesProf")=='yes') { //on cherche dans les groupes du professeur $query = EleveQuery::create()->filterById($eleve->getId()) ->useJEleveGroupeQuery()->useGroupeQuery()->useJGroupesProfesseursQuery() ->filterByUtilisateurProfessionnel($this) ->endUse()->endUse()->endUse(); if ($query->findOne() != null) { $this->collAccesFicheEleves[$eleve->getPrimaryKey()] = true; return true; } //on cherche dans les aid du professeur $query = EleveQuery::create()->filterById($eleve->getId()) ->useJAidElevesQuery()->useAidDetailsQuery()->useJAidUtilisateursProfessionnelsQuery() ->filterByUtilisateurProfessionnel($this) ->endUse()->endUse()->endUse(); if ($query->findOne() != null) { $this->collAccesFicheEleves[$eleve->getPrimaryKey()] = true; return true; } } $this->collAccesFicheEleves[$eleve->getPrimaryKey()] = false; return false; } else if ($this->getStatut() == "autre") { if (isset($this->collAccesFicheEleves['statut_autre'])) { return $this->collAccesFicheEleves['statut_autre']; } // On récupère les droits de ce statuts pour savoir ce qu'on peut afficher $sql_d = "SELECT * FROM droits_speciaux WHERE id_statut = '" . $_SESSION['statut_special_id'] . "'"; $query_d = mysqli_query($mysqli, $sql_d); while($rep_d = mysqli_fetch_array($query_d)){ //print_r($rep_d); if (($rep_d['nom_fichier'] == '/voir_resp' AND $rep_d['autorisation'] == 'V') || ($rep_d['nom_fichier'] == '/voir_ens' AND $rep_d['autorisation'] == 'V') || ($rep_d['nom_fichier'] == '/voir_notes' AND $rep_d['autorisation'] == 'V') || ($rep_d['nom_fichier'] == '/voir_bulle' AND $rep_d['autorisation'] == 'V') || ($rep_d['nom_fichier'] == '/voir_abs' AND $rep_d['autorisation'] == 'V') || ($rep_d['nom_fichier'] == '/voir_anna' AND $rep_d['autorisation'] == 'V') || ($rep_d['nom_fichier'] == '/mod_discipline/saisie_incident.php' AND $rep_d['autorisation'] == 'V') ) { $this->collAccesFicheEleves['statut_autre'] = true; return true; } } $this->collAccesFicheEleves['statut_autre'] = false; return false; } return false; }