Skip to content
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

Development #7

Merged
merged 17 commits into from
Oct 21, 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
Binary file removed .vs/slnx.sqlite
Binary file not shown.
82 changes: 61 additions & 21 deletions classes/components/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public static function display($type = '', $data = array())
case 'submission':
return self::submissionCard($data[0], $data[1], $data[2], $data[3], $data[4], $data[5]);

case 'event':
return self::eventCard($data[0], $data[1], $data[2], $data[3], $data[4], $data[5]);
case 'conferenceCard':
return self::conferenceCard($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6]);

case 'upcomingEvent':
return self::upcomingEventCard($data[0], $data[1], $data[2], $data[3]);
case 'upcomingConference':
return self::upcomingConferenceCard($data[0], $data[1], $data[2], $data[3]);

case 'userProfileCard':
return self::userProfileCard($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6]);

case 'displayEventCard':
return self::displayEventCard($data[0], $data[1], $data[2], $data[3], $data[4], $data[5]);
case 'displayConferenceCard':
return self::displayConferenceCard($data[0], $data[1], $data[2], $data[3], $data[4], $data[5]);

case 'viewSubTableHeadCard':
return self::displaySubTableHeadCard();
Expand Down Expand Up @@ -55,28 +55,40 @@ private static function submissionCard($cTitle, $filePath, $status, $date, $time
';
}

private static function eventCard($title, $link, $timestamp, $filePath, $presenter, $status)
private static function conferenceCard($title, $date, $time, $link, $filePath, $status, $subId)
{
$accept_selected = $reject_selected = "";
if ($status == "pending") {
$accept_selected = $reject_selected = "";
}
else if ($status == 1) {
$accept_selected = "selected";
}
else if ($status == 0) {
$reject_selected = "selected";
}


return '
<div class="card">
<span class="badge ' . self::defineConfirmationStatus($status) . ' text-dark">Event ' . $status . '</span>
<span class="badge ' . self::defineAttendanceBadge($status) . ' text-dark">' . self::defineAttendanceStatus($status) . '</span>
<div class="card-body">
<h5 class="card-title">' . $title . '</h5>
<h6 class="card-subtitle mb-2 text-muted">Presented by: ' . $presenter . ' </h6>
<div class="text-left">
<p class="card-text">
<strong> Event Date </strong> : ' . date("d M y \a\\t g:i A", strtotime($timestamp)) . '</a><br>
<strong> Event Date </strong> : ' . $date . '</a><br>
<strong> Event Time </strong> : ' . $time . '</a><br>
<strong> Meeting URL </strong> : <a href="' . $link . '">' . $link . '</a><br>
<strong> Paper to be presented </strong> : <a href="' . $filePath . '">' . $filePath . '</a>
<strong> Paper to be presented </strong> : <a href=./viewSubmission?filepath=' . rawurlencode($filePath) . '&subId=' . $subId . '">' . $filePath . '</a>
</p>
<form>
<select class="form-select" name="attendanceOption">
<option value="accept">Confirmed Attendance</option>
<option value="reject">Cancel Attendance</option>
<form action="#" method="post">
<select class="form-select" name="attendance_options">
<option value="accept-' . $subId . '"' . $accept_selected .'>Confirm Attendance</option>
<option value="reject-' . $subId . '"' . $reject_selected .'>Cancel Attendance</option>
</select>
<br>
<div class="form-group btn-group-sm d-grid gap-2">
<button name="submitAttendance" type="submit" class="btn btn-primary" onclick="showToast()">Submit Attendance</button>
<button name="submitAttendance" type="submit" class="btn btn-primary">Submit Attendance</button>
</div>
</form>
</div>
Expand All @@ -86,15 +98,15 @@ private static function eventCard($title, $link, $timestamp, $filePath, $present
';
}

private static function upcomingEventCard($title, $timestamp, $eventURL, $status)
private static function upcomingConferenceCard($title, $timestamp, $conferenceURL, $status)
{
return '
<div class="card bg-gradient-light">
<span class="badge ' . self::defineConfirmationStatus($status) . ' text-dark">' . $status . '</span>
<div class="card-body">
<h5 class="card-title">' . $title . '</h5>
<h6 class="card-subtitle mb-2 text-muted">Event at: ' . $timestamp . ' </h6>
<a class="stretched-link" href="' . $eventURL . '" class="card-link">View My Event in Details</a>
<h6 class="card-subtitle mb-2 text-muted">Conference at: ' . $timestamp . ' </h6>
<a class="stretched-link" href="' . $conferenceURL . '" class="card-link">View My Conference in Details</a>
</div>
</div>
<br>
Expand Down Expand Up @@ -226,7 +238,7 @@ private static function userProfileCard($id, $fName, $lName, $email, $phoneNo, $
}
}

private static function displayEventCard($id, $title, $sTimestamp, $eTimestamp, $location, $status)
private static function displayConferenceCard($id, $title, $sTimestamp, $eTimestamp, $location, $status)
{
return '
<div class="card">
Expand All @@ -235,7 +247,7 @@ private static function displayEventCard($id, $title, $sTimestamp, $eTimestamp,
<h6 class="card-subtitle mb-2">Start Date: <a class="text-muted"> ' . date("d M y \a\\t g:i A", strtotime($sTimestamp)) . '</a> </h6>
<h6 class="card-subtitle mb-2">End Date: <a class="text-muted"> ' . date("d M y \a\\t g:i A", strtotime($eTimestamp)) . '</a> </h6>
<h6 class="card-subtitle mb-2">Location: <a href="' . $location . '">' . $location . ' </a> </h6>
<a href="./submitPaper?eventid=' . $id . '" class="btn btn-primary"">' . $status . '</a>
<a href="./submitPaper?conferenceid=' . $id . '" class="btn btn-primary"">' . $status . '</a>
</div>
</div>
<br>
Expand Down Expand Up @@ -722,4 +734,32 @@ private static function defineConfirmationStatus($status)
return 'bg-danger';
}
}

private static function defineAttendanceStatus($status)
{
switch ($status) {
case "pending":
return 'Confirmation Pending';

case 1:
return 'Attendance Confirmed';

case 0:
return 'Attendance Cancelled';
}
}

private static function defineAttendanceBadge($status)
{
switch ($status) {
case "pending":
return 'bg-warning';

case 1:
return 'bg-success';

case 0:
return 'bg-danger';
}
}
}
61 changes: 56 additions & 5 deletions classes/dbAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,23 +473,74 @@ public function updateReview()

/* START EVENT API CONNECTION*/

public function createNewEvent()
public function createRegistration()
{
extract(func_get_args(), EXTR_PREFIX_ALL, "arg");
$fields = [
'RegId' => $arg_0,
'RegistrationId' => $arg_0,
'UserId' => $arg_1,
'ConferenceId' => $arg_2,
'RegDateTime' => $arg_3,
'Attendance' => $arg_4
'RegistrationTimestamp' => $arg_3,
'RegistrationAttendance' => $arg_4
];

return API::request(
$this->baseUrl . 'user/createNewEvent',
$this->baseUrl . 'registration/createRegistration',
"POST_REQUEST",
$fields
);
}

public function updateRegistration()
{
extract(func_get_args(), EXTR_PREFIX_ALL, "arg");
$fields = [
'RegistrationId' => $arg_0,
'UserId' => $arg_1,
'ConferenceId' => $arg_2,
'RegistrationTimestamp' => $arg_3,
'RegistrationAttendance' => $arg_4
];

return API::request(
$this->baseUrl . 'registration/updateRegistration',
"POST_REQUEST",
$fields
);
}

public function getRegistration()
{
return API::request(
$this->baseUrl . 'registration/list',
"GET_REQUEST",
$this->baseHeader
);
}

public function findRegistrationByUserId($id) {
return API::request(
$this->baseUrl . 'registration/findRegistrationByUserId?id=' . $id,
"GET_REQUEST",
$this->baseHeader
);
}

public function findRegistrationByConferenceId($id) {
return API::request(
$this->baseUrl . 'registration/findRegistrationByConferenceId?id=' . $id,
"GET_REQUEST",
$this->baseHeader
);
}

public function findRegistrationByAttendance($attendance) {
return API::request(
$this->baseUrl . 'registration/findRegistrationByAttendance?attendance=' . $attendance,
"GET_REQUEST",
$this->baseHeader
);
}

/* END EVENT API CONNECTION*/
}
5 changes: 5 additions & 0 deletions classes/idGenerator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ static function conference()
return self::unqid(8);
}

static function registration()
{
return self::unqid(8);
}

private static function unqid($lenght = 5)
{
$bytes = openssl_random_pseudo_bytes(ceil($lenght / 2));
Expand Down
26 changes: 13 additions & 13 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,28 @@
require $publicPath . '/submitter/checkSubmission.php';
break;

case (preg_match('/submitPaper\?eventid=.*/', $request) ? true : false):
case (preg_match('/submitPaper\?conferenceid=.*/', $request) ? true : false):
require $publicPath . '/submitter/submitPaper.php';
break;

case (preg_match('/viewSubmission\?filepath=.*&subId=.*/', $request) ? true : false):
require $publicPath . '/submitter/viewSubmission.php';
break;

case '/manageMyEvents':
require $publicPath . '/submitter/manageMyEvents.php';
case '/registerConference':
require $publicPath . '/submitter/registerConference.php';
break;

case '/myUpcomingEvents':
require $publicPath . '/submitter/myUpcomingEvents.php';
case '/myUpcomingConferences':
require $publicPath . '/submitter/myUpcomingConferences.php';
break;

case '/registerNewEvent':
require $publicPath . '/submitter/registerNewEvent.php';
case '/registerNewConference':
require $publicPath . '/submitter/registerNewConference.php';
break;

case '/events':
require $publicPath . '/submitter/displayEvents.php';
case '/conferences':
require $publicPath . '/submitter/displayConferences.php';
break;

case '/privacyPolicy':
Expand Down Expand Up @@ -151,12 +151,12 @@
break;
*/

case '/manageEvents':
require $publicPath . '/admin/manageEvents.php';
case '/manageConferences':
require $publicPath . '/admin/manageConferences.php';
break;

case '/createNewEvent':
require $publicPath . '/admin/createNewEvent.php';
case '/createNewConference':
require $publicPath . '/admin/createNewConference.php';
break;

default:
Expand Down
6 changes: 3 additions & 3 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $(document).ready(function () {
editProfileData(rawID, tableID);
break;

case "/manageEvents":
case "/manageConferences":
editConferenceData(rawID, tableID);
break;
}
Expand All @@ -45,15 +45,15 @@ $(document).ready(function () {
disableUserData(rawID, tableID);
break;

case "/manageEvents":
case "/manageConferences":
disableConferenceData(rawID, tableID, "disable", "0");
break;
}
}

if (rawID.includes('enable')) {
switch (curentPath) {
case "/manageEvents":
case "/manageConferences":
disableConferenceData(rawID, tableID, "enable", "1");
break;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $.getScript("./scripts/button.js");

// hand the data to userHandler to process the changes
$.post('./scripts/handlers/formHandler.php', {
editBySubmission: event.target.id,
editBySubmission: conference.target.id,
SubmissionId: $('#sID'.concat(id)).text(),
SubmissionFirstName: $('#sFName'.concat(id)).val(),
SubmissionLastName: $('#sLName'.concat(id)).val(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

$cTitle = $cSDate = $cSTime = $cEDate = $cETime = $cLocation = "";

$valid = false;

$errs = [
"cTitle" => "",
"cLocation" => "",
Expand Down Expand Up @@ -43,22 +45,25 @@
$cEDate . " " . $cETime,
$cLocation,
$cStatus
);
);
$valid = true;
}
else {
Validator::displayErrorToasts($errs);
$valid = false;
}

}

?>

<div id="content" class="container-fluid p-5">
<div id="register_conference_content" class="container-fluid p-5">

<div class="d-flex flex-column min-vh-100 justify-content-center align-items-center text-center h-100 mb-5">
<div class="card-body">
<h1 class="display-4">Register An Upcoming Conference</h1>
<br>
<!--Start Event Register Form-->
<!--Start Conference Register Form-->
<form id="registerConferenceForm" action="#" method="post">

<div class="form-group mb-2 mr-2">
Expand Down Expand Up @@ -115,4 +120,12 @@
</div>
</div>

</div>
</div>

<?php
if ($valid) {
echo Toast::successSubmission("register_conference_content");
echo Toast::successToast("Conference successfully created.");
}
?>

File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/admin/manageSubmissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<option value="Path"><a class="dropdown-item" name="searchFile" id="searchFile" href="#">File Name</a></option>
</select>
</div>
<input type="input" class="form-control form-control-sm" name="searchSubmissionParam" id="searchSubmissionParam" placeholder="Search" onkeydown="return (event.keyCode!=13);">
<input type="input" class="form-control form-control-sm" name="searchSubmissionParam" id="searchSubmissionParam" placeholder="Search" onkeydown="return (conference.keyCode!=13);">
</div>
</form>
<hr>
Expand Down
Loading