diff options
author | Philip Häusler <msquare@notrademark.de> | 2011-06-02 16:56:45 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2011-06-02 16:56:45 +0200 |
commit | 0d351f47915679f98cbd93cd5d8f4d32d91a834a (patch) | |
tree | 172987cc073c573956547a344a32a5ef6f9311d8 | |
parent | 5a935f413dd6dff69df736b437073d343aa8a6ec (diff) |
admin rooms
-rw-r--r-- | includes/funktion_schichtplan.php | 389 | ||||
-rw-r--r-- | includes/funktion_schichtplan_Tage.php | 101 | ||||
-rw-r--r-- | includes/funktion_schichtplan_aray.php | 38 | ||||
-rw-r--r-- | includes/pages/admin_rooms.php | 148 | ||||
-rw-r--r-- | includes/pages/user_news.php | 54 | ||||
-rw-r--r-- | includes/sys_shift.php | 442 | ||||
-rw-r--r-- | includes/sys_template.php | 8 | ||||
-rw-r--r-- | templates/admin_rooms_edit_form.html | 59 | ||||
-rw-r--r-- | templates/admin_rooms_new_form.html | 46 | ||||
-rw-r--r-- | www-ssl/css/base.css | 16 | ||||
-rw-r--r-- | www-ssl/index.php | 5 |
11 files changed, 751 insertions, 555 deletions
diff --git a/includes/funktion_schichtplan.php b/includes/funktion_schichtplan.php deleted file mode 100644 index 6d6c3553..00000000 --- a/includes/funktion_schichtplan.php +++ /dev/null @@ -1,389 +0,0 @@ -<?php - - -/*####################################################### -# gibt die engelschischten aus # -#######################################################*/ -function ausgabe_Feld_Inhalt( $SID, $Man ) -{ -// gibt, nach übergabe der der SchichtID (SID) und der RaumBeschreibung, -// die eingetragenden und und offenden Schichteintäge zurück - global $EngelType, $EngelTypeID, $TID2Name, $con, $debug, $gmdateOffset; - - $Spalten = ""; - - if( !isset($_GET["Icon"])) - $_GET["Icon"]=1; - - /////////////////////////////////////////////////////////////////// - // Schow Admin Page - /////////////////////////////////////////////////////////////////// - $Spalten.=funktion_isLinkAllowed_addLink_OrEmpty( - "admin/schichtplan.php?action=change&SID=$SID", - "edit<br />\n"); - - /////////////////////////////////////////////////////////////////// - // Ausgabe des Schischtnamens - /////////////////////////////////////////////////////////////////// - $SQL = "SELECT `URL` FROM `Shifts` WHERE (`SID` = '$SID');"; - $Erg = mysql_query($SQL, $con); - if( mysql_result($Erg, 0, 0) != "") - $Spalten.="<a href=\"". mysql_result($Erg, 0, 0). "\" target=\"_black\"><u>$Man:</u></a><br />"; - else - $Spalten.="<u>".$Man.":</u><br />"; - - - /////////////////////////////////////////////////////////////////// - // SQL abfrage für die benötigten schichten - /////////////////////////////////////////////////////////////////// - $SQL = "SELECT * FROM `ShiftEntry` WHERE (`SID` = '$SID') ORDER BY `TID`, `UID` DESC ;"; - $Erg = mysql_query($SQL, $con); - - $Anzahl = mysql_num_rows($Erg); - $Feld=0; - $Temp_TID_old=-1; - for( $i = 0; $i < $Anzahl; $i++ ) - { - if( isset($Temp[$Feld]["TID"])) - $Temp_TID_old = $Temp[$Feld]["TID"]; - if( isset($Temp[$Feld]["UID"])) - $Temp_UID_old = $Temp[$Feld]["UID"]; - - $Temp_TID = mysql_result($Erg, $i, "TID"); - - // wenn sich der Type ändert wird zumnästen feld geweckselt - if( $Temp_TID_old != $Temp_TID ) - $Feld++; - - $Temp[$Feld]["TID"] = $Temp_TID; - $Temp[$Feld]["UID"] = mysql_result($Erg, $i, "UID"); - - // sonderfall ersten durchlauf - if( $i == 0 ) - { - $Temp_TID_old = $Temp[$Feld]["TID"]; - $Temp_UID_old = $Temp[$Feld]["UID"]; - } - - // ist es eine zu vergeben schicht? - if( $Temp[$Feld]["UID"] == 0 ) - { - if( isset($Temp[$Feld]["free"])) - $Temp[$Feld]["free"]++; - else - $Temp[$Feld]["free"]=1; - } - else - $Temp[$Feld]["Engel"][] = $Temp[$Feld]["UID"]; - } // FOR - - - /////////////////////////////////////////////////////////////////// - // Aus gabe der Schicht - /////////////////////////////////////////////////////////////////// - if( isset($Temp)) - if( count($Temp) ) - foreach( $Temp as $TempEntry => $TempValue ) - { - if( !isset($TempValue["free"])) - $TempValue["free"] = 0; - - // ausgabe EngelType - $Spalten.= $EngelTypeID[ $TempValue["TID"] ]. " "; - - // ausgabe Eingetragener Engel - if( isset($TempValue["Engel"])) - if( count($TempValue["Engel"]) > 0 ) - { - if( count($TempValue["Engel"]) == 1 ) - $Spalten.= Get_Text("inc_schicht_ist"). ":<br />\n"; - else - $Spalten.= Get_Text("inc_schicht_sind"). ":<br />\n"; - - foreach( $TempValue["Engel"] as $TempEngelEntry=> $TempEngelID ) - { - if( funktion_isLinkAllowed( "admin/user.php") === TRUE) - { - // add color, wenn Engel "Gekommen" - $TempText= - ((UIDgekommen( $TempEngelID ) == "1") - ? "<span style=\"color: blue;\">" - : "<span style=\"color: red;\">"). - UID2Nick( $TempEngelID). "</span>"; - } - else - { - $TempText = UID2Nick( $TempEngelID ); - } - - // add link to user - $TempText= funktion_isLinkAllowed_addLink_OrLinkText( - "admin/userChangeNormal.php?enterUID=$TempEngelID&Type=Normal", - $TempText); - - $Spalten.= " ". $TempText. - ( ($_GET["Icon"]==1) ? DisplayAvatar( $TempEngelID): ""). - "<br />\n"; - - - } - $Spalten = substr( $Spalten, 0, strlen($Spalten)-7 ); - } - - // ausgabe benötigter Engel - //////////////////////////// - //in vergangenheit - $SQLtime = "SELECT `DateE` FROM `Shifts` WHERE (`SID`='$SID' AND `DateE` >= '". - gmdate("Y-m-d H:i:s", time()+ $gmdateOffset). "')"; - $Ergtime = mysql_query($SQLtime, $con); - if( mysql_num_rows( $Ergtime) > 0) - { - //wenn keien rechte definiert sind - if( !isset($_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ])) - $_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ] = "Y"; - - if( $_SESSION['CVS'][ $TID2Name[$TempValue["TID"]] ] == "Y") - if( $TempValue["free"] > 0 ) - { - $Spalten.= "<br />\n <a href=\"./schichtplan_add.php?SID=$SID&TID=". - $TempValue["TID"]."\">"; - $Spalten.= $TempValue["free"]; - if( $TempValue["free"] != 1 ) - $Spalten.= Get_Text("inc_schicht_weitere"). - " ".Get_Text("inc_schicht_Engel"). - Get_Text("inc_schicht_wird"); - else - $Spalten.= Get_Text("inc_schicht_weiterer"). - " ".Get_Text("inc_schicht_Engel"). - Get_Text("inc_schicht_werden"); - $Spalten.= Get_Text("inc_schicht_noch_gesucht"); - $Spalten.= "</a>"; - } - } - else - { - if( isset($TempValue["free"])) - if( $TempValue["free"] > 0 ) - $Spalten.= "<br />\n <h3><a>Fehlen noch: ". - $TempValue["free"]. "</a></h3>"; - } - $Spalten.= "<br />\n"; - - } // FOREACH - return $Spalten; -} // function Ausgabe_Feld_Inhalt - - - -/*####################################################### -# gibt die engelschischten Druckergerecht aus # -#######################################################*/ -function Ausgabe_Feld_Inhalt_Druck($RID, $Man ) -{ -// gibt, nach übergabe der der SchichtID (SID) und der RaumBeschreibung, -// die eingetragenden und und offenden Schichteintäge zurück - - -} // function Ausgabe_Feld_Inhalt - - - - -/*####################################################### -# Ausgabe der Raum Spalten # -#######################################################*/ -function CreateRoomShifts( $raum ) -{ - global $Spalten, $ausdatum, $con, $debug, $GlobalZeileProStunde, $error_messages; - - ///////////////////////////////////////////////////////////// - // beginnt die erste schicht vor dem heutigen tag und geht darüber hinaus - ///////////////////////////////////////////////////////////// - $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 23:59:59') AND ". - "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; - $ErgSonder = mysql_query($SQLSonder, $con); - if( (mysql_num_rows( $ErgSonder) > 1) ) - { - if( funktion_isLinkAllowed( "admin/schichtplan.php") === TRUE ) - { - echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; - for( $i=0; $i<mysql_num_rows( $ErgSonder); $i++) - { - echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". - mysql_result($ErgSonder, $i, "SID"). "\">". - mysql_result($ErgSonder, $i, "DateS"). - " '". mysql_result($ErgSonder, $i, "Man")."' (RID $raum) (00-24)". - "</a><br />\n"; - } - } - } - elseif( (mysql_num_rows( $ErgSonder) == 1) ) - { - $Spalten[0].= "<td valign=\"top\" rowspan=\"". (24 * $GlobalZeileProStunde). "\">\n". - "<h3>↑↑↑</h3>". - Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), - mysql_result($ErgSonder, 0, "Man") ). - "<h3>↓↓↓</h3>". - "\n</td>\n"; - return; - } - - $ZeitZeiger = 0; - - ///////////////////////////////////////////////////////////// - // beginnt die erste schicht vor dem heutigen tag? - ///////////////////////////////////////////////////////////// - $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 00:00:00') AND ". - "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; - $ErgSonder = mysql_query($SQLSonder, $con); - if( (mysql_num_rows( $ErgSonder) > 1) ) - { - if( funktion_isLinkAllowed( "admin/schichtplan.php") === TRUE ) - { - echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; - for( $i=0; $i<mysql_num_rows( $ErgSonder); $i++) - { - echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". - mysql_result($ErgSonder, $i, "SID"). "\">". - mysql_result($ErgSonder, $i, "DateS"). - " '". mysql_result($ErgSonder, $i, "Man")."' (RID $raum) (00-xx)". - "</a><br />\n"; - } - } - } - elseif( (mysql_num_rows( $ErgSonder) == 1) ) - { - $ZeitZeiger = substr( mysql_result($ErgSonder, 0, "DateE"), 11, 2 )+ - (substr( mysql_result($ErgSonder, 0, "DateE"), 14, 2 ) / 60); - $Spalten[0].= "<td valign=\"top\" rowspan=\"". ($ZeitZeiger * $GlobalZeileProStunde). "\">\n". - "<h3>↑↑↑</h3>". - Ausgabe_Feld_Inhalt( mysql_result($ErgSonder, 0, "SID"), - mysql_result($ErgSonder, 0, "Man") ). - "\n</td>\n"; - } - - ///////////////////////////////////////////////////////////// - // gibt die schichten für den tag aus - ///////////////////////////////////////////////////////////// - $SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') and ". - "(`DateS` >= '$ausdatum $ZeitZeiger:00:00') and ". - "(`DateS` like '$ausdatum%')) ORDER BY `DateS`;"; - $Erg = mysql_query($SQL, $con); - for( $i = 0; $i < mysql_num_rows($Erg); ++$i ) - { - $ZeitPos = substr( mysql_result($Erg, $i, "DateS"), 11, 2 )+ - (substr( mysql_result($Erg, $i, "DateS"), 14, 2 ) / 60); - $len = mysql_result($Erg, $i, "Len"); - - if( $len <= 0) - array_push( $error_messages, "Error in shift denition SID=". mysql_result($Erg, $i, "SID"). " Len=$len"); - - if( $ZeitZeiger < $ZeitPos ) - { - $Spalten[$ZeitZeiger * $GlobalZeileProStunde].= - "<td valign=\"top\" rowspan=\"". ( ($ZeitPos - $ZeitZeiger ) * $GlobalZeileProStunde ). "\"> </td>\n"; - - $ZeitZeiger += $ZeitPos - $ZeitZeiger; - } - if($ZeitZeiger == $ZeitPos ) - { - //sonderfall wenn die schicht über dei 24 stunden hinaus geht - // (eintrag abkürzen, pfeiel ausgeben) - $Spalten[$ZeitZeiger * $GlobalZeileProStunde].= - "<td valign=\"top\" rowspan=\"". - ( ( ($len+$ZeitZeiger)? $len : 24-$len+$ZeitZeiger) * $GlobalZeileProStunde). - "\">\n". - "". - Ausgabe_Feld_Inhalt( mysql_result($Erg, $i, "SID"), - mysql_result($Erg, $i, "Man") ). - (( ($ZeitZeiger+$len) > 24)? "<h3>↓↓↓</h3>" : ""). - "\n</td>\n"; - $ZeitZeiger += $len; - } - else - { - echo "<h1>". Get_Text("pub_schichtplan_colision"). "</h1> "; - echo "<a href=\"./../admin/schichtplan.php?action=change&SID=". - mysql_result($Erg, $i, "SID"). "\">". - mysql_result($Erg, $i, "DateS"). - " '". mysql_result($Erg, $i, "Man"). "' ". - " (". mysql_result($Erg, $i, "SID"). " R$raum) (xx-xx)</a><br /><br />"; - } - } - if( $ZeitZeiger < 24 ) - $Spalten[($ZeitZeiger * $GlobalZeileProStunde)].= - "<td valign=\"top\" rowspan=\"". - ((24 - $ZeitZeiger) * $GlobalZeileProStunde ). - "\"> </td>\n"; -} // function CreateRoomShifts - - -/*####################################################### -# Ausgabe der freien schichten # -#######################################################*/ -function showEmptyShifts( ) -{ - global $con, $debug, $RoomID, $gmdateOffset; - - echo "<table border=\"1\">\n"; - echo "<tr>\n"; - echo "<th>". Get_Text("inc_schicht_date"). "</th>\n"; - echo "<th>". Get_Text("inc_schicht_time"). "</th>\n"; - echo "<th>". Get_Text("inc_schicht_room"). "</th>\n"; - echo "<th>". Get_Text("inc_schicht_commend"). "</th>\n"; - echo "</tr>\n"; - - $sql = "SELECT `SID`, `DateS`, `Man`, `RID` FROM `Shifts` ". - "WHERE (`Shifts`.`DateS`>='". gmdate("Y-m-d H:i:s", time()+$gmdateOffset). "') ". - "ORDER BY `DateS`, `RID`;"; - $Erg = mysql_query($sql, $con); - - $angezeigt = 0; - for ($i=0; ($i<mysql_num_rows($Erg)) && ($angezeigt< 15); $i++) - if( isset($RoomID[mysql_result( $Erg, $i, "RID")])) - if( $RoomID[mysql_result( $Erg, $i, "RID")]!="" ) - { - $Sql2 = "SELECT `UID` FROM `ShiftEntry` ". - "WHERE `SID`=". mysql_result( $Erg, $i, "SID"). " AND ". - "`UID`='0';"; - $Erg2 = mysql_query($Sql2, $con); - - if( mysql_num_rows($Erg2)>0) - { - $angezeigt++; - echo "<tr>\n"; - echo "<td>". substr(mysql_result( $Erg, $i, "DateS"), 0, 10). "</td>\n"; - echo "<td>". substr(mysql_result( $Erg, $i, "DateS"), 11). "</td>\n"; - echo "<td>". $RoomID[mysql_result( $Erg, $i, "RID")]. "</td>\n"; - echo "<td>". - ausgabe_Feld_Inhalt( mysql_result( $Erg, $i, "SID"), mysql_result( $Erg, $i, "Man")). - "</td>\n"; - echo "</tr>\n"; - } - } - - echo "</table>\n"; - -} //function showEmptyShifts - - -/*####################################################### -# Gibt die anzahl der Schichten im Raum zurück # -#######################################################*/ -function SummRoomShifts( $raum ) -{ - global $ausdatum, $con, $debug, $GlobalZeileProStunde; - - $SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` ". - "WHERE ((`RID` = '$raum') AND (`DateE` >= '$ausdatum 00:00:00') AND ". - "(`DateS` <= '$ausdatum 23:59:59') ) ORDER BY `DateS`;"; - - $ErgSonder = mysql_query($SQLSonder, $con); - - return mysql_num_rows($ErgSonder); -} - -?> diff --git a/includes/funktion_schichtplan_Tage.php b/includes/funktion_schichtplan_Tage.php deleted file mode 100644 index 2c21a992..00000000 --- a/includes/funktion_schichtplan_Tage.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - if(!function_exists("DatumUm1TagErhoehen")) { - function DatumUm1TagErhoehen( $Datum) { - $Jahr = substr($Datum, 0, 4); - $Monat = substr($Datum, 5, 2); - $Tag = substr($Datum, 8, 2); - - $Tag++; - - switch( $Monat) { - case 1: - $Mmax = 31; - break; - case 2: - $Mmax = 28; - break; - case 3: - $Mmax = 31; - break; - case 4: - $Mmax = 30; - break; - case 5: - $Mmax = 31; - break; - case 6: - $Mmax = 30; - break; - case 7: - $Mmax = 31; - break; - case 8: - $Mmax = 31; - break; - case 9: - $Mmax = 30; - break; - case 10: - $Mmax = 31; - break; - case 11: - $Mmax = 30; - break; - case 12: - $Mmax = 31; - break; - } - - if($Tag > $Mmax) { - $Tag = 1; - $Monat++; - } - - if($Monat > 12) { - $Monat = 1; - $Jahr++; - } - - $Tag = strlen( $Tag ) == 1 ? "0".$Tag : $Tag; - $Monat = strlen( $Monat ) == 1 ? "0".$Monat : $Monat; - - return ("$Jahr-$Monat-$Tag"); - } - } - - // suchen den ersten eintrags - $SQL = "SELECT `DateS` FROM `Shifts` ORDER BY `DateS` LIMIT 1"; - $Erg = mysql_query($SQL, $con); - - $Pos = 0; - - if(mysql_num_rows($Erg) > 0) { - do { - // Startdatum einlesen und link ausgeben - $DateS = substr(mysql_result($Erg, 0 , 0), 0,10); - $VeranstaltungsTage[$Pos++] = $DateS; - - // auslesen den endes und eventuelle weitere tage ausgeben - $SQL2 = "SELECT MAX(`DateE`) FROM `Shifts` WHERE ( (`DateS` like '$DateS%') AND NOT (`DateE` like '%00:00:00'))"; - $Erg2 = mysql_query($SQL2, $con); - $DateE = substr(mysql_result($Erg2, 0 , 0), 0,10); - - if(strlen($DateE) == 0) - $DateE = $DateS; - else - while( $DateS != $DateE) { - $DateS = DatumUm1TagErhoehen( $DateS); - $VeranstaltungsTage[$Pos++] = $DateS; - } - - // suchen den naesten eintrag - $SQL = "SELECT `DateS` FROM `Shifts` ". - "WHERE (`DateS` > '$DateE 23:59:59' ) ". - "ORDER BY `DateS` ". - "LIMIT 1"; - $Erg = mysql_query($SQL, $con); - } while( mysql_fetch_row($Erg) > 0); - } - - $VeranstaltungsTageMax = $Pos - 1; -?> diff --git a/includes/funktion_schichtplan_aray.php b/includes/funktion_schichtplan_aray.php deleted file mode 100644 index f9b04bd6..00000000 --- a/includes/funktion_schichtplan_aray.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/*####################################################### -# Aufbau von Standart Feldern # -#######################################################*/ - -// erstellt ein Array der Reume - $sql = "SELECT `RID`, `Name` FROM `Room` ". - "WHERE `Show`='Y'". - "ORDER BY `Number`, `Name`;"; - - $Erg = mysql_query($sql, $con); - $rowcount = mysql_num_rows($Erg); - - for ($i=0; $i<$rowcount; $i++) - { - $Room[$i]["RID"] = mysql_result($Erg, $i, "RID"); - $Room[$i]["Name"] = mysql_result($Erg, $i, "Name"); - - $RoomID[ mysql_result($Erg, $i, "RID") ] = mysql_result($Erg, $i, "Name"); - } - -// erstellt ein Aray der Engeltypen - $sql = "SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`"; - $Erg = mysql_query($sql, $con); - $rowcount = mysql_num_rows($Erg); - for ($i=0; $i<$rowcount; $i++) - { - $EngelType[$i]["TID"] = mysql_result($Erg, $i, "TID"); - $EngelType[$i]["Name"] = mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); - - $EngelTypeID[ mysql_result($Erg, $i, "TID") ] = - mysql_result($Erg, $i, "Name").Get_Text("inc_schicht_engel"); - $TID2Name[ mysql_result($Erg, $i, "TID") ] = mysql_result($Erg, $i, "Name"); - } - -include ("funktion_schichtplan_Tage.php"); -?> diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php new file mode 100644 index 00000000..6695d6a9 --- /dev/null +++ b/includes/pages/admin_rooms.php @@ -0,0 +1,148 @@ +<?php +function admin_rooms() { + global $user; + + $html = ""; + $rooms = sql_select("SELECT * FROM `Room` ORDER BY `Number`, `Name`"); + if (!isset ($_REQUEST["action"])) { + $html .= "Hallo " . $user['Nick'] . + ",<br />\nhier hast du die Möglichkeit, neue Räume für die Schichtpläne einzutragen " . + "oder vorhandene abzuändern:<br /><br />\n"; + + $html .= "<a href=\"" . page_link_to("admin_rooms") . "&action=new\">Neuen Raum/Ort eintragen</a><br />\n"; + + // Räume auflisten + if (count($rooms) > 0) { + $html .= '<table><thead><tr>'; + + $html .= "<table width=\"100%\" class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n"; + $html .= "<tr class=\"contenttopic\">\n"; + + // Tabellenüberschriften generieren + foreach ($rooms[0] as $attr => $tmp) + if ($attr == 'RID') + $html .= '<th>Anzahl: ' . count($rooms) . '</th>'; + else + $html .= '<th>' . $attr . '</th>'; + $html .= '<th> </th>'; + $html .= '</tr></thead><tbody>'; + + foreach ($rooms as $i => $room) { + $html .= '<tr>'; + foreach ($room as $attr => $value) + if ($attr == 'RID') + $html .= '<td>' . ($i +1) . '</td>'; + else + $html .= '<td>' . $value . '</td>'; + $html .= '<td><a href="' . page_link_to("admin_rooms") . '&action=change&RID=' . $room['RID'] . '">Edit</a></td>'; + $html .= '</tr>'; + } + + $html .= '</tbody></table>'; + } + } else { + switch ($_REQUEST["action"]) { + + case 'new' : + $html .= template_render('../templates/admin_rooms_new_form.html', array ( + 'link' => page_link_to("admin_rooms") + )); + break; + + case 'newsave' : + $name = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}]{1,})/ui", '', strip_tags($_REQUEST['Name'])); + $man = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}]{1,})/ui", '', strip_tags($_REQUEST['Man'])); + $from_pentabarf = preg_replace("/([^YN]{1,})/ui", '', strip_tags($_REQUEST['FromPentabarf'])); + $show = preg_replace("/([^YN]{1,})/ui", '', strip_tags($_REQUEST['Show'])); + $number = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($_REQUEST['Number'])); + sql_query("INSERT INTO `Room` SET `Name`='" . sql_escape($name) . "', `Man`='" . sql_escape($man) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($show) . "', `Number`='" . sql_escape($number) . "'"); + header("Location: " . page_link_to("admin_rooms")); + break; + + case 'change' : + if (isset ($_REQUEST['RID']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['RID'])) + $rid = $_REQUEST['RID']; + else + return error("Incomplete call, missing Room ID."); + + $room = sql_select("SELECT * FROM `Room` WHERE `RID`=" . sql_escape($rid) . " LIMIT 1"); + if (count($room) > 0) { + list ($room) = $room; + $room_angel_types = sql_select("SELECT * FROM `AngelTypes` LEFT OUTER JOIN `RoomAngelTypes` ON (`AngelTypes`.`TID` = `RoomAngelTypes`.`angel_type_id` AND `RoomAngelTypes`.`room_id`=" . sql_escape($rid) . ") ORDER BY `AngelTypes`.`Name`"); + + $angel_types = ""; + foreach ($room_angel_types as $room_angel_type) { + if ($room_angel_type['count'] == "") + $room_angel_type['count'] = "0"; + $angel_types .= '<tr><td>' . $room_angel_type['Name'] . '</td><td><input type="text" name="angel_type_' . $room_angel_type['TID'] . '" value="' . $room_angel_type['count'] . '" /></td></tr>'; + } + + $html .= template_render('../templates/admin_rooms_edit_form.html', array ( + 'link' => page_link_to("admin_rooms"), + 'room_id' => $rid, + 'name' => $room['Name'], + 'man' => $room['Man'], + 'number' => $room['Number'], + 'from_pentabarf_options' => html_options('FromPentabarf', array ( + 'Y' => 'Yes', + 'N' => 'No' + ), $room['FromPentabarf']), + 'show_options' => html_options('Show', array ( + 'Y' => 'Yes', + 'N' => 'No' + ), $room['show']), + 'angel_types' => $angel_types + )); + } else + return error("No Room found."); + break; + + case 'changesave' : + if (isset ($_REQUEST['RID']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['RID'])) + $rid = $_REQUEST['RID']; + else + return error("Incomplete call, missing Room ID."); + + $room = sql_select("SELECT * FROM `Room` WHERE `RID`=" . sql_escape($rid) . " LIMIT 1"); + if (count($room) > 0) { + list ($room) = $room; + $room_angel_types = sql_select("SELECT * FROM `AngelTypes` LEFT OUTER JOIN `RoomAngelTypes` ON (`AngelTypes`.`TID` = `RoomAngelTypes`.`angel_type_id` AND `RoomAngelTypes`.`room_id`=" . sql_escape($rid) . ") ORDER BY `AngelTypes`.`Name`"); + + $name = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}]{1,})/ui", '', strip_tags($_REQUEST['Name'])); + $man = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}]{1,})/ui", '', strip_tags($_REQUEST['Man'])); + $from_pentabarf = preg_replace("/([^YN]{1,})/ui", '', strip_tags($_REQUEST['FromPentabarf'])); + $show = preg_replace("/([^YN]{1,})/ui", '', strip_tags($_REQUEST['Show'])); + $number = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($_REQUEST['Number'])); + sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `Man`='" . sql_escape($man) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($show) . "', `Number`='" . sql_escape($number) . "' WHERE `RID`=" . sql_escape($rid) . " LIMIT 1"); + sql_query("DELETE FROM `RoomAngelTypes` WHERE `room_id`=" . sql_escape($rid)); + foreach ($room_angel_types as $room_angel_type) { + if (isset ($_REQUEST['angel_type_' . $room_angel_type['TID']]) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['angel_type_' . $room_angel_type['TID']])) + $count = $_REQUEST['angel_type_' . $room_angel_type['TID']]; + else + $count = "0"; + sql_query("INSERT INTO `RoomAngelTypes` SET `room_id`=" . sql_escape($rid) . ", `angel_type_id`=" . sql_escape($room_angel_type['TID']) . ", `count`=" . sql_escape($count)); + } + header("Location: " . page_link_to("admin_rooms")); + } else + return error("No Room found."); + break; + + case 'delete' : + if (isset ($_REQUEST['RID']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['RID'])) + $rid = $_REQUEST['RID']; + else + return error("Incomplete call, missing Room ID."); + + if (sql_num_query("SELECT * FROM `Room` WHERE `RID`=" . sql_escape($rid) . " LIMIT 1") > 0) { + sql_query("DELETE FROM `Room` WHERE `RID`=" . sql_escape($rid) . " LIMIT 1"); + sql_query("DELETE FROM `RoomAngelTypes` WHERE `room_id`=" . sql_escape($rid) . " LIMIT 1"); + header("Location: " . page_link_to("admin_rooms")); + } else + return error("No Room found."); + break; + + } + } + return $html; +} +?> diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php index 7012bb99..4295edb8 100644 --- a/includes/pages/user_news.php +++ b/includes/pages/user_news.php @@ -64,43 +64,43 @@ function user_news_output() { for ($i = 1; $i <= $dis_rows; $i++) { if (!((($i * $DISPLAY_NEWS) - $_GET["news_begin"]) == $DISPLAY_NEWS)) { - $html .= "<a href=\"./news.php?news_begin=" . (($i * $DISPLAY_NEWS) - $DISPLAY_NEWS -1) . "\">$i</a> "; + $html .= '<a href="' . page_link_to("news") . '&news_begin=' . (($i * $DISPLAY_NEWS) - $DISPLAY_NEWS -1) . '">' . $i . '</a> '; } else { $html .= "$i "; } } $html .= '</div> - <br /><hr /> - <h2>' . Get_Text(6) . '</h2> - <a name="Neu"> </a> - - <form action="" method="post"> - <?PHP - - // Datum mit uebergeben, um doppelte Eintraege zu verhindern - // (Reload nach dem Eintragen!) - ?> - <input type="hidden" name="date" value="' . date("Y-m-d H:i:s") . '"> - <table> - <tr> - <td align="right">' . Get_Text(7) . '</td> - <td><input type="text" name="betreff" size="60"></td> - </tr> - <tr> - <td align="right">' . Get_Text(8) . '</td> - <td><textarea name="text" cols="50" rows="10"></textarea></td> - </tr>'; + <br /><hr /> + <h2>' . Get_Text(6) . '</h2> + <a name="Neu"> </a> + + <form action="" method="post"> + <?PHP + + // Datum mit uebergeben, um doppelte Eintraege zu verhindern + // (Reload nach dem Eintragen!) + ?> + <input type="hidden" name="date" value="' . date("Y-m-d H:i:s") . '"> + <table> + <tr> + <td align="right">' . Get_Text(7) . '</td> + <td><input type="text" name="betreff" size="60"></td> + </tr> + <tr> + <td align="right">' . Get_Text(8) . '</td> + <td><textarea name="text" cols="50" rows="10"></textarea></td> + </tr>'; if (in_array('news_add_meeting', $privileges)) { $html .= ' <tr> - <td align="right">' . Get_Text(9) . '</td> - <td><input type="checkbox" name="treffen" size="1" value="1"></td> - </tr>'; + <td align="right">' . Get_Text(9) . '</td> + <td><input type="checkbox" name="treffen" size="1" value="1"></td> + </tr>'; } $html .= '</table> - <br /> - <input type="submit" value="' . Get_Text("save") . '"> - </form>'; + <br /> + <input type="submit" value="' . Get_Text("save") . '"> + </form>'; return $html; } ?>
\ No newline at end of file diff --git a/includes/sys_shift.php b/includes/sys_shift.php new file mode 100644 index 00000000..ff75465c --- /dev/null +++ b/includes/sys_shift.php @@ -0,0 +1,442 @@ +<?php +function load_shift_basics() { + global $VeranstaltungsTageMax, $Room, $RoomID, $EngelType, $EngelTypeID, $TID2Name, $Veranstaltungstage; + + // erstellt ein Array der Räume + $rooms = sql_select("SELECT `RID`, `Name` FROM `Room` WHERE `Show`='Y' ORDER BY `Number`, `Name`"); + foreach ($rooms as $i => $r) { + $Room[$i] = array ( + 'RID' => $r['RID'], + 'Name' => $r['Name'] + ); + $RoomID[$r['RID']] = $r['Name']; + } + + // erstellt ein Array der Engeltypen + $engel_types = sql_select("SELECT `TID`, `Name` FROM `EngelType` ORDER BY `Name`"); + foreach ($engel_types as $engel_type) { + $EngelType[$i] = array ( + 'TID' => $engel_type['TID'], + 'Name' => $engel_type['Name'] . Get_Text("inc_schicht_engel") + ); + $EngelTypeID[$engel_type['TID']] = $engel_type['Name'] . Get_Text("inc_schicht_engel"); + $TID2Name[$engel_type['TID']] = $engel_type['Name']; + } + + // Erste Schicht suchen + $Pos = 0; + $first_shift = sql_select("SELECT `DateS` FROM `Shifts` ORDER BY `DateS` LIMIT 1"); + if (count($first_shift) > 0) { + do { + // Startdatum einlesen und link ausgeben + $DateS = substr($first_shift[0]['DateS'], 0, 10); + $VeranstaltungsTage[$Pos++] = $DateS; + + // auslesen den endes und eventuelle weitere tage ausgeben + $last_shift = sql_select("SELECT MAX(`DateE`) FROM `Shifts` WHERE ( (`DateS` like '" . sql_escape($DateS) . "%') AND NOT (`DateE` like '%00:00:00'))"); + $DateE = substr($last_shift[0]['DateE'], 0, 10); + + if (strlen($DateE) == 0) + $DateE = $DateS; + else + while ($DateS != $DateE) { + $DateS = DatumUm1TagErhoehen($DateS); + $VeranstaltungsTage[$Pos++] = $DateS; + } + + // suchen den nächsten eintrag + $first_shift = sql_select("SELECT `DateS` FROM `Shifts` " . "WHERE (`DateS` > '" . sql_escape($DateE) . " 23:59:59' ) " . "ORDER BY `DateS` " . "LIMIT 1"); + } while (count($first_shift) > 0); + } + + $VeranstaltungsTageMax = $Pos -1; +} + +/*####################################################### +# gibt die engelschischten aus # +#######################################################*/ +function ausgabe_Feld_Inhalt($SID, $Man) { + // gibt, nach �bergabe der der SchichtID (SID) und der RaumBeschreibung, + // die eingetragenden und und offenden Schichteint�ge zur�ck + global $EngelType, $EngelTypeID, $TID2Name, $con, $debug, $gmdateOffset; + + $Spalten = ""; + + if (!isset ($_GET["Icon"])) + $_GET["Icon"] = 1; + + /////////////////////////////////////////////////////////////////// + // Schow Admin Page + /////////////////////////////////////////////////////////////////// + $Spalten .= funktion_isLinkAllowed_addLink_OrEmpty("admin/schichtplan.php?action=change&SID=$SID", "edit<br />\n"); + + /////////////////////////////////////////////////////////////////// + // Ausgabe des Schischtnamens + /////////////////////////////////////////////////////////////////// + $SQL = "SELECT `URL` FROM `Shifts` WHERE (`SID` = '$SID');"; + $Erg = mysql_query($SQL, $con); + if (mysql_result($Erg, 0, 0) != "") + $Spalten .= "<a href=\"" . mysql_result($Erg, 0, 0) . "\" target=\"_black\"><u>$Man:</u></a><br />"; + else + $Spalten .= "<u>" . + $Man . ":</u><br />"; + + /////////////////////////////////////////////////////////////////// + // SQL abfrage f�r die ben�tigten schichten + /////////////////////////////////////////////////////////////////// + $SQL = "SELECT * FROM `ShiftEntry` WHERE (`SID` = '$SID') ORDER BY `TID`, `UID` DESC ;"; + $Erg = mysql_query($SQL, $con); + + $Anzahl = mysql_num_rows($Erg); + $Feld = 0; + $Temp_TID_old = -1; + for ($i = 0; $i < $Anzahl; $i++) { + if (isset ($Temp[$Feld]["TID"])) + $Temp_TID_old = $Temp[$Feld]["TID"]; + if (isset ($Temp[$Feld]["UID"])) + $Temp_UID_old = $Temp[$Feld]["UID"]; + + $Temp_TID = mysql_result($Erg, $i, "TID"); + + // wenn sich der Type �ndert wird zumn�sten feld geweckselt + if ($Temp_TID_old != $Temp_TID) + $Feld++; + + $Temp[$Feld]["TID"] = $Temp_TID; + $Temp[$Feld]["UID"] = mysql_result($Erg, $i, "UID"); + + // sonderfall ersten durchlauf + if ($i == 0) { + $Temp_TID_old = $Temp[$Feld]["TID"]; + $Temp_UID_old = $Temp[$Feld]["UID"]; + } + + // ist es eine zu vergeben schicht? + if ($Temp[$Feld]["UID"] == 0) { + if (isset ($Temp[$Feld]["free"])) + $Temp[$Feld]["free"]++; + else + $Temp[$Feld]["free"] = 1; + } else + $Temp[$Feld]["Engel"][] = $Temp[$Feld]["UID"]; + } // FOR + + /////////////////////////////////////////////////////////////////// + // Aus gabe der Schicht + /////////////////////////////////////////////////////////////////// + if (isset ($Temp)) + if (count($Temp)) + foreach ($Temp as $TempEntry => $TempValue) { + if (!isset ($TempValue["free"])) + $TempValue["free"] = 0; + + // ausgabe EngelType + $Spalten .= $EngelTypeID[$TempValue["TID"]] . " "; + + // ausgabe Eingetragener Engel + if (isset ($TempValue["Engel"])) + if (count($TempValue["Engel"]) > 0) { + if (count($TempValue["Engel"]) == 1) + $Spalten .= Get_Text("inc_schicht_ist") . ":<br />\n"; + else + $Spalten .= Get_Text("inc_schicht_sind") . ":<br />\n"; + + foreach ($TempValue["Engel"] as $TempEngelEntry => $TempEngelID) { + if (funktion_isLinkAllowed("admin/user.php") === TRUE) { + // add color, wenn Engel "Gekommen" + $TempText = ((UIDgekommen($TempEngelID) == "1") ? "<span style=\"color: blue;\">" : "<span style=\"color: red;\">") . + UID2Nick($TempEngelID) . "</span>"; + } else { + $TempText = UID2Nick($TempEngelID); + } + + // add link to user + $TempText = funktion_isLinkAllowed_addLink_OrLinkText("admin/userChangeNormal.php?enterUID=$TempEngelID&Type=Normal", $TempText); + + $Spalten .= " " . $TempText . + (($_GET["Icon"] == 1) ? DisplayAvatar($TempEngelID) : "") . + "<br />\n"; + + } + $Spalten = substr($Spalten, 0, strlen($Spalten) - 7); + } + + // ausgabe ben�tigter Engel + //////////////////////////// + //in vergangenheit + $SQLtime = "SELECT `DateE` FROM `Shifts` WHERE (`SID`='$SID' AND `DateE` >= '" . + gmdate("Y-m-d H:i:s", time() + $gmdateOffset) . "')"; + $Ergtime = mysql_query($SQLtime, $con); + if (mysql_num_rows($Ergtime) > 0) { + //wenn keien rechte definiert sind + if (!isset ($_SESSION['CVS'][$TID2Name[$TempValue["TID"]]])) + $_SESSION['CVS'][$TID2Name[$TempValue["TID"]]] = "Y"; + + if ($_SESSION['CVS'][$TID2Name[$TempValue["TID"]]] == "Y") + if ($TempValue["free"] > 0) { + $Spalten .= "<br />\n <a href=\"./schichtplan_add.php?SID=$SID&TID=" . + $TempValue["TID"] . "\">"; + $Spalten .= $TempValue["free"]; + if ($TempValue["free"] != 1) + $Spalten .= Get_Text("inc_schicht_weitere") . + " " . Get_Text("inc_schicht_Engel") . + Get_Text("inc_schicht_wird"); + else + $Spalten .= Get_Text("inc_schicht_weiterer") . + " " . Get_Text("inc_schicht_Engel") . + Get_Text("inc_schicht_werden"); + $Spalten .= Get_Text("inc_schicht_noch_gesucht"); + $Spalten .= "</a>"; + } + } else { + if (isset ($TempValue["free"])) + if ($TempValue["free"] > 0) + $Spalten .= "<br />\n <h3><a>Fehlen noch: " . + $TempValue["free"] . "</a></h3>"; + } + $Spalten .= "<br />\n"; + + } // FOREACH + return $Spalten; +} // function Ausgabe_Feld_Inhalt + +/*####################################################### +# gibt die engelschischten Druckergerecht aus # +#######################################################*/ +function Ausgabe_Feld_Inhalt_Druck($RID, $Man) { + // gibt, nach �bergabe der der SchichtID (SID) und der RaumBeschreibung, + // die eingetragenden und und offenden Schichteint�ge zur�ck + +} // function Ausgabe_Feld_Inhalt + +/*####################################################### +# Ausgabe der Raum Spalten # +#######################################################*/ +function CreateRoomShifts($raum) { + global $Spalten, $ausdatum, $con, $debug, $GlobalZeileProStunde, $error_messages; + + ///////////////////////////////////////////////////////////// + // beginnt die erste schicht vor dem heutigen tag und geht dar�ber hinaus + ///////////////////////////////////////////////////////////// + $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` " . + "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 23:59:59') AND " . + "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; + $ErgSonder = mysql_query($SQLSonder, $con); + if ((mysql_num_rows($ErgSonder) > 1)) { + if (funktion_isLinkAllowed("admin/schichtplan.php") === TRUE) { + echo "<h1>" . Get_Text("pub_schichtplan_colision") . "</h1> "; + for ($i = 0; $i < mysql_num_rows($ErgSonder); $i++) { + echo "<a href=\"./../admin/schichtplan.php?action=change&SID=" . + mysql_result($ErgSonder, $i, "SID") . "\">" . + mysql_result($ErgSonder, $i, "DateS") . + " '" . mysql_result($ErgSonder, $i, "Man") . "' (RID $raum) (00-24)" . + "</a><br />\n"; + } + } + } + elseif ((mysql_num_rows($ErgSonder) == 1)) { + $Spalten[0] .= "<td valign=\"top\" rowspan=\"" . (24 * $GlobalZeileProStunde) . "\">\n" . + "<h3>↑↑↑</h3>" . + Ausgabe_Feld_Inhalt(mysql_result($ErgSonder, 0, "SID"), mysql_result($ErgSonder, 0, "Man")) . + "<h3>↓↓↓</h3>" . + "\n</td>\n"; + return; + } + + $ZeitZeiger = 0; + + ///////////////////////////////////////////////////////////// + // beginnt die erste schicht vor dem heutigen tag? + ///////////////////////////////////////////////////////////// + $SQLSonder = "SELECT `SID`, `DateS`, `DateE` , `Len`, `Man` FROM `Shifts` " . + "WHERE ((`RID` = '$raum') AND (`DateE` > '$ausdatum 00:00:00') AND " . + "(`DateS` < '$ausdatum 00:00:00') ) ORDER BY `DateS`;"; + $ErgSonder = mysql_query($SQLSonder, $con); + if ((mysql_num_rows($ErgSonder) > 1)) { + if (funktion_isLinkAllowed("admin/schichtplan.php") === TRUE) { + echo "<h1>" . Get_Text("pub_schichtplan_colision") . "</h1> "; + for ($i = 0; $i < mysql_num_rows($ErgSonder); $i++) { + echo "<a href=\"./../admin/schichtplan.php?action=change&SID=" . + mysql_result($ErgSonder, $i, "SID") . "\">" . + mysql_result($ErgSonder, $i, "DateS") . + " '" . mysql_result($ErgSonder, $i, "Man") . "' (RID $raum) (00-xx)" . + "</a><br />\n"; + } + } + } + elseif ((mysql_num_rows($ErgSonder) == 1)) { + $ZeitZeiger = substr(mysql_result($ErgSonder, 0, "DateE"), 11, 2) + (substr(mysql_result($ErgSonder, 0, "DateE"), 14, 2) / 60); + $Spalten[0] .= "<td valign=\"top\" rowspan=\"" . ($ZeitZeiger * $GlobalZeileProStunde) . "\">\n" . + "<h3>↑↑↑</h3>" . + Ausgabe_Feld_Inhalt(mysql_result($ErgSonder, 0, "SID"), mysql_result($ErgSonder, 0, "Man")) . + "\n</td>\n"; + } + + ///////////////////////////////////////////////////////////// + // gibt die schichten f�r den tag aus + ///////////////////////////////////////////////////////////// + $SQL = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` " . + "WHERE ((`RID` = '$raum') and " . + "(`DateS` >= '$ausdatum $ZeitZeiger:00:00') and " . + "(`DateS` like '$ausdatum%')) ORDER BY `DateS`;"; + $Erg = mysql_query($SQL, $con); + for ($i = 0; $i < mysql_num_rows($Erg); ++ $i) { + $ZeitPos = substr(mysql_result($Erg, $i, "DateS"), 11, 2) + (substr(mysql_result($Erg, $i, "DateS"), 14, 2) / 60); + $len = mysql_result($Erg, $i, "Len"); + + if ($len <= 0) + array_push($error_messages, "Error in shift denition SID=" . mysql_result($Erg, $i, "SID") . " Len=$len"); + + if ($ZeitZeiger < $ZeitPos) { + $Spalten[$ZeitZeiger * $GlobalZeileProStunde] .= "<td valign=\"top\" rowspan=\"" . (($ZeitPos - $ZeitZeiger) * $GlobalZeileProStunde) . "\"> </td>\n"; + + $ZeitZeiger += $ZeitPos - $ZeitZeiger; + } + if ($ZeitZeiger == $ZeitPos) { + //sonderfall wenn die schicht �ber dei 24 stunden hinaus geht + // (eintrag abk�rzen, pfeiel ausgeben) + $Spalten[$ZeitZeiger * $GlobalZeileProStunde] .= "<td valign=\"top\" rowspan=\"" . + ((($len + $ZeitZeiger) ? $len : 24 - $len + $ZeitZeiger) * $GlobalZeileProStunde) . + "\">\n" . + "" . + Ausgabe_Feld_Inhalt(mysql_result($Erg, $i, "SID"), mysql_result($Erg, $i, "Man")) . + ((($ZeitZeiger + $len) > 24) ? "<h3>↓↓↓</h3>" : "") . + "\n</td>\n"; + $ZeitZeiger += $len; + } else { + echo "<h1>" . Get_Text("pub_schichtplan_colision") . "</h1> "; + echo "<a href=\"./../admin/schichtplan.php?action=change&SID=" . + mysql_result($Erg, $i, "SID") . "\">" . + mysql_result($Erg, $i, "DateS") . + " '" . mysql_result($Erg, $i, "Man") . "' " . + " (" . mysql_result($Erg, $i, "SID") . " R$raum) (xx-xx)</a><br /><br />"; + } + } + if ($ZeitZeiger < 24) + $Spalten[($ZeitZeiger * $GlobalZeileProStunde)] .= "<td valign=\"top\" rowspan=\"" . + ((24 - $ZeitZeiger) * $GlobalZeileProStunde) . + "\"> </td>\n"; +} // function CreateRoomShifts + +/*####################################################### +# Ausgabe der freien schichten # +#######################################################*/ +function showEmptyShifts() { + global $con, $debug, $RoomID, $gmdateOffset; + + echo "<table border=\"1\">\n"; + echo "<tr>\n"; + echo "<th>" . Get_Text("inc_schicht_date") . "</th>\n"; + echo "<th>" . Get_Text("inc_schicht_time") . "</th>\n"; + echo "<th>" . Get_Text("inc_schicht_room") . "</th>\n"; + echo "<th>" . Get_Text("inc_schicht_commend") . "</th>\n"; + echo "</tr>\n"; + + $sql = "SELECT `SID`, `DateS`, `Man`, `RID` FROM `Shifts` " . + "WHERE (`Shifts`.`DateS`>='" . gmdate("Y-m-d H:i:s", time() + $gmdateOffset) . "') " . + "ORDER BY `DateS`, `RID`;"; + $Erg = mysql_query($sql, $con); + + $angezeigt = 0; + for ($i = 0;($i < mysql_num_rows($Erg)) && ($angezeigt < 15); $i++) + if (isset ($RoomID[mysql_result($Erg, $i, "RID")])) + if ($RoomID[mysql_result($Erg, $i, "RID")] != "") { + $Sql2 = "SELECT `UID` FROM `ShiftEntry` " . + "WHERE `SID`=" . mysql_result($Erg, $i, "SID") . " AND " . + "`UID`='0';"; + $Erg2 = mysql_query($Sql2, $con); + + if (mysql_num_rows($Erg2) > 0) { + $angezeigt++; + echo "<tr>\n"; + echo "<td>" . substr(mysql_result($Erg, $i, "DateS"), 0, 10) . "</td>\n"; + echo "<td>" . substr(mysql_result($Erg, $i, "DateS"), 11) . "</td>\n"; + echo "<td>" . $RoomID[mysql_result($Erg, $i, "RID")] . "</td>\n"; + echo "<td>" . + ausgabe_Feld_Inhalt(mysql_result($Erg, $i, "SID"), mysql_result($Erg, $i, "Man")) . + "</td>\n"; + echo "</tr>\n"; + } + } + + echo "</table>\n"; + +} //function showEmptyShifts + +/*####################################################### +# Gibt die anzahl der Schichten im Raum zur�ck # +#######################################################*/ +function SummRoomShifts($raum) { + global $ausdatum, $con, $debug, $GlobalZeileProStunde; + + $SQLSonder = "SELECT `SID`, `DateS`, `Len`, `Man` FROM `Shifts` " . + "WHERE ((`RID` = '$raum') AND (`DateE` >= '$ausdatum 00:00:00') AND " . + "(`DateS` <= '$ausdatum 23:59:59') ) ORDER BY `DateS`;"; + + $ErgSonder = mysql_query($SQLSonder, $con); + + return mysql_num_rows($ErgSonder); +} + +function DatumUm1TagErhoehen($Datum) { + $Jahr = substr($Datum, 0, 4); + $Monat = substr($Datum, 5, 2); + $Tag = substr($Datum, 8, 2); + + $Tag++; + + switch ($Monat) { + case 1 : + $Mmax = 31; + break; + case 2 : + $Mmax = 28; + break; + case 3 : + $Mmax = 31; + break; + case 4 : + $Mmax = 30; + break; + case 5 : + $Mmax = 31; + break; + case 6 : + $Mmax = 30; + break; + case 7 : + $Mmax = 31; + break; + case 8 : + $Mmax = 31; + break; + case 9 : + $Mmax = 30; + break; + case 10 : + $Mmax = 31; + break; + case 11 : + $Mmax = 30; + break; + case 12 : + $Mmax = 31; + break; + } + + if ($Tag > $Mmax) { + $Tag = 1; + $Monat++; + } + + if ($Monat > 12) { + $Monat = 1; + $Jahr++; + } + + $Tag = strlen($Tag) == 1 ? "0" . $Tag : $Tag; + $Monat = strlen($Monat) == 1 ? "0" . $Monat : $Monat; + + return ("$Jahr-$Monat-$Tag"); +} +?> diff --git a/includes/sys_template.php b/includes/sys_template.php index ab613c07..2c7f4f22 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -14,4 +14,12 @@ function template_render($file, $data) { die('Cannot find template file «' . $file . '».'); } } + +function html_options($name, $options, $selected = "") { + $html = ""; + foreach ($options as $value => $label) + $html .= '<input type="radio"' . ($value == $selected ? ' selected="selected"' : '') . ' name="' . $name . '" value="' . $value . '"> ' . $label; + + return $html; +} ?>
\ No newline at end of file diff --git a/templates/admin_rooms_edit_form.html b/templates/admin_rooms_edit_form.html new file mode 100644 index 00000000..cd1506fa --- /dev/null +++ b/templates/admin_rooms_edit_form.html @@ -0,0 +1,59 @@ +Raum und dafür benötigte Engel bearbeiten: +<br/> +<form action="%link%&action=changesave" method="post"> + <table> + <tr> + <td> + Name + </td> + <td> + <input type="text" name="Name" value="%name%" /> + </td> + </tr> + <tr> + <td> + Man + </td> + <td> + <input type="text" name="Man" value="%man%" /> + </td> + </tr> + <tr> + <td> + From Pentabarf + </td> + <td> + %from_pentabarf_options% + </td> + </tr> + <tr> + <td> + Show + </td> + <td> + %show_options% + </td> + </tr> + <tr> + <td> + Number + </td> + <td> + <input type="text" name="Number" value="%number%" /> + </td> + </tr> + <tr> + <th> + Angle Type + </th> + <th> + Needed for this room + </th> + </tr> + %angel_types% + </table> + <input type="hidden" name="RID" value="%room_id%" /><input type="submit" value="Save" /> +</form> +<form action="%link%&action=delete" method="post"> + <input type="hidden" name="RID" value="%room_id%" /><input type="submit" value="Delete" /> +</form>
\ No newline at end of file diff --git a/templates/admin_rooms_new_form.html b/templates/admin_rooms_new_form.html new file mode 100644 index 00000000..68ea9485 --- /dev/null +++ b/templates/admin_rooms_new_form.html @@ -0,0 +1,46 @@ +Neuen Raum einrichten: +<br/> +<form action="%link%&action=newsave" method="post"> + <table> + <tr> + <td> + Name + </td> + <td> + <input type="text" name="Name" /> + </td> + </tr> + <tr> + <td> + Man + </td> + <td> + <input type="text" name="Man" /> + </td> + </tr> + <tr> + <td> + From Pentabarf + </td> + <td> + <input type="radio" name="FromPentabarf" value="Y" /> Yes <input type="radio" name="FromPentabarf" value="N" />No + </td> + </tr> + <tr> + <td> + Show + </td> + <td> + <input type="radio" name="Show" value="Y" /> Yes<input type="radio" name="Show" value="N" /> No + </td> + </tr> + <tr> + <td> + Number + </td> + <td> + <input type="text" name="Number" value="%number%" /> + </td> + </tr> + </table><input type="submit" value="Create" /> +</form>
\ No newline at end of file diff --git a/www-ssl/css/base.css b/www-ssl/css/base.css index 808fb512..8b46e703 100644 --- a/www-ssl/css/base.css +++ b/www-ssl/css/base.css @@ -93,6 +93,22 @@ a.sprache img { margin-right: 5px; } +table { + border-collapse: collapse; +} + +tr:hover > td { + background: #f0f0f0; +} + +th { + background: #f0f0f0; +} + +td, th { + border: 1px solid #888; +} + .background { background: #f0f0f0; } diff --git a/www-ssl/index.php b/www-ssl/index.php index 98c7e439..184702c8 100644 --- a/www-ssl/index.php +++ b/www-ssl/index.php @@ -6,6 +6,7 @@ require_once ('includes/sys_lang.php'); require_once ('includes/sys_menu.php'); require_once ('includes/sys_mysql.php'); require_once ('includes/sys_page.php'); +require_once ('includes/sys_shift.php'); require_once ('includes/sys_template.php'); require_once ('includes/sys_user.php'); @@ -43,6 +44,10 @@ if (in_array($p, $privileges)) { elseif ($p == "logout") { require_once ('includes/pages/guest_login.php'); $content = guest_logout(); + } + elseif ($p == "admin_rooms") { + require_once ('includes/pages/admin_rooms.php'); + $content = admin_rooms(); } else { require_once ('includes/pages/guest_start.php'); $content = guest_start(); |