Skip to content
Permalink
Browse files

Add exercise_additional_teacher_modify_actions conf settings - refs B…

…T#15265

Allow add additional actions (as links) in exercises list for teachers.
  • Loading branch information...
AngelFQC committed Mar 11, 2019
1 parent 0b604ee commit 0de2668a7108ac509e14607849a7a7302672e59c
Showing with 34 additions and 0 deletions.
  1. +6 −0 main/exercise/exercise.php
  2. +24 −0 main/inc/lib/exercise.lib.php
  3. +4 −0 main/install/configuration.dist.php
@@ -1245,6 +1245,12 @@
}
if ($is_allowedToEdit) {
$additionalActions = ExerciseLib::getAdditionalTeacherActions($row['id']);
if (!empty($additionalActions)) {
$actions .= $additionalActions.PHP_EOL;
}
$item .= Display::tag('td', $actions, ['class' => 'td_actions']);
} else {
if ($isDrhOfCourse) {
@@ -5231,4 +5231,28 @@ public static function getNotificationSettings()
return $emailAlerts;
}
/**
* Get the additional actions added in exercise_additional_teacher_modify_actions configuration.
*
* @param int $exerciseId
* @param int $iconSize
*
* @return string
*/
public static function getAdditionalTeacherActions($exerciseId, $iconSize = ICON_SIZE_SMALL)
{
$additionalActions = api_get_configuration_value('exercise_additional_teacher_modify_actions') ?: [];
$actions = [];
foreach ($additionalActions as $additionalAction) {
$actions[] = call_user_func(
$additionalAction,
$exerciseId,
$iconSize
);
}
return implode(PHP_EOL, $actions);
}
}
@@ -566,6 +566,10 @@
//$_configuration['quiz_prevent_copy_paste'] = false;
// Always show the test description on the results page of the test
//$_configuration['quiz_show_description_on_results_page'] = false;
// Allow add additional actions (as links) in exercises list for teachers.
// Callback get the $exerciseId and $iconSize as parameters.
// e.g. ['myplugin' => ['MyPlugin', 'urlGeneratorCallback']]
//$_configuration['exercise_additional_teacher_modify_actions'] = []
// Hide search form in session list
//$_configuration['hide_search_form_in_session_list'] = false;

0 comments on commit 0de2668

Please sign in to comment.
You can’t perform that action at this time.