Exemplo n.º 1
0
function DBGetTablesListByGroup($db = "db")
{
    if ($db == "db") {
        $tables = DBGetTablesList();
    } elseif ($db == "project") {
        $tables = GetTablesListReport();
    } else {
        $tables = GetTablesListCustom();
    }
    $ret = array();
    if ($db == "db") {
        $tables_admin = WRGetTableListAdmin("db");
    } elseif ($db == "project") {
        $tables_admin = WRGetTableListAdmin("project");
    } else {
        $tables_admin = WRGetTableListAdmin("custom");
    }
    $userGroups = GetUserGroup();
    //	all tables
    foreach ($tables as $table_name) {
        if ($db == "custom") {
            $tablename = $table_name["sqlname"];
        } else {
            $tablename = $table_name;
        }
        //	permissions
        foreach ($tables_admin as $tablerights) {
            if ($tablerights["tablename"] != $tablename) {
                continue;
            }
            //	user groups
            $found = false;
            if (!count($userGroups)) {
                //	no groups at all
                $found = true;
            } elseif ($tablerights["group"] == "") {
                //	initial table initialization
                $found = true;
            } else {
                foreach ($userGroups as $group) {
                    if ((string) $group == $tablerights["group"]) {
                        $found = true;
                        break;
                    }
                }
            }
            if ($found) {
                $ret[] = $table_name;
                break;
            }
        }
    }
    return $ret;
}
Exemplo n.º 2
0
$xt = new Xtempl();

$h_includes = "";
$b_includes = "";

$h_includes .= '
	<link rel="stylesheet" href="'.GetRootPathForResources("include/css/jquery-ui.css").'" type="text/css">
	<link rel="stylesheet" href="'.GetRootPathForResources("include/css/dstyle.css").'" type="text/css">
	
	<script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery.min.js").'"></script>
	<script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery.dimensions.pack.js").'"></script>
    <script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery-ui.js").'"></script>
'."\r\n";

$xt->assign("h_includes", $h_includes);
$arr_UserGroups = GetUserGroup();

$b_includes .= '<script type="text/javascript">'."\r\n";
$b_includes .= '
$(document).ready(function(){
	$("#alert").dialog({
		title: "Message",
		draggable: false,
		resizable: false,
		bgiframe: true,
		autoOpen: false,
		modal: true,
		buttons: {
			Ok: function() {
				$(this).dialog("close");
			}
Exemplo n.º 3
0
function getUser($user_id)
{
    if (GetUserGroup($user_id) == 1 || GetUserGroup($user_id) == 2) {
        $whoami = "";
        $data .= '<option value="0" selected="selected">ყველა ოპერატორი</option>';
    } else {
        $whoami = " AND `users`.`id` = {$user_id}";
    }
    $req = mysql_query("SELECT \t    `users`.`id`,\r\n                    \t\t\t\t`user_info`.`name`\r\n                        FROM \t\t`users`\r\n                        JOIN \t\t`user_info` ON `users`.`id` = `user_info`.`user_id`\r\n                        WHERE\t\t`users`.`actived` = 1 {$whoami}");
    while ($res = mysql_fetch_assoc($req)) {
        $data .= '<option value="' . $res['id'] . '">' . $res['name'] . '</option>';
    }
    return $data;
}