diff --git a/ATL/CHANGEDB.php b/ATL/CHANGEDB.php index ae21524..c229fc6 100644 --- a/ATL/CHANGEDB.php +++ b/ATL/CHANGEDB.php @@ -176,3 +176,8 @@ ++$count; $sql[$count][0] = '1.5.09'; $sql[$count][1] = ''; + +//v1.5.10 +++$count; +$sql[$count][0] = '1.5.10'; +$sql[$count][1] = ''; diff --git a/ATL/CHANGELOG.txt b/ATL/CHANGELOG.txt index 6b882e1..c598227 100644 --- a/ATL/CHANGELOG.txt +++ b/ATL/CHANGELOG.txt @@ -1,5 +1,10 @@ CHANGELOG ========= +v1.5.10 +------- +Fixed visualization showing data that has not gone live +Added a Go Live date reminder to the Write ATL page + v1.5.09 ------- Fixed student and parent PHP dashboard warning and exception diff --git a/ATL/atl_write_data.php b/ATL/atl_write_data.php index 4513ba5..bdd3ada 100644 --- a/ATL/atl_write_data.php +++ b/ATL/atl_write_data.php @@ -118,7 +118,7 @@ $form->addRow()->addHeading(__('Students')); $form->addRow()->addAlert(__('There are no records to display.'), 'error'); } else { - $table = $form->addRow()->addTable()->setClass('smallIntBorder fullWidth colorOddEven noMargin noPadding noBorder'); + $table = $form->addRow()->setClass('p-0')->addTable()->setClass('smallIntBorder fullWidth colorOddEven noMargin noPadding noBorder'); $completeText = !empty($values['completeDate'])? __('Marked on').' '.Format::date($values['completeDate']) : __('Unmarked'); @@ -170,6 +170,10 @@ $row->addLabel('completeDate', __('Go Live Date'))->prepend('1. ')->append('
'.__('2. Column is hidden until date is reached.')); $row->addDate('completeDate'); + if (!empty($values['completeDate']) && $values['completeDate'] > date('Y-m-d', strtotime('+1 day'))) { + $row = $form->addRow()->addAlert(__m('Your Go Live date is more than 24 hours in the future. If you have completed this ATL, be sure to update your Go Live date to set it to the next school day.'), 'message'); + } + $row = $form->addRow(); $row->addSubmit(); diff --git a/ATL/manifest.php b/ATL/manifest.php index 5262737..bbb672d 100644 --- a/ATL/manifest.php +++ b/ATL/manifest.php @@ -25,7 +25,7 @@ $entryURL = 'atl_write.php'; $type = 'Additional'; $category = 'Assess'; -$version = '1.5.09'; +$version = '1.5.10'; $author = 'Ross Parker'; $url = 'http://rossparker.org'; diff --git a/ATL/moduleFunctions.php b/ATL/moduleFunctions.php index d055b2b..d1efe9f 100644 --- a/ATL/moduleFunctions.php +++ b/ATL/moduleFunctions.php @@ -27,7 +27,11 @@ use Gibbon\Contracts\Services\Session; function getATLRecord($guid, $connection2, $gibbonPersonID) { - global $session; + global $session, $container; + + require_once $session->get('absolutePath').'/modules/ATL/src/Domain/ATLColumnGateway.php'; + + $atlColumnGateway = $container->get(ATLColumnGateway::class); $output = ''; @@ -49,16 +53,9 @@ function getATLRecord($guid, $connection2, $gibbonPersonID) { $results = false; while ($rowYears = $resultYears->fetch()) { //Get and output ATLs - try { - $dataATL = array('gibbonPersonID1' => $gibbonPersonID, 'gibbonPersonID2' => $gibbonPersonID, 'gibbonSchoolYearID' => $rowYears['gibbonSchoolYearID']); - $sqlATL = "SELECT DISTINCT atlColumn.*, atlEntry.*, gibbonCourse.name AS course, gibbonCourseClass.nameShort AS class, gibbonPerson.dateStart FROM gibbonCourse JOIN gibbonCourseClass ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) JOIN gibbonCourseClassPerson ON (gibbonCourseClassPerson.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN atlColumn ON (atlColumn.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN atlEntry ON (atlEntry.atlColumnID=atlColumn.atlColumnID) JOIN gibbonPerson ON (atlEntry.gibbonPersonIDStudent=gibbonPerson.gibbonPersonID) WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID1 AND atlEntry.gibbonPersonIDStudent=:gibbonPersonID2 AND gibbonSchoolYearID=:gibbonSchoolYearID AND completeDate<='".date('Y-m-d')."' AND gibbonCourseClass.reportable='Y' AND gibbonCourseClassPerson.reportable='Y' ORDER BY completeDate DESC, gibbonCourse.nameShort, gibbonCourseClass.nameShort"; - $resultATL = $connection2->prepare($sqlATL); - $resultATL->execute($dataATL); - } catch (PDOException $e) { - $output .= "
".$e->getMessage().'
'; - } + $entries = $atlColumnGateway->selectATLEntriesByStudent($rowYears['gibbonSchoolYearID'], $gibbonPersonID)->fetchAll(); - if ($resultATL->rowCount() > 0) { + if (!empty($entries)) { $results = true; $output .= '

