Minor - Update from 1.11.x

pull/3064/head
Julio Montoya 5 years ago
parent 5ea477d5a6
commit fb103d5e64
  1. 3
      assets/css/print.css
  2. 4
      main/exercise/fill_blanks.class.php
  3. 13
      main/gradebook/gradebook_display_certificate.php
  4. 13
      main/gradebook/lib/be/category.class.php
  5. 71
      main/gradebook/lib/gradebook_data_generator.class.php
  6. 2
      main/inc/lib/api.lib.php
  7. 44
      main/inc/lib/document.lib.php
  8. 2
      main/lp/learnpath.class.php
  9. 5
      main/lp/learnpathList.class.php

@ -262,9 +262,6 @@ dl.upload_option {
line-height: 0;
height: 0;
}
p, blockquote, ol, ul {
font-size: 12px;
}
h1 {
font-size: 21px;
}

@ -1132,7 +1132,7 @@ class FillBlanks extends Question
$result = '';
$listStudentAnswerInfo = self::getAnswerInfo($answer, true);
if (in_array($resultsDisabled, [
/*if (in_array($resultsDisabled, [
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK,
]
@ -1142,7 +1142,7 @@ class FillBlanks extends Question
if ($showTotalScoreAndUserChoices) {
$resultsDisabled = false;
}
}
}*/
// rebuild the answer with good HTML style
// this is the student answer, right or wrong

@ -317,12 +317,21 @@ if (count($certificate_list) == 0) {
echo '<td width="30%">'.get_lang('Date').' : '.api_convert_and_format_date($valueCertificate['created_at']).'</td>';
echo '<td width="20%">';
$url = api_get_path(WEB_PATH).'certificates/index.php?id='.$valueCertificate['id'].'&user_id='.$value['user_id'];
$certificates = Display::url(
$certificateUrl = Display::url(
get_lang('Certificate'),
$url,
['target' => '_blank', 'class' => 'btn btn-default']
);
echo $certificates;
echo $certificateUrl;
$url .= '&action=export';
$pdf = Display::url(
Display::return_icon('pdf.png', get_lang('Download')),
$url,
['target' => '_blank']
);
echo $pdf;
echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&'.api_get_cidreq().'&action=delete&cat_id='.$categoryId.'&certificate_id='.$valueCertificate['id'].'">
'.Display::return_icon('delete.png', get_lang('Delete')).'
</a>';

@ -946,7 +946,6 @@ class Category implements GradebookItem
}
}
$students = [];
if (!empty($evals)) {
/** @var Evaluation $eval */
foreach ($evals as $eval) {
@ -1137,18 +1136,6 @@ class Category implements GradebookItem
$maxScore = current($totalScorePerStudent);
return [$maxScore, $this->get_weight()];
if (empty($bestResult)) {
if ($cacheAvailable) {
$cacheDriver->save($key, null);
}
return null;
}
if ($cacheAvailable) {
$cacheDriver->save($key, [$bestResult, $weightsum]);
}
return [$bestResult, $weightsum];
break;
case 'average':
if (empty($ressum)) {

@ -242,8 +242,68 @@ class GradebookDataGenerator
}
} else {
if (!empty($studentList)) {
$session_id = api_get_session_id();
//$cats = $item->get_subcategories(null);
$evals = $item->get_evaluations(null);
$links = $item->get_links(null);
foreach ($studentList as $user) {
$score = $this->build_result_column(
$ressum = 0;
$weightsum = 0;
$bestResult = 0;
if (!empty($evals)) {
foreach ($evals as $eval) {
$evalres = $eval->calc_score($user['user_id'], null);
$eval->setStudentList($studentList);
if (isset($evalres) && $eval->get_weight() != 0) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
if (!empty($evalres[1])) {
$ressum += $evalres[0] / $evalres[1] * $evalweight;
}
if ($ressum > $bestResult) {
$bestResult = $ressum;
}
} else {
if ($eval->get_weight() != 0) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
}
}
}
}
if (!empty($links)) {
foreach ($links as $link) {
$link->setStudentList($studentList);
if ($session_id) {
$link->set_session_id($session_id);
}
$linkres = $link->calc_score($user['user_id'], null);
if (!empty($linkres) && $link->get_weight() != 0) {
$linkweight = $link->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
$weightsum += $linkweight;
$ressum += $linkres[0] / $link_res_denom * $linkweight;
if ($ressum > $bestResult) {
$bestResult = $ressum;
}
} else {
// Adding if result does not exists
if ($link->get_weight() != 0) {
$linkweight = $link->get_weight();
$weightsum += $linkweight;
}
}
}
}
/*$score = $this->build_result_column(
$user['user_id'],
$item,
$ignore_score_color,
@ -251,11 +311,18 @@ class GradebookDataGenerator
);
if (!empty($score['score'][0])) {
$invalidateResults = false;
}*/
if (!empty($ressum)) {
$invalidateResults = false;
}
$rankingStudentList[$user['user_id']] = $score['score'][0];
$rankingStudentList[$user['user_id']] = $ressum;
}
}
//error_log($item->get_id());
$score = AbstractLink::getCurrentUserRanking($userId, $rankingStudentList);
//error_log(print_r($score, 1));
}
$row['ranking'] = $scoreDisplay->display_score(

@ -6368,7 +6368,7 @@ function api_replace_dangerous_char($filename, $treat_spaces_as_hyphens = true)
250,
'',
true,
true,
false,
false,
false,
$treat_spaces_as_hyphens

@ -1806,50 +1806,23 @@ class DocumentManager
public static function create_directory_certificate_in_course($courseInfo)
{
if (!empty($courseInfo)) {
$to_group_id = 0;
$to_user_id = null;
$course_dir = $courseInfo['path']."/document/";
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir;
$dir_name = '/certificates';
$post_dir_name = get_lang('Certificates');
$visibility_command = 'invisible';
$id = self::get_document_id_of_directory_certificate();
if (empty($id)) {
create_unexisting_directory(
$courseInfo,
api_get_user_id(),
api_get_session_id(),
$to_group_id,
$to_user_id,
$base_work_dir,
0,
0,
'',
$dir_name,
$post_dir_name,
null,
false,
false
);
$id = self::get_document_id_of_directory_certificate();
if (empty($id)) {
self::addDocument(
$courseInfo,
$dir_name,
'folder',
0,
$post_dir_name,
null,
0,
true,
$to_group_id,
0,
0,
false
);
}
}
}
}
@ -2844,6 +2817,7 @@ class DocumentManager
{
$id = api_get_unique_id();
switch ($extension) {
case 'ogg':
case 'mp3':
$document_data['file_extension'] = $extension;
$html = '<div style="margin: 0; position: absolute; top: 50%; left: 35%;">';
@ -4752,15 +4726,13 @@ class DocumentManager
//$url = 'show_content.php?'.$courseParams.'&id='.$document_data['id'];
$class = 'ajax ';
//$url = $documentWebPath.str_replace('%2F', '/', $url_path).'?'.$courseParams;
$url_path = str_replace('%2F', '/', $url_path);
$url = api_get_path(WEB_PUBLIC_PATH)."courses/$courseCode/document$url_path?type=show";
if ($addToEditor) {
$class = $classAddToEditor;
$url = $documentWebPath.str_replace('%2F', '/', $url_path).'?'.$courseParams;
$url = $documentWebPath.$url_path;
}
$url_path = str_replace('%2F', '/', $url_path);
if ($visibility == false) {
$class = ' ajax text-muted ';
if ($addToEditor) {
@ -5333,6 +5305,7 @@ This folder contains all sessions that have been opened in the chat. Although th
*/
public static function createUserSharedFolder($userId, array $courseInfo, $sessionId = 0)
{
return false;
$documentDirectory = api_get_path(SYS_COURSE_PATH).$courseInfo['directory'].'/document';
$userInfo = api_get_user_info($userId);
@ -6176,13 +6149,14 @@ This folder contains all sessions that have been opened in the chat. Although th
return false;
}
// is updated using the title
$document = new CDocument();
$document
->setCourse($courseEntity)
->setPath($path)
->setFiletype($fileType)
->setSize($fileSize)
->setTitle($title)
->setPath($path)
->setComment($comment)
->setReadonly($readonly)
->setSession($session)

@ -12850,7 +12850,7 @@ EOD;
}
$documentPathInfo = pathinfo($document->getPath());
$mediaSupportedFiles = ['mp3', 'mp4', 'ogv', 'flv', 'm4v'];
$mediaSupportedFiles = ['mp3', 'mp4', 'ogv', 'ogg', 'flv', 'm4v'];
$extension = isset($documentPathInfo['extension']) ? $documentPathInfo['extension'] : '';
$showDirectUrl = !in_array($extension, $mediaSupportedFiles);

@ -106,10 +106,7 @@ class LearnpathList
$isAllowToEdit = api_is_allowed_to_edit();
/** @var CLp $row */
foreach ($learningPaths as $row) {
// Use domesticate here instead of Database::escape_string because
// it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
// is done using domesticate()
$name = domesticate($row->getName());
$name = Database::escape_string($row->getName());
$link = 'lp/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
$oldLink = 'newscorm/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;

Loading…
Cancel
Save