Minor - flint fixes

pull/3063/head
Julio Montoya 7 years ago
parent 9c217e952e
commit e4bf86f34d
  1. 2
      main/announcements/announcements.php
  2. 6
      main/dropbox/index.php
  3. 2
      main/gradebook/lib/be/exerciselink.class.php
  4. 2
      main/gradebook/lib/fe/displaygradebook.php
  5. 22
      main/gradebook/lib/fe/gradebooktable.class.php
  6. 22
      main/inc/ajax/course_home.ajax.php
  7. 18
      main/inc/lib/AnnouncementManager.php
  8. 2
      main/inc/lib/banner.lib.php
  9. 4
      main/inc/lib/course.lib.php
  10. 1
      main/inc/lib/course_home.lib.php
  11. 2
      main/inc/lib/document.lib.php
  12. 1
      main/inc/lib/exercise.lib.php
  13. 6
      main/inc/lib/formvalidator/FormValidator.class.php
  14. 60
      main/inc/lib/tracking.lib.php
  15. 2
      main/inc/lib/usermanager.lib.php
  16. 8
      main/inc/lib/userportal.lib.php
  17. 45
      main/lp/learnpath.class.php
  18. 14
      main/lp/learnpathItem.class.php
  19. 2
      main/tracking/messages.php
  20. 30
      main/user/subscribe_user.php
  21. 4
      main/work/upload.php
  22. 14
      main/work/work.lib.php
  23. 4
      main/work/work_list_all.php

@ -631,7 +631,7 @@ switch ($action) {
).'<div id="announcement_preview_result" style="display:none"></div>'
);
$form->addHtml('<div id="send_button" style="display:none">');
$form->addButtonSave(get_lang('ButtonPublishAnnouncement'));
$form->addButtonSave(get_lang('ButtonPublishAnnouncement'));
$form->addHtml('</div>');
}
$form->setDefaults($defaults);

