Exemplo n.º 1
0
function ui_admin_default($template_file = NULL, $html_string = NULL)
{
    $basepath = $_SESSION['basepath'];
    $template = new Template();
    $is_admin = user_admin_is_admin();
    // Deteksi User Agent
    $template->basepath = $basepath;
    if ($is_admin) {
        // definisikan content untuk header, footer, left, center dan right
        if (isset($template_file) && is_file($template_file)) {
            $middle = $template->render($template_file);
        } else {
            if (isset($html_string)) {
                $middle = $html_string;
            } else {
                // defaultnya tampilin apa bro?
                $middle = $template->render("modules/000_user_interface/templates/ui_admin_logged_in.php");
            }
        }
    } else {
        // definisikan content untuk header, footer, left, center dan right
        //		$middle = file_get_contents($basepath . "user/user/login_form");
        $middle = $template->render("modules/000_user_interface/templates/ui_admin_not_logged_in.php");
    }
    $template->middle = $middle;
    $user_property = user_user_property();
    $template->user_property = json_decode($user_property);
    $template->heartBeatInterval = 60000;
    // komponen2 template lain
    $template->is_admin = $is_admin;
    $template->top = $template->render("modules/000_user_interface/templates/top.php");
    $template->left = $template->render("modules/000_user_interface/templates/left.php");
    $template->right = $template->render("modules/000_user_interface/templates/right.php");
    $template->bottom = $template->render("modules/000_user_interface/templates/bottom.php");
    $return = $template->render("modules/000_user_interface/templates/ui_admin_default.php");
    return $return;
}
Exemplo n.º 2
0
/**
 * CRUD for all users
 * return_type = html, array
 */
function user_admin_user_list($return_type = "html")
{
    $is_admin = user_admin_is_admin();
    if (!$is_admin) {
        //		return 0;
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Account');
    $all_users = $lilo_mongo->find();
    $users_array = array();
    while ($user = $all_users->getNext()) {
        $users_array[] = $user;
    }
    if ($return_type == "array") {
        return $users_array;
    }
    $template = new Template();
    $template->users_array = $users_array;
    $template->basepath = $_SESSION['basepath'];
    $html = $template->render("modules/001_user_management/templates/user_admin_user_list.php");
    return $html;
}