Minor - Flint fixes

pull/3063/head
Julio Montoya 7 years ago
parent aa82ff785b
commit f5c57ac4a9
  1. 7
      load_search.php
  2. 1
      main/admin/skill_translate.php
  3. 2
      main/auth/inscription.php
  4. 2
      main/auth/sso/sso.Drupal.class.php
  5. 2
      main/auth/sso/sso.TCC.class.php
  6. 1
      main/document/showinframes.php
  7. 2
      main/dropbox/dropbox_functions.inc.php
  8. 2
      main/exercise/TestCategory.php
  9. 4
      main/exercise/overview.php
  10. 3
      main/forum/forumfunction.inc.php
  11. 1
      main/forum/viewthread.php
  12. 4
      main/gradebook/lib/be/category.class.php
  13. 2
      main/gradebook/lib/fe/gradebooktable.class.php
  14. 4
      main/gradebook/lib/fe/linkform.class.php
  15. 2
      main/gradebook/lib/fe/resulttable.class.php
  16. 2
      main/gradebook/lib/gradebook_data_generator.class.php
  17. 2
      main/inc/ajax/statistics.ajax.php
  18. 2
      main/inc/lib/api.lib.php
  19. 2
      main/inc/lib/blog.lib.php
  20. 6
      main/inc/lib/chat.lib.php
  21. 4
      main/inc/lib/course.lib.php
  22. 1
      main/inc/lib/database.lib.php
  23. 3
      main/inc/lib/display.lib.php
  24. 1
      main/inc/lib/exercise.lib.php
  25. 1
      main/inc/lib/extra_field.lib.php
  26. 134
      main/inc/lib/formvalidator/Element/DateTimeRangePicker.php
  27. 7
      main/inc/lib/formvalidator/FormValidator.class.php
  28. 1
      main/inc/lib/internationalization.lib.php
  29. 1
      main/inc/lib/message.lib.php
  30. 1
      main/inc/lib/sessionmanager.lib.php
  31. 231
      main/inc/lib/social.lib.php
  32. 1
      main/inc/lib/usergroup.lib.php
  33. 3
      main/inc/lib/usermanager.lib.php
  34. 2
      main/inc/lib/userportal.lib.php
  35. 2
      main/install/configuration.dist.php
  36. 1
      main/lp/learnpath.class.php
  37. 4
      main/lp/learnpathItem.class.php
  38. 2
      main/lp/lp_ajax_save_item.php
  39. 2
      main/mySpace/myStudents.php
  40. 3
      main/social/home.php
  41. 2
      main/social/map.php
  42. 1
      main/survey/question.php
  43. 1
      main/survey/survey.lib.php
  44. 2
      main/webservices/lp.php
  45. 18
      main/webservices/registration.soap.php
  46. 2
      main/webservices/tcc.soap.php
  47. 2
      main/work/work.lib.php
  48. 4
      plugin/advanced_subscription/src/HookAdvancedSubscription.php
  49. 8
      search.php
  50. 2
      src/Chamilo/ContactBundle/Form/Type/ContactType.php
  51. 1
      src/Chamilo/FaqBundle/Entity/CategoryTranslation.php
  52. 1
      src/Chamilo/FaqBundle/Entity/Question.php
  53. 1
      src/Chamilo/FaqBundle/Entity/QuestionTranslation.php
  54. 2
      src/Chamilo/UserBundle/Repository/UserRepository.php

