Internal: Exercise UI enhancements and bug fixes

pull/5255/head
christianbeeznst 8 months ago
parent a531dfc35e
commit d78568e19c
  1. 25
      assets/css/app.scss
  2. 189
      assets/css/scss/_exercise.scss
  3. 2
      assets/css/scss/atoms/_buttons.scss
  4. 4
      public/main/exercise/admin.php
  5. 23
      public/main/exercise/exercise.class.php
  6. 2
      public/main/exercise/question_list_admin.inc.php
  7. 3
      public/main/forum/forumfunction.inc.php
  8. 4
      public/main/inc/lib/display.lib.php
  9. 7
      public/main/inc/lib/exercise.lib.php
  10. 2
      public/main/inc/lib/formvalidator/FormValidator.class.php
  11. 4
      public/main/inc/lib/sortable_table.class.php

@ -91,21 +91,34 @@
// Alerts
.alert {
@apply px-6 py-4 border-0 rounded relative mb-4;
@apply p-3.5 mb-5 border border-transparent rounded;
}
.alert-info {
.alert-warning {
background-color: #fff3cd;
color: #856404;
border-color: #ffeeba;
}
.alert-warning {
.alert-danger {
background-color: #f8d7da;
color: #721c24;
border-color: #f5c6cb;
}
.alert-success {
.alert-info {
background-color: #d1ecf1;
color: #0c5460;
border-color: #bee5eb;
}
.alert-danger {
.alert-success {
background-color: #d4edda;
color: #155724;
border-color: #c3e6cb;
}
// Tabs
.tab_wrapper nav {
@ -133,7 +146,7 @@
}
.pull-right {
@apply flex flex-row;
@apply flex justify-end;
}
.header-border-bottom {

@ -72,6 +72,195 @@
padding: 5px;
}
.data_table {
@apply border-collapse w-full;
}
.data_table thead th {
@apply bg-gray-20 text-gray-90 font-semibold text-left px-4 py-3 border-b border-gray-30 border-l border-r border-gray-30 text-center;
}
.data_table tbody td {
@apply px-4 py-3 border-b border-gray-30 border-l border-r border-gray-30;
}
.data_table tbody tr:nth-child(odd) {
@apply bg-gray-5;
}
.data_table tbody tr:hover {
background-color: #eff6ff;
}
.data_table .checkbox label {
@apply pl-4;
}
.data_table i.mdi {
@apply align-middle;
}
.data_table .mdi::before {
@apply inline-block;
font-size: inherit;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
transform: translate(0, 0);
}
#question_list {
font-family: Arial, sans-serif;
width: 100%;
.row,
.header_operations .row > div,
.header_operations .row > div > a,
.header_operations .row > div > a > i {
display: flex;
align-items: center;
}
.header_operations .row > div {
flex: 1;
padding: 0.75rem 1rem;
}
.question {
flex: 2 !important;
}
.type,
.category,
.level,
.score,
.btn-actions {
flex: 1;
justify-content: center;
}
.level,
.score,
.btn-actions {
justify-content: flex-end;
}
.header_operations .xs {
display: none;
}
.row:first-child {
font-weight: bold;
background-color: #f8f9fa;
border: 1px solid #ddd;
border-radius: 4px;
}
.btn-actions .edition {
gap: 10px;
}
.btn-actions .edition a {
margin: 0;
}
i.mdi {
font-size: 16px;
}
.ui-sortable-handle {
font-size: 25px !important;
margin-right: 5px;
}
}
.question-header {
display: flex;
align-items: center;
justify-content: center;
background-color: #f8f9fa;
padding: 15px;
border: 1px solid #ddd;
border-radius: 4px;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
> div {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding: 0.75rem;
}
.col-sm-5 {
flex: 3;
}
.col-sm-1 {
flex: 2 !important;
}
.col-sm-2 {
flex: 2;
}
.col-sm-1.text-right,
.col-sm-2.text-right {
justify-content: flex-end;
text-align: right;
}
@media (max-width: 768px) {
flex-direction: column;
> div {
text-align: left;
width: 100%;
padding: 0.5rem 0;
}
}
}
.question-list-description-block {
background-color: #fff;
border: 1px solid #ddd;
padding: 15px;
margin-top: -1px;
border-radius: 0 0 4px 4px;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
.lead {
font-size: 1.25rem;
margin-bottom: 10px;
}
.question_options {
padding: 10px;
background-color: #f8f9fa;
border-radius: 4px;
input[type="text"] {
width: auto;
margin: 0 5px;
padding: 5px;
border: 1px solid #ccc;
border-radius: 4px;
}
}
@media (max-width: 768px) {
padding: 10px;
.question_options {
padding: 5px;
input[type="text"] {
padding: 4px;
}
}
}
}
.question_menu {
@apply p-4 flex flex-row gap-1;
}

@ -40,7 +40,7 @@
}
&--plain {
@apply bg-gray-30 text-white mr-1.5;
@apply bg-gray-50 text-white mr-1.5;
&:hover,
&:focus {

@ -55,7 +55,7 @@ api_protect_course_script(true);
$is_allowedToEdit = api_is_allowed_to_edit(null, true, false, false);
$sessionId = api_get_session_id();
$studentViewActive = api_is_student_view_active();
$showPagination = api_get_setting('exercise.show_question_pagination');
$showPagination = 'true' === api_get_setting('exercise.show_question_pagination');
if (!$is_allowedToEdit) {
api_not_allowed(true);
@ -338,7 +338,7 @@ if ($inATest) {
if ($editQuestion && $objQuestion->existsInAnotherExercise()) {
echo Display::return_message(
Display::getMdiIcon('alert', 'ch-tool-icon', null, ICON_SIZE_SMALL)
.get_lang('ThisQuestionExistsInAnotherTestsWarning'),
.get_lang('Warning: This question exists in another tests'),
'warning',
false
);

@ -8834,8 +8834,8 @@ class Exercise
}
if (!empty($keyword)) {
$qb->andWhere($qb->expr()->eq('resource.title', ':keyword'));
$qb->setParameter('keyword', $keyword);
$qb->andWhere($qb->expr()->like('resource.title', ':keyword'));
$qb->setParameter('keyword', '%'.$keyword.'%');
}
// Only for administrators
@ -9455,12 +9455,19 @@ class Exercise
if (empty($tableRows) && empty($categoryId)) {
if ($is_allowedToEdit && 'learnpath' !== $origin) {
$content .= Display::noDataView(
get_lang('Quiz'),
Display::getMdiIcon(ToolIcon::QUIZ, 'ch-tool-icon', null, ICON_SIZE_BIG),
get_lang('Create a new test'),
'exercise_admin.php?'.api_get_cidreq()
);
if (!empty($_GET['keyword'])) {
$content .= Display::return_message(
get_lang('No Results for keyword: ').Security::remove_XSS($_GET['keyword']),
'warning'
);
} else {
$content .= Display::noDataView(
get_lang('Quiz'),
Display::getMdiIcon(ToolIcon::QUIZ, 'ch-tool-icon', null, ICON_SIZE_BIG),
get_lang('Create a new test'),
'exercise_admin.php?'.api_get_cidreq()
);
}
}
} else {
if (empty($tableRows)) {

@ -182,7 +182,7 @@ if (!$inATest) {
$objExercise->questionSelectionType = $originalQuestionSelectType;
echo '
<div class="row gt-xs my-4">
<div class="row gt-xs my-4 question-header">
<div class="col-sm-5"><strong>'.get_lang('Questions').'</strong></div>
<div class="col-sm-1 text-center"><strong>'.get_lang('Type').'</strong></div>
<div class="col-sm-2"><strong>'.get_lang('Category').'</strong></div>

@ -1864,7 +1864,8 @@ function saveThread(
send_notification_mails(
$forum,
$thread,
$reply_info
$reply_info,
$course
);
Session::erase('formelements');

@ -453,11 +453,11 @@ class Display
*
* @param string $message
* @param string $type Example: confirm, normal, warning, error
* @param bool $filter Whether to XSS-filter or not
* @param bool $filter Whether to XSS-filter or not
*
* @return string Message wrapped into an HTML div
*/
public static function return_message($message, $type = 'normal', $filter = true)
public static function return_message(string $message, string $type = 'normal', bool $filter = true): string
{
if (empty($message)) {
return '';

@ -1969,6 +1969,7 @@ HOTSPOT;
ON (gru.user_id = u.id AND gru.c_id= $courseId )
INNER JOIN $TBL_GROUP g
ON (gru.group_id = g.id AND g.c_id= $courseId )
WHERE u.active <> ".USER_SOFT_DELETED."
)";
}
@ -2001,6 +2002,7 @@ HOTSPOT;
'' as group_name,
'' as group_id
FROM $TBL_USER u
WHERE u.active <> ".USER_SOFT_DELETED."
)";
$sql_inner_join_tbl_user = null;
}
@ -2032,6 +2034,7 @@ HOTSPOT;
ON (gru.user_id = u.id AND gru.c_id= $courseId )
LEFT OUTER JOIN $TBL_GROUP g
ON (gru.group_id = g.id AND g.c_id = $courseId )
WHERE u.active <> ".USER_SOFT_DELETED."
)";
}
@ -2043,7 +2046,7 @@ HOTSPOT;
(
SELECT u.id as user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code
FROM $TBL_USER u
WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').")
WHERE u.active <> ".USER_SOFT_DELETED." AND u.status NOT IN(".api_get_users_status_ignored_in_reports('string').")
)";
}
@ -2094,8 +2097,6 @@ HOTSPOT;
";
}
$sql .= !str_contains($sql, 'WHERE') ? ' WHERE user.active <> '.USER_SOFT_DELETED : ' AND user.active <> '.USER_SOFT_DELETED;
if (empty($sql)) {
return false;
}

@ -229,7 +229,7 @@ EOT;
*/
public function addCourseHiddenParams()
{
$this->addHidden('cid', api_get_course_id());
$this->addHidden('cid', api_get_course_int_id());
$this->addHidden('sid', api_get_session_id());
}

@ -423,12 +423,12 @@ class SortableTable extends HTML_Table
if (count($this->form_actions) > 0) {
$html .= '<div class="flex flex-row justify-between" role="group">';
$html .= '<a
class="btn btn--primary"
class="btn btn--primary mr-2"
href="?'.$params.'&amp;'.$this->param_prefix.'selectall=1"
onclick="javascript: setCheckbox(true, \''.$table_id.'\'); return false;">'.
get_lang('Select all').'</a>';
$html .= '<a
class="btn btn--primary"
class="btn btn--primary mr-2"
href="?'.$params.'"
onclick="javascript: setCheckbox(false, \''.$table_id.'\'); return false;">'.
get_lang('Deselect all').'</a> ';

Loading…
Cancel
Save