2011-06-01 12:13:39 +02:00
|
|
|
<?php
|
2011-06-01 15:02:00 +02:00
|
|
|
require_once ('../bootstrap.php');
|
2005-09-10 19:25:43 +02:00
|
|
|
|
|
|
|
$title = "akive Engel";
|
|
|
|
$header = "Liste der aktiven Engel";
|
2011-06-01 15:02:00 +02:00
|
|
|
include ("includes/header.php");
|
|
|
|
include ("includes/funktion_db_list.php");
|
2005-09-10 19:25:43 +02:00
|
|
|
|
|
|
|
echo "<form action=\"./aktiv.php\" method=\"post\">";
|
2011-06-01 15:02:00 +02:00
|
|
|
echo Get_Text("pub_aktive_Text1") . "<br />\n";
|
|
|
|
echo Get_Text("pub_aktive_Text2") . "<br /><br />\n";
|
|
|
|
|
2005-09-10 19:25:43 +02:00
|
|
|
// auswahlbox
|
2011-06-01 15:02:00 +02:00
|
|
|
echo Get_Text("pub_aktive_Text31") . "\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
echo "<select name=\"Anzahl\">\n";
|
2011-06-01 15:02:00 +02:00
|
|
|
for ($i = 0; $i < 50; $i++)
|
|
|
|
echo "\t<option value=\"$i\">$i</option>\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
echo "</select>";
|
2011-06-01 15:02:00 +02:00
|
|
|
echo Get_Text("pub_aktive_Text32") . "<br /><br />\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
echo "<input type=\"submit\" name=\"SendType\" value=\"Show..\">\n";
|
|
|
|
echo "<input type=\"submit\" name=\"SendType\" value=\"Write..\">\n";
|
|
|
|
echo "</form>\n";
|
|
|
|
|
|
|
|
echo "<form action=\"./aktiv.php\" method=\"post\">\n";
|
2011-06-01 15:02:00 +02:00
|
|
|
echo "\t<br /><input type=\"submit\" name=\"ResetActive\" value=\"reset Active setting\">\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
echo "</form>\n";
|
|
|
|
|
2011-06-01 15:02:00 +02:00
|
|
|
if (Isset ($_POST["ResetActive"])) {
|
|
|
|
$SQLreset = "UPDATE `User` SET `Aktiv`='0'";
|
|
|
|
$ErgReset = db_query($SQLreset, "Reset Active");
|
|
|
|
if ($ErgReset != 1)
|
|
|
|
echo "Fehler beim zuruecksetzen der Activ\n";
|
|
|
|
else
|
|
|
|
echo "Active wurde erfolgreich zurueckgesetzt\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
}
|
|
|
|
|
2011-06-01 15:02:00 +02:00
|
|
|
if (IsSet ($_POST["Anzahl"]))
|
|
|
|
echo "<br />\n\n" . Get_Text("pub_aktive_Text5_1") . $_POST["Anzahl"] . Get_Text("pub_aktive_Text5_2") . ":";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
2011-06-01 12:13:39 +02:00
|
|
|
echo "<br /><br />\n\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
|
|
|
//ausgabe tabelle
|
|
|
|
echo "<table width=\"100%\" class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n";
|
|
|
|
echo "<tr class=\"contenttopic\">\n";
|
2011-06-01 15:02:00 +02:00
|
|
|
echo "\t<td>" . Get_Text("pub_aktive_Nick") . "</td>\n";
|
|
|
|
echo "\t<td>" . Get_Text("pub_aktive_Anzahl") . "</td>\n";
|
|
|
|
echo "\t<td>" . Get_Text("pub_aktive_Time") . "</td>\n";
|
|
|
|
echo "\t<td>" . Get_Text("pub_aktive_Time") . " Weight</td>\n";
|
|
|
|
echo "\t<td>Freeloader " . Get_Text("pub_aktive_Anzahl") . "</td>\n";
|
|
|
|
echo "\t<td>Freeloader " . Get_Text("pub_aktive_Time") . "</td>\n";
|
|
|
|
echo "\t<td>" . Get_Text("pub_aktive_Time") . " result</td>\n";
|
|
|
|
echo "\t<td>" . Get_Text("pub_aktive_Active") . "</td>\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
echo "</tr>\n";
|
2011-06-01 15:02:00 +02:00
|
|
|
|
2010-12-28 15:05:59 +01:00
|
|
|
$SQL = "
|
|
|
|
SELECT d.UID, d.nr, d.len, d.lenWeight, f.nr AS nrFree, f.len AS lenFree, d.lenWeight - COALESCE(f.len, 0) as lenReal
|
2011-06-01 12:13:39 +02:00
|
|
|
FROM
|
|
|
|
(SELECT e.UID, COUNT(s.Len) as nr, SUM(s.Len) as len, SUM( s.Len*(1+(((HOUR(s.DateS)+2)%24)<10 and ((HOUR(s.DateE)+2)%24)<=10)) ) as lenWeight FROM `Shifts` AS s INNER JOIN `ShiftEntry` AS e USING(SID) WHERE NOT UID=0 GROUP BY UID) as d
|
|
|
|
LEFT JOIN
|
|
|
|
(SELECT UID, COUNT(Length) AS nr, SUM(Length) AS len FROM `ShiftFreeloader` GROUP BY UID) AS f
|
|
|
|
USING(UID)
|
|
|
|
ORDER BY lenReal DESC, nr DESC, UID";
|
2010-12-28 15:05:59 +01:00
|
|
|
|
2005-09-10 19:25:43 +02:00
|
|
|
$Erg = mysql_query($SQL, $con);
|
|
|
|
echo mysql_error($con);
|
|
|
|
$rowcount = mysql_num_rows($Erg);
|
|
|
|
|
2011-06-01 15:02:00 +02:00
|
|
|
$aktivecount = 0;
|
|
|
|
for ($i = 0; $i < $rowcount; $i++) {
|
|
|
|
echo "\n\n\t<tr class=\"content\">\n";
|
|
|
|
echo "\t\t<td>" . UID2Nick(mysql_result($Erg, $i, "UID")) . "</td>\n";
|
|
|
|
echo "\t\t<td>" . mysql_result($Erg, $i, "nr") . "x</td>\n";
|
|
|
|
echo "\t\t<td>" . mysql_result($Erg, $i, "len") . "h</td>\n";
|
|
|
|
echo "\t\t<td>" . mysql_result($Erg, $i, "lenWeight") . "h</td>\n";
|
|
|
|
echo "\t\t<td>" . mysql_result($Erg, $i, "nrFree") . "x</td>\n";
|
|
|
|
echo "\t\t<td>" . mysql_result($Erg, $i, "lenFree") . "h</td>\n";
|
|
|
|
echo "\t\t<td>" . mysql_result($Erg, $i, "lenReal") . "h</td>\n";
|
|
|
|
|
|
|
|
echo "\t\t<td>";
|
|
|
|
if (IsSet ($_POST["Anzahl"])) {
|
|
|
|
if ($_POST["Anzahl"] < mysql_result($Erg, $i, "lenReal")) {
|
|
|
|
$aktivecount++;
|
|
|
|
if ($_POST["SendType"] == "Show..")
|
|
|
|
echo "show set";
|
|
|
|
else {
|
|
|
|
$SQL2 = "UPDATE `User` SET `Aktiv`='1' WHERE `UID`='" . mysql_result($Erg, $i, "UID") . "' LIMIT 1";
|
|
|
|
$Erg2 = db_query($SQL2, "update Active State");
|
|
|
|
if ($Erg2 != 1)
|
|
|
|
echo "Fehler beim speichern bei Engel " . UID2Nick(mysql_result($Erg, $i, "UID"));
|
|
|
|
else
|
|
|
|
echo "write set";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "</td>\n";
|
|
|
|
echo "\t</tr>\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
} // ende Auflistung aktive Engel
|
|
|
|
|
|
|
|
echo "</table>";
|
|
|
|
|
2011-06-01 12:13:39 +02:00
|
|
|
echo "<br />Anzahl eintraege: $aktivecount / $rowcount (Aktive/Mitschichten)<br /><br />";
|
2007-12-28 18:30:58 +01:00
|
|
|
|
2011-06-01 15:02:00 +02:00
|
|
|
include ("includes/footer.php");
|
2005-09-10 19:25:43 +02:00
|
|
|
?>
|
|
|
|
|