Skip to content

Commit

Permalink
v5.22.02
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Parker committed Aug 19, 2023
1 parent 93b47e8 commit 7befe4e
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 41 deletions.
5 changes: 5 additions & 0 deletions Free Learning/CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -2240,3 +2240,8 @@
++$count;
$sql[$count][0] = '5.22.01';
$sql[$count][1] = "";

//v5.22.02
++$count;
$sql[$count][0] = '5.22.02';
$sql[$count][1] = "";
4 changes: 4 additions & 0 deletions Free Learning/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
CHANGELOG
=========
v5.22.02
--------
Removed bulk Lock/Unlock from Manage Units_learningAreas

v5.22.01
--------
Restricted parent and student dashboard hooks to current year's data
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.01';
$version = '5.22.02';
$author = 'Ross Parker';
$url = 'http://rossparker.org/free-learning';

Expand Down
5 changes: 4 additions & 1 deletion Free Learning/units_manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@

$form = BulkActionForm::create('bulkAction', $session->get('absoluteURL').'/modules/Free Learning/units_manageProcessBulk.php');

$bulkActions = ['Export' => __('Export'), 'Duplicate' => __('Duplicate'), 'Lock' => __m('Lock'), 'Unlock' => __m('Unlock')];
$bulkActions = ['Export' => __('Export'), 'Duplicate' => __('Duplicate')];
if ($highestAction == 'Manage Units_all') {
$bulkActions += ['Lock' => __m('Lock'), 'Unlock' => __m('Unlock')];
}
$col = $form->createBulkActionColumn($bulkActions);
$col->addSubmit(__('Go'));

Expand Down
81 changes: 43 additions & 38 deletions Free Learning/units_manageProcessBulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,57 +36,62 @@
$URL .= '&return=error0';
header("Location: {$URL}");
} else {
// Proceed!
$action = $_REQUEST['action'] ?? '';
$name = $_REQUEST['name'] ?? [];
$freeLearningUnitID = $_REQUEST['freeLearningUnitID'] ?? [];
$freeLearningUnitIDList = is_array($freeLearningUnitID) ? $freeLearningUnitID : [$freeLearningUnitID];
$partialFail = false;

if (empty($action)) {
$URL .= '&return=error1';
$highestAction = getHighestGroupedAction($guid, $session->get('address'), $connection2);
if ($highestAction == false) {
$URL .= '&return=error0';
header("Location: {$URL}");
exit;
}
} else {
// Proceed!
$action = $_REQUEST['action'] ?? '';
$name = $_REQUEST['name'] ?? [];
$freeLearningUnitID = $_REQUEST['freeLearningUnitID'] ?? [];
$freeLearningUnitIDList = is_array($freeLearningUnitID) ? $freeLearningUnitID : [$freeLearningUnitID];
$partialFail = false;

if (empty($action)) {
$URL .= '&return=error1';
header("Location: {$URL}");
exit;
}

if ($action == 'Export') {
if ($action == 'Export') {

// Export zip contents of units
$exporter = $container->get(UnitExporter::class);
$exporter->setFilename(!empty($name)? $name : 'FreeLearningUnits');
// Export zip contents of units
$exporter = $container->get(UnitExporter::class);
$exporter->setFilename(!empty($name)? $name : 'FreeLearningUnits');

foreach ($freeLearningUnitIDList as $freeLearningUnitID) {
$exporter->addUnitToExport($freeLearningUnitID);
}
foreach ($freeLearningUnitIDList as $freeLearningUnitID) {
$exporter->addUnitToExport($freeLearningUnitID);
}

$exporter->output();
exit;
$exporter->output();
exit;

} else if ($action == 'Duplicate') {
} else if ($action == 'Duplicate') {

$duplicator = $container->get(UnitDuplicator::class);
$duplicator = $container->get(UnitDuplicator::class);

foreach ($freeLearningUnitIDList as $freeLearningUnitID) {
$partialFail = $duplicator->duplicateUnit($freeLearningUnitID);
}
foreach ($freeLearningUnitIDList as $freeLearningUnitID) {
$partialFail = $duplicator->duplicateUnit($freeLearningUnitID);
}

} else if ($action == 'Lock' or $action == 'Unlock') {
} else if (($action == 'Lock' or $action == 'Unlock') and $highestAction == 'Manage Units_all') {

$unitGateway = $container->get(UnitGateway::class);
$unitGateway = $container->get(UnitGateway::class);

foreach ($freeLearningUnitIDList as $freeLearningUnitID) {
$partialFail = !$unitGateway->update($freeLearningUnitID, ['editLock' => ($action == 'Lock' ? 'Y' : 'N')]);
foreach ($freeLearningUnitIDList as $freeLearningUnitID) {
$partialFail = !$unitGateway->update($freeLearningUnitID, ['editLock' => ($action == 'Lock' ? 'Y' : 'N')]);
}

} else {
$URL .= '&return=error1';
header("Location: {$URL}");
exit;
}

} else {
$URL .= '&return=error1';
$URL .= $partialFail
? '&return=warning1'
: '&return=success0';
header("Location: {$URL}");
exit;
}

$URL .= $partialFail
? '&return=warning1'
: '&return=success0';
header("Location: {$URL}");

}
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.01';
$moduleVersion = '5.22.02';
$coreVersion = '24.0.00';

0 comments on commit 7befe4e

Please sign in to comment.