template cleanup
This commit is contained in:
parent
1e05da6c81
commit
c8041fa27f
|
@ -6,32 +6,34 @@ function admin_arrive_title() {
|
||||||
function admin_arrive() {
|
function admin_arrive() {
|
||||||
$msg = "";
|
$msg = "";
|
||||||
$search = "";
|
$search = "";
|
||||||
if (isset ($_REQUEST['search']))
|
if (isset($_REQUEST['search']))
|
||||||
$search = strip_request_item('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'];
|
$id = $_REQUEST['reset'];
|
||||||
$user_source = User($id);
|
$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");
|
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));
|
engelsystem_log("User set to not arrived: " . User_Nick_render($user_source));
|
||||||
$msg = success("Reset done. Angel has not arrived.", true);
|
$msg = success("Reset done. Angel has not arrived.", true);
|
||||||
} else $msg = error("Angel not found.", true);
|
} else
|
||||||
}
|
$msg = error("Angel not found.", true);
|
||||||
elseif (isset ($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) {
|
} elseif (isset($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) {
|
||||||
$id = $_REQUEST['arrived'];
|
$id = $_REQUEST['arrived'];
|
||||||
$user_source = User($id);
|
$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");
|
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));
|
engelsystem_log("User set has arrived: " . User_Nick_render($user_source));
|
||||||
$msg = success("Angel has been marked as arrived.", true);
|
$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`");
|
$users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
|
||||||
$table = "";
|
$table = "";
|
||||||
|
$users_matched = array();
|
||||||
if ($search == "")
|
if ($search == "")
|
||||||
$tokens = array ();
|
$tokens = array();
|
||||||
else
|
else
|
||||||
$tokens = explode(" ", $search);
|
$tokens = explode(" ", $search);
|
||||||
foreach ($users as $usr) {
|
foreach ($users as $usr) {
|
||||||
|
@ -40,25 +42,35 @@ function admin_arrive() {
|
||||||
$index = join("", $usr);
|
$index = join("", $usr);
|
||||||
foreach ($tokens as $t)
|
foreach ($tokens as $t)
|
||||||
if (stristr($index, trim($t))) {
|
if (stristr($index, trim($t))) {
|
||||||
$match = true;
|
$match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!$match)
|
if (! $match)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$table .= '<tr>';
|
$table .= '<tr>';
|
||||||
$table .= '<td>' . User_Nick_render($usr) . '</td>';
|
$table .= '<td>' . User_Nick_render($usr) . '</td>';
|
||||||
|
$usr['nick'] = User_Nick_render($usr);
|
||||||
|
$usr['arrived'] = $usr['Gekommen'] == 1 ? _("yes") : "";
|
||||||
|
$usr['actions'] = $usr['Gekommen'] == 1 ? '<a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">' . _("reset") . '</a>' : '<a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">' . _("arrived") . '</a>';
|
||||||
if ($usr['Gekommen'] == 1)
|
if ($usr['Gekommen'] == 1)
|
||||||
$table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">reset</a></td>';
|
$table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">reset</a></td>';
|
||||||
else
|
else
|
||||||
$table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">arrived</a></td>';
|
$table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">arrived</a></td>';
|
||||||
$table .= '</tr>';
|
$table .= '</tr>';
|
||||||
|
$users_matched[] = $usr;
|
||||||
}
|
}
|
||||||
return template_render('../templates/admin_arrive.html', array (
|
return page(array(
|
||||||
'search' => $search,
|
msg(),
|
||||||
'table' => $table,
|
form(array(
|
||||||
'msg' => $msg,
|
form_text('search', _("Search"), $search),
|
||||||
'link' => page_link_to('admin_arrive')
|
form_submit('submit', _("Search"))
|
||||||
|
)),
|
||||||
|
table(array(
|
||||||
|
'nick' => _("Nickname"),
|
||||||
|
'arrived' => _("Arrived?"),
|
||||||
|
'actions' => ""
|
||||||
|
), $users_matched)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
<p>
|
|
||||||
Angel types:
|
|
||||||
</p>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
Name
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Man
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Action
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
%table%
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<hr/><h2>Create new Angel type:</h2>
|
|
||||||
<form action="%link%&action=create" method="post">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
Name
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" name="name" value="" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
Man
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" name="man" value="" />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table><input type="submit" name="submit" value="Create" />
|
|
||||||
</form>
|
|
|
@ -1,24 +0,0 @@
|
||||||
Edit angel type:
|
|
||||||
<form action="%link%&action=save" 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>
|
|
||||||
</table><input type="hidden" name="id" value="%id%" /><input type="submit" name="submit" value="Save" />
|
|
||||||
</form>
|
|
||||||
<form action="%link%&action=delete" method="post">
|
|
||||||
<input type="hidden" name="id" value="%id%" /><input type="submit" name="submit" value="Delete" />
|
|
||||||
</form>
|
|
|
@ -1,23 +0,0 @@
|
||||||
<form action="%link%" method="post">
|
|
||||||
<p>
|
|
||||||
<input type="text" name="search" value="%search%" /><input type="submit" name="submit" value="Search" />
|
|
||||||
</p>
|
|
||||||
</form>%msg%
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
Nickname
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Arrived?
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Action
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
%table%
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
Loading…
Reference in New Issue