<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
if (!S::logged()) {
return false;
}
- if (!$survey->checkPromo(S::v('promo'))) { // checks promotion
+ $profile = S::user()->profile();
+ if (!$profile) {
+ return false;
+ }
+ // checks promotion
+ $allowed = false;
+ foreach ($profile->yearspromo() as $p) {
+ if ($survey->checkPromo($p)) {
+ $allowed = true;
+ break;
+ }
+ }
+ if (!$allowed) {
$page->kill("Tu n'as pas accès à ce sondage car il est réservé à d'autres promotions.");
}
}