'admin/account/types' => $this->make_hook('account_types', AUTH_MDP, 'admin'),
'admin/xnet_without_group' => $this->make_hook('xnet_without_group', AUTH_MDP, 'admin'),
'admin/jobs' => $this->make_hook('jobs', AUTH_MDP, 'admin,edit_directory'),
- 'admin/profile' => $this->make_hook('profile', AUTH_MDP, 'admin,edit_directory')
+ 'admin/profile' => $this->make_hook('profile', AUTH_MDP, 'admin,edit_directory'),
+ 'admin/phd' => $this->make_hook('phd', AUTH_MDP, 'admin')
);
}
$degreeid = $eduDegrees[Profile::DEGREE_D];
$grad_year = $promotion;
$entry_year = $promotion - 3;
- $promo = 'D' . $promotion;
+ $promo = 'D (en cours)';
$hrpromo = $promo;
$type = 'phd';
break;
default:
- $page->killError("La formation n'est pas reconnue:" . Env::t('edu_type') . '.');
+ $page->killError("La formation n'est pas reconnue : " . Env::t('edu_type') . '.');
}
XDB::startTransaction();
ORDER BY pd.directory_name');
$page->assign('updates', $res);
}
+
+ function handler_phd($page, $promo = null, $validate = false)
+ {
+ $page->changeTpl('admin/phd.tpl');
+ $eduDegrees = DirEnum::getOptions(DirEnum::EDUDEGREES);
+ $eduDegrees = array_flip($eduDegrees);
+
+ if (is_null($promo)) {
+ $promo_list = XDB::fetchColumn('SELECT DISTINCT(grad_year)
+ FROM profile_education
+ WHERE FIND_IN_SET(\'primary\', flags) AND NOT FIND_IN_SET(\'completed\', flags) AND degreeid = {?}
+ ORDER BY grad_year',
+ $eduDegrees[Profile::DEGREE_D]);
+ $page->assign('promo_list', $promo_list);
+ $page->assign('nothing', count($promo_list) == 0);
+ return;
+ }
+
+ if ($validate) {
+ S::assert_xsrf_token();
+
+ $list = XDB::iterator('SELECT pe.pid, pd.directory_name
+ FROM profile_education AS pe
+ INNER JOIN profile_display AS pd ON (pe.pid = pd.pid)
+ WHERE FIND_IN_SET(\'primary\', pe.flags) AND NOT FIND_IN_SET(\'completed\', pe.flags)
+ AND pe.degreeid = {?} AND pe.grad_year = {?}',
+ $eduDegrees[Profile::DEGREE_D], $promo);
+ while ($res = $list->next()) {
+ $pid = $res['pid'];
+ $name = $res['directory_name'];
+ if (Post::b('completed_' . $pid)) {
+ $grad_year = Post::t('grad_year_' . $pid);
+ XDB::execute('UPDATE profile_education
+ SET flags = \'primary,completed\', grad_year = {?}
+ WHERE FIND_IN_SET(\'primary\', flags) AND pid = {?}',
+ $grad_year, $pid);
+ XDB::execute('UPDATE profile_display
+ SET promo = {?}
+ WHERE pid = {?}',
+ 'D' . $grad_year, $pid);
+ $page->trigSuccess("Promotion de $name validée.");
+ }
+ }
+ }
+
+ $list = XDB::iterator('SELECT pe.pid, pd.directory_name
+ FROM profile_education AS pe
+ INNER JOIN profile_display AS pd ON (pe.pid = pd.pid)
+ WHERE FIND_IN_SET(\'primary\', pe.flags) AND NOT FIND_IN_SET(\'completed\', pe.flags)
+ AND pe.degreeid = {?} AND pe.grad_year = {?}
+ ORDER BY pd.directory_name',
+ $eduDegrees[Profile::DEGREE_D], $promo);
+ $page->assign('list', $list);
+ $page->assign('promo', $promo);
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{if t($nothing)}
+<p>Rien à faire.</p>
+{elseif t($promo_list)}
+<p>
+ Années de soutenance de thèse prévues pour lesquelles il reste des doctorants n'ayant pas soutenus :<br />|
+ {foreach from=$promo_list item=promo}
+ <a href="admin/phd/{$promo}">{$promo}</a> |
+ {/foreach}
+</p>
+{else}
+<script type="text/javascript">//<![CDATA[
+{literal}
+var toggleState = false;
+function toggleAll() {
+ toggleState = !toggleState;
+ var boxes = $(":checkbox.completed");
+ if (toggleState) {
+ boxes.attr("checked", "checked");
+ } else {
+ boxes.removeAttr("checked");
+ }
+}
+{/literal}
+//]]></script>
+
+<form action="admin/phd/{$promo}/validate" id="phd_list" method="post">
+ {xsrf_token_field}
+ <table class="bicol" summary="liste des doctorants">
+ <tr>
+ <th>Nom</th>
+ <th>Année de soutenance prévue</th>
+ <th>A soutenu <a href="javascript:toggleAll()">{icon name="arrow_refresh" title="Tout (dé)cocher"}</a></th>
+ </tr>
+ {iterate item=profile from=$list}
+ <tr class="{cycle values="impair,pair"}">
+ <td>{$profile.directory_name}</td>
+ <td class="center">
+ <input type="text" name="grad_year_{$profile.pid}" value="{$promo}" size="10" maxlength="10" />
+ </td>
+ <td class="center">
+ <input type="checkbox" class="completed" name="completed_{$profile.pid}" />
+ </td>
+ </tr>
+ {/iterate}
+ <tr>
+ <td class="center" colspan="3">
+ <input type="submit" value="Valider" />
+ </td>
+ </tr>
+ </table>
+</form>
+
+<p>
+ <a href="admin/phd">Revenir à la liste des années de soutenance de thèse prévues pour lesquelles il reste des doctorants n'ayant pas soutenus.</a>
+</p>
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}