Exercise: Add multi-delete with checkboxes in reporting page - refs #3625

pull/6027/head
Christian Beeznest 8 months ago
parent c04c17f138
commit 8004a7f87a
  1. 69
      assets/css/scss/_exercise.scss
  2. 26
      public/main/exercise/exercise_report.php
  3. 8
      public/main/inc/ajax/model.ajax.php

@ -509,3 +509,72 @@
}
}
}
.ui-jqgrid {
.btn.btn-sm.ui-pg-button.active:hover {
@apply bg-primary text-white border-primary;
}
.fm-button-icon.active,
.fm-button-text.active {
@apply text-primary;
}
}
.modal.ui-jqgrid-bootstrap.ui-jqdialog {
@apply absolute bg-white rounded-lg border border-gray-30 shadow-lg overflow-hidden font-sans p-0 w-[300px];
}
.ui-jqdialog {
.modal-dialog {
@apply h-full;
}
.modal-content {
@apply bg-white border-none rounded-lg shadow-none w-full;
}
.modal-header.ui-jqdialog-titlebar {
@apply bg-primary text-white px-4 py-3 text-lg font-bold flex justify-between items-center w-full box-border;
}
.modal-header .close.ui-jqdialog-titlebar-close {
@apply text-white text-2xl no-underline m-0 cursor-pointer;
}
.modal-header .close.ui-jqdialog-titlebar-close:hover {
@apply text-support-5;
}
.modal-body {
@apply px-5 py-5 text-sm text-gray-90 text-center;
}
.fm-button {
@apply bg-gray-10 text-gray-90 inline-flex items-center gap-2 px-4 py-2 rounded-md transition-all duration-200 ease-in-out;
}
.fm-button:hover {
@apply bg-gray-20 text-gray-50;
}
.fm-button-icon {
@apply text-gray-30 transition-colors duration-200 ease-in-out;
}
.fm-button-icon:hover {
@apply text-gray-50;
}
.fm-button-text {
color: inherit;
}
.ui-resizable-handle {
@apply bg-gray-25 w-1 h-1 cursor-pointer;
}
.ui-resizable-handle:hover {
@apply bg-primary;
}
}

@ -63,6 +63,8 @@ $exercise_id = isset($_REQUEST['exerciseId']) ? (int) $_REQUEST['exerciseId'] :
$locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE);
$sessionId = api_get_session_id();
$action = $_REQUEST['action'] ?? null;
$idChecked = $_REQUEST['idChecked'] ?? null;
$idMultiple = $_REQUEST['id'] ?? null;
if (empty($exercise_id)) {
api_not_allowed(true);
@ -96,6 +98,13 @@ if (!empty($_GET['path'])) {
}
switch ($action) {
case 'delete_multiple':
$exeIds = explode(',', $idMultiple);
foreach ($exeIds as $exeId) {
ExerciseLib::deleteExerciseAttempt((int) $exeId);
}
echo 1;
exit;
case 'export_all_results':
$sessionId = api_get_session_id();
$courseId = api_get_course_int_id();
@ -767,7 +776,9 @@ if ($is_allowedToEdit || $is_tutor) {
}';
}
$deleteUrl = api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&action=delete_multiple';
$extra_params['autowidth'] = 'true';
$extra_params['multiselect'] = true;
$extra_params['height'] = 'auto';
$extra_params['gridComplete'] = "
defaultGroupId = Cookies.get('default_group_".$exercise_id."');
@ -848,16 +859,11 @@ $gridJs = Display::grid_js(
if ($is_allowedToEdit || $is_tutor) {
?>
$("#results").jqGrid(
'navGrid',
'#results_pager', {
view:true, edit:false, add:false, del:false, excel:false
},
{height:280, reloadAfterSubmit:false}, // view options
{height:280, reloadAfterSubmit:false}, // edit options
{height:280, reloadAfterSubmit:false}, // add options
{reloadAfterSubmit: false}, // del options
{width:500}, // search options
$("#results").jqGrid('navGrid', '#results_pager',
{edit:false,add:false,del:true},
{height:280,reloadAfterSubmit:false}, // edit options
{height:280,reloadAfterSubmit:false}, // add options
{reloadAfterSubmit:true, url: '<?php echo $deleteUrl; ?>' }, // del options
);
var sgrid = $("#results")[0];

@ -14,8 +14,8 @@ require_once __DIR__.'/../global.inc.php';
// 1. Setting variables needed by jqgrid
$action = $_GET['a'];
$page = (int) $_REQUEST['page']; //page
$limit = (int) $_REQUEST['rows']; //quantity of rows
$page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
$limit = isset($_REQUEST['rows']) ? (int) $_REQUEST['rows'] : 20;
$cid = isset($_REQUEST['cid']) ? (int) $_REQUEST['cid'] : null;
$sid = isset($_REQUEST['sid']) ? (int) $_REQUEST['sid'] : null;
@ -29,8 +29,8 @@ if (empty($savedRows)) {
}
}
$sidx = $_REQUEST['sidx']; //index (field) to filter
$sord = $_REQUEST['sord']; //asc or desc
$sidx = isset($_REQUEST['sidx']) ? $_REQUEST['sidx'] : ''; // Default to empty string
$sord = isset($_REQUEST['sord']) ? $_REQUEST['sord'] : 'asc';
$exportFilename = isset($_REQUEST['export_filename']) ? $_REQUEST['export_filename'] : '';
if (false !== strpos(strtolower($sidx), 'asc')) {

Loading…
Cancel
Save