'; $output .= $rowYears['name']; @@ -75,7 +72,7 @@ function getATLRecord($guid, $connection2, $gibbonPersonID) { $output .= ''; $count = 0; - while ($rowATL = $resultATL->fetch()) { + foreach ($entries as $rowATL) { if ($count % 2 == 0) { $rowNum = 'even'; } else { diff --git a/ATL/src/Domain/ATLColumnGateway.php b/ATL/src/Domain/ATLColumnGateway.php index 3e338e5..3ff4db5 100644 --- a/ATL/src/Domain/ATLColumnGateway.php +++ b/ATL/src/Domain/ATLColumnGateway.php @@ -21,7 +21,7 @@ class ATLColumnGateway extends QueryableGateway public function getATLRubricByStudent($gibbonSchoolYearID, $gibbonPersonID) { - $data = array('gibbonSchoolYearID' => $gibbonSchoolYearID, 'gibbonPersonID' => $gibbonPersonID); + $data = array('gibbonSchoolYearID' => $gibbonSchoolYearID, 'gibbonPersonID' => $gibbonPersonID, 'today' => date('Y-m-d')); $sql = "SELECT gibbonPerson.gibbonPersonID, surname, @@ -38,11 +38,40 @@ public function getATLRubricByStudent($gibbonSchoolYearID, $gibbonPersonID) WHERE status='Full' AND gibbonStudentEnrolment.gibbonSchoolYearID=:gibbonSchoolYearID AND gibbonPerson.gibbonPersonID=:gibbonPersonID + AND atlColumn.completeDate<=:today AND gibbonCourseClassPerson.role='Student' + AND gibbonCourseClass.reportable='Y' + AND gibbonCourseClassPerson.reportable='Y' ORDER BY surname, preferredName LIMIT 0, 1"; return $this->db()->selectOne($sql, $data); } + + public function selectATLEntriesByStudent($gibbonSchoolYearID, $gibbonPersonID) + { + $data = ['gibbonPersonID' => $gibbonPersonID, 'gibbonSchoolYearID' => $gibbonSchoolYearID, 'today' => date('Y-m-d')]; + $sql = "SELECT DISTINCT + atlColumn.*, + atlEntry.*, + gibbonCourse.name AS course, + gibbonCourseClass.nameShort AS class, + gibbonPerson.dateStart + FROM gibbonCourse + JOIN gibbonCourseClass ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) + JOIN gibbonCourseClassPerson ON (gibbonCourseClassPerson.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN atlColumn ON (atlColumn.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) + JOIN atlEntry ON (atlEntry.atlColumnID=atlColumn.atlColumnID) + JOIN gibbonPerson ON (atlEntry.gibbonPersonIDStudent=gibbonPerson.gibbonPersonID) + WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID + AND atlEntry.gibbonPersonIDStudent=:gibbonPersonID + AND gibbonSchoolYearID=:gibbonSchoolYearID + AND atlColumn.completeDate<=:today + AND gibbonCourseClassPerson.role='Student' + AND gibbonCourseClass.reportable='Y' + AND gibbonCourseClassPerson.reportable='Y' + ORDER BY atlColumn.completeDate DESC, gibbonCourse.nameShort, gibbonCourseClass.nameShort"; + + return $this->db()->select($sql, $data); + } } diff --git a/ATL/version.php b/ATL/version.php index 1677936..e41cbc5 100644 --- a/ATL/version.php +++ b/ATL/version.php @@ -20,5 +20,5 @@ /** * Sets version information. */ -$moduleVersion = '1.5.09'; +$moduleVersion = '1.5.10'; $coreVersion = '23.0.00';