private function show_user_overview() { if (($user_count = $this->model->count_users()) === false) { $this->output->add_tag("result", "Database error."); return; } handle_table_sort("adminuser_order", array("id", "username", "fullname", "email", "status"), array("username", "id")); $paging = new pagination($this->output, "admin_users", $this->settings->admin_page_size, $user_count); $users = $this->model->get_users($_SESSION["adminuser_order"], $paging->offset, $paging->size); $roles = $this->model->get_roles(); if ($users === false || $roles === false) { $this->output->add_tag("result", "Database error."); return; } $status = array("Disabled", "Change password", "Active"); $this->output->open_tag("overview"); $this->output->open_tag("users"); foreach ($users as $user) { $user["status"] = $status[$user["status"]]; $this->output->open_tag("user", array("id" => $user["id"], "admin" => show_boolean($user["is_admin"]))); $this->output->add_tag("username", $user["username"]); $this->output->add_tag("fullname", $user["fullname"]); $this->output->add_tag("email", $user["email"]); $this->output->add_tag("status", $user["status"]); $this->output->close_tag(); } $this->output->close_tag(); $paging->show_browse_links(); $this->output->close_tag(); }
public function execute() { if ($_SERVER["REQUEST_METHOD"] == "POST") { /* Delete message */ if ($this->model->delete_message($_POST["id"])) { $this->user->log_action("guestbook entry %d deleted", $_POST["id"]); } } handle_table_sort("adminguestbook_order", array("author", "message", "timestamp", "ip_address"), array("timestamp", "author")); $paging = new pagination($this->output, "admin_guestbook", $this->settings->admin_page_size, $message_count); if (($guestbook = $this->model->get_messages($_SESSION["adminguestbook_order"], $paging->offset, $paging->size)) === false) { $this->output->add_tag("result", "Database error."); return; } $this->output->open_tag("guestbook"); foreach ($guestbook as $item) { $item["message"] = truncate_text($item["message"], 45); if ($this->output->mobile) { $item["timestamp"] = date("Y-m-d", $item["timestamp"]); } else { $item["timestamp"] = date("j F Y, H:i", $item["timestamp"]); } $this->output->record($item, "item"); } $paging->show_browse_links(); $this->output->close_tag(); }