+ /* Skills */
+ private $skills = null;
+ public function setSkills(ProfileSkills $skills)
+ {
+ $this->skills = $skills;
+ }
+ public function getSkills()
+ {
+ if ($this->skills == null && !$this->fetched(self::FETCH_SKILL)) {
+ $skills = $this->getProfileField(self::FETCH_SKILL);
+ if ($skills) {
+ $this->setSkills($skills);
+ }
+ }
+
+ if ($this->skills == null) {
+ return array();
+ } else {
+ return $this->skills->skills;
+ }
+ }
+
+ /* Languades */
+ private $languages = null;
+ public function setLanguages(ProfileLanguages $languages)
+ {
+ $this->languages = $languages;
+ }
+ public function getLanguages()
+ {
+ if ($this->languages == null && !$this->fetched(self::FETCH_LANGUAGE)) {
+ $languages = $this->getProfileField(self::FETCH_LANGUAGE);
+ if ($languages) {
+ $this->setLanguages($languages);
+ }
+ }
+
+ if ($this->languages == null) {
+ return array();
+ } else {
+ return $this->languages->languages;
+ }
+ }
+
+ /** DeltaTen
+ */
+
+ /** Find out whether this profile may take part to the "DeltaTen" operation.
+ * @param $role Which role to select ('young' or 'old')
+ * @return Boolean: whether it is enabled.
+ */
+ const DELTATEN_YOUNG = 'young';
+ const DELTATEN_OLD = 'old';
+ public function isDeltaTenEnabled($role)
+ {
+ global $globals;
+ switch ($role) {
+ case self::DELTATEN_YOUNG:
+ return ($this->mainGrade() == UserFilter::GRADE_ING && $this->yearpromo() >= $globals->deltaten->first_promo_young);
+ case self::DELTATEN_OLD:
+ // Roughly compute the current promo in second year on the campus:
+ // Promo 2010 is in second year between 09/2011 and 08/2012 => use 2012.
+ // DeltaTen program begins around January of the second year.
+ $promo_on_platal = ((int) date('Y')) - 2;
+ return ($this->mainGrade() == UserFilter::GRADE_ING && $this->yearpromo() >= $globals->deltaten->first_promo_young - 10 && $this->yearpromo() <= $promo_on_platal - 10);
+ default:
+ Platal::assert(false, "Invalid DeltaTen role $role");
+ }
+ }
+
+ /** Retrieve the "Deltaten" message of the user.
+ * Returns "null" if the message is empty or the user is not taking part to the
+ * DeltaTen operation.
+ */
+ public function getDeltatenMessage()
+ {
+ if ($this->isDeltaTenEnabled(self::DELTATEN_OLD)) {
+ return $this->deltaten_message;
+ } else {
+ return null;
+ }
+ }