Fix FS#703 - Using '+' in email redirections now works as expected. The problem was...
[platal.git] / include / applis.func.inc.php
CommitLineData
0337d704 1<?php
2/***************************************************************************
5ddeb07c 3 * Copyright (C) 2003-2007 Polytechnique.org *
0337d704 4 * http://opensource.polytechnique.org/ *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22global $page;
23
24function applis_options($current=0) {
0337d704 25 $html = '<option value="-1"></option>';
08cce2ff 26 $res = XDB::iterator("select * from applis_def order by text");
0337d704 27 while ($arr_appli = $res->next()) {
28 $html .= '<option value="'.$arr_appli["id"].'"';
29 if ($arr_appli["id"]==$current) $html .= " selected='selected'";
30 $html .= '>'.htmlspecialchars($arr_appli["text"])."</option>\n";
31 }
32 return $html;
33}
34/** pour appeller applis_options depuis smarty
35 */
36function _applis_options_smarty($params){
37 if(!isset($params['selected']))
38 $params['selected'] = 0;
39 return applis_options($params['selected']);
40}
41$page->register_function('applis_options','_applis_options_smarty');
42
43
44/** affiche un Array javascript contenant les types de chaque appli
45 */
46function applis_type(){
0337d704 47 $html = "";
08cce2ff 48 $res=XDB::iterRow("select type from applis_def order by text");
0337d704 49 if (list($appli_type) = $res->next()) {
50 $html .= "new Array('".str_replace(",","','",$appli_type)."')";
51 }
52 while (list($appli_type) = $res->next()) {
53 $html .= ",\nnew Array('".str_replace(",","','",$appli_type)."')";
54 }
55 return $html;
56}
57$page->register_function('applis_type','applis_type');
58
59/** affiche tous les types possibles d'applis
60 */
61function applis_type_all(){
08cce2ff 62 $res = XDB::query("show columns from applis_def like 'type'");
0337d704 63 $arr_appli = $res->fetchOneAssoc();
64 return str_replace(")","",str_replace("set(","",$arr_appli["Type"]));
65}
66$page->register_function('applis_type_all','applis_type_all');
67
68/** formatte une ecole d'appli pour l'affichage
69 */
70function applis_fmt($type, $text, $url) {
71 $txt="";
a7de4ef7 72 if (($type!="Ingénieur")&&($type!="Diplôme"))
0337d704 73 $txt .= $type;
a7de4ef7 74 if ($text!="Université") {
0337d704 75 if ($txt) $txt .= " ";
76 if ($url)
77 $txt .= "<a href=\"$url\" onclick=\"return popup(this)\">$text</a>";
78 else
79 $txt .= $text;
80 }
81 return $txt;
82}
83function _applis_fmt($params, &$smarty) {
84 extract($params);
85 return applis_fmt($type, $text, $url);
86}
87$page->register_function('applis_fmt','_applis_fmt');
88
a7de4ef7 89// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
0337d704 90?>