From c8041fa27fbabdc13af18ba5360043e4002cc24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Thu, 28 Nov 2013 22:49:15 +0100 Subject: [PATCH] template cleanup --- includes/pages/admin_arrive.php | 52 +++++++++++++--------- templates/admin_angel_types.html | 42 ----------------- templates/admin_angel_types_edit_form.html | 24 ---------- templates/admin_arrive.html | 23 ---------- 4 files changed, 32 insertions(+), 109 deletions(-) delete mode 100644 templates/admin_angel_types.html delete mode 100644 templates/admin_angel_types_edit_form.html delete mode 100644 templates/admin_arrive.html diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index 5ce21e44..1e564681 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -6,32 +6,34 @@ function admin_arrive_title() { function admin_arrive() { $msg = ""; $search = ""; - if (isset ($_REQUEST['search'])) + if (isset($_REQUEST['search'])) $search = strip_request_item('search'); - - if (isset ($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) { + + if (isset($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) { $id = $_REQUEST['reset']; $user_source = User($id); - if($user_source != null) { + if ($user_source != null) { sql_query("UPDATE `User` SET `Gekommen`=0 WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("User set to not arrived: " . User_Nick_render($user_source)); $msg = success("Reset done. Angel has not arrived.", true); - } else $msg = error("Angel not found.", true); - } - elseif (isset ($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) { + } else + $msg = error("Angel not found.", true); + } elseif (isset($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) { $id = $_REQUEST['arrived']; $user_source = User($id); - if($user_source != null) { + if ($user_source != null) { sql_query("UPDATE `User` SET `Gekommen`=1 WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); engelsystem_log("User set has arrived: " . User_Nick_render($user_source)); $msg = success("Angel has been marked as arrived.", true); - } else $msg = error("Angel not found.", true); + } else + $msg = error("Angel not found.", true); } - + $users = sql_select("SELECT * FROM `User` ORDER BY `Nick`"); $table = ""; + $users_matched = array(); if ($search == "") - $tokens = array (); + $tokens = array(); else $tokens = explode(" ", $search); foreach ($users as $usr) { @@ -40,25 +42,35 @@ function admin_arrive() { $index = join("", $usr); foreach ($tokens as $t) if (stristr($index, trim($t))) { - $match = true; - break; - } - if (!$match) + $match = true; + break; + } + if (! $match) continue; } $table .= ''; $table .= '' . User_Nick_render($usr) . ''; + $usr['nick'] = User_Nick_render($usr); + $usr['arrived'] = $usr['Gekommen'] == 1 ? _("yes") : ""; + $usr['actions'] = $usr['Gekommen'] == 1 ? '' . _("reset") . '' : '' . _("arrived") . ''; if ($usr['Gekommen'] == 1) $table .= 'yesreset'; else $table .= 'arrived'; $table .= ''; + $users_matched[] = $usr; } - return template_render('../templates/admin_arrive.html', array ( - 'search' => $search, - 'table' => $table, - 'msg' => $msg, - 'link' => page_link_to('admin_arrive') + return page(array( + msg(), + form(array( + form_text('search', _("Search"), $search), + form_submit('submit', _("Search")) + )), + table(array( + 'nick' => _("Nickname"), + 'arrived' => _("Arrived?"), + 'actions' => "" + ), $users_matched) )); } ?> diff --git a/templates/admin_angel_types.html b/templates/admin_angel_types.html deleted file mode 100644 index 4f2e3a56..00000000 --- a/templates/admin_angel_types.html +++ /dev/null @@ -1,42 +0,0 @@ -

- Angel types: -

- - - - - - - - - - %table% - -
- Name - - Man - - Action -
-

Create new Angel type:

-
- - - - - - - - - -
- Name - - -
- Man - - -
-
\ No newline at end of file diff --git a/templates/admin_angel_types_edit_form.html b/templates/admin_angel_types_edit_form.html deleted file mode 100644 index 16ffebca..00000000 --- a/templates/admin_angel_types_edit_form.html +++ /dev/null @@ -1,24 +0,0 @@ -Edit angel type: -
- - - - - - - - - -
- Name - - -
- Man - - -
-
-
- -
\ No newline at end of file diff --git a/templates/admin_arrive.html b/templates/admin_arrive.html deleted file mode 100644 index 5bc8c32b..00000000 --- a/templates/admin_arrive.html +++ /dev/null @@ -1,23 +0,0 @@ -
-

- -

-
%msg% - - - - - - - - - - %table% - -
- Nickname - - Arrived? - - Action -