<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
// {{{ class OrangeReq
-class OrangeReq extends Validate
+class OrangeReq extends ProfileValidate
{
// {{{ properties
public $unique = true;
- public $promo_sortie;
+ public $oldGradYear;
+ public $newGradYear;
+ public $entryYear;
public $rules = "À priori accepter (la validation sert à repousser les
petits malins). Refuse si tu connais la personne et que tu es sûr
// }}}
// {{{ constructor
- public function __construct(User &$_user, $_sortie)
+ public function __construct(User $_user, Profile $_profile, $_newGradYear)
{
- parent::__construct($_user, true, 'orange');
- $this->promo_sortie = $_sortie;
- $res = XDB::query("SELECT entry_year
+ parent::__construct($_user, $_profile, true, 'orange');
+ $this->newGradYear = $_newGradYear;
+ $res = XDB::query("SELECT entry_year, grad_year
FROM profile_education
- WHERE uid = {?} AND FIND_IN_SET('primary', flags)", $_uid);
- $this->promo = $res->fetchOneCell();
+ WHERE pid = {?} AND FIND_IN_SET('primary', flags)",
+ $this->profile->id());
+ $years = $res->fetchOneRow();
+ $this->entryYear = $years[0];
+ $this->oldGradYear = $years[1];
}
// }}}
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.";
}
}
{
XDB::execute("UPDATE profile_education
SET grad_year = {?}
- WHERE uid = {?} AND FIND_IN_SET('primary', flags)", $this->promo_sortie, $this->uid);
+ WHERE pid = {?} AND FIND_IN_SET('primary', flags)",
+ $this->newGradYear, $this->profile->id());
return true;
}