-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCP_user.php
56 lines (31 loc) · 1.28 KB
/
CP_user.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
session_start();
ob_start();
error_reporting(E_ALL);
ini_set("display_errors", 1);
use src\ProjectWhisky\business\UserBusiness;
use Doctrine\Common\ClassLoader;
require_once("rolestarter.php");
require_once("adminRights.php"); // Redirects users ir guest from control panel to index.php if is not admin
require_once('Doctrine/Common/ClassLoader.php');
$classLoader = new ClassLoader("src");
$classLoader->register();
require_once("lib/Twig/Autoloader.php");
Twig_Autoloader::register();
$userBiz = new UserBusiness;
if (isset($_GET['search_username']) && (!empty($_GET['search_username'])))
{
$usernameTrim = trim($_GET['search_username']);
$userlist = $userBiz->getUsersByUsername($usernameTrim);
$loader = new Twig_Loader_Filesystem("src/ProjectWhisky/presentation");
$twig = new Twig_Environment($loader);
$view = $twig->render("CP_user.twig", array("user" => $_SESSION['user'], "users"=>$userlist, "searchInputUsername"=>$usernameTrim));
}
else {
$userlist = $userBiz->getAllUsers();
$loader = new Twig_Loader_Filesystem("src/ProjectWhisky/presentation");
$twig = new Twig_Environment($loader);
$view = $twig->render("CP_user.twig", array("user" => $_SESSION['user'], "users"=>$userlist));
}
print($view);
ob_flush();