summaryrefslogtreecommitdiff
path: root/www-ssl/nonpublic/schichtplan.php
blob: e8f8f02a2ef04962dfbcabc0d5b42dfa34ceb738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
  $title = "Himmel";
  $header = "Schichtpl&auml;ne";
  $submenus = 2;

  if(isset($_GET["ausdatum"]))
    $ausdatum = $_GET["ausdatum"];
  if(isset($_GET["raum"])) {
    $raum = $_GET["raum"];

    if($raum==-1 &&  isset($_GET["show"])) {
      $raum = "";
      foreach ($_GET as $k => $v) {
        if(substr($k, 0, 5) == "raum_") {
          $raum = $raum. ";". $v;
        }
      }
    }
  }

  include ("../../../camp2011/includes/header.php");
  include ("../../../camp2011/includes/funktionen.php");
  include ("../../../camp2011/includes/funktion_schichtplan.php");
  include ("../../../camp2011/includes/funktion_schichtplan_aray.php");

  echo Get_Text("Hello").$_SESSION['Nick'].",<br />".
          Get_Text("pub_schicht_beschreibung"). "<br /><br />";

  function ShowSwitchDay() {
    global $VeranstaltungsTage, $VeranstaltungsTageMax, $ausdatum, $raum;

    echo "\n\n<table border=\"0\" width=\"100%\"><tr>\n";

    if( isset($VeranstaltungsTage))
      foreach( $VeranstaltungsTage as $k => $v)
    if( $ausdatum == $v)
    {
      if( $k > 0)
        echo "\t\t\t<td align=\"left\">".
          "<a href='./schichtplan.php?ausdatum=". $VeranstaltungsTage[$k-1]. 
          "&raum=$raum'>". $VeranstaltungsTage[$k-1]. "</a></td>\n";
      if( $k < $VeranstaltungsTageMax)
        echo "\t\t\t<td align=\"right\">".
          "<a href='./schichtplan.php?ausdatum=". $VeranstaltungsTage[$k+1]. 
          "&raum=$raum'>". $VeranstaltungsTage[$k+1]. "</a></td>\n";
    }
  echo "\n\n</table>";
}

// wenn kein Datum gesetzt ist (die Seite zum ersten mal aufgerufen wird),
// das Datum auf den ersten Tag setzen...
if( !isset($ausdatum) ) 
{
  $sql = "SELECT `DateS` FROM `Shifts` WHERE `DateS` like '". gmdate("Y-m-d", time()+$gmdateOffset). "%' ORDER BY `DateS`";
//  $sql = "SELECT `DateS` FROM `Shifts` WHERE `DateS` like '2004-12-29%' ORDER BY `DateS`";
  $Erg = mysql_query($sql, $con);
  if( mysql_num_rows( $Erg ) == 0 )
  {
     $sql = "SELECT `DateS` FROM `Shifts` ORDER BY `DateS` ASC LIMIT 0, 1";
      $Erg = mysql_query($sql, $con);
  }
  if( mysql_num_rows( $Erg ) > 0 )
    $ausdatum = substr(mysql_result($Erg,0,"DateS"),0,10);
  else
    $ausdatum = gmdate("Y-m-d", time()+$gmdateOffset);

}



