Merge pull request #5271 from christianbeeznest/fixes-updates10

Course: Improve UI and fix bugs in user tool
pull/5272/head
christianbeeznest 2 years ago committed by GitHub
commit 956f3da5ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 38
      assets/css/app.scss
  2. 6
      public/main/inc/ajax/model.ajax.php
  3. 2
      public/main/inc/lib/display.lib.php
  4. 2
      public/main/inc/lib/sortable_table.class.php
  5. 2
      public/main/user/class.php
  6. 6
      public/main/user/subscribe_user.php
  7. 14
      public/main/user/user.php

@ -124,6 +124,44 @@
}
}
.sortable-container {
width: 100%;
overflow: auto;
}
.toolbar-action {
.p-toolbar-group-start.p-toolbar-group-left {
display: flex;
padding: 10px;
background: #f0f0f0;
border-radius: 5px;
}
.p-toolbar-group-start.p-toolbar-group-left .btn {
padding: 10px 20px;
text-decoration: none;
color: #333;
background-color: #e7e7e7;
border: 1px solid #ddd;
border-radius: 5px;
transition: background-color 0.3s;
}
.p-toolbar-group-start.p-toolbar-group-left .btn:hover {
background-color: #ddd;
}
.p-toolbar-group-start.p-toolbar-group-left .btn.active {
background-color: #007bff;
color: white;
border-color: #007bff;
}
.p-toolbar-group-start.p-toolbar-group-left .btn + .btn {
margin-left: 10px;
}
}
.sortable-buttons-actions {
@apply bg-gray-5 border border-gray-20 rounded shadow;

@ -2552,8 +2552,8 @@ switch ($action) {
]);
break;
case 'get_usergroups_teacher':
$columns = ['name', 'users', 'status', 'group_type', 'actions'];
$options['order'] = "name $sord";
$columns = ['title', 'users', 'status', 'group_type', 'actions'];
$options['order'] = "title $sord";
$options['limit'] = "$start , $limit";
$options['session_id'] = $sessionId;
switch ($type) {
@ -2564,7 +2564,7 @@ switch ($action) {
$options['where'] = [' (session_id IS NULL OR session_id != ?) ' => $sessionId];
}
if (!empty($keyword)) {
$options['where']['AND name like %?% '] = $keyword;
$options['where']['AND title like %?% '] = $keyword;
}
$result = $obj->getUserGroupNotInCourse(
$options,

@ -2180,7 +2180,7 @@ class Display
}
return '<div id="'.$id.'" class="p-toolbar p-component flex items-center justify-between flex-wrap" role="toolbar">
return '<div id="'.$id.'" class="toolbar-action p-toolbar p-component flex items-center justify-between flex-wrap" role="toolbar">
<div class="p-toolbar-group-start p-toolbar-group-left">'.$start.'</div>
<div class="p-toolbar-group-center">'.$center.'</div>
<div class="p-toolbar-group-end p-toolbar-group-right">'.$end.'</div>

@ -407,7 +407,7 @@ class SortableTable extends HTML_Table
}
//$html .= '<div class="table-responsive">'.$content.'</div>';
$html .= '<div class="">';
$html .= '<div class="sortable-container">';
$html .= $content.'</div>';
if (!empty($this->additional_parameters)) {

@ -115,7 +115,7 @@ if (api_is_allowed_to_edit()) {
}
// jqgrid will use this URL to do the selects
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_usergroups_teacher&type='.$type.'&group_filter='.$groupFilter.'&keyword='.$keyword;
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_usergroups_teacher&type='.$type.'&group_filter='.$groupFilter.'&keyword='.$keyword.'&'.api_get_cidreq();
// The order is important you need to check the the $column variable in the model.ajax.php file
$columns = [

@ -141,6 +141,9 @@ $table = new SortableTable(
);
$parameters['keyword'] = $keyword;
$parameters['type'] = $type;
$parameters['cid'] = api_get_course_int_id();
$parameters['sid'] = api_get_session_id();
$table->set_additional_parameters($parameters);
$col = 0;
$table->set_header($col++, '', false);
@ -205,7 +208,8 @@ $form = new FormValidator(
);
$form->addText('keyword', '', false);
$form->addElement('hidden', 'type', $type);
$form->addElement('hidden', 'cidReq', api_get_course_id());
$form->addElement('hidden', 'cid', api_get_course_int_id());
$form->addElement('hidden', 'sid', api_get_session_id());
$form->addButtonSearch(get_lang('Search'));
echo Display::toolbarAction('toolbar-subscriber', [$actionsLeft, $extraForm, $form->returnForm()]);

@ -498,6 +498,8 @@ $table = new SortableTable(
$parameters['keyword'] = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$parameters['sec_token'] = Security::get_token();
$parameters['id_session'] = api_get_session_id();
$parameters['cid'] = api_get_course_int_id();
$parameters['sid'] = api_get_session_id();
$parameters['type'] = $type;
$table->set_additional_parameters($parameters);
@ -673,11 +675,13 @@ function get_number_of_users()
$counter = 0;
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
$active = isset($_GET['active']) ? $_GET['active'] : null;
if ($active) {
$active = true;
} else {
$active = false;
$active = $_GET['active'] ?? null;
if (isset($active)) {
if ($active) {
$active = true;
} else {
$active = false;
}
}
$type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : STUDENT;

Loading…
Cancel
Save