Merge remote-tracking branch 'origin/master'

pull/4855/head
Angel Fernando Quiroz Campos 1 year ago
commit 9727731ef2
  1. 4
      public/main/gradebook/gradebook_view_result.php
  2. 4
      public/main/gradebook/lib/fe/displaygradebook.php
  3. 34
      public/main/inc/lib/display.lib.php
  4. 8
      public/main/survey/fillsurvey.php
  5. 15
      public/main/survey/survey.lib.php

@ -675,7 +675,7 @@ if (null == $file_type) {
//show the result header
if (isset($export_result_form) && !(isset($edit_res_form))) {
echo $export_result_form->display();
DisplayGradebook::display_header_result($eval[0], $currentcat[0]->get_id(), 1);
DisplayGradebook::display_header_result($eval[0], $currentcat[0]->get_id(), 'view_result');
} else {
if (isset($import_result_form)) {
echo $import_result_form->display();
@ -683,7 +683,7 @@ if (null == $file_type) {
if (isset($edit_res_form)) {
echo $edit_res_form->toHtml();
}
DisplayGradebook::display_header_result($eval[0], $currentcat[0]->get_id(), 1);
DisplayGradebook::display_header_result($eval[0], $currentcat[0]->get_id(), 'view_result');
}
// Letter-based scores are built from lib/results_data_generator.class.php::get_score_display()
$resultTable->display();

@ -22,6 +22,7 @@ class DisplayGradebook
$links[] = '<a href="'.Category::getUrl().'selectcat='.$selectcat.'">'.
Display::return_icon('back.png', get_lang('Assessment home'), '', ICON_SIZE_MEDIUM)
.'</a>';
if ('view_result' === $page) {
if ((null != $evalobj->get_course_code()) && !$evalobj->has_results()) {
$links[] = '<a href="gradebook_add_result.php?'.api_get_cidreq().'&selectcat='.$selectcat.'&selecteval='.$evalobj->get_id().'">
'.Display::return_icon('evaluation_rate.png', get_lang('Grade learners'), '', ICON_SIZE_MEDIUM).'</a>';
@ -45,6 +46,7 @@ class DisplayGradebook
}
$links[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&print=&selecteval='.$evalobj->get_id().'" target="_blank">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
}
} else {
$links[] = '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.
Display::return_icon('back.png', get_lang('Assessment home'), '', ICON_SIZE_MEDIUM).'</a>';
@ -118,7 +120,7 @@ class DisplayGradebook
}
}
echo Display::toolbarAction('grade', $links);
echo Display::toolbarGradeAction($links);
echo $evalinfo;
}

@ -2184,6 +2184,40 @@ class Display
';
}
/**
* @param array $content
* @param array $colsWidth Optional. Columns width
*
* @return string
*/
public static function toolbarGradeAction($content, $colsWidth = [])
{
$col = count($content);
if (!$colsWidth) {
$width = 8 / $col;
array_walk($content, function () use ($width, &$colsWidth) {
$colsWidth[] = $width;
});
}
$html = '<div id="grade" class="p-toolbar p-component flex items-center justify-between flex-wrap" role="toolbar">';
for ($i = 0; $i < $col; $i++) {
$class = 'col-sm-'.$colsWidth[$i];
if ($col > 1) {
if ($i > 0 && $i < count($content) - 1) {
$class .= ' text-center';
} elseif ($i === count($content) - 1) {
$class .= ' text-right';
}
}
$html .= '<div class="'.$class.'">'.$content[$i].'</div>';
}
$html .= '</div>';
return $html;
}
public static function getMdiIcon(string $name, string $additionalClass = null, string $style = null, int $pixelSize = null, string $title = null, array $additionalAttributes = null): string
{
$sizeString = '';

@ -76,6 +76,10 @@ if ((!isset($_GET['course']) || !isset($_GET['invitationcode'])) && !isset($_GET
$repo = Container::getSurveyRepository();
$surveyId = isset($_GET['iid']) ? (int) $_GET['iid'] : 0;
if (empty($surveyId) && (isset($_POST['language']) && is_numeric($_POST['language']))) {
$surveyId = (int) $_POST['language'];
}
/** @var CSurvey $survey */
$survey = $repo->find($surveyId);
if (null === $survey) {
@ -197,7 +201,7 @@ $sql = "SELECT * FROM $table_survey
$result = Database::query($sql);
if (Database::num_rows($result) > 1) {
if ($_POST['language']) {
if (isset($_POST['language'])) {
$survey_invitation['survey_id'] = $_POST['language'];
} else {
Display::display_header(get_lang('Surveys'));
@ -210,7 +214,7 @@ if (Database::num_rows($result) > 1) {
echo '<form id="language" name="language" method="POST" action="'.$frmLangUrl.'">';
echo '<select name="language">';
while ($row = Database::fetch_array($result, 'ASSOC')) {
echo '<option value="'.$row['survey_id'].'">'.$row['lang'].'</option>';
echo '<option value="'.$row['iid'].'">'.$row['lang'].'</option>';
}
echo '</select>';
echo '<button type="submit" name="Submit" class="next">'.get_lang('Validate').'</button>';

@ -2212,15 +2212,18 @@ class SurveyManager
$sessionId = 0,
$groupId = 0
) {
$invitationRepo = Database::getManager()->getRepository(CSurveyInvitation::class);
$em = Database::getManager();
$invitationRepo = $em->getRepository(CSurveyInvitation::class);
$surveyRepo = $em->getRepository(CSurvey::class);
$survey = $surveyRepo->findBy(['code' => $surveyCode]);
return $invitationRepo->findBy(
[
'user' => $userId,
'cId' => $courseId,
'sessionId' => $sessionId,
'groupId' => $groupId,
'surveyCode' => $surveyCode,
'user' => api_get_user_entity($userId),
'course' => api_get_course_entity($courseId),
'session' => api_get_session_entity($sessionId),
'group' => api_get_group_entity($groupId),
'survey' => $survey,
],
['invitationDate' => 'DESC']
);

Loading…
Cancel
Save