X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Forange.inc.php;h=068aff8ac5e7e26e3e6f363bb8bc26435d6718f5;hb=86ab1c8f496429e2dfed2d0ffe9afd20531abf5b;hp=3c7d3fd25dd01d9449032ed9aaa4efead89c6266;hpb=ce0b2c6f3fc4e7c524df32f56f1bc8e8d573bb1a;p=platal.git diff --git a/include/validations/orange.inc.php b/include/validations/orange.inc.php index 3c7d3fd..068aff8 100644 --- a/include/validations/orange.inc.php +++ b/include/validations/orange.inc.php @@ -21,7 +21,7 @@ // {{{ class OrangeReq -class OrangeReq extends Validate +class OrangeReq extends ProfileValidate { // {{{ properties @@ -38,15 +38,17 @@ class OrangeReq extends Validate // }}} // {{{ constructor - public function __construct(User &$_user, $_newGradYear) + public function __construct(User &$_user, Profile &$_profile, $_newGradYear) { - parent::__construct($_user, true, 'orange'); + parent::__construct($_user, $_profile, true, 'orange'); $this->newGradYear = $_newGradYear; - $res = XDB::query("SELECT entry_year + $res = XDB::query("SELECT entry_year, grad_year FROM profile_education - WHERE pid = {?} AND FIND_IN_SET('primary', flags)", $this->user->profile()->id()); - $this->entryYear = $res->fetchOneCell(); - $this->oldGradYear = $this->entryYear + 3; + WHERE pid = {?} AND FIND_IN_SET('primary', flags)", + $this->profile->id()); + $years = $res->fetchOneRow(); + $this->entryYear = $years[0]; + $this->oldGradYear = $years[1]; } // }}} @@ -71,11 +73,11 @@ class OrangeReq extends Validate protected function _mail_body($isok) { if ($isok) { - return " La demande de changement de promotion de sortie que tu as demandée vient d'être effectuée. " + return " La demande de changement de promotion que tu as demandée vient d'être effectuée. " . "Si tu le souhaites, tu peux maintenant modifier l'affichage de ta promotion sur le site sur la page suivante : " . "https://www.polytechnique.org/profile/edit"; } else { - return " La demande de changement de promotion de sortie tu avais faite a été refusée."; + return " La demande de changement de promotion tu avais faite a été refusée."; } } @@ -86,7 +88,8 @@ class OrangeReq extends Validate { XDB::execute("UPDATE profile_education SET grad_year = {?} - WHERE pid = {?} AND FIND_IN_SET('primary', flags)", $this->newGradYear, $this->user->profile()->id()); + WHERE pid = {?} AND FIND_IN_SET('primary', flags)", + $this->newGradYear, $this->profile->id()); return true; }