@ -329,7 +329,7 @@ $extra = $extraField->addElements(
$fieldsToShow = [
'heures_disponibilite_par_semaine',
'moment_de_disponibilite',
'langue_cible'
'langue_cible',
];
$extra = $extraFieldUser->addElements(
@ -387,9 +387,8 @@ $extra = $extraField->addElements(
true
);
$fieldsToShow = [
'langue_cible'
'langue_cible',
];
$extra = $extraFieldUser->addElements(
@ -659,7 +658,6 @@ if ($form->validate()) {
'item_id' => $userToLoad,
'extra_heures_disponibilite_par_semaine' => isset($userData['extra_heures_disponibilite_par_semaine']) ? $userData['extra_heures_disponibilite_par_semaine'] : '',
'extra_langue_cible' => isset($userData['extra_langue_cible']) ? $userData['extra_langue_cible'] : '',
];
$extraFieldValue->saveFieldValues(
$userDataToSave,
@ -929,7 +927,6 @@ if (!empty($filterToSend)) {
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&load_extra_field='.$extraFieldListToString.'&_force_search=true&rows=20&page=1&sidx=&sord=asc';
}
// Autowidth
$extra_params['autowidth'] = 'true';

@ -2,7 +2,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\Language;
use Chamilo\CoreBundle\Entity\Skill;

@ -22,7 +22,7 @@ $allowedFields = [
'status',
'language',
'extra_fields',
'address'
'address',
];
$allowedFieldsConfiguration = api_get_configuration_value('allow_fields_inscription');

@ -91,7 +91,7 @@ class ssoDrupal
/**
* Validates the received active connection data with the database.
*
* @return null|false Return the loginFailed variable value to local.inc.php
* @return false|null Return the loginFailed variable value to local.inc.php
*/
public function check_user()
{

@ -89,7 +89,7 @@ class ssoTCC
/**
* Validates the received active connection data with the database.
*
* @return null|false Return the loginFailed variable value to local.inc.php
* @return false|null Return the loginFailed variable value to local.inc.php
*/
public function check_user()
{

@ -244,7 +244,6 @@ if ($is_freemind_available) {
$execute_iframe = false;
}
$execute_iframe = true;
if (!$playerSupported && $execute_iframe) {

@ -862,7 +862,7 @@ function removeMoreIfMailing($file_id)
* @param array $file
* @param Dropbox_SentWork $work
*
* @return array|null|string
* @return array|string|null
*/
function store_add_dropbox($file = [], $work = null)
{

@ -652,7 +652,7 @@ class TestCategory
* @param int $questionId
* @param int $in_display_category_name
*
* @return null|string
* @return string|null
*/
public static function returnCategoryAndTitle($questionId, $in_display_category_name = 1)
{

@ -76,12 +76,11 @@ if ($origin != 'learnpath') {
}
$tpl = new Template('Overview');
$list = array();
$list = [];
$html = '';
$message = '';
$isAllowedToEdit = api_is_allowed_to_edit(null, true);
$list['id'] = $objExercise->id;
$list['session_id'] = $objExercise->sessionId;
@ -329,4 +328,3 @@ $tpl->assign('table_result', $tableContent);
$layout = $tpl->get_template('exercise/overview.tpl');
$tpl->assign('content', $tpl->fetch($layout));
$tpl->display_one_col_template();

@ -5699,7 +5699,6 @@ function send_notifications($forum_id = 0, $thread_id = 0, $post_id = 0)
$forumCourseId = api_get_configuration_value('global_forums_course_id');
if (!empty($forumCourseId)) {
if ($_course['real_id'] == $forumCourseId) {
return false;
}
}
@ -6769,6 +6768,7 @@ function giveRevisionButton($postId, $threadInfo)
/**
* @param int $postId
* @param array $threadInfo
*
* @return string
*/
function getReportButton($postId, $threadInfo)
@ -6832,7 +6832,6 @@ function getReportRecepients()
case 'community_managers':
$managers = api_get_configuration_value('community_managers_user_list');
if (!empty($managers) && isset($managers['users'])) {
$users = array_merge($users, $managers['users']);
}
break;

@ -70,7 +70,6 @@ $(function() {
</script>';
/* Actions */
$my_action = isset($_GET['action']) ? $_GET['action'] : '';

@ -296,7 +296,7 @@ class Category implements GradebookItem
}
/**
* @return null|int
* @return int|null
*/
public function get_grade_model_id()
{
@ -2644,7 +2644,7 @@ class Category implements GradebookItem
* Internal function used by get_tree().
*
* @param int $level
* @param null|int $visible
* @param int|null $visible
*
* @return array
*/

@ -1140,7 +1140,7 @@ class GradebookTable extends SortableTable
/**
* @param AbstractLink $item
*
* @return null|string
* @return string|null
*/
private function build_edit_column($item)
{

@ -140,9 +140,9 @@ class LinkForm extends FormValidator
/**
* @param int $link
* @param null|string $courseCode
* @param string|null $courseCode
*
* @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink
* @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|StudentPublicationLink|SurveyLink|null
*/
private function createLink($link, $courseCode)
{

@ -22,7 +22,7 @@ class ResultTable extends SortableTable
*
* @param string $evaluation
* @param array $results
* @param null|string $iscourse
* @param string|null $iscourse
* @param array $addparams
* @param bool $forprint
*/

@ -431,7 +431,7 @@ class GradebookDataGenerator
* @param GradebookItem $item
* @param bool $ignore_score_color
*
* @return null|string
* @return string|null
*/
private function build_result_column(
$userId,

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
/**
* Responses to AJAX calls.
*/

@ -4643,7 +4643,7 @@ function api_get_languages_combo($name = 'language')
* @param bool Hide form if only one language available (defaults to false = show the box anyway)
* @param bool $showAsButton
*
* @return null|string Display the box directly
* @return string|null Display the box directly
*/
function api_display_language_form($hide_if_no_choice = false, $showAsButton = false)
{

@ -3212,7 +3212,7 @@ class Blog
* @param string $fullText
* @param int $length
*
* @return null|string
* @return string|null
*/
private static function getPostExtract($fullText, $length = BLOG_MAX_PREVIEW_CHARS)
{

@ -116,7 +116,6 @@ class Chat extends Model
$chats = [];
foreach ($chatHistory as $userId => $time) {
/*$items = $this->getPreviousMessages(
$userId,
api_get_user_id(),
@ -138,7 +137,6 @@ class Chat extends Model
$chats[$userId]['window_user_info'] = api_get_user_info($userId);
}
/*
foreach ($chatHistory as $chat) {
$userId = $chat['user_info']['user_id'];
@ -351,7 +349,7 @@ class Chat extends Model
'online' => $user_info['user_is_online'],
'avatar' => $user_info['avatar_small'],
'user_id' => $user_info['user_id'],
]
],
];
$items[$fromUserId] = $item;
@ -383,7 +381,7 @@ class Chat extends Model
'online' => $user_info['user_is_online'],
'avatar' => $user_info['avatar_small'],
'user_id' => $user_info['user_id'],
]
],
];
$items[$fromUserId] = $item;

@ -35,8 +35,8 @@ class CourseManager
* Creates a course.
*
* @param array $params Columns in the main.course table.
* @param int $authorId Optional.
* @param int $accessUrlId Optional.
* @param int $authorId optional
* @param int $accessUrlId optional
*
* @return mixed false if the course was not created, array with the course info
*/

@ -180,7 +180,6 @@ class Database
$sysPath."vendor/gedmo/doctrine-extensions/lib"
);
Type::overrideType(
Type::DATETIME,
self::getUTCDateTimeTypeClass()

@ -1900,7 +1900,7 @@ class Display
/**
* @param array $list
*
* @return null|string
* @return string|null
*/
public static function description($list)
{
@ -2801,7 +2801,6 @@ HTML;
default:
//$html = self::url($data['basename'], $fileUrl);
break;
}
//$html = self::url($content, $fileUrl, ['ajax']);

@ -1,7 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\TrackEExercises;
use ChamiloSession as Session;
/**

@ -1391,7 +1391,6 @@ class ExtraField extends Model
$options[$option_details['option_value']] = $option_details['display_text'];
}
if ($orderDependingDefaults) {
$defaultOptions = $extraData['extra_'.$field_details['variable']];
if (!empty($defaultOptions)) {

@ -44,70 +44,6 @@ class DateTimeRangePicker extends DateRangePicker
'.$this->getElementJS();
}
/**
* Get the necessary javascript for this datepicker.
*
* @return string
*/
private function getElementJS()
{
$js = null;
$id = $this->getAttribute('id');
$js .= "<script>
$(function() {
var txtDate = $('#$id'),
inputGroup = txtDate.parents('.input-group'),
txtDateAlt = $('#{$id}_alt'),
txtDateAltText = $('#{$id}_alt_text');
txtDate
.hide()
.datepicker({
defaultDate: '".$this->getValue()."',
dateFormat: 'yy-mm-dd',
altField: '#{$id}_alt',
altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
showOn: 'both',
buttonImage: '".Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
buttonImageOnly: true,
buttonText: '".get_lang('SelectDate')."',
changeMonth: true,
changeYear: true,
yearRange: 'c-60y:c+5y'
})
.on('change', function (e) {
txtDateAltText.text(txtDateAlt.val());
});
txtDateAltText.on('click', function () {
txtDate.datepicker('show');
});
inputGroup
.find('button')
.on('click', function (e) {
e.preventDefault();
$('#$id, #{$id}_alt').val('');
$('#{$id}_alt_text').html('');
});
$('#".$id."_time_range .time').timepicker({
'showDuration': true,
'timeFormat': 'H:i:s',
'scrollDefault': 'now',
});
var timeOnlyExampleEl = document.getElementById('".$id."_time_range');
var timeOnlyDatepair = new Datepair(timeOnlyExampleEl);
});
</script>";
return $js;
}
/**
* @param string $layout
*
@ -122,7 +58,7 @@ class DateTimeRangePicker extends DateRangePicker
if (empty($size)) {
$sizeTemp = 8;
}
$size = array(2, $sizeTemp, 2);
$size = [2, $sizeTemp, 2];
} else {
if (is_array($size)) {
if (count($size) != 3) {
@ -130,11 +66,11 @@ class DateTimeRangePicker extends DateRangePicker
if (empty($size)) {
$sizeTemp = 8;
}
$size = array(2, $sizeTemp, 2);
$size = [2, $sizeTemp, 2];
}
// else just keep the $size array as received
} else {
$size = array(2, intval($size), 2);
$size = [2, intval($size), 2];
}
}
@ -206,4 +142,68 @@ class DateTimeRangePicker extends DateRangePicker
break;
}
}
/**
* Get the necessary javascript for this datepicker.
*
* @return string
*/
private function getElementJS()
{
$js = null;
$id = $this->getAttribute('id');
$js .= "<script>
$(function() {
var txtDate = $('#$id'),
inputGroup = txtDate.parents('.input-group'),
txtDateAlt = $('#{$id}_alt'),
txtDateAltText = $('#{$id}_alt_text');
txtDate
.hide()
.datepicker({
defaultDate: '".$this->getValue()."',
dateFormat: 'yy-mm-dd',
altField: '#{$id}_alt',
altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
showOn: 'both',
buttonImage: '".Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
buttonImageOnly: true,
buttonText: '".get_lang('SelectDate')."',
changeMonth: true,
changeYear: true,
yearRange: 'c-60y:c+5y'
})
.on('change', function (e) {
txtDateAltText.text(txtDateAlt.val());
});
txtDateAltText.on('click', function () {
txtDate.datepicker('show');
});
inputGroup
.find('button')
.on('click', function (e) {
e.preventDefault();
$('#$id, #{$id}_alt').val('');
$('#{$id}_alt_text').html('');
});
$('#".$id."_time_range .time').timepicker({
'showDuration': true,
'timeFormat': 'H:i:s',
'scrollDefault': 'now',
});
var timeOnlyExampleEl = document.getElementById('".$id."_time_range');
var timeOnlyDatepair = new Datepair(timeOnlyExampleEl);
});
</script>";
return $js;
}
}

@ -177,13 +177,15 @@ EOT;
/**
* Adds a text field to the form.
* A trim-filter is attached to the field.
*
* @param string $label The label for the form-element
* @param string $name The element name
* @param bool $required (optional) Is the form-element required (default=true)
* @param array $attributes (optional) List of attributes for the form-element
*
* @return HTML_QuickForm_text
*/
public function addText($name, $label, $required = true, $attributes = array())
public function addText($name, $label, $required = true, $attributes = [])
{
$element = $this->addElement('text', $name, $label, $attributes);
$this->applyFilter($name, 'trim');
@ -1884,7 +1886,8 @@ EOT;
}
/**
* Cleans HTML text filter
* Cleans HTML text filter.
*
* @param string $html HTML to clean
* @param int $mode (optional)
*

@ -724,6 +724,7 @@ function api_format_date($time, $format = null, $language = null)
* @param string $date Result of a date function in this format -> date('Y-m-d H:i:s', time());
* @param string $timeZone
* @param bool $returnDateDifference
*
* @return string
*
* @author Julio Montoya

@ -911,6 +911,7 @@ class MessageManager
'message_id' => $message_id,
'size' => $file_attach['size'],
];
return Database::insert($table, $params);
}
}

@ -564,7 +564,6 @@ class SessionManager
$inject_joins .= " LEFT JOIN $table su ON (su.session_id = s.id)";
}
if (!empty($language)) {
$table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);

@ -1796,7 +1796,7 @@ class SocialManager extends UserManager
'cidReq' => $courseInfo['code'],
'forum' => $post->getForumId(),
'thread' => $post->getThreadId(),
'post_id' => $post->getIid()
'post_id' => $post->getIid(),
]).'#post_id_'.$post->getIid();
}
}
@ -1932,7 +1932,7 @@ class SocialManager extends UserManager
[
'id' => 'message_'.$message['id'],
'title' => get_lang('SocialMessageDelete'),
'onclick' => 'deleteComment(' . $message['id'] . ')'
'onclick' => 'deleteComment('.$message['id'].')',
]
);
$comment .= '</div>';
@ -2194,7 +2194,7 @@ class SocialManager extends UserManager
$userInfo['language'] = [
'label' => $languageInfo['original_name'],
'value' => $languageInfo['english_name'],
'code' => $languageInfo['isocode']
'code' => $languageInfo['isocode'],
];
}
@ -2430,7 +2430,7 @@ class SocialManager extends UserManager
false,
[
'cols-size' => [1, 10, 1],
'custom' => true
'custom' => true,
]
);
$form->addHtml('</div>');
@ -2578,106 +2578,6 @@ class SocialManager extends UserManager
return $template->fetch($skillBlock);
}
/**
* Returns the formatted header message post.
*
* @param int $authorInfo
* @param int $receiverInfo
* @param array $message Message data
*
* @return string $html The formatted header message post
*/
private static function headerMessagePost($authorInfo, $receiverInfo, $message)
{
$currentUserId = api_get_user_id();
$iconStatus = null;
$authorId = (int) $authorInfo['user_id'];
$receiverId = (int) $receiverInfo['user_id'];
$userStatus = $authorInfo['status'];
$urlImg = api_get_path(WEB_IMG_PATH);
$isAdmin = self::is_admin($authorId);
if ($userStatus == 5) {
if ($authorInfo['has_certificates']) {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_graduated.svg" width="22px" height="22px">';
} else {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_student.svg" width="22px" height="22px">';
}
} else {
if ($userStatus == 1) {
if ($isAdmin) {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_admin.svg" width="22px" height="22px">';
} else {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_teacher.svg" width="22px" height="22px">';
}
}
}
$date = Display::dateToStringAgoAndLongDate($message['send_date']);
$avatarAuthor = $authorInfo['avatar'];
$urlAuthor = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$authorId;
$nameCompleteAuthor = $authorInfo['complete_name'];
$urlReceiver = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$receiverId;
$nameCompleteReceiver = $receiverInfo['complete_name'];
$htmlReceiver = '';
if ($authorId !== $receiverId) {
$htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
}
if (!empty($message['group_info'])) {
$htmlReceiver = ' > <a href="'.$message['group_info']['url'].'">'.$message['group_info']['name'].'</a> ';
}
$canEdit = ($currentUserId == $authorInfo['user_id'] || $currentUserId == $receiverInfo['user_id']) && empty($message['group_info']);
if (!empty($message['thread_id'])) {
$htmlReceiver = ' > <a href="'.$message['thread_url'].'">'.$message['forum_title'].'</a> ';
$canEdit = false;
}
$postAttachment = self::getPostAttachment($message);
$html = '';
$html .= '<div class="top-mediapost">';
if ($canEdit) {
$htmlDelete = Display::url(
Display::returnFontAwesomeIcon('trash'),
'javascript:void(0)',
[
'id' => 'message_' . $message['id'],
'title' => get_lang('SocialMessageDelete'),
'onclick' => 'deleteMessage(' . $message['id'] . ')'
]
);
$html .= '<div class="pull-right deleted-mgs">';
$html .= $htmlDelete;
$html .= '</div>';
}
$html .= '<div class="user-image" >';
$html .= '<a href="'.$urlAuthor.'">
<img class="avatar-thumb" src="'.$avatarAuthor.'" alt="'.$nameCompleteAuthor.'"></a>';
$html .= '</div>';
$html .= '<div class="user-data">';
$html .= $iconStatus;
$html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>';
$html .= '<div>'.$date.'</div>';
$html .= '</div>';
$html .= '<div class="msg-content">';
$html .= '<div class="post-attachment" >';
$html .= $postAttachment;
$html .= '</div>';
$html .= '<p>'.Security::remove_XSS($message['content']).'</p>';
$html .= '</div>';
$html .= '</div>'; // end mediaPost
// Popularity post functionality
$html .= '<div class="popularity-mediapost"></div>';
return $html;
}
/**
* @param int $user_id
*
@ -2756,13 +2656,13 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => $optionInfo['display_text']
'value' => $optionInfo['display_text'],
];
} else {
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => implode(',', $data)
'value' => implode(',', $data),
];
}
break;
@ -2773,11 +2673,10 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => implode(',', $data)
'value' => implode(',', $data),
];
break;
}
} else {
switch ($extraFieldInfo['field_type']) {
case ExtraField::FIELD_TYPE_RADIO:
@ -2791,7 +2690,7 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => $data
'value' => $data,
];
break;
@ -2812,7 +2711,7 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => $value_options
'value' => $value_options,
];
break;
case ExtraField::FIELD_TYPE_TAG:
@ -2832,7 +2731,7 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => $tag_tmp
'value' => $tag_tmp,
];
break;
case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
@ -2855,7 +2754,7 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => $data
'value' => $data,
];
break;
case ExtraField::FIELD_TYPE_SELECT_WITH_TEXT_FIELD:
@ -2874,7 +2773,7 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => $parsedData[1]
'value' => $parsedData[1],
];
break;
case ExtraField::FIELD_TYPE_TRIPLE_SELECT:
@ -2893,7 +2792,7 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => implode(' ', $optionValues)
'value' => implode(' ', $optionValues),
];
break;
default:
@ -2912,7 +2811,7 @@ class SocialManager extends UserManager
$extraFieldItem = [
'variable' => $extraFieldInfo['variable'],
'label' => ucfirst($extraFieldInfo['display_text']),
'value' => $data
'value' => $data,
];
break;
}
@ -3143,7 +3042,7 @@ class SocialManager extends UserManager
Session::erase('forum_notification');
$threadUrlBase = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.http_build_query([
'cidReq' => $courseInfo['code']
'cidReq' => $courseInfo['code'],
]).'&';
if (isset($notification['thread']) && !empty($notification['thread'])) {
$threadList = array_filter(array_unique($notification['thread']));
@ -3176,4 +3075,104 @@ class SocialManager extends UserManager
return $threads;
}
/**
* Returns the formatted header message post.
*
* @param int $authorInfo
* @param int $receiverInfo
* @param array $message Message data
*
* @return string $html The formatted header message post
*/
private static function headerMessagePost($authorInfo, $receiverInfo, $message)
{
$currentUserId = api_get_user_id();
$iconStatus = null;
$authorId = (int) $authorInfo['user_id'];
$receiverId = (int) $receiverInfo['user_id'];
$userStatus = $authorInfo['status'];
$urlImg = api_get_path(WEB_IMG_PATH);
$isAdmin = self::is_admin($authorId);
if ($userStatus == 5) {
if ($authorInfo['has_certificates']) {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_graduated.svg" width="22px" height="22px">';
} else {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_student.svg" width="22px" height="22px">';
}
} else {
if ($userStatus == 1) {
if ($isAdmin) {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_admin.svg" width="22px" height="22px">';
} else {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_teacher.svg" width="22px" height="22px">';
}
}
}
$date = Display::dateToStringAgoAndLongDate($message['send_date']);
$avatarAuthor = $authorInfo['avatar'];
$urlAuthor = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$authorId;
$nameCompleteAuthor = $authorInfo['complete_name'];
$urlReceiver = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$receiverId;
$nameCompleteReceiver = $receiverInfo['complete_name'];
$htmlReceiver = '';
if ($authorId !== $receiverId) {
$htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
}
if (!empty($message['group_info'])) {
$htmlReceiver = ' > <a href="'.$message['group_info']['url'].'">'.$message['group_info']['name'].'</a> ';
}
$canEdit = ($currentUserId == $authorInfo['user_id'] || $currentUserId == $receiverInfo['user_id']) && empty($message['group_info']);
if (!empty($message['thread_id'])) {
$htmlReceiver = ' > <a href="'.$message['thread_url'].'">'.$message['forum_title'].'</a> ';
$canEdit = false;
}
$postAttachment = self::getPostAttachment($message);
$html = '';
$html .= '<div class="top-mediapost">';
if ($canEdit) {
$htmlDelete = Display::url(
Display::returnFontAwesomeIcon('trash'),
'javascript:void(0)',
[
'id' => 'message_'.$message['id'],
'title' => get_lang('SocialMessageDelete'),
'onclick' => 'deleteMessage('.$message['id'].')',
]
);
$html .= '<div class="pull-right deleted-mgs">';
$html .= $htmlDelete;
$html .= '</div>';
}
$html .= '<div class="user-image" >';
$html .= '<a href="'.$urlAuthor.'">
<img class="avatar-thumb" src="'.$avatarAuthor.'" alt="'.$nameCompleteAuthor.'"></a>';
$html .= '</div>';
$html .= '<div class="user-data">';
$html .= $iconStatus;
$html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>';
$html .= '<div>'.$date.'</div>';
$html .= '</div>';
$html .= '<div class="msg-content">';
$html .= '<div class="post-attachment" >';
$html .= $postAttachment;
$html .= '</div>';
$html .= '<p>'.Security::remove_XSS($message['content']).'</p>';
$html .= '</div>';
$html .= '</div>'; // end mediaPost
// Popularity post functionality
$html .= '<div class="popularity-mediapost"></div>';
return $html;
}
}

@ -2115,7 +2115,6 @@ class UserGroup extends Model
$relationType = array_map('intval', $relationType);
$relationType = implode("','", $relationType);
$relationCondition = " AND ( gu.relation_type IN ('$relationType')) ";
} else {
$relationType = (int) $relationType;
$relationCondition = " AND gu.relation_type = $relationType ";

@ -5487,7 +5487,7 @@ class UserManager
}
/**
* Subscribe boss to students, if $bossList is empty then the boss list will be empty too
* Subscribe boss to students, if $bossList is empty then the boss list will be empty too.
*
* @param int $studentId
* @param array $bossList
@ -5516,7 +5516,6 @@ class UserManager
// Boss list is the same, nothing changed.
if ($bossList == $previousBossList) {
return false;
}

@ -103,7 +103,7 @@ class IndexManager
/**
* @param bool $show_slide
*
* @return null|string
* @return string|null
*/
public function return_announcements($show_slide = true)
{

@ -991,11 +991,9 @@ $_configuration['required_extra_fields_in_profile'] = [
// global forum in social network BT#15309
//$_configuration['global_forums_course_id'] = 0;
// ------ Custom DB changes (keep this at the end)
// Add user activation by confirmation email
// This option prevents the new user to login in the platform if your account is not confirmed via email
// You need add a new option called "confirmation" to the registration settings
//INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_registration', 'confirmation', 'MailConfirmation');
// ------ (End) Custom DB changes

@ -6,7 +6,6 @@ use Chamilo\CoreBundle\Entity\Repository\ItemPropertyRepository;
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
use Chamilo\CourseBundle\Component\CourseCopy\CourseBuilder;
use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CItemProperty;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Entity\CLpCategory;

@ -89,7 +89,7 @@ class learnpathItem
* @param int $id Learning path item ID
* @param int $user_id User ID
* @param int $course_id Course int id
* @param null|array $item_content An array with the contents of the item
* @param array|null $item_content An array with the contents of the item
*/
public function __construct(
$id,
@ -4238,7 +4238,7 @@ class learnpathItem
/**
* Adds an audio file attached to the current item (store on disk and in db).
*
* @return bool|null|string
* @return bool|string|null
*/
public function add_audio()
{

@ -38,7 +38,7 @@ require_once __DIR__.'/../inc/global.inc.php';
* @param int $userNavigatesAway Whether the user is moving to another item
* @param int $statusSignalReceived Whether the SCO called SetValue(lesson_status)
*
* @return bool|null|string The resulting JS string
* @return bool|string|null The resulting JS string
*/
function save_item(
$lp_id,

@ -2,7 +2,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Message;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Entity\CLpCategory;
use ChamiloSession as Session;
@ -1049,7 +1048,6 @@ $userGroups = $userGroupManager->getNameListByUser(
}
}
// Display timezone if the user selected one and if the admin allows the use of user's timezone
$timezone = null;
$timezone_user = UserManager::get_extra_user_data_by_field(

@ -104,7 +104,6 @@ $social_search_block = Display::panel(
get_lang('SearchUsers')
);
/*
$results = $userGroup->get_groups_by_user($user_id,
[
@ -234,7 +233,7 @@ $formSearch->addText(
[
'aria-label' => get_lang('SearchUsers'),
'custom' => true,
'placeholder' => get_lang('ByName')
'placeholder' => get_lang('ByName'),
]
);
//$formSearch->addButtonSearch(get_lang('Search'));

@ -82,7 +82,6 @@ foreach ($data as &$result) {
}
}
$apiKey = api_get_configuration_value('google_api_key');
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_JS_PATH).'map/markerclusterer.js"></script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_JS_PATH).'map/oms.min.js"></script>';
@ -115,6 +114,5 @@ $tpl->assign(
$tpl->assign('places', json_encode($data));
$tpl->assign('api_key', $apiKey);
$layout = $tpl->get_template('social/map.tpl');
$tpl->display($layout);

@ -138,7 +138,6 @@ switch ($_GET['type']) {
break;
}
// We are editing a question
if (isset($_GET['question_id']) && !empty($_GET['question_id'])) {
$formData = SurveyManager::get_question($_GET['question_id']);

@ -2208,7 +2208,6 @@ class SurveyManager
];
self::save_question($surveyData, $values);
}
}
}
}

@ -592,7 +592,7 @@ $server->register(
/**
* @param array $params
*
* @return null|soap_fault
* @return soap_fault|null
*/
function WSCreateLp($params)
{

@ -19,7 +19,7 @@ define('DEFAULT_ADMIN_USER_ID', 1);
/**
* @param string $code
*
* @return null|soap_fault
* @return soap_fault|null
*/
function returnError($code)
{
@ -1119,7 +1119,7 @@ $server->register(
*
* @param array $params - WSFunction parameters (include VerifyKey)
*
* @return bool|null|soap_fault A simple boolean (true if teacher successful subscribed, false otherwise)
* @return bool|soap_fault|null A simple boolean (true if teacher successful subscribed, false otherwise)
*/
function WSSubscribeTeacherToSessionCourse($params)
{
@ -1178,7 +1178,7 @@ $server->register(
*
* @param array $params - WSFunction parameters (include VerifyKey)
*
* @return bool|null|soap_fault A simple boolean (true if teacher successful unsubscribed, false otherwise)
* @return bool|soap_fault|null A simple boolean (true if teacher successful unsubscribed, false otherwise)
*/
function WSUnsubscribeTeacherFromSessionCourse($params)
{
@ -1609,7 +1609,7 @@ $server->register(
*
* @throws \Doctrine\DBAL\DBALException
*
* @return bool|int|null|soap_fault
* @return bool|int|soap_fault|null
*/
function WSEditUserCredentials($params)
{
@ -4720,7 +4720,7 @@ $server->register(
*
* @param array $params
*
* @return array|int|null|soap_fault|string
* @return array|int|soap_fault|string|null
*/
function WSSubscribeUserToCourseSimple($params)
{
@ -5241,7 +5241,7 @@ $server->register(
/**
* @param array $params
*
* @return array|null|soap_fault
* @return array|soap_fault|null
*/
function WSUnSubscribeUserFromCourseSimple($params)
{
@ -5540,7 +5540,7 @@ $server->register(
/**
* @param array $params
*
* @return int|null|soap_fault|string
* @return int|soap_fault|string|null
*/
function WSSubscribeUserToSessionSimple($params)
{
@ -6298,7 +6298,7 @@ $server->register(
/**
* @param array $params
*
* @return int|null|soap_fault
* @return int|soap_fault|null
*/
function WSUpdateUserApiKey($params)
{
@ -6481,7 +6481,7 @@ $server->register(
*
* @param array $params Array of parameters (course and user_id)
*
* @return bool|null|soap_fault A simple boolean (true if user is subscribed, false otherwise)
* @return bool|soap_fault|null A simple boolean (true if user is subscribed, false otherwise)
*/
function WSUserSubscribedInCourse($params)
{

@ -22,7 +22,7 @@ define('WS_ERROR_SETTING', 4);
/**
* @param string $code
*
* @return null|soap_fault
* @return soap_fault|null
*/
function returnError($code)
{

@ -3786,7 +3786,7 @@ function checkExistingWorkFileName($filename, $workId)
* @param bool $checkDuplicated
* @param bool $showFlashMessage
*
* @return null|string
* @return string|null
*/
function processWorkForm(
$workInfo,

@ -405,7 +405,7 @@ class HookAdvancedSubscription extends HookObserver implements HookAdminBlockObs
/**
* @param $params
*
* @return null|soap_fault
* @return soap_fault|null
*/
public static function WSSessionListInCategory($params)
{
@ -456,7 +456,7 @@ class HookAdvancedSubscription extends HookObserver implements HookAdminBlockObs
/**
* @param $params
*
* @return null|soap_fault
* @return soap_fault|null
*/
public static function WSSessionGetDetailsByUser($params)
{

@ -451,7 +451,7 @@ foreach ($elements as $element) {
$fieldsToShow = [
'heures_disponibilite_par_semaine',
'moment_de_disponibilite'
'moment_de_disponibilite',
];
$extra = $extraField->addElements(
@ -685,14 +685,12 @@ $userForm->addLabel(null, get_lang('MonEnvironnementDeTravailExplanationIntro2')
$jqueryExtra .= $extra['jquery_ready_content'];
$fieldsToShow = [
'browser_platforme',
'browser_platforme_autre',
'browser_platforme_version',
];
$extra = $extraField->addElements(
$userForm,
api_get_user_id(),
@ -714,12 +712,8 @@ $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseEight]');
$userForm->addHtml('</div></div></div>');
$userForm->addHtml('</div>');
$userForm->addHtml('</div>');
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
'.$jqueryExtra.'

@ -5,6 +5,7 @@ namespace Chamilo\ContactBundle\Form\Type;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
@ -12,7 +13,6 @@ use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
/**
* Class ContactType.

@ -13,7 +13,6 @@ use Knp\DoctrineBehaviors\Model as ORMBehaviors;
* @ORM\Entity
* @ORM\Table(name="faq_category_translation")
*
*
* @package Chamilo\FaqBundle\Entity
*/
class CategoryTranslation

@ -13,7 +13,6 @@ use Knp\DoctrineBehaviors\Model as ORMBehaviors;
* @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Entity\QuestionRepository")
* @ORM\Table(name="faq_question")
*
*
* @package Chamilo\FaqBundle\Entity
*/
class Question

@ -13,7 +13,6 @@ use Knp\DoctrineBehaviors\Model as ORMBehaviors;
* @ORM\Entity
* @ORM\Table(name="faq_question_translation")
*
*
* @package Chamilo\FaqBundle\Entity
*/
class QuestionTranslation

@ -1293,7 +1293,7 @@ class UserRepository extends EntityRepository
*
* @throws \Exception
*
* @return null|TrackELogin
* @return TrackELogin|null
*/
public function getLastLogin(User $user)
{

Loading…
Cancel
Save