function displaySettings() { $tpl = new FastTemplate("templates/"); $tpl->define(array("web_main" => "web_main.html", "web_header" => "web_header.html", "head_script" => "settings/head_script.html", "profile" => "settings/profile.html", "department" => "settings/department.html", "department_option" => "settings/department_option.html", "authority" => "settings/authority.html", "body" => "settings/body.html", "web_nav" => "web_nav.html", "web_footer" => "web_footer.html")); $userDAO = new UserDAO(); $user = $userDAO->getUserByID($_SESSION["userID"]); //display profile displayProfile($user, $tpl); //display group displayGroup($user, $tpl); $role = $user->getRole(); if ($role->getRoleID() == "1" || $role->getRoleID() == "2") { //display user displayUser($user, $tpl); desplayDepartment($user, $tpl); //display record displayRecord($user, $tpl); $tpl->parse("SETTINGS_AUTHORITY", "authority"); } else { $tpl->assign("SETTINGS_DEPARTMENT", ""); $tpl->assign("SETTINGS_USER", ""); $tpl->assign("SETTINGS_RECORD", ""); $tpl->assign("SETTINGS_AUTHORITY", ""); } $tpl->assign("TITLE", "My Profile"); $tpl->parse("WEB_HEADER", "web_header"); $tpl->parse("HEAD_SCRIPT", "head_script"); $tpl->parse("WEB_NAV", "web_nav"); $tpl->parse("SETTINGS_PROFILE", "profile"); $tpl->parse("BODY", ".body"); $tpl->parse("WEB_FOOTER", "web_footer"); $tpl->parse("MAIN", "web_main"); $tpl->FastPrint(); }
function displayAllUsers() { $usersDAO = new UsersDAO(MaBD::getInstance()); $users = $usersDAO->getAll(); foreach ($users as $user) { displayUser($user); } }
$data = $db->getUsersAndTimes(); $counter = 0; $NUM_ENTRIES_PER_ROW = 4; //Bootstrap $cellSpan = "span" . 12 / $NUM_ENTRIES_PER_ROW; $numRows = ceil((double) count($data) / $NUM_ENTRIES_PER_ROW); //Display the users!! //Rows for ($rowNum = 0; $rowNum < $numRows; $rowNum++) { //Row echo "<div class='row'>\n"; //Columns for ($columnNumber = 0; $columnNumber < $NUM_ENTRIES_PER_ROW; $columnNumber++) { $userIndex = $rowNum * $NUM_ENTRIES_PER_ROW + $columnNumber; if ($userIndex < count($data)) { displayUser($data[$userIndex], $cellSpan); } } //End Row echo "</div>\n"; } function displayUser($user, $class) { // $time = $user['time'] == null ? 0 : $user['time']; echo "<div class='{$class}'>\n"; echo "<div class='well'>\n"; //Add id as a link //echo "<div class='name'><a href='index.php?id=".$user['id']."'>".$user['email']."</a></div>\n"; echo "<div class='name'>" . $user['email'] . "</div>\n"; echo "<h2><div class='time'>" . formatTime($time) . "</div></h2>\n";
} else { if ($_GET['disable']) { $in['is_active'] = 0; } } if ($_GET['password']) { if (Config::validatePassword($input["password"])) { $_SESSION['glpiID'] = $user->getID(); // to allow change $in['password'] = $in['password2'] = $_GET['password']; } else { die("Invalid new password\n"); } } if ($_GET['db']) { $in['authtype'] = 1; $in['auths_id'] = Auth::DB_GLPI; } if (count($in)) { $in['id'] = $user->getID(); if ($user->update($in)) { unset($in['id'], $in['password2']); echo "Update: succes (" . implode(', ', array_keys($in)) . ")\n"; displayUser($user); } else { echo "Update: failed\n"; } } } else { die("User not found {$_GET['user']}"); }