Skip to content

Commit

Permalink
v5.22.08
Browse files Browse the repository at this point in the history
  • Loading branch information
SKuipers committed Jun 14, 2024
1 parent 8489e96 commit baa882f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
5 changes: 5 additions & 0 deletions Free Learning/CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -2270,3 +2270,8 @@
++$count;
$sql[$count][0] = '5.22.07';
$sql[$count][1] = "";

//v5.22.08
++$count;
$sql[$count][0] = '5.22.08';
$sql[$count][1] = "";
5 changes: 5 additions & 0 deletions Free Learning/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
CHANGELOG
=========

v5.22.08
--------
Fixed the bug to manage units according to the Learning Area

v5.22.07
--------
Added the ability to modify authors of a unit
Expand Down
2 changes: 1 addition & 1 deletion Free Learning/manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$entryURL = 'units_browse.php';
$type = 'Additional';
$category = 'Learn';
$version = '5.22.07';
$version = '5.22.08';
$author = 'Ross Parker';
$url = 'http://rossparker.org/free-learning';

Expand Down
9 changes: 5 additions & 4 deletions Free Learning/src/Domain/UnitGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ public function queryUnitsByLearningAreaStaff(QueryCriteria $criteria, $gibbonPe
$query->bindValue('gibbonYearGroupIDMinimum', $criteria->getFilterValue('gibbonYearGroupIDMinimum'));
$query->where("freeLearningUnit.gibbonYearGroupIDMinimum=:gibbonYearGroupIDMinimum");
}

$criteria->addFilterRules($this->getSharedFilterRules());

$query->union()
$this->unionWithCriteria($query, $criteria)
->distinct()
->cols(['freeLearningUnit.*', "GROUP_CONCAT(gibbonDepartment.name SEPARATOR '<br/>') as learningArea"])
->from($this->getTableName())
->leftJoin('gibbonDepartment', "freeLearningUnit.gibbonDepartmentIDList LIKE CONCAT('%', gibbonDepartment.gibbonDepartmentID, '%')")
Expand All @@ -160,8 +163,6 @@ public function queryUnitsByLearningAreaStaff(QueryCriteria $criteria, $gibbonPe
->bindValue('gibbonPersonID', $gibbonPersonID)
->groupBy(['freeLearningUnit.freeLearningUnitID']);

$criteria->addFilterRules($this->getSharedFilterRules());

return $this->runQuery($query, $criteria);
}

Expand All @@ -172,7 +173,7 @@ public function selectPrerequisiteNamesByUnitID($freeLearningUnitID)
name
FROM
freeLearningUnitPrerequisite
JOIN freeLearningUnit ON (freeLearningUnitPrerequisite.freeLearningUnitIDPrerequisite=freeLearningUnit.freeLearningUnitID)
JOIN freeLearningUnit ON (freeLearningUnitPrerequisite.freeLearningUnitID=freeLearningUnit.freeLearningUnitID)
WHERE
freeLearningUnitPrerequisite.freeLearningUnitID=:freeLearningUnitID";

Expand Down
6 changes: 3 additions & 3 deletions Free Learning/src/UnitExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public function addUnitToExport($freeLearningUnitID)
'unit' => $unit,
'prerequisites' => $this->unitGateway->selectPrerequisiteNamesByUnitID($unit['freeLearningUnitID'])->fetchAll(\PDO::FETCH_COLUMN),
'blocks' => $blocks,
'authors' => $this->unitAuthorGateway->selectAuthorsByUnit($freeLearningUnitID)->fetchAll(),
];
'authors' => $this->unitGateway->selectUnitAuthorsByID($unit['freeLearningUnitID'])->fetchAll()
];
}

public function output()
Expand All @@ -135,7 +135,7 @@ public function output()
// Add Files
foreach ($this->files as $file) {
if ($file['type'] == 'url') {
// Handle images from url by downloading them firsy
// Handle images from url by downloading them first
$context = stream_context_create(['ssl' => ['verify_peer' => false]]);
$fileContents = @file_get_contents($file['location'], false, $context);

Expand Down
13 changes: 3 additions & 10 deletions Free Learning/units_manage_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,9 @@
} else {
$data = array('gibbonPersonID' => $session->get('gibbonPersonID'), 'freeLearningUnitID' => $freeLearningUnitID);
$sql = "SELECT DISTINCT freeLearningUnit.*, GROUP_CONCAT(DISTINCT freeLearningUnitPrerequisite.freeLearningUnitIDPrerequisite SEPARATOR ',') as freeLearningUnitIDPrerequisiteList
FROM freeLearningUnit
JOIN gibbonDepartment ON (freeLearningUnit.gibbonDepartmentIDList LIKE CONCAT('%', gibbonDepartment.gibbonDepartmentID, '%'))
LEFT JOIN freeLearningUnitPrerequisite ON (freeLearningUnitPrerequisite.freeLearningUnitID=freeLearningUnit.freeLearningUnitID) LEFT JOIN gibbonDepartmentStaff ON (gibbonDepartmentStaff.gibbonDepartmentID=gibbonDepartment.gibbonDepartmentID)
LEFT JOIN freeLearningUnitAuthor ON (freeLearningUnitAuthor.freeLearningUnitID=freeLearningUnit.freeLearningUnitID AND freeLearningUnitAuthor.gibbonPersonID=:gibbonPersonID)
WHERE (
(gibbonDepartmentStaff.gibbonPersonID=:gibbonPersonID AND (role='Coordinator' OR role='Assistant Coordinator' OR role='Teacher (Curriculum)'))
OR
(freeLearningUnitAuthor.freeLearningUnitAuthorID IS NOT NULL)
)
AND freeLearningUnit.freeLearningUnitID=:freeLearningUnitID";
FROM freeLearningUnit JOIN gibbonDepartment ON (freeLearningUnit.gibbonDepartmentIDList LIKE CONCAT('%', gibbonDepartment.gibbonDepartmentID, '%')) LEFT JOIN freeLearningUnitPrerequisite ON (freeLearningUnitPrerequisite.freeLearningUnitID=freeLearningUnit.freeLearningUnitID) JOIN gibbonDepartmentStaff ON (gibbonDepartmentStaff.gibbonDepartmentID=gibbonDepartment.gibbonDepartmentID) WHERE gibbonDepartmentStaff.gibbonPersonID=:gibbonPersonID AND (role='Coordinator' OR role='Assistant Coordinator' OR role='Teacher (Curriculum)') AND freeLearningUnit.freeLearningUnitID=:freeLearningUnitID
UNION
SELECT DISTINCT freeLearningUnit.*, NULL as freeLearningUnitIDPrerequisiteList FROM freeLearningUnit JOIN freeLearningUnitAuthor ON (freeLearningUnitAuthor.freeLearningUnitID=freeLearningUnit.freeLearningUnitID) WHERE freeLearningUnitAuthor.gibbonPersonID=:gibbonPersonID AND freeLearningUnitAuthor.freeLearningUnitID=:freeLearningUnitID";
}
$result = $connection2->prepare($sql);
$result->execute($data);
Expand Down
2 changes: 1 addition & 1 deletion Free Learning/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
/**
* Sets version information.
*/
$moduleVersion = '5.22.07';
$moduleVersion = '5.22.08';
$coreVersion = '24.0.00';

0 comments on commit baa882f

Please sign in to comment.