@ -297,11 +297,11 @@ if ($action != 'add') {
} else {
if (api_is_allowed_to_session_edit(false, true)) {
echo '<div class="actions">';
if (empty($viewSentCategory)) {
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".
if (empty($viewSentCategory)) {
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".
Display::return_icon('upload_file.png', get_lang('UploadNewFile'), '', ICON_SIZE_MEDIUM).
"</a>";
}
}
if ($view_dropbox_category_sent != 0) {
echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> ';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.

@ -334,7 +334,7 @@ class ExerciseLink extends AbstractLink
$result = [0, $weight];
if ($cacheAvailable) {
$cacheDriver->save($key, $result);
}
}
return $result;
}

@ -111,7 +111,7 @@ class DisplayGradebook
if (!$evalobj->has_results()) {
$evalinfo .= '<br /><i>'.get_lang('NoResultsInEvaluation').'</i>';
}
//$evalinfo .= '<br /><br /><a href="gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.Display::return_icon(('evaluation_rate.png'),get_lang('ViewResult'),'',ICON_SIZE_MEDIUM) . '</a>';
//$evalinfo .= '<br /><br /><a href="gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.Display::return_icon(('evaluation_rate.png'),get_lang('ViewResult'),'',ICON_SIZE_MEDIUM) . '</a>';
if ($page != 'statistics') {
if (api_is_allowed_to_edit(null, true)) {
$evalinfo .= '<br /><a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.

@ -105,7 +105,7 @@ class GradebookTable extends SortableTable
$model = ExerciseLib::getCourseScoreModel();
$this->set_header(
$this->set_header(
$column++,
get_lang('Weight'),
'',
@ -116,17 +116,17 @@ class GradebookTable extends SortableTable
$this->set_header($column++, get_lang('Result'), false);
}
if (empty($model)) {
if (in_array(1, $this->loadStats)) {
$this->set_header($column++, get_lang('Ranking'), false);
}
if (in_array(2, $this->loadStats)) {
$this->set_header($column++, get_lang('BestScore'), false);
}
if (in_array(3, $this->loadStats)) {
$this->set_header($column++, get_lang('Average'), false);
}
if (empty($model)) {
if (in_array(1, $this->loadStats)) {
$this->set_header($column++, get_lang('Ranking'), false);
}
if (in_array(2, $this->loadStats)) {
$this->set_header($column++, get_lang('BestScore'), false);
}
if (in_array(3, $this->loadStats)) {
$this->set_header($column++, get_lang('Average'), false);
}
}
if ($this->teacherView) {
} else {

@ -142,28 +142,28 @@ switch ($action) {
$course_info = api_get_course_info($_GET['code']);
$content = get_lang('NoDescription');
if (!empty($course_info)) {
if (api_get_setting('course_catalog_hide_private') === 'true' &&
if (api_get_setting('course_catalog_hide_private') === 'true' &&
$course_info['visibility'] == COURSE_VISIBILITY_REGISTERED
) {
echo get_lang('PrivateAccess');
break;
}
echo get_lang('PrivateAccess');
break;
}
$table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$sql = "SELECT * FROM $table
WHERE c_id = ".$course_info['real_id']." AND session_id = 0
ORDER BY id";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
while ($description = Database::fetch_object($result)) {
$descriptions[$description->id] = $description;
}
// Function that displays the details of the course description in html.
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
while ($description = Database::fetch_object($result)) {
$descriptions[$description->id] = $description;
}
// Function that displays the details of the course description in html.
$content = CourseManager::get_details_course_description_html(
$descriptions,
api_get_system_encoding(),
false
);
}
}
}
echo $content;
break;

@ -754,7 +754,7 @@ class AnnouncementManager
);
$sentToAllGroup = true;
}
// when no user is selected we send it to everyone
// when no user is selected we send it to everyone
if ($sentToAllGroup === false) {
if (!empty($send_to_users['groups'])) {
foreach ($send_to_users['groups'] as $group) {
@ -773,7 +773,7 @@ class AnnouncementManager
$groupInfo = GroupManager::get_group_properties($groupId);
if (!empty($send_to_users['users'])) {
foreach ($send_to_users['users'] as $user) {
api_item_property_update(
api_item_property_update(
$courseInfo,
TOOL_ANNOUNCEMENT,
$last_id,
@ -1145,8 +1145,8 @@ class AnnouncementManager
case null:
if (isset($row['to_user_id']) && !empty($row['to_user_id'])) {
if (!in_array('USER:'.$row['to_user_id'], $to)) {
$to[] = 'USER:'.$row['to_user_id'];
}
$to[] = 'USER:'.$row['to_user_id'];
}
}
break;
// it was sent to everyone
@ -1160,9 +1160,9 @@ class AnnouncementManager
}
} else {
if (!in_array('GROUP:'.$toGroup, $to)) {
$to[] = 'GROUP:'.$toGroup;
}
}
$to[] = 'GROUP:'.$toGroup;
}
}
if ($includeGroupWhenLoadingUser) {
if (!in_array('GROUP:'.$toGroup, $to)) {
@ -1253,7 +1253,7 @@ class AnnouncementManager
$userToArray = [];
foreach ($users as $student) {
$userToArray[] = $student['complete_name_with_username'];
}
}
$output[] =
'<br />'.
Display::label($group_names[$group_id]['name'], 'info').
@ -1962,7 +1962,7 @@ class AnnouncementManager
if ($disableEdit === true) {
$modify_icons = "<a href='#'>".$editIconDisable."</a>";
} else {
$modify_icons = "<a href=\"".$actionUrl."&action=modify&id=".$row['id']."\">".$editIcon."</a>";
$modify_icons = "<a href=\"".$actionUrl."&action=modify&id=".$row['id']."\">".$editIcon."</a>";
}
if ($row['visibility'] == 1) {

@ -182,7 +182,7 @@ function getCustomTabs()
/**
* Return the active logo of the portal, based on a series of settings.
*
* @param string $theme The name of the theme folder from web/css/themes/
* @param string $theme The name of the theme folder from web/css/themes/
* @param bool $responsive add class img-responsive
*
* @return string HTML string with logo as an HTML element

@ -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
*/

@ -1048,7 +1048,6 @@ class CourseHome
.$tool['original_link'].$qm_or_amp.api_get_cidreq();
}
$icon = Display::return_icon(
$tool['image'],
$tool_name,

@ -3465,7 +3465,7 @@ class DocumentManager
$url .= '&add_move_button=1';
}
$return .= "<script>
$return .= "<script>
function testResources(id, img) {
var numericId = id.split('_')[1];
var parentId = 'doc_id_'+numericId;

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

@ -179,9 +179,9 @@ EOT;
* A trim-filter is attached to the field.
*
* @param string|array $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
* @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
*/

@ -1869,8 +1869,8 @@ class Tracking
}
}
} else {
$tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = 'SELECT login_course_date
$tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = 'SELECT login_course_date
FROM '.$tbl_track_login.'
WHERE
user_id = '.$student_id.' AND
@ -1878,20 +1878,20 @@ class Tracking
session_id = '.$session_id.'
ORDER BY login_course_date ASC
LIMIT 0,1';
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($first_login_date = Database::result($rs, 0, 0)) {
if ($convert_date) {
return api_convert_and_format_date(
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($first_login_date = Database::result($rs, 0, 0)) {
if ($convert_date) {
return api_convert_and_format_date(
$first_login_date,
DATE_FORMAT_SHORT
);
} else {
return $first_login_date;
} else {
return $first_login_date;
}
}
}
}
}
return false;
}
@ -1937,17 +1937,17 @@ class Tracking
ORDER BY logout_course_date DESC
LIMIT 0,1";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
return false;
}
//see #5736
$last_login_date_timestamp = api_strtotime($last_login_date);
$now = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
if ($last_login_date = Database::result($rs, 0, 0)) {
if (empty($last_login_date)) {
return false;
}
//see #5736
$last_login_date_timestamp = api_strtotime($last_login_date);
$now = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
/*
if ($now - $last_login_date_timestamp > 604800) {
if ($convert_date) {
@ -2005,20 +2005,20 @@ class Tracking
</a>'
: null;
return $icon.Display::label($last_login_date, 'warning');
} else {
return $last_login_date;
}
} else {
if ($convert_date) {
return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
return $icon.Display::label($last_login_date, 'warning');
} else {
return $last_login_date;
}
} else {
return $last_login_date;
if ($convert_date) {
return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
} else {
return $last_login_date;
}
}
}
}
}
}
return false;
}

@ -4602,7 +4602,7 @@ class UserManager
*
* @param bool $friend_id
* @param bool $real_removed true will delete ALL friends relationship
* @param string $with_status_condition
* @param string $with_status_condition
*
* @author isaac flores paz <isaac.flores@dokeos.com>
* @author Julio Montoya <gugli100@gmail.com> Cleaning code

@ -911,16 +911,16 @@ class IndexManager
'title' => get_lang('PersonalDataReport'),
];
if (api_get_configuration_value('allow_my_files_link_in_homepage')) {
if (api_get_setting('allow_my_files') !== 'false') {
$items[] = [
if (api_get_configuration_value('allow_my_files_link_in_homepage')) {
if (api_get_setting('allow_my_files') !== 'false') {
$items[] = [
'class' => 'myfiles-social',
'icon' => Display::return_icon('sn-files.png', get_lang('Files')),
'link' => api_get_path(WEB_PATH).'main/social/myfiles.php',
'title' => get_lang('MyFiles'),
];
}
}
}
$items[] = [
'class' => 'profile-social',

@ -2039,13 +2039,13 @@ class learnpath
$previousIcon = '';
$nextIcon = '';
if ($hideArrows === false) {
$previousIcon = '
$previousIcon = '
<a class="icon-toolbar" id="scorm-previous" href="#"
onclick="switch_item('.$mycurrentitemid.',\'previous\');return false;" title="'.$previousText.'">
<span class="fa fa-chevron-left"></span><span class="sr-only">'.$previousText.'</span>
</a>';
$nextIcon = '
$nextIcon = '
<a class="icon-toolbar" id="scorm-next" href="#"
onclick="switch_item('.$mycurrentitemid.',\'next\');return false;" title="'.$nextText.'">
<span class="fa fa-chevron-right"></span><span class="sr-only">'.$nextText.'</span>
@ -2329,7 +2329,7 @@ class learnpath
} else {
$autostart_audio = $autostart;
}
}
}
break;
case TOOL_READOUT_TEXT:;
$autostart_audio = 'false';
@ -2546,16 +2546,16 @@ class learnpath
}
if ($is_visible) {
$subscriptionSettings = self::getSubscriptionSettings();
$subscriptionSettings = self::getSubscriptionSettings();
// Check if the subscription users/group to a LP is ON
if (isset($row['subscribe_users']) && $row['subscribe_users'] == 1 &&
// Check if the subscription users/group to a LP is ON
if (isset($row['subscribe_users']) && $row['subscribe_users'] == 1 &&
$subscriptionSettings['allow_add_users_to_lp'] === true
) {
// Try group
$is_visible = false;
// Checking only the user visibility
$userVisibility = api_get_item_visibility(
// Try group
$is_visible = false;
// Checking only the user visibility
$userVisibility = api_get_item_visibility(
$courseInfo,
'learnpath',
$row['id'],
@ -2564,14 +2564,14 @@ class learnpath
'LearnpathSubscription'
);
if ($userVisibility == 1) {
$is_visible = true;
} else {
$userGroups = GroupManager::getAllGroupPerUserSubscription($student_id);
if (!empty($userGroups)) {
foreach ($userGroups as $groupInfo) {
$groupId = $groupInfo['iid'];
$userVisibility = api_get_item_visibility(
if ($userVisibility == 1) {
$is_visible = true;
} else {
$userGroups = GroupManager::getAllGroupPerUserSubscription($student_id);
if (!empty($userGroups)) {
foreach ($userGroups as $groupInfo) {
$groupId = $groupInfo['iid'];
$userVisibility = api_get_item_visibility(
$courseInfo,
'learnpath',
$row['id'],
@ -2581,15 +2581,15 @@ class learnpath
$groupId
);
if ($userVisibility == 1) {
$is_visible = true;
break;
if ($userVisibility == 1) {
$is_visible = true;
break;
}
}
}
}
}
}
}
return $is_visible;
}
@ -10162,7 +10162,6 @@ class learnpath
if (in_array($item_type, [TOOL_DOCUMENT, TOOL_LP_FINAL_ITEM, TOOL_HOTPOTATOES])) {
$documentData = DocumentManager::get_document_data_by_id($row['path'], $course_code);
if (empty($documentData)) {
$table = Database::get_course_table(TABLE_DOCUMENT);
$sql = "SELECT path FROM $table
WHERE

@ -1890,14 +1890,14 @@ class learnpathItem
}
if (!Tracking::minimunTimeAvailable(api_get_session_id(), api_get_course_int_id())) {
$fixedAddedMinute = 5 * 60; // Add only 5 minutes
if ($time > $sessionLifetime) {
error_log("fixAbusiveTime: Total time is too big: $time replaced with: $fixedAddedMinute");
error_log("item_id : ".$this->db_id." lp_item_view.iid: ".$this->db_item_view_id);
$time = $fixedAddedMinute;
}
$fixedAddedMinute = 5 * 60; // Add only 5 minutes
if ($time > $sessionLifetime) {
error_log("fixAbusiveTime: Total time is too big: $time replaced with: $fixedAddedMinute");
error_log("item_id : ".$this->db_id." lp_item_view.iid: ".$this->db_item_view_id);
$time = $fixedAddedMinute;
}
return $time;
return $time;
} else {
// Calulate minimum and accumulated time
$user_id = api_get_user_id();

@ -54,8 +54,8 @@ if (api_is_drh()) {
} else {
if (!$isFollowed) {
api_not_allowed(true);
}
}
}
}
$usersData[$toUserId] = api_get_user_info($toUserId);

@ -60,24 +60,24 @@ $list_not_register_user = '';
if (isset($_REQUEST['register'])) {
$userInfo = api_get_user_info($_REQUEST['user_id']);
if ($userInfo) {
if ($type === COURSEMANAGER) {
if (!empty($sessionId)) {
if ($type === COURSEMANAGER) {
if (!empty($sessionId)) {
$message = $userInfo['complete_name_with_username'].' '.get_lang('AddedToCourse');
SessionManager::set_coach_to_course_session(
SessionManager::set_coach_to_course_session(
$_REQUEST['user_id'],
$sessionId,
$courseInfo['real_id']
);
Display::addFlash(Display::return_message($message));
} else {
CourseManager::subscribeUser(
Display::addFlash(Display::return_message($message));
} else {
CourseManager::subscribeUser(
$_REQUEST['user_id'],
$courseInfo['code'],
COURSEMANAGER
);
}
} else {
CourseManager::subscribeUser(
}
} else {
CourseManager::subscribeUser(
$_REQUEST['user_id'],
$courseInfo['code']
);
@ -95,8 +95,8 @@ if (isset($_POST['action'])) {
foreach ($_POST['user'] as $index => $user_id) {
$userInfo = api_get_user_info($user_id);
if ($userInfo) {
if ($type === COURSEMANAGER) {
if (!empty($sessionId)) {
if ($type === COURSEMANAGER) {
if (!empty($sessionId)) {
$message = $userInfo['complete_name_with_username'].' '.get_lang('AddedToCourse');
$result = SessionManager::set_coach_to_course_session(
$user_id,
@ -106,12 +106,12 @@ if (isset($_POST['action'])) {
if ($result) {
$isSuscribe[] = $message;
}
} else {
} else {
CourseManager::subscribeUser($user_id, $courseInfo['code'], COURSEMANAGER);
}
} else {
}
} else {
CourseManager::subscribeUser($user_id, $courseInfo['code']);
}
}
}
}

@ -47,11 +47,11 @@ $student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
$onlyOnePublication = api_get_configuration_value('allow_only_one_student_publication_per_user');
// @todo add an option to allow/block multiple attempts.
if ($onlyOnePublication) {
$count = get_work_count_by_student($user_id, $work_id);
$count = get_work_count_by_student($user_id, $work_id);
if ($count >= 1) {
api_not_allowed(true);
}
}
}
$homework = get_work_assignment_by_id($workInfo['id']);
$validationStatus = getWorkDateValidationStatus($homework);

@ -2149,20 +2149,20 @@ function get_work_user_list(
} else {
if ($blockEdition && !api_is_platform_admin()) {
$editLink = '';
} else {
if ($qualification_exists) {
} else {
if ($qualification_exists) {
$editLink = '<a href="'.$url.'edit.php?'.api_get_cidreq(
).'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang(
'Edit'
).'" >'.
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
} else {
} else {
$editLink = '<a href="'.$url.'edit.php?'.api_get_cidreq(
).'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang(
'Modify'
).'">'.
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
}
}
}
$action .= $editLink;
}
@ -2861,9 +2861,9 @@ function getStudentSubscribedToWork(
}
/**
* @param int $userId
* @param int $workId
* @param int $courseId
* @param int $userId
* @param int $workId
* @param int $courseId
* @param bool $forceAccessForCourseAdmins
*
* @return bool

@ -172,8 +172,8 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !$isDrhOfC
$blockAddDocuments = api_get_configuration_value('block_student_publication_add_documents');
if (!$blockAddDocuments) {
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
$actionsLeft .= Display::return_icon('new_document.png', get_lang('AddDocument'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
$actionsLeft .= Display::return_icon('new_document.png', get_lang('AddDocument'), '', ICON_SIZE_MEDIUM).'</a>';
}
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_user.php?'.api_get_cidreq().'&id='.$workId.'">';

Loading…
Cancel
Save