X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fprofile.php;h=0f5eb73d0b7a380023a793b735f39e170f1d9249;hb=bc0276a2d79d88a56656514fe24bd427c0ef3b88;hp=bb4d2bf97241372760f29bcfc7b4a7fa88228d89;hpb=29d68ff3edf3369886ff840a3780488e8049eccd;p=platal.git diff --git a/classes/profile.php b/classes/profile.php index bb4d2bf..0f5eb73 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -731,6 +731,34 @@ class Profile implements PlExportable return $this->corps; } + /** + * Retrieve the name of the corps which has been done. + * + * Note: this function first tries getCorps(), and if this field is blank + * tries to find an education which degree is "Corps". + * + * Returns an empty string if nothing has been found. + */ + public function getCorpsName() + { + $corps = $this->getCorps(); + if ($corps && $corps->current) { + $corpsList = DirEnum::getOptions(DirEnum::CURRENTCORPS); + return $corpsList[$corps->current]; + } + + foreach ($this->getExtraEducations() as $edu) { + if (!strcasecmp($edu->degree, 'Corps')) { + if ($edu->school_short) { + return $edu->school_short; + } elseif ($edu->school) { + return $edu->school; + } + } + } + return ''; + } + /** Networking */ private $networks = null;