+ $educations = array();
+ $year = getdate();
+ $year = $year['year'];
+ $nb = 0;
+ foreach ($this->educations as $id => $edu) {
+ if (
+ (($flags & Profile::EDUCATION_MAIN) && $edu->flags->hasFlag('primary'))
+ ||
+ (($flags & Profile::EDUCATION_EXTRA) && !$edu->flags->hasFlag('primary'))
+ ||
+ (($flags & Profile::EDUCATION_FINISHED) && $edu->grad_year <= $year)
+ ||
+ (($flags & Profile::EDUCATION_CURRENT) && $edu->grad_year > $year)
+ ||
+ ($flags & Profile::EDUCATION_ALL)
+ ) {
+ $educations[$id] = $edu;
+ ++$nb;
+ }
+ if ($limit != null && $nb >= $limit) {
+ break;
+ }
+ }
+ return $educations;
+ }
+
+ public static function fetchData(array $pids, ProfileVisibility $visibility)
+ {
+ $data = XDB::iterator('SELECT pe.id, pe.pid,
+ pe.entry_year, pe.grad_year, pe.program, pe.flags,
+ pee.name AS school, pee.abbreviation AS school_short,
+ pee.url AS school_url, gc.country,
+ pede.degree, pede.abbreviation AS degree_short, pede.level AS degree_level,
+ pefe.field
+ FROM profile_education AS pe
+ LEFT JOIN profile_education_enum AS pee ON (pee.id = pe.eduid)
+ LEFT JOIN geoloc_countries AS gc ON (gc.iso_3166_1_a2 = pee.country)
+ LEFT JOIN profile_education_degree_enum AS pede ON (pede.id = pe.degreeid)
+ LEFT JOIN profile_education_field_enum AS pefe ON (pefe.id = pe.fieldid)
+ WHERE pe.pid IN {?}
+ ORDER BY ' . XDB::formatCustomOrder('pid', $pids) . ',
+ NOT FIND_IN_SET(\'primary\', pe.flags), pe.entry_year, pe.id',
+ $pids);