Adding get_open_subscribed_requests
This commit was merged in pull request #86.
This commit is contained in:
@@ -67,6 +67,26 @@
|
||||
return $requests;
|
||||
}
|
||||
|
||||
function get_open_subscribed_requests($db) {
|
||||
$requests = array();
|
||||
$sub_tickets_stmt = "SELECT ticket_uuid FROM ticket_subscribers WHERE user_uuid=:uuid AND status != 'Closed'";
|
||||
$sub_tickets_sql = $db->prepare($sub_tickets_stmt);
|
||||
$sub_tickets_sql->bindParam(':uuid', $_SESSION['uuid']);
|
||||
$sub_tickets_sql->execute();
|
||||
$sub_tickets_sql->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$sub_tickets_result = $sub_tickets_sql->fetchAll();
|
||||
foreach ($sub_tickets_result as $tkt) {
|
||||
$stmt = "SELECT * FROM tickets WHERE uuid=:uuid";
|
||||
$sql = $db->prepare($stmt);
|
||||
$sql->bindParam(':uuid', $tkt['ticket_uuid']);
|
||||
$sql->execute();
|
||||
$sql->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$result = $sql->fetchAll();
|
||||
array_push($requests, $result[0]);
|
||||
}
|
||||
return $requests;
|
||||
}
|
||||
|
||||
function get_request($db, $uuid) {
|
||||
$ticket_stmt = "SELECT * FROM tickets WHERE uuid=:uuid";
|
||||
$ticket_sql = $db->prepare($ticket_stmt);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
if (is_signed_in()) {
|
||||
$requests = get_my_open_requests($db);
|
||||
$subscriptions = get_subscribed_requests($db);
|
||||
$subscriptions = get_open_subscribed_requests($db);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user