Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / front / planning.php @ b67d8923

Historique | Voir | Annoter | Télécharger (5,77 ko)

1
<?php
2
/*
3
 * @version $Id: planning.php 7763 2009-01-06 18:44:50Z moyo $
4
 -------------------------------------------------------------------------
5
 GLPI - Gestionnaire Libre de Parc Informatique
6
 Copyright (C) 2003-2009 by the INDEPNET Development Team.
7

8
 http://indepnet.net/   http://glpi-project.org
9
 -------------------------------------------------------------------------
10

11
 LICENSE
12

13
 This file is part of GLPI.
14

15
 GLPI is free software; you can redistribute it and/or modify
16
 it under the terms of the GNU General Public License as published by
17
 the Free Software Foundation; either version 2 of the License, or
18
 (at your option) any later version.
19

20
 GLPI is distributed in the hope that it will be useful,
21
 but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 GNU General Public License for more details.
24

25
 You should have received a copy of the GNU General Public License
26
 along with GLPI; if not, write to the Free Software
27
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
 --------------------------------------------------------------------------
29
 */
30

    
31
// ----------------------------------------------------------------------
32
// Original Author of file:
33
// Purpose of file:
34
// ----------------------------------------------------------------------
35

    
36

    
37

    
38
$NEEDED_ITEMS=array("planning","tracking","user","computer","printer","monitor","peripheral","networking","software","enterprise","reminder","phone");
39

    
40
define('GLPI_ROOT', '..');
41
include (GLPI_ROOT . "/inc/includes.php");
42

    
43
commonHeader($LANG["Menu"][29],$_SERVER['PHP_SELF'],"maintain","planning");
44

    
45
checkSeveralRightsOr(array("show_all_planning"=>"1","show_planning"=>"1"));
46

    
47
if (!isset($_GET["date"])||$_GET["date"]=="0000-00-00") $_GET["date"]=strftime("%Y-%m-%d");
48
if (!isset($_GET["type"])) $_GET["type"]="week";
49
if (!isset($_GET["uID"])||!haveRight("show_all_planning","1")) $_GET["uID"]=$_SESSION["glpiID"];
50
if (!isset($_GET["gID"])) $_GET["gID"]=0;
51
if (!isset($_GET["usertype"])) $_GET["usertype"]="user";
52

    
53
if ($_GET["type"]!="month"){
54
        $time=strtotime($_GET["date"]);
55

    
56
        $step=0;
57
        switch ($_GET["type"]){
58
                case "week":
59
                        $step=7*60*60*24;
60
                break;
61
                case "day":
62
                        $step=60*60*24;
63
                break;
64
        }
65

    
66
        $next=$time+$step+10;
67
        $prev=$time-$step;
68

    
69
        $next=strftime("%Y-%m-%d",$next);
70
        $prev=strftime("%Y-%m-%d",$prev);
71
} else {
72
        $split=split("-",$_GET["date"]);
73
        $year_next=$split[0];
74
        $month_next=$split[1]+1;
75
        if ($month_next>12) {
76
                $year_next++;
77
                $month_next-=12;
78
        }
79

    
80
        $year_prev=$split[0];
81
        $month_prev=$split[1]-1;
82

    
83
        if ($month_prev==0) {
84
                $year_prev--;
85
                $month_prev+=12;
86
        }
87
        $next=$year_next."-".$month_next."-".$split[2];
88
        $prev=$year_prev."-".$month_prev."-".$split[2];
89

    
90
}
91

    
92
echo "<div align='center'><form method=\"get\" name=\"form\" action=\"planning.php\">";
93
echo "<table class='tab_cadre'><tr class='tab_bg_2'>";
94
echo "<td>";
95
echo "<a href=\"".$_SERVER['PHP_SELF']."?type=".$_GET["type"]."&amp;uID=".$_GET["uID"]."&amp;date=$prev\"><img src=\"".$CFG_GLPI["root_doc"]."/pics/left.png\" alt='".$LANG["buttons"][12]."' title='".$LANG["buttons"][12]."'></a>";
96
echo "</td>";
97
echo "<td>";
98
if (haveRight("show_all_planning","1")){
99
        echo "<input type='radio' id='radio_user' name='usertype' value='user' ".($_GET["usertype"]=="user"?"checked":"").">";
100
        $rand_user=dropdownUsers("uID",$_GET['uID'],"interface",1,1,$_SESSION["glpiactive_entity"]);
101
        echo "<hr>";
102
        echo "<input type='radio' id='radio_group' name='usertype' value='group' ".($_GET["usertype"]=="group"?"checked":"").">";
103
        $rand_group=dropdownValue("glpi_groups","gID",$_GET['gID'],1,$_SESSION["glpiactive_entity"]);
104
        echo "<hr>";
105
        echo "<input type='radio' id='radio_group' name='usertype' value='user_group' ".($_GET["usertype"]=="user_group"?"checked":"").">";
106
        echo $LANG["joblist"][3];
107

    
108

    
109
        echo "<script type='text/javascript' >\n";
110
        echo "   new Form.Element.Observer('dropdown_uID".$rand_user."', 1, \n";
111
        echo "      function(element, value) {\n";
112
        echo "window.document.getElementById('radio_user').checked=true;";
113
        echo "});\n";
114
        echo "   new Form.Element.Observer('dropdown_gID".$rand_group."', 1, \n";
115
        echo "      function(element, value) {\n";
116
        echo "window.document.getElementById('radio_group').checked=true;";
117
        echo "});\n";
118

    
119
        echo "</script>\n";
120
} else if (haveRight("show_group_planning","1")){
121
        echo "<select name='usertype'>";
122
        echo "<option value='user' ".($_GET['usertype']=='user'?'selected':'').">".$LANG["joblist"][1]."</option>";
123
        echo "<option value='user_group' ".($_GET['usertype']=='user_group'?'selected':'').">".$LANG["joblist"][3]."</option>";
124
        echo "</select>";
125
}
126
echo "</td>";
127
echo "<td align='right'>";
128
echo $LANG["common"][27].":</td><td>";
129
echo showCalendarForm("form","date",$_GET["date"]);
130
echo "</td>";
131
echo "<td><select name='type'>";
132
echo "<option value='day' ".($_GET["type"]=="day"?" selected ":"").">".$LANG["planning"][5]."</option>";
133
echo "<option value='week' ".($_GET["type"]=="week"?" selected ":"").">".$LANG["planning"][6]."</option>";
134
echo "<option value='month' ".($_GET["type"]=="month"?" selected ":"").">".$LANG["planning"][14]."</option>";
135
echo "</select></td>";
136
echo "<td rowspan='2' align='center'><input type=\"submit\" class='button' name=\"submit\" Value=\"". $LANG["buttons"][7] ."\" /></td>";
137
echo "<td>";
138
urlIcal ($_GET['uID']);
139
echo "</td>";        
140
echo "<td>";
141
echo "<a href=\"".$_SERVER['PHP_SELF']."?type=".$_GET["type"]."&amp;uID=".$_GET["uID"]."&amp;date=$next\"><img src=\"".$CFG_GLPI["root_doc"]."/pics/right.png\" alt='".$LANG["buttons"][11]."' title='".$LANG["buttons"][11]."'></a>";
142
echo "</td>";
143

    
144
echo "</tr>";
145
echo "</table></form></div>";
146

    
147
switch ($_GET["usertype"]){
148
        case "user" :
149
                $_GET['gID']=-1;
150
                break;
151
        case "group" :        
152
                $_GET['uID']=-1;
153
                break;
154
        case "user_group":
155
                $_GET['gID']="mine";
156
                break;
157
}
158
showPlanning($_GET['uID'],$_GET['gID'],$_GET["date"],$_GET["type"]);
159

    
160

    
161

    
162
commonFooter();
163

    
164
?>
Redmine Appliance - Powered by TurnKey Linux