Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
25cd6e61
Commit
25cd6e61
authored
Jan 26, 2015
by
Leigh B Stoller
Browse files
Show the nonlocal_id. Change projlist to be ordered by project
most recently used.
parent
305f5a3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
www/user_defs.php
View file @
25cd6e61
<?php
#
# Copyright (c) 2006-201
4
University of Utah and the Flux Group.
# Copyright (c) 2006-201
5
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -345,6 +345,7 @@ class User
function
wikiname
()
{
return
$this
->
field
(
"wikiname"
);
}
function
wikionly
()
{
return
$this
->
field
(
"wikionly"
);
}
function
mailman_password
()
{
return
$this
->
field
(
"mailman_password"
);
}
function
nonlocal_id
()
{
return
$this
->
field
(
"nonlocal_id"
);
}
function
genesis
()
{
return
$this
->
field
(
"genesis"
);
}
function
isAPT
()
{
return
$this
->
genesis
()
==
"aptlab"
?
1
:
0
;
}
function
isCloud
()
{
return
$this
->
genesis
()
==
"cloudlab"
?
1
:
0
;
}
...
...
@@ -725,6 +726,7 @@ class User
$stud
=
$user
->
stud
();
$uuid
=
$user
->
uuid
();
$genesis
=
$user
->
genesis
();
$nonlocal_id
=
$user
->
nonlocal_id
();
if
(
!
strcmp
(
$usr_addr2
,
""
))
$usr_addr2
=
" "
;
...
...
@@ -767,6 +769,13 @@ class User
<td>Username:</td>
<td>
$uid
(
$uid_idx
)</td>
</tr>
\n
"
;
if
(
$nonlocal_id
)
{
echo
"<tr>
<td>Nonlocal ID:</td>
<td>
$nonlocal_id
</td>
</tr>
\n
"
;
}
echo
"<tr>
<td>Full Name:</td>
...
...
@@ -1165,7 +1174,7 @@ class User
# now, later return actual objects.
#
function
ProjectAccessList
(
$access_type
)
{
global
$TB_PROJECT_CREATEEXPT
;
global
$TB_PROJECT_CREATEEXPT
;
global
$TB_PROJECT_MAKEOSID
;
global
$TB_PROJECT_MAKEIMAGEID
;
global
$TB_PROJECT_MAKEGROUP
;
...
...
@@ -1224,6 +1233,40 @@ class User
$result
[
$pid
][]
=
$gid
;
}
# We want to order by time of last usage.
$query_result
=
DBQueryFatal
(
"(select pid,max(UNIX_TIMESTAMP(s.last_activity)) "
.
" as last from experiment_stats as s "
.
" where s.creator_idx='
$uid_idx
' and pid_idx!=0 "
.
" group by s.pid_idx order by last desc) "
.
"union "
.
"(select pid,max(UNIX_TIMESTAMP(created)) as last "
.
" from apt_instances "
.
" where creator_idx='
$uid_idx
' and pid is not null "
.
" group by pid_idx order by last desc)"
);
$ordered
=
array
();
while
(
$row
=
mysql_fetch_array
(
$query_result
))
{
$pid
=
$row
[
'pid'
];
$stamp
=
$row
[
'last'
];
if
(
array_key_exists
(
$pid
,
$ordered
))
{
if
(
$ordered
[
$pid
]
>
$stamp
)
{
continue
;
}
}
$ordered
[
$pid
]
=
$stamp
;
}
$sorter
=
function
(
$a
,
$b
)
use
(
$ordered
)
{
$s1
=
$ordered
[
$a
];
$s2
=
$ordered
[
$b
];
if
(
$s1
==
$s2
)
{
return
0
;
}
return
(
$s1
>
$s2
)
?
-
1
:
1
;
};
uksort
(
$result
,
$sorter
);
return
$result
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment