diff --git a/.vs/26-CMA/v16/.suo b/.vs/26-CMA/v16/.suo deleted file mode 100644 index abb56a2..0000000 Binary files a/.vs/26-CMA/v16/.suo and /dev/null differ diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json deleted file mode 100644 index 5ddea5d..0000000 --- a/.vs/VSWorkspaceState.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ExpandedNodes": [ - "" - ], - "SelectedNode": "\\.gitignore", - "PreviewInSolutionExplorer": false -} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite deleted file mode 100644 index 017fa49..0000000 Binary files a/.vs/slnx.sqlite and /dev/null differ diff --git a/classes/components/card.php b/classes/components/card.php index d3c2d82..57bd0be 100644 --- a/classes/components/card.php +++ b/classes/components/card.php @@ -10,8 +10,8 @@ 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 'conference': - return self::conferenceCard($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 'upcomingConference': return self::upcomingConferenceCard($data[0], $data[1], $data[2], $data[3]); @@ -55,28 +55,40 @@ private static function submissionCard($cTitle, $filePath, $status, $date, $time '; } - private static function conferenceCard($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 '
- Conference ' . $status . ' + ' . self::defineAttendanceStatus($status) . '
' . $title . '
-
Presented by: ' . $presenter . '

- Conference Date : ' . date("d M y \a\\t g:i A", strtotime($timestamp)) . '
+ Event Date : ' . $date . '
+ Event Time : ' . $time . '
Meeting URL : ' . $link . '
- Paper to be presented : ' . $filePath . ' + Paper to be presented : ' . $filePath . '

-
- + +
- +
@@ -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'; + } + } } diff --git a/classes/dbAPI.class.php b/classes/dbAPI.class.php index 111588c..ffc810e 100644 --- a/classes/dbAPI.class.php +++ b/classes/dbAPI.class.php @@ -473,23 +473,74 @@ public function updateReview() /* START EVENT API CONNECTION*/ - public function createNewConference() + 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/createNewConference', + $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*/ } \ No newline at end of file diff --git a/classes/idGenerator.class.php b/classes/idGenerator.class.php index 24e5e46..d054403 100644 --- a/classes/idGenerator.class.php +++ b/classes/idGenerator.class.php @@ -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)); diff --git a/index.php b/index.php index 0d24f1d..8adfcc7 100644 --- a/index.php +++ b/index.php @@ -50,8 +50,8 @@ require $publicPath . '/submitter/viewSubmission.php'; break; - case '/manageMyConferences': - require $publicPath . '/submitter/manageMyConferences.php'; + case '/registerConference': + require $publicPath . '/submitter/registerConference.php'; break; case '/myUpcomingConferences': diff --git a/src/pages/reviewer/reviewSubmission.php b/src/pages/reviewer/reviewSubmission.php index e5764b2..7619b6f 100644 --- a/src/pages/reviewer/reviewSubmission.php +++ b/src/pages/reviewer/reviewSubmission.php @@ -85,6 +85,7 @@ function getFilePath($uId) { $db->updateSubmission( $subId, $submission[0]->UserId, + $submission[0]->ReviewerId, $submission[0]->ConferenceId, $submission[0]->SubmissionTimestamp, $submission[0]->SubmissionPath, diff --git a/src/pages/submitter/manageMyConferences.php b/src/pages/submitter/manageMyConferences.php index 6f62dd5..ce00cd5 100644 --- a/src/pages/submitter/manageMyConferences.php +++ b/src/pages/submitter/manageMyConferences.php @@ -1,26 +1,41 @@ getConferences(); - $submissions = $db->getAllSubmission(); - - foreach($conferences as $conference) { - if (TimeProcessor::cmpETimeandCTime($conference->ConferenceEndTimestamp)) { - $db->updateConference( - $conference->ConferenceId, - $conference->ConferenceTitle, - $conference->ConferenceStartTimestamp, - $conference->ConferenceEndTimestamp, - $conference->ConferenceLocation, - "0" - ); - } +include_once("./classes/components/card.php"); +include_once("./classes/components/timeProcessor.php"); +require_once "./classes/dbAPI.class.php"; + +$db = new Database(); +$conferences = $db->getConferences(); + +foreach ($conferences as $conference) { + if (TimeProcessor::cmpETimeandCTime($conference->ConferenceEndTimestamp)) { + $db->updateConference( + $conference->ConferenceId, + $conference->ConferenceTitle, + $conference->ConferenceStartTimestamp, + $conference->ConferenceEndTimestamp, + $conference->ConferenceLocation, + "0" + ); } +} + +if (isset($_POST['manageMyConferences'])) { + $attendanceOption = $_POST["attendanceOption"]; + + $db->createRegistration( + $regId, + $_SESSION["UID"], + $conference->ConferenceId, + '', + $_POST["attendanceOption"] + ); + + header('Location: /dashboard'); +} + +$submissions = $db->findSubmissionByUserId($_SESSION['UID']); +$users = $db->findUserById($_SESSION['UID']); - $conferences = $db->findConferenceByStatus("1"); ?> @@ -28,20 +43,59 @@

My Conferences

Check your conferences progress here. We'll send you a notification nearing the conference date. Keep a look out!

-
+

No current conferences available

'; - } else { - foreach ($conferences as $conference) { + } else { + foreach ($conferences as $conference) { + echo Card::display( + 'conferenceCard', + [ + $conference->ConferenceTitle, + $conference->ConferenceLocation, + $conference->ConferenceStartTimestamp, + $submissions[0]->SubmissionPath, + $users[0]->UserFirstName . ' ' . $users[0]->UserLastName, + $submissions[0]->SubmissionStatus + ] + ); + + if ($db->findRegistrationByAttendance($confirmedAttendance)) { + echo '

attending status will show here

'; + } else { + //No regID found, choose confirmation status, then a record will be created with your regId (same as submissionID) and your attending status + other info + echo '
+ +
+
+ +
+
'; + } + + + /* + echo '
'; $submissionByID = $db->findSubmissionByConferenceId($conference->ConferenceId); + $regId = $conference->ConferenceId . '_' . $_SESSION["UID"]; + $attendanceByID = $db->findAttendanceById($regId); if (in_array($_SESSION["UID"], array_column($submissionByID, 'UserId'))) { - + // This wil needs fixing // This line checks, if a submission path for the current conference exists, assign it to $file, otherwise display 'file is not available' if (in_array($conference->ConferenceId, array_column($submissions, 'SubmissionPath'))) { @@ -49,6 +103,9 @@ } else { $file = 'Not available yet'; } + + //This needs to get the submission status from submissions + $status = "unkown"; $subData = [ $conference->ConferenceTitle, @@ -56,15 +113,37 @@ $conference->ConferenceStartTimestamp, $file, $_SESSION['uFName'] . " " . $_SESSION['uLName'], - 'status unknown' + $status ]; echo Card::display("conference", $subData); + + // Search for the regID, if found, display attending status, else display confirmation form + if (in_array($regId, array_column($allAttendance, 'RegId'))) { + echo '

attending status will show here

'; + } else { + //No regID found, choose confirmation status, then a record will be created with your regId (same as submissionID) and your attending status + other info + echo '
+ +
+
+ +
+
'; + } + + echo '
'; + } else { + echo 'This User has no conferences'; } - } + */ } + } ?> - +
diff --git a/src/pages/submitter/registerConference.php b/src/pages/submitter/registerConference.php new file mode 100644 index 0000000..4d9cd61 --- /dev/null +++ b/src/pages/submitter/registerConference.php @@ -0,0 +1,122 @@ +findSubmissionByUserId($_SESSION["UID"]); + + $successfulSubs = array(); + + foreach ($submissions as $sub) { + if ($review = $db->findReviewBySubmissionId($sub->SubmissionId)) { + if ($review[0]->ReviewStatus == "Success") { + array_push($successfulSubs, $sub); + } + } + } + + if (isset($_POST["submitAttendance"])) { + $attendance = ""; + $isRegistered = false; + + $args = explode("-", $_POST["attendance_options"]); + + $sub = $db->findSubmissionById($args[1]); + + $timestamp = date('Y-m-d h:i:s'); + + $attendance = ($args[0] == "accept")? 1 : 0; + + $registrations = $db->findRegistrationByUserId($sub[0]->UserId); + + foreach ($registrations as $r) { + if ($r->ConferenceId == $sub[0]->ConferenceId) { + $registration = $r; + $isRegistered = true; + } + } + + if ($isRegistered) { + $db->updateRegistration( + $registration->RegistrationId, + $registration->UserId, + $registration->ConferenceId, + $timestamp, + $attendance + ); + } + else { + $id = IDGenerator::registration(); + + $db->createRegistration( + $id, + $sub[0]->UserId, + $sub[0]->ConferenceId, + $timestamp, + $attendance + ); + } + + $toast_msg = ($attendance)? "Attendance successfully confirmed" : "Attendance cancelled"; + + echo Toast::successToast($toast_msg); + } + +?> + + +
+
+

My Events

+

Check your events progress here. We'll send you a notification nearing the event date. Keep a look out!

+
+ + findConferenceById($sub->ConferenceId); + + $registrations = $db->findRegistrationByUserId($sub->UserId); + + $isRegistered = false; + + foreach ($registrations as $r) { + if ($r->ConferenceId == $sub->ConferenceId) { + $registration = $r; + $isRegistered = true; + } + } + + $regStatus = ($isRegistered)? $registration->RegistrationAttendance : "pending"; + + $timestamp = strtotime($conference[0]->ConferenceEndTimestamp); + $date = date('d/m/Y', $timestamp); + $time = date('H:i', $timestamp); + + $subData = [ + $conference[0]->ConferenceTitle, + $date, + $time, + $conference[0]->ConferenceLocation, + $sub->SubmissionPath, + $regStatus, + $sub->SubmissionId + ]; + + echo Card::display("conferenceCard", $subData); + + } + + ?> + +
+
+
+ + \ No newline at end of file diff --git a/src/pages/submitter/submissions/SCS0c6d2/012345aa_Testing Conference #1.pdf b/src/pages/submitter/submissions/SCS0c6d2/012345aa_Testing Conference #1.pdf deleted file mode 100644 index 706a93d..0000000 Binary files a/src/pages/submitter/submissions/SCS0c6d2/012345aa_Testing Conference #1.pdf and /dev/null differ diff --git a/src/template/navbar.php b/src/template/navbar.php index 95f4706..75b5787 100644 --- a/src/template/navbar.php +++ b/src/template/navbar.php @@ -29,7 +29,7 @@ Conferences