+
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $entryYear = $page->profile->entry_year;
+ $gradYear = $page->profile->grad_year;
+ $success = true;
+ if (is_null($value) || $value == $page->profile->yearpromo()) {
+ if ($gradYear != $entryYear + $page->profile->mainEducationDuration()) {
+ $promoChoice = array();
+ for ($i = $entryYear + $page->profile->mainEducationDuration(); $i <= $gradYear; ++$i) {
+ $promoChoice[] = $page->profile->mainEducation() . strval($i);
+ }
+ Platal::page()->assign('promo_choice', $promoChoice);
+ }
+ if ($page->profile->mainEducation() == 'X') {
+ return $page->profile->grad_year - $page->profile->mainEducationDuration();
+ }
+ return $page->profile->yearpromo();
+ }
+
+ // If this profile belongs to an X, $promoNew needs to be changed to
+ // the graduation year.
+ $gradYearNew = $value;
+ if ($page->profile->mainEducation() == 'X') {
+ $gradYearNew += $page->profile->mainEducationDuration();
+ }
+
+ if ($value < 1000 || $value > 9999) {
+ Platal::page()->trigError('L\'année de sortie doit être un nombre de quatre chiffres.');
+ $success = false;
+ } elseif ($gradYearNew < $entryYear + $page->profile->mainEducationDuration()) {
+ Platal::page()->trigError('Trop tôt !');
+ $success = false;
+ }
+ return intval($value);
+ }