if ( !isset($raum) )
{
  // Ausgabe wenn kein Raum Ausgew�hlt:
  echo Get_Text("pub_schicht_auswahl_raeume"). "<br /><br />\n";

  if( isset($Room))
  {
    echo "<form action=\"./schichtplan.php\" method=\"GET\">\n";
    foreach( $Room as $RoomEntry  )
    {
      echo "\t<li><input type=\"checkbox\" name=\"raum_". $RoomEntry["RID"]. "\" value=\"". $RoomEntry["RID"]." \">";
      echo "<a href='./schichtplan.php?ausdatum=$ausdatum&raum=". $RoomEntry["RID"]. "'>". $RoomEntry["Name"]. "</a>";
      echo "</input></li>\n";
    }
    echo "<input type=\"hidden\" name=\"ausdatum\" value=\"$ausdatum\">";
    echo "<input type=\"hidden\" name=\"raum\" value=\"-1\">";
    echo "<input type=\"submit\" name=\"show\" value=\"show\">\n";
    echo "</form>\n";
  }

  echo "<br /><br />";
  echo Get_Text("pub_schicht_alles_1"). "<a href='./schichtplan.php?ausdatum=$ausdatum&raum=-1'> <u>".
       Get_Text("pub_schicht_alles_2"). "</u> </a>".Get_Text("pub_schicht_alles_3");
  echo "\n<br /><br />\n\n";
  echo "<hr>\n\n";
  echo Get_Text("pub_schicht_EmptyShifts"). "\n";
  
  
  // zeit die naesten freien schichten
  showEmptyShifts(); 
} 
else 
{   // Wenn einraum Ausgew�hlt ist:
  if( $raum == -1 ) 
    echo Get_Text("pub_schicht_Anzeige_1").$ausdatum.":<br /><br />";
  elseif( substr( $raum, 0, 1) == ";" )
    echo Get_Text("pub_schicht_Anzeige_1").$ausdatum.":<br /><br />";
  else 
    echo Get_Text("pub_schicht_Anzeige_1"). $ausdatum. 
         Get_Text("pub_schicht_Anzeige_2"). $RoomID[$raum]. "<br /><br />";

  ShowSwitchDay();

  echo "\n\n<table border=\"0\" width=\"100%\" class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n";
  echo "\t<tr class=\"contenttopic\">\n";
  echo "\t\t<td>start</td>\n";

  //Ausgabe Spalten �berschrift
  if( $raum == -1 )
  {
    if( isset($Room))
       foreach( $Room as $RoomEntry  )
      if (SummRoomShifts($RoomEntry["RID"]) > 0)
        echo "\t\t<th>". $RoomEntry["Name"]. "</th>\n";
  }
  elseif( substr( $raum, 0, 1) == ";" )
  {
    $words = preg_split("/;/", $raum); 
    foreach ($words as $word)
    {
      if( strlen(trim($word)) > 0)
        echo "\t\t<th>". $RoomID[trim($word)]. "</th>\n";
    }
  }
  else
    echo "\t\t<th>". $RoomID[$raum]. "</th>\n";
    echo "\t</tr>\n";
  
  //Zeit Ausgeben
  for( $i = 0; $i < 24; $i++ )
    for( $j = 0; $j < $GlobalZeileProStunde; $j++)
    {
      $Spalten[$i * $GlobalZeileProStunde + $j] = 
        "\t<tr class=\"content\">\n\t\t";

      //Stunde:
      $SpaltenTemp="";  
      $SpaltenTemp.= ($i<10)? "0$i:": "$i:";

      //Minute
      $TempMinuten = (($j*60) / $GlobalZeileProStunde);
      $SpaltenTemp.= ($TempMinuten<10)? "0$TempMinuten": "$TempMinuten";
        
      //aktuelle stunde markieren
      if( ($j==0) && ($i == gmdate("H", time()+$gmdateOffset)) && (gmdate("Y-m-d", time()+ $gmdateOffset) == $ausdatum) )
        $SpaltenTemp = "<h1>$SpaltenTemp</h1>";
        
      $SpaltenTemp = "<td>$SpaltenTemp</td>\n";
      $Spalten[$i * $GlobalZeileProStunde + $j].= $SpaltenTemp;
    }
  
  if( $raum == -1 )
  {
    if( isset($Room))
        foreach( $Room as $RoomEntry  )
      if (SummRoomShifts($RoomEntry["RID"]) > 0)
        CreateRoomShifts( $RoomEntry["RID"] );
  }
  elseif( substr( $raum, 0, 1) == ";" )
  {
    if( isset($Room))
    {
        $words = preg_split("/;/", $raum); 
        foreach ($words as $word)
        {
      if( strlen(trim($word)) > 0)
        if (SummRoomShifts($word) > 0)
          CreateRoomShifts( $word );
        }
    }
  }
  else
    CreateRoomShifts( $raum );
  
  //Ausageb Zeilen
  for ($i = 0; $i < (24 * $GlobalZeileProStunde); $i++) 
  {
    echo $Spalten[$i]."\t</tr>\n";
  }

    echo "</table>\n";
  
  ShowSwitchDay();

}//if (isset($raum))

echo "<a href=\"". $_SESSION["newurl"]. "&Icon=0\">@</a>";

include ("../../../camp2011/includes/footer.php");
?>