Update from 1.11.x

pull/3890/head
Julio Montoya 4 years ago
parent 01102ec4f5
commit 00181688f8
  1. 4
      public/main/inc/lib/career.lib.php
  2. 38
      public/main/inc/lib/course.lib.php
  3. 13
      public/main/inc/lib/extra_field.lib.php
  4. 7
      public/main/inc/lib/formvalidator/Element/SelectAjax.php

@ -917,6 +917,10 @@ class Career extends Model
$iconData['Description'] = 'Result Id = '.$resultId;
}
if ('Joe Anonymous' === $iconData['TeacherUsername']) {
$iconData['TeacherUsername'] = '';
}
if (!empty($icon)) {
$params = [
'id' => 'course_'.$id.'_'.$resultId,

@ -6666,6 +6666,44 @@ class CourseManager
return Display::tabsOnlyLink($tabs, $default);
}
public static function getUrlMarker($courseId)
{
if (UrlManager::getCountAccessUrlFromCourse($courseId) > 1) {
return ' '.Display::returnFontAwesomeIcon(
'link',
null,
null,
null,
get_lang('CourseUsedInOtherURL')
);
}
return '';
}
public static function insertUserInCourse(int $studentId, int $courseId, array $relationInfo = [])
{
$courseUserTable = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$relationInfo = array_merge(
['relation_type' => 0, 'status' => STUDENT, 'sort' => 0, 'user_course_cat' => 0],
$relationInfo
);
Database::insert(
$courseUserTable,
[
'c_id' => $courseId,
'user_id' => $studentId,
'status' => $relationInfo['status'],
'sort' => $relationInfo['sort'],
'relation_type' => $relationInfo['relation_type'],
'user_course_cat' => $relationInfo['user_course_cat'],
]
);
Event::logSubscribedUserInCourse($studentId, $courseId);
}
/**
* Check if a specific access-url-related setting is a problem or not.
*

@ -8,9 +8,6 @@ use Chamilo\CoreBundle\Entity\ExtraFieldRelTag;
use Chamilo\CoreBundle\Entity\Tag;
use Chamilo\CoreBundle\Framework\Container;
/**
* Class ExtraField.
*/
class ExtraField extends Model
{
public const FIELD_TYPE_TEXT = 1;
@ -3195,9 +3192,7 @@ JAVASCRIPT;
}
}
/** @var \HTML_QuickForm_select $slct */
$slct = $form->addElement(
'select',
$select = $form->addSelect(
'extra_'.$fieldDetails['variable'],
$fieldDetails['display_text'],
[],
@ -3205,19 +3200,19 @@ JAVASCRIPT;
);
if (empty($defaultValueId)) {
$slct->addOption(get_lang('Please select an option'));
$select->addOption(get_lang('Please select an option'), '');
}
foreach ($options as $value => $text) {
if (empty($value)) {
$slct->addOption($text, $value);
$select->addOption($text, $value);
continue;
}
$valueParts = explode('#', $text);
$dataValue = count($valueParts) > 1 ? array_shift($valueParts) : '';
$slct->addOption(implode('', $valueParts), $value, ['data-value' => $dataValue]);
$select->addOption(implode('', $valueParts), $value, ['data-value' => $dataValue]);
}
if ($freezeElement) {

@ -45,7 +45,7 @@ class SelectAjax extends HTML_QuickForm_select
$plHolder = $this->getAttribute('placeholder');
if (empty($plHolder)) {
$plHolder = get_lang('Please select an option');
$plHolder = preg_replace("/'/", "\\'", get_lang('Please select an option'));
}
$id = $this->getAttribute('id');
@ -76,8 +76,7 @@ class SelectAjax extends HTML_QuickForm_select
$max = !empty($max) ? "maximumSelectionLength: $max, " : '';
// wait XX milliseconds before triggering the request
$delay = (int) $this->getAttribute('delay');
$delay = (0 !== $delay) ? "delay: $delay, " : '';
$delay = ((int) $this->getAttribute('delay')) ?: 1000;
$html = <<<JS
<script>
@ -91,7 +90,7 @@ class SelectAjax extends HTML_QuickForm_select
tags: $tags,
ajax: {
url: $url,
{$delay}
delay: $delay,
dataType: 'json',
data: function(params) {
return {

Loading…
Cancel
Save