+ $ft = $type;
+ }
+ $sub = '_' . $ft;
+ self::assertName($ft);
+
+ if (!is_null($variant) && $variant == 'other') {
+ $sub .= $this->pno++;
+ }
+ $this->pn[$sub] = Profile::getNameTypeId($ft);
+ return $sub;
+ }
+
+ private function nameJoins()
+ {
+ $joins = array();
+ foreach ($this->pn as $sub => $type) {
+ $joins['pn' . $sub] = array('left', 'profile_name', '$ME.pid = $PID AND $ME.typeid = ' . $type);
+ }
+ return $joins;
+ }
+
+
+ /** EDUCATION
+ */
+ const GRADE_ING = 'Ing.';
+ const GRADE_PHD = 'PhD';
+ const GRADE_MST = 'M%';
+ static public function isGrade($grade)
+ {
+ return $grade == self::GRADE_ING || self::$grade == GRADE_PHD || self::$grade == GRADE_MST;
+ }
+
+ static public function assertGrade($grade)
+ {
+ if (!self::isGrade($grade)) {
+ Platal::page()->killError("DiplĂ´me non valide");
+ }
+ }
+
+ private $pepe = array();
+ private $with_pee = false;
+ private $pe_g = 0;
+ public function addEducationFilter($x = false, $grade = null)
+ {
+ if (!$x) {
+ $index = $this->pe_g;
+ $sub = $this->pe_g++;
+ } else {
+ self::assertGrade($grade);
+ $index = $grade;
+ $sub = $grade[0];
+ $this->with_pee = true;
+ }
+ $sub = '_' . $sub;
+ $this->pepe[$index] = $sub;
+ return $sub;
+ }
+
+ private function educationJoins()
+ {
+ $joins = array();
+ if ($this->with_pee) {
+ $joins['pee'] = array('inner', 'profile_education_enum', 'pee.abbreviation = \'X\'');
+ }
+ foreach ($this->pepe as $grade => $sub) {
+ if ($this->isGrade($grade)) {
+ $joins['pe' . $sub] = array('left', 'profile_education', '$ME.eduid = pee.id AND $ME.uid = $PID');
+ $joins['pede' . $sub] = array('inner', 'profile_education_degree_enum', '$ME.id = pe' . $sub . '.degreeid AND $ME.abbreviation LIKE ' .
+ XDB::format('{?}', $grade));
+ } else {
+ $joins['pe' . $sub] = array('left', 'profile_education', '$ME.uid = $PID');
+ $joins['pee' . $sub] = array('inner', 'profile_education_enum', '$ME.id = pe' . $sub . '.eduid');
+ $joins['pede' . $sub] = array('inner', 'profile_education_degree_enum', '$ME.id = pe' . $sub . '.degreeid');
+ }