diff --git a/Free Learning/CHANGEDB.php b/Free Learning/CHANGEDB.php index 48c6a7c..2efd7f1 100644 --- a/Free Learning/CHANGEDB.php +++ b/Free Learning/CHANGEDB.php @@ -2204,3 +2204,8 @@ ++$count; $sql[$count][0] = '5.21.14'; $sql[$count][1] = ""; + +//v5.21.15 +++$count; +$sql[$count][0] = '5.21.15'; +$sql[$count][1] = ""; diff --git a/Free Learning/CHANGELOG.txt b/Free Learning/CHANGELOG.txt index 58fd5f9..cc97834 100644 --- a/Free Learning/CHANGELOG.txt +++ b/Free Learning/CHANGELOG.txt @@ -1,5 +1,9 @@ CHANGELOG ========= +v5.21.15 +-------- +Added Term filter to My Unit History + v5.21.14 -------- Added notifications for collaborators of enrolling learner diff --git a/Free Learning/manifest.php b/Free Learning/manifest.php index b2007d9..f3fb746 100644 --- a/Free Learning/manifest.php +++ b/Free Learning/manifest.php @@ -25,7 +25,7 @@ $entryURL = 'units_browse.php'; $type = 'Additional'; $category = 'Learn'; -$version = '5.21.14'; +$version = '5.21.15'; $author = 'Ross Parker'; $url = 'http://rossparker.org/free-learning'; diff --git a/Free Learning/report_unitHistory_my.php b/Free Learning/report_unitHistory_my.php index 5d18271..dd236db 100755 --- a/Free Learning/report_unitHistory_my.php +++ b/Free Learning/report_unitHistory_my.php @@ -19,6 +19,8 @@ use Gibbon\Forms\Form; use Gibbon\Forms\DatabaseFormFactory; +use Gibbon\Domain\System\SettingGateway; +use Gibbon\Domain\School\SchoolYearTermGateway; use Gibbon\Module\FreeLearning\Tables\UnitHistory; // Module includes @@ -28,13 +30,14 @@ // Access denied $page->addError(__('You do not have access to this action.')); } else { - //Get action with highest precendence + // Get action with highest precendence $highestAction = getHighestGroupedAction($guid, $_GET['q'], $connection2); if ($highestAction == false) { $page->addError(__('The highest grouped action cannot be determined.')); } else { // Filter $gibbonSchoolYearID = $_GET['gibbonSchoolYearID'] ?? $session->get('gibbonSchoolYearID'); + $gibbonSchoolYearTermID = $_GET['gibbonSchoolYearTermID'] ?? null; $form = Form::create('search', $session->get('absoluteURL').'/index.php', 'get'); $form->setFactory(DatabaseFormFactory::create($pdo)); @@ -47,18 +50,42 @@ $row = $form->addRow(); $row->addLabel('gibbonSchoolYearID', __('School Year')); $row->addSelectSchoolYear('gibbonSchoolYearID', 'Recent')->selected($gibbonSchoolYearID); + + $settingGateway = $container->get(SettingGateway::class); + $bigDataSchool = $settingGateway->getSettingByScope('Free Learning', 'bigDataSchool'); + if ($bigDataSchool == "Y") { + $dataSelect = []; + $sqlSelect = "SELECT gibbonSchoolYear.gibbonSchoolYearID as chainedTo, gibbonSchoolYearTerm.gibbonSchoolYearTermID as value, gibbonSchoolYearTerm.name FROM gibbonSchoolYearTerm JOIN gibbonSchoolYear ON (gibbonSchoolYearTerm.gibbonSchoolYearID=gibbonSchoolYear.gibbonSchoolYearID) ORDER BY gibbonSchoolYearTerm.sequenceNumber"; + $rowFilter = $form->addRow(); + $rowFilter->addLabel('gibbonSchoolYearTermID', __('Term')); + $rowFilter->addSelect('gibbonSchoolYearTermID') + ->fromQueryChained($pdo, $sqlSelect, $dataSelect, 'gibbonSchoolYearID') + ->placeholder() + ->selected($gibbonSchoolYearTermID); + } $row = $form->addRow(); $row->addSearchSubmit($session, __('Clear Filters')); echo $form->getOutput(); - //Proceed! + // Proceed! $page->scripts->add('chart'); $page->breadcrumbs->add(__m('My Unit History')); - $table = $container->get(UnitHistory::class)->create($session->get('gibbonPersonID'), false, true, false, $gibbonSchoolYearID); + // Convert term ID into start and end dates + $dateStart = null; + $dateEnd = null; + if (!is_null($gibbonSchoolYearTermID)) { + $schoolYearTermGateway = $container->get(SchoolYearTermGateway::class); + $term = $schoolYearTermGateway->getByID($gibbonSchoolYearTermID); + $dateStart = $term['firstDay']; + $dateEnd = $term['lastDay']; + } + + $table = $container->get(UnitHistory::class)->create($session->get('gibbonPersonID'), false, true, false, $gibbonSchoolYearID, $dateStart, $dateEnd); + echo $table; } -} +} \ No newline at end of file diff --git a/Free Learning/version.php b/Free Learning/version.php index 251ec52..f838b9d 100755 --- a/Free Learning/version.php +++ b/Free Learning/version.php @@ -20,5 +20,5 @@ /** * Sets version information. */ -$moduleVersion = '5.21.14'; +$moduleVersion = '5.21.15'; $coreVersion = '24.0.00';