Skip to content

Commit

Permalink
Planner: add an Add Block to All option in Deploy Working Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
SKuipers committed Sep 5, 2024
1 parent 4b4adf3 commit b30a9aa
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ v28.0.00
Messenger: limited the individual message target to a maximum of 50 people
Messenger: updated preferences to ensure signatures are displayed on a white background
Planner: improved default selected course in Unit Planner sidebar menu
Planner: added an Add Block to All option in Deploy Working Copy
Reports: added a Progress by Department report for viewing class criteria progress
Staff: updated Manage Staff to override required custom fields when manually editing a staff member
Staff: updated family page on Staff Profile to exclude personal details and addresses
Expand Down
21 changes: 20 additions & 1 deletion modules/Planner/units_edit_deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,16 @@
$form = Form::create('action', $session->get('absoluteURL').'/modules/Planner/units_edit_deployProcess.php?'.http_build_query($urlParams));
$form->setFactory(PlannerFormFactory::create($pdo));
$form->setTitle(__('Step 2 - Distribute Blocks'));
$form->setDescription(__('You can now add your unit blocks using the dropdown menu in each lesson. Blocks can be dragged from one lesson to another.'));

$addAll = $form->getFactory()->createRow()
->setClass('-mt-4')
->addSelect('blockAddAll')
->fromArray($blockSelect)
->placeholder()
->setClass('blockAddAll float-right w-32')
->prepend(Format::small(__('Add Block to All').':'));

$form->setDescription('<div class="float-right w-32 -mt-8">'.$addAll->getOutput().'</div>'.__('You can now add your unit blocks using the dropdown menu in each lesson. Blocks can be dragged from one lesson to another.'));

$form->addHiddenValue('address', $session->get('address'));

Expand Down Expand Up @@ -318,4 +327,14 @@
count++;
});

$('.blockAddAll').change(function () {
var gibbonUnitBlockID = $(this).val();
if (gibbonUnitBlockID == '') return;

var sortable = $('.sortableArea').each(function (index, element) {
$(element).append($('<div class="draggable z-100">').load("<?php echo $session->get('absoluteURL'); ?>/modules/Planner/units_add_blockAjax.php?mode=workingDeploy&gibbonUnitID=<?php echo $gibbonUnitID; ?>&gibbonUnitBlockID=" + gibbonUnitBlockID, "id=" + count) );
count++;
});
});

</script>
21 changes: 20 additions & 1 deletion modules/Planner/units_edit_working.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@
$form = Form::create('action', $session->get('absoluteURL').'/modules/Planner/units_edit_workingProcess.php?'.http_build_query($urlParams));

$form->setTitle(__('Lessons & Blocks'));
$form->setDescription(__('You can now add your unit blocks using the dropdown menu in each lesson. Blocks can be dragged from one lesson to another.').Format::alert(__('Deploying lessons only works for units with smart blocks. If you have duplicated a unit from a past year that does not have smart blocks, be sure to edit the lessons manually and assign a new date to them.'), 'message'));

$addAll = $form->getFactory()->createRow()
->setClass('-mt-4')
->addSelect('blockAddAll')
->fromArray($blockSelect)
->placeholder()
->setClass('blockAddAll float-right w-32')
->prepend(Format::small(__('Add Block to All').':'));

$form->setDescription('<div class="float-right w-32 -mt-2">'.$addAll->getOutput().'</div><br/>'.__('You can now add your unit blocks using the dropdown menu in each lesson. Blocks can be dragged from one lesson to another.').Format::alert(__('Deploying lessons only works for units with smart blocks. If you have duplicated a unit from a past year that does not have smart blocks, be sure to edit the lessons manually and assign a new date to them.'), 'message'));

$form->addHiddenValue('address', $session->get('address'));

Expand Down Expand Up @@ -230,4 +239,14 @@
count++;
});

$('.blockAddAll').change(function () {
var gibbonUnitBlockID = $(this).val();
if (gibbonUnitBlockID == '') return;

var sortable = $('.sortableArea').each(function (index, element) {
$(element).append($('<div class="draggable z-100">').load("<?php echo $session->get('absoluteURL'); ?>/modules/Planner/units_add_blockAjax.php?mode=workingEdit&gibbonUnitID=<?php echo $gibbonUnitID; ?>&gibbonUnitBlockID=" + gibbonUnitBlockID, "id=" + count) );
count++;
});
});

</script>

0 comments on commit b30a9aa

Please sign in to comment.