if (isset($_REQUEST['count']) && preg_match("/^[0-9]+$/", $_REQUEST['count']))
if (isset($_REQUEST['count']) && preg_match("/^[0-9]+$/", $_REQUEST['count']))
$count = strip_request_item('count');
$count = strip_request_item('count');
else {
else {
$ok = false;
$ok = false;
$msg .= error("Please enter a number of angels to be marked as active.", true);
$msg .= error(_("Please enter a number of angels to be marked as active."), true);
}
}
if ($ok)
if ($ok)
$limit = " LIMIT " . $count;
$limit = " LIMIT " . $count;
if (isset($_REQUEST['ack'])) {
if (isset($_REQUEST['ack'])) {
sql_query("UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0");
sql_query("UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0");
$users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
$users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
$user_nicks = array();
$user_nicks = array();
@ -37,61 +36,58 @@ function admin_active() {
engelsystem_log("These angels are active now: " . join(", ", $user_nicks));
engelsystem_log("These angels are active now: " . join(", ", $user_nicks));
sql_query("UPDATE `User` SET `Tshirt`=0 WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
sql_query("UPDATE `User` SET `Tshirt`=0 WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
engelsystem_log("User " . User_Nick_render($user_source) . " has NO tshirt.");
engelsystem_log("User " . User_Nick_render($user_source) . " has NO tshirt.");
$msg = success("Angel has got no t-shirt.", true);
$msg = success(_("Angel has got no t-shirt."), true);
}
} else
else $msg = error("Angel not found.", true);
$msg = error(_("Angel not found."), true);
}
}
$users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
$users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
Mark <inputtype="text"name="count"value="%count%"style="width: 30px;"/>most working angels as active <inputtype="submit"name="set_active"value="Preview"/>