Skip to content

Adding request date to user/pi requests #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions resources/lib/UnityGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ public function getRequests()

$out = array();
foreach ($requests as $request) {
array_push($out, new UnityUser($request["uid"], $this->LDAP, $this->SQL, $this->MAILER));
$user = new UnityUser($request["uid"], $this->LDAP, $this->SQL, $this->MAILER);
array_push($out, [$user, $request["timestamp"]]);
}

return $out;
Expand Down Expand Up @@ -361,9 +362,12 @@ public function getGroupMemberUIDs()

public function requestExists($user)
{
foreach ($this->getRequests() as $requester) {
if ($requester->getUID() == $user->getUID()) {
return true;
$requesters = $this->getRequests();
if (count($requesters) > 0) {
foreach ($requesters as $requester) {
if ($requester[0]->getUID() == $user->getUID()) {
return true;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions webroot/admin/pi-mgmt.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<td>Name</td>
<td>Unity ID</td>
<td>Mail</td>
<td>Requested On</td>
<td>Actions</td>
</tr>

Expand All @@ -83,6 +84,7 @@
echo "<td>" . $request_user->getFirstname() . " " . $request_user->getLastname() . "</td>";
echo "<td>" . $request_user->getUID() . "</td>";
echo "<td><a href='mailto:" . $request_user->getMail() . "'>" . $request_user->getMail() . "</a></td>";
echo "<td>" . date("jS F, Y", strtotime($request['timestamp'])) . "</td>";
echo "<td>";
echo
"<form action='' method='POST'>
Expand Down
1 change: 1 addition & 0 deletions webroot/panel/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
echo "<td>" . $requested_owner->getFirstname() . " " . $requested_owner->getLastname() . "</td>";
echo "<td>" . $requested_account->getPIUID() . "</td>";
echo "<td><a href='mailto:" . $requested_owner->getMail() . "'>" . $requested_owner->getMail() . "</a></td>";
echo "<td>" . date("jS F, Y", strtotime($request['timestamp'])) . "</td>";
echo "<td></td>";
echo "</tr>";
}
Expand Down
13 changes: 7 additions & 6 deletions webroot/panel/pi.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,19 @@

foreach ($requests as $request) {
echo "<tr>";
echo "<td>" . $request->getFirstname() . " " . $request->getLastname() . "</td>";
echo "<td>" . $request->getUID() . "</td>";
echo "<td><a href='mailto:" . $request->getMail() . "'>" . $request->getMail() . "</a></td>";
echo "<td>" . $request[0]->getFirstname() . " " . $request[0]->getLastname() . "</td>";
echo "<td>" . $request[0]->getUID() . "</td>";
echo "<td><a href='mailto:" . $request[0]->getMail() . "'>" . $request[0]->getMail() . "</a></td>";
echo "<td>" . date("jS F, Y", strtotime($request[1])) . "</td>";
echo "<td>";
echo
"<form action='' method='POST'>
<input type='hidden' name='form_name' value='userReq'>
<input type='hidden' name='uid' value='" . $request->getUID() . "'>
<input type='hidden' name='uid' value='" . $request[0]->getUID() . "'>
<input type='submit' name='action' value='Approve'
onclick='return confirm(\"Are you sure you want to approve " . $request->getUID() . "?\")'>
onclick='return confirm(\"Are you sure you want to approve " . $request[0]->getUID() . "?\")'>
<input type='submit' name='action' value='Deny'
onclick='return confirm(\"Are you sure you want to deny " . $request->getUID() . "?\")'>
onclick='return confirm(\"Are you sure you want to deny " . $request[0]->getUID() . "?\")'>
</form>";
echo "</td>";
echo "</tr>";
Expand Down