Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 8 years ago
parent acf90c4e86
commit 1f901f0a32
  1. 8
      main/admin/access_url_edit_usergroup_to_url.php
  2. 60
      main/admin/dashboard_add_users_to_user.php
  3. 12
      main/auth/profile.php
  4. 6
      main/calendar/agenda_list.php
  5. 12
      main/document/upload.php
  6. 28
      main/exercise/exercise_history.php
  7. 4
      main/forum/editpost.php
  8. 10
      main/glossary/index.php
  9. 10
      main/gradebook/lib/be/studentpublicationlink.class.php
  10. 10
      main/inc/lib/MoodleImport.php
  11. 20
      main/inc/lib/dashboard.lib.php
  12. 14
      main/inc/lib/grade_model.lib.php
  13. 16
      main/inc/lib/promotion.lib.php
  14. 18
      main/inc/lib/skill.lib.php
  15. 832
      main/inc/lib/tracking.lib.php
  16. 42
      main/inc/local.inc.php
  17. 4
      main/install/ajax.php
  18. 26
      main/lp/lp_list_search.php
  19. 14
      main/session/session_add.php
  20. 26
      main/tracking/exams.php
  21. 78
      main/user/add_users_to_session.php
  22. 10
      plugin/bbb/admin.php
  23. 2
      plugin/courseblock/config.php
  24. 6
      src/Chamilo/CoreBundle/Entity/Course.php

@ -54,7 +54,7 @@ function add_user_to_url(code, content) {
function send() {
if (document.formulaire.access_url_id.value!=0) {
document.formulaire.form_sent.value=0;
document.formulaire.add_type.value=\'' . $add_type . '\';
document.formulaire.add_type.value=\'' . $add_type.'\';
document.formulaire.submit();
}
}
@ -100,7 +100,7 @@ Display::display_header($tool_name);
echo '<div class="actions">';
echo Display::url(
Display::return_icon('view_more_stats.gif', get_lang('AddUserGroupToURL'), ''),
api_get_path(WEB_CODE_PATH) . 'admin/access_url_add_usergroup_to_url.php'
api_get_path(WEB_CODE_PATH).'admin/access_url_add_usergroup_to_url.php'
);
echo '</div>';
@ -138,7 +138,7 @@ if ($add_type == 'multiple') {
<?php
echo Display::toolbarButton(
get_lang('SessionAddTypeUnique'),
api_get_self() . '?' . http_build_query([
api_get_self().'?'.http_build_query([
'add_type' => 'unique',
'access_url_id' => $access_url_id
]),
@ -148,7 +148,7 @@ if ($add_type == 'multiple') {
);
echo Display::toolbarButton(
get_lang('SessionAddTypeMultiple'),
api_get_self() . '?' . http_build_query([
api_get_self().'?'.http_build_query([
'add_type' => 'multiple',
'access_url_id' => $access_url_id
]),

@ -24,7 +24,7 @@ api_protect_admin_script(true);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'user_list.php','name' => get_lang('UserList'));
$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList'));
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@ -44,17 +44,17 @@ $firstLetterUser = isset($_POST['firstLetterUser']) ? $_POST['firstLetterUser']
$isAdmin = UserManager::is_admin($user_id);
if ($isAdmin) {
$userStatus = PLATFORM_ADMIN;
$tool_name= get_lang('AssignUsersToPlatformAdministrator');
$tool_name = get_lang('AssignUsersToPlatformAdministrator');
} else if ($user_info['status'] == SESSIONADMIN) {
$tool_name= get_lang('AssignUsersToSessionsAdministrator');
} else if ($user_info['status'] == STUDENT_BOSS) {
$tool_name= get_lang('AssignUsersToBoss');
$tool_name = get_lang('AssignUsersToSessionsAdministrator');
} else if ($user_info['status'] == STUDENT_BOSS) {
$tool_name = get_lang('AssignUsersToBoss');
} else {
$tool_name= get_lang('AssignUsersToHumanResourcesManager');
$tool_name = get_lang('AssignUsersToHumanResourcesManager');
}
$add_type = 'multiple';
if (isset($_GET['add_type']) && $_GET['add_type']!='') {
if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
@ -64,7 +64,7 @@ if (!api_is_platform_admin()) {
function search_users($needle, $type)
{
global $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id, $userStatus;
global $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id, $userStatus;
$xajax_response = new xajaxResponse();
$return = '';
@ -102,7 +102,7 @@ function search_users($needle, $type)
LEFT JOIN $tbl_access_url_rel_user au ON (au.user_id = user.user_id)
WHERE
".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND
status NOT IN(".DRH.", ".SESSIONADMIN.", " . STUDENT_BOSS . ") AND
status NOT IN(".DRH.", ".SESSIONADMIN.", ".STUDENT_BOSS.") AND
user.user_id NOT IN ($user_anonymous, $current_user_id, $user_id)
$without_assigned_users AND
access_url_id = ".api_get_current_access_url_id()."
@ -114,13 +114,13 @@ function search_users($needle, $type)
FROM $tbl_user user
WHERE
".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND
status NOT IN(".DRH.", ".SESSIONADMIN.", " . STUDENT_BOSS . ") AND
status NOT IN(".DRH.", ".SESSIONADMIN.", ".STUDENT_BOSS.") AND
user_id NOT IN ($user_anonymous, $current_user_id, $user_id)
$without_assigned_users
$order_clause
";
}
$rs = Database::query($sql);
$rs = Database::query($sql);
$xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
if ($type == 'single') {
@ -140,10 +140,10 @@ function search_users($needle, $type)
switch ($userStatus) {
case DRH:
$sql .= " user.status <> 6 AND user.status <> " . DRH;
$sql .= " user.status <> 6 AND user.status <> ".DRH;
break;
case STUDENT_BOSS:
$sql .= " user.status <> 6 AND user.status <> " . STUDENT_BOSS;
$sql .= " user.status <> 6 AND user.status <> ".STUDENT_BOSS;
break;
}
@ -160,12 +160,12 @@ function search_users($needle, $type)
$return .= '...<br />';
}
}
$xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
$xajax_response->addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return));
} else {
$return .= '<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15" ">';
while($user = Database :: fetch_array($rs)) {
while ($user = Database :: fetch_array($rs)) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<option value="'.$user['user_id'].'" title="'.htmlspecialchars($person_name,ENT_QUOTES).'">'.$person_name.' ('.$user['username'].')</option>';
$return .= '<option value="'.$user['user_id'].'" title="'.htmlspecialchars($person_name, ENT_QUOTES).'">'.$person_name.' ('.$user['username'].')</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
@ -242,7 +242,7 @@ function remove_item(origin) {
}
</script>';
$formSent=0;
$formSent = 0;
$errorMsg = '';
$UserList = array();
@ -257,7 +257,7 @@ $filters = array(
$searchForm = new FormValidator('search', 'get', api_get_self().'?user='.$user_id);
$searchForm->addHeader(get_lang('AdvancedSearch'));
$renderer =& $searchForm->defaultRenderer();
$renderer = & $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'user', $user_id);
foreach ($filters as $param) {
@ -299,7 +299,7 @@ if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
$affected_rows = 0;
}
if ($affected_rows) {
if ($affected_rows) {
$msg = get_lang('AssignedUsersHaveBeenUpdatedSuccessfully');
}
}
@ -322,7 +322,7 @@ if ($userStatus != STUDENT_BOSS) {
}
$actionsRight = Display::url(
'<em class="fa fa-search"></em> ' . get_lang('AdvancedSearch'),
'<em class="fa fa-search"></em> '.get_lang('AdvancedSearch'),
'#',
array('class' => 'btn btn-default advanced_options', 'id' => 'advanced_search')
);
@ -359,13 +359,13 @@ switch ($userStatus) {
$assigned_users_id = array_keys($assigned_users_to_hrm);
$without_assigned_users = '';
if (count($assigned_users_id) > 0) {
$without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND ";
$without_assigned_users = " user.user_id NOT IN(".implode(',', $assigned_users_id).") AND ";
}
$search_user = '';
if (!empty($firstLetterUser)) {
$needle = Database::escape_string($firstLetterUser);
$search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'";
$search_user = "AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'";
}
$sqlConditions = null;
@ -406,12 +406,12 @@ if (api_is_multiple_url_enabled()) {
$sqlConditions
ORDER BY firstname ";
}
$result = Database::query($sql);
$result = Database::query($sql);
?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" class="form-horizontal" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" class="form-horizontal" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
<input type="hidden" name="formSent" value="1" />
<?php
if(!empty($msg)) {
if (!empty($msg)) {
Display::display_normal_message($msg); //main API
}
?>
@ -427,7 +427,7 @@ if(!empty($msg)) {
<?php
while ($enreg = Database::fetch_array($result)) {
$person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']); ?>
<option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name,ENT_QUOTES).'"';?>>
<option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
<?php echo $person_name.' ('.$enreg['username'].')'; ?>
</option>
<?php } ?>
@ -440,8 +440,8 @@ if(!empty($msg)) {
</div>
<div class="col-md-4">
<div class="code-course">
<?php if($add_type == 'multiple') { ?>
<p><?php echo get_lang('FirstLetterUser');?></p>
<?php if ($add_type == 'multiple') { ?>
<p><?php echo get_lang('FirstLetterUser'); ?></p>
<select class="selectpicker show-tick form-control" name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')">
<option value="%">--</option>
<?php echo Display::get_alphabet_options($firstLetterUser); ?>
@ -492,10 +492,10 @@ if(!empty($msg)) {
<select id='destination' class="form-control" name="UsersList[]" multiple="multiple" size="15" >
<?php
if (is_array($assigned_users_to_hrm)) {
foreach($assigned_users_to_hrm as $enreg) {
foreach ($assigned_users_to_hrm as $enreg) {
$person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']);
?>
<option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name,ENT_QUOTES).'"'; ?>>
<option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
<?php echo $person_name.' ('.$enreg['username'].')'; ?>
</option>
<?php }

@ -33,7 +33,7 @@ $geolocalization = $gMapsPlugin->get('enable_api') === 'true';
if ($geolocalization) {
$gmapsApiKey = $gMapsPlugin->get('api_key');
$htmlHeadXtra[] = '<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=true&key='. $gmapsApiKey . '" ></script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=true&key='.$gmapsApiKey.'" ></script>';
}
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#password1');
@ -119,10 +119,10 @@ $form = new FormValidator('profile');
if (api_is_western_name_order()) {
// FIRST NAME and LAST NAME
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
$form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
$form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
} else {
// LAST NAME and FIRST NAME
$form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
$form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
$form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
}
if (api_get_setting('profile', 'name') !== 'true') {
@ -131,7 +131,7 @@ if (api_get_setting('profile', 'name') !== 'true') {
$form->applyFilter(array('lastname', 'firstname'), 'stripslashes');
$form->applyFilter(array('lastname', 'firstname'), 'trim');
$form->applyFilter(array('lastname', 'firstname'), 'html_filter');
$form->addRule('lastname' , get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
// USERNAME
@ -176,7 +176,7 @@ if (api_get_setting('profile', 'email') !== 'true') {
$form->freeze('email');
}
if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
$form->applyFilter('email', 'stripslashes');
$form->applyFilter('email', 'trim');
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
@ -331,7 +331,7 @@ $jquery_ready_content = $return['jquery_ready_content'];
// the $jquery_ready_content variable collects all functions that
// will be load in the $(document).ready javascript function
$htmlHeadXtra[] ='<script>
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
'.$jquery_ready_content.'
});

@ -28,7 +28,7 @@ $this_section = SECTION_MYAGENDA;
if (!empty($currentCourseId) && $currentCourseId != -1) {
// Agenda is inside a course tool
$url = api_get_self() . '?' . api_get_cidreq();
$url = api_get_self().'?'.api_get_cidreq();
$this_section = SECTION_COURSES;
// Order by start date
@ -51,7 +51,7 @@ if (!empty($currentCourseId) && $currentCourseId != -1) {
if (!empty($events)) {
foreach ($events as &$event) {
$courseId = isset($event['course_id']) ? $event['course_id'] : '';
$event['url'] = api_get_self() . '?cid=' . $courseId . '&type=' . $event['type'];
$event['url'] = api_get_self().'?cid='.$courseId.'&type='.$event['type'];
}
}
}
@ -77,7 +77,7 @@ if (api_is_allowed_to_edit()) {
} else {
$courseCondition = '&'.api_get_cidreq();
}
header('Location: '. api_get_self().'?type='.$agenda->type.$courseCondition);
header('Location: '.api_get_self().'?type='.$agenda->type.$courseCondition);
exit;
}
}

@ -72,7 +72,7 @@ if (isset($_REQUEST['id'])) {
}
if (empty($document_data)) {
$document_id = $parent_id = 0;
$document_id = $parent_id = 0;
$path = '/';
} else {
$document_id = $document_data['id'];
@ -199,10 +199,10 @@ if (!empty($_FILES)) {
true
);
$redirectUrl = api_get_self() . '?' . api_get_cidreq();
$redirectUrl = api_get_self().'?'.api_get_cidreq();
if ($document_data) {
$redirectUrl .= '&' . http_build_query([
$redirectUrl .= '&'.http_build_query([
'id' => $document_data['iid']
]);
}
@ -217,11 +217,11 @@ Display::display_header($nameTools, 'Doc');
// Actions
// Link back to the documents overview
if ($is_certificate_mode) {
$actions = '<a href="document.php?id='.$document_id.'&selectcat=' . $selectcat.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
$actions = '<a href="document.php?id='.$document_id.'&selectcat='.$selectcat.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
} else {
$actions = '<a href="document.php?id='.$document_id.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
}
// Link to create a folder

@ -10,41 +10,41 @@
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section=SECTION_COURSES;
$this_section = SECTION_COURSES;
api_protect_course_script(true);
// moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
$show = (isset($_GET['show']) && $_GET['show'] == 'result') ? 'result' : 'test';
/* Constants and variables */
$is_allowedToEdit = api_is_allowed_to_edit(null,true);
$is_allowedToEdit = api_is_allowed_to_edit(null, true);
$is_tutor = api_is_allowed_to_edit(true);
if (!$is_allowedToEdit){
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise.php?' . api_get_cidreq());
if (!$is_allowedToEdit) {
header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq());
exit;
}
$interbreadcrumb[]= array ('url' => 'exercise_report.php?'.api_get_cidreq(),'name' => get_lang('Exercises'));
$interbreadcrumb[]= array ('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(),'name' => get_lang('StudentScore'));
$interbreadcrumb[]= array ('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details'));
$interbreadcrumb[] = array('url' => 'exercise_report.php?'.api_get_cidreq(), 'name' => get_lang('Exercises'));
$interbreadcrumb[] = array('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(), 'name' => get_lang('StudentScore'));
$interbreadcrumb[] = array('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details'));
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_EXERCISES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_ATTEMPT_RECORDING= Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
Display::display_header($nameTools,get_lang('Exercise'));
$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
Display::display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message'])) {
if (in_array($_GET['message'], array('ExerciseEdited'))) {
$my_message_history=Security::remove_XSS($_GET['message']);
$my_message_history = Security::remove_XSS($_GET['message']);
Display::display_confirmation_message(get_lang($my_message_history));
}
}
echo '<div class="actions">';
echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' .
Display :: return_icon('back.png', get_lang('BackToResultList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="exercise_report.php?'.api_get_cidreq().'&filter=2">'.
Display :: return_icon('back.png', get_lang('BackToResultList'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
?>
@ -65,10 +65,10 @@ $sql = "SELECT *, quiz_question.question, firstname, lastname
WHERE
quiz_question.id = question_id AND
user_id = author AND
exe_id = '".(int)$_GET['exe_id']."'
exe_id = '".(int) $_GET['exe_id']."'
ORDER BY position";
$query = Database::query($sql);
while($row = Database::fetch_array($query)){
while ($row = Database::fetch_array($query)) {
echo '<tr';
if ($i % 2 == 0) {
echo 'class="row_odd"';

@ -149,7 +149,7 @@ if (!api_is_allowed_to_edit(null, true) &&
if (!api_is_allowed_to_edit(null, true) &&
(
($current_forum_category && $current_forum_category['locked'] <> 0 ) ||
($current_forum_category && $current_forum_category['locked'] <> 0) ||
$current_forum['locked'] <> 0 ||
$current_thread['locked'] <> 0
)
@ -199,7 +199,7 @@ echo '<div class="forum_title">';
echo '<h1>';
echo Display::url(
prepare4display($current_forum['forum_title']),
'viewforum.php?' . api_get_cidreq() . '&' . http_build_query([
'viewforum.php?'.api_get_cidreq().'&'.http_build_query([
'origin' => $origin,
'forum' => $current_forum['forum_id']
]),

@ -53,7 +53,7 @@ switch ($action) {
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed(true);
}
$tool_name = get_lang('Add');
$tool_name = get_lang('Add');
$form = new FormValidator(
'glossary',
'post',
@ -184,7 +184,7 @@ switch ($action) {
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed(true);
}
$tool_name = get_lang('ImportGlossary');
$tool_name = get_lang('ImportGlossary');
$form = new FormValidator(
'glossary',
'post',
@ -212,7 +212,7 @@ switch ($action) {
foreach (GlossaryManager::get_glossary_terms() as $term) {
if (!GlossaryManager::delete_glossary($term['id'], false)) {
Display::addFlash(
Display::return_message(get_lang("CannotDeleteGlossary") . ':' . $term['id'], 'error')
Display::return_message(get_lang("CannotDeleteGlossary").':'.$term['id'], 'error')
);
} else {
$termsDeleted[] = $term['name'];
@ -309,7 +309,7 @@ switch ($action) {
if (count($badList) > 0) {
Display::addFlash(
Display::return_message(
get_lang("GlossaryTermAlreadyExists").': ' . implode(', ', $badList),
get_lang("GlossaryTermAlreadyExists").': '.implode(', ', $badList),
'error'
)
);
@ -352,7 +352,7 @@ switch ($action) {
GlossaryManager::export_to_pdf();
break;
case 'changeview':
if (in_array($_GET['view'], array('list','table'))) {
if (in_array($_GET['view'], array('list', 'table'))) {
Session::write('glossary_view', $_GET['view']);
} else {
$view = Session::read('glossary_view');

@ -92,7 +92,7 @@ class StudentPublicationLink extends AbstractLink
$result = Database::query($sql);
$cats=array();
$cats = array();
while ($data = Database::fetch_array($result)) {
$cats[] = array($data['id'], $data['url']);
}
@ -135,9 +135,9 @@ class StudentPublicationLink extends AbstractLink
if (empty($work_name)) {
$work_name = basename($data->getUrl());
}
$cats[] = array ($data->getId(), $work_name);
$cats[] = array($data->getId(), $work_name);
}
$cats=isset($cats) ? $cats : array();
$cats = isset($cats) ? $cats : array();
return $cats;
}
@ -264,7 +264,7 @@ class StudentPublicationLink extends AbstractLink
];
}
$students = array(); // user list, needed to make sure we only
$students = array(); // user list, needed to make sure we only
// take first attempts into account
$rescount = 0;
$sum = 0;
@ -297,7 +297,7 @@ class StudentPublicationLink extends AbstractLink
return array($bestResult, $weight);
break;
case 'average':
return array($sumResult/$rescount, $weight);
return array($sumResult / $rescount, $weight);
break;
case 'ranking':
return AbstractLink::getCurrentUserRanking($stud_id, $students);

@ -43,11 +43,11 @@ class MoodleImport
}
$folder = api_get_unique_id();
$destinationDir = api_get_path(SYS_ARCHIVE_PATH) . $folder;
$destinationDir = api_get_path(SYS_ARCHIVE_PATH).$folder;
$coursePath = api_get_course_path();
$sessionId = api_get_session_id();
$groupId = api_get_group_id();
$documentPath = api_get_path(SYS_COURSE_PATH) . $coursePath . '/document';
$documentPath = api_get_path(SYS_COURSE_PATH).$coursePath.'/document';
$courseInfo = api_get_course_info();
mkdir($destinationDir, api_get_permissions_for_new_directories(), true);
@ -814,7 +814,7 @@ class MoodleImport
if ($weighting > 0) {
$questionWeighting += $weighting;
}
$goodAnswer = $correct ? true : false;
$goodAnswer = $correct ? true : false;
$this->fixPathInText($importedFiles, $answer);
@ -851,7 +851,7 @@ class MoodleImport
if ($weighting > 0) {
$questionWeighting += $weighting;
}
$goodAnswer = $correct ? true : false;
$goodAnswer = $correct ? true : false;
$this->fixPathInText($importedFiles, $answer);
@ -952,7 +952,7 @@ class MoodleImport
$answer['questiontext']
);
$placeholder .= '<p> ' . strip_tags($answer['questiontext']).' '.$currentAnswers . ' </p>';
$placeholder .= '<p> '.strip_tags($answer['questiontext']).' '.$currentAnswers.' </p>';
}
return $optionsValues;

@ -68,7 +68,7 @@ class DashboardManager
'tr',
Display::tag(
'td',
get_lang('CheckFilePermissions') . ' ' . Security::remove_XSS($plugin_info_file),
get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file),
array('colspan' => '3')
)
);
@ -81,7 +81,7 @@ class DashboardManager
foreach ($disabled_blocks_data as $disabled_block) {
echo '<tr style="background-color:#eee">';
echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>';
for ($j = 0 ; $j < count($table_cols); $j++) {
for ($j = 0; $j < count($table_cols); $j++) {
if (isset($disabled_block[strtolower($table_cols[$j])])) {
if ($j == 2) {
echo '<td>';
@ -192,10 +192,10 @@ class DashboardManager
// clean from block data
if (!empty($not_selected_blocks_id)) {
$sql_check = "SELECT id FROM $tbl_block
WHERE id IN(".implode(',',$not_selected_blocks_id).")";
WHERE id IN(".implode(',', $not_selected_blocks_id).")";
$rs_check = Database::query($sql_check);
if (Database::num_rows($rs_check) > 0) {
$del = "DELETE FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
$del = "DELETE FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")";
Database::query($del);
}
}
@ -215,7 +215,7 @@ class DashboardManager
$affected_rows = Database::affected_rows($result);
} else {
// insert
$plugin_info_file = $dashboard_pluginpath . $testplugin . "/$testplugin.info";
$plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info";
$plugin_info = array();
if (file_exists($plugin_info_file)) {
$plugin_info = api_parse_info_file($plugin_info_file);
@ -285,7 +285,7 @@ class DashboardManager
// We check if plugin exists inside directory for updating active field
$sql = "SELECT * FROM $tbl_block";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0){
if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs)) {
if (!in_array($row['path'], $possibleplugins)) {
$active = 0;
@ -393,13 +393,13 @@ class DashboardManager
echo '<td>'.$block['description'].'</td>';
echo '<td>
<select class="selectpicker show-tick form-control" name="columns['.$block['id'].']">
<option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option>
<option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option>
<option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 1 ? 'selected' : '').' >1</option>
<option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 2 ? 'selected' : '').' >2</option>
</select>
</td>';
echo '</tr>';
} else {
echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
}
}
@ -449,7 +449,7 @@ class DashboardManager
*/
public static function store_user_blocks($user_id, $enabled_blocks, $columns)
{
$selected_blocks_id = array();
$selected_blocks_id = array();
if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
$selected_blocks_id = array_keys($enabled_blocks);
}

@ -16,7 +16,7 @@ class GradeModel extends Model
public function __construct()
{
parent::__construct();
$this->table = Database::get_main_table(TABLE_GRADE_MODEL);
$this->table = Database::get_main_table(TABLE_GRADE_MODEL);
}
/**
@ -55,7 +55,7 @@ class GradeModel extends Model
{
// action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="grade_models.php">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo Display::grid_html('grade_model');
@ -129,7 +129,7 @@ class GradeModel extends Model
$form->addElement('hidden', 'components['.$i.'][id]', null);
$template_percentage =
'<div id=' . $i . ' style="display: '.(($i<=$nr_items)?'inline':'none').';" class="form-group">
'<div id='.$i.' style="display: '.(($i <= $nr_items) ? 'inline' : 'none').';" class="form-group">
<label for="" class="col-sm-2 control-label">
{label}
</label>
@ -143,11 +143,11 @@ class GradeModel extends Model
$template_title =
'&nbsp{element} <!-- BEGIN error --> <span class="form_error">{error}</span><!-- END error -->
<a href="javascript:plusItem(' . ($counter+1) . ')">
'.Display::return_icon('add.png', get_lang('Add'), ['id' => 'plus-' . ($counter+1), 'style' => 'display: '.(($counter>=$nr_items) ? 'inline':'none') ]).'
<a href="javascript:plusItem(' . ($counter + 1).')">
'.Display::return_icon('add.png', get_lang('Add'), ['id' => 'plus-'.($counter + 1), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).'
</a>
<a href="javascript:minItem(' . ($counter) . ')">
'.Display::return_icon('delete.png', get_lang('Delete'), ['id' => 'min-' . ($counter), 'style' => 'display: '.(($counter>=$nr_items) ? 'inline':'none') ]).'
<a href="javascript:minItem(' . ($counter).')">
'.Display::return_icon('delete.png', get_lang('Delete'), ['id' => 'min-'.($counter), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).'
</a>
</div></div>';
$renderer->setElementTemplate($template_title, 'components['.$i.'][title]');

@ -63,7 +63,7 @@ class Promotion extends Model
case 'updated_at':
break;
case 'name':
$val .= ' ' . get_lang('CopyLabelSuffix');
$val .= ' '.get_lang('CopyLabelSuffix');
$new[$key] = $val;
break;
case 'created_at':
@ -72,7 +72,7 @@ class Promotion extends Model
break;
case 'career_id':
if (!empty($career_id)) {
$val = (int)$career_id;
$val = (int) $career_id;
}
$new[$key] = $val;
break;
@ -160,22 +160,22 @@ class Promotion extends Model
{
// Action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="career_dashboard.php">' . Display::return_icon('back.png',
get_lang('Back'), '', '32') . '</a>';
echo '<a href="' . api_get_self() . '?action=add">' .
echo '<a href="career_dashboard.php">'.Display::return_icon('back.png',
get_lang('Back'), '', '32').'</a>';
echo '<a href="'.api_get_self().'?action=add">'.
Display::return_icon(
'new_promotion.png',
get_lang('Add'),
'',
'32'
) . '</a>';
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'session/session_add.php">' .
).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'.
Display::return_icon(
'new_session.png',
get_lang('AddSession'),
'',
'32'
) . '</a>';
).'</a>';
echo '</div>';
echo Display::grid_html('promotions');
}

@ -803,7 +803,7 @@ class Skill extends Model
$attributes = array(
'skill_id' => $skill_id,
'parent_id' => $parent_id,
'relation_type' => (isset($params['relation_type'])?$params['relation_type']:0),
'relation_type' => (isset($params['relation_type']) ? $params['relation_type'] : 0),
//'level' => $params['level'],
);
$skill_rel_skill->save($attributes);
@ -1012,7 +1012,7 @@ class Skill extends Model
$skills[$skill_id] = $skill_info;
// Uncomment code below to hide the searched skill
$skills[$skill_id]['data']['parent_id'] = $skill_info['extra']['parent_id'];
$skills[$skill_id]['parent_id'] = 1;
$skills[$skill_id]['parent_id'] = 1;
}
}
}
@ -1077,7 +1077,7 @@ class Skill extends Model
$skill['data']['skill_has_gradebook'] = true;
}
$refs[$skill['id']] = &$skill;
$flat_array[$skill['id']] = &$skill;
$flat_array[$skill['id']] = &$skill;
}
// Checking family value
@ -1098,7 +1098,7 @@ class Skill extends Model
$refs['root']['children'][0] = $skills[1];
$skills[$skill_id]['data']['family_id'] = 1;
$refs['root']['children'][0]['children'][0] = $skills[$skill_id];
$flat_array[$skill_id] = $skills[$skill_id];
$flat_array[$skill_id] = $skills[$skill_id];
} else {
// Moving node to the children index of their parents
@ -1107,7 +1107,7 @@ class Skill extends Model
$skill['data']['family_id'] = $new_family_array[$skill['id']];
}
$refs[$skill['parent_id']]['children'][] = &$skill;
$flat_array[$my_skill_id] = $skill;
$flat_array[$my_skill_id] = $skill;
}
}
@ -1219,7 +1219,7 @@ class Skill extends Model
INNER JOIN {$this->table_skill_rel_user} su
ON (s.id = su.skill_id)
WHERE user_id = $user_id";
$result = Database::query($sql);
$result = Database::query($sql);
if (Database::num_rows($result)) {
$result = Database::fetch_row($result);
return $result[0];
@ -1261,7 +1261,7 @@ class Skill extends Model
*/
public function get_user_list_skill_ranking_count()
{
$sql = "SELECT count(*) FROM (
$sql = "SELECT count(*) FROM (
SELECT count(distinct 1)
FROM {$this->table} s
INNER JOIN {$this->table_skill_rel_user} su
@ -1316,7 +1316,7 @@ class Skill extends Model
ON c.code = g.course_code
WHERE sg.skill_id = $skill_id
AND (g.session_id IS NULL OR g.session_id = 0)";
$result = Database::query($sql);
$result = Database::query($sql);
return Database::store_result($result, 'ASSOC');
}
@ -1505,7 +1505,7 @@ class Skill extends Model
WHERE sg.skill_id = $skillId
AND g.session_id > 0";
$result = Database::query($sql);
$result = Database::query($sql);
return Database::store_result($result, 'ASSOC');
}

File diff suppressed because it is too large Load Diff

@ -216,7 +216,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
// is necessary verify check
if ($legal_type == 1) {
if ((isset($_POST['legal_accept']) && $_POST['legal_accept']=='1')) {
if ((isset($_POST['legal_accept']) && $_POST['legal_accept'] == '1')) {
$legal_option = true;
} else {
$legal_option = false;
@ -504,7 +504,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
* Process external authentication
* on the basis of the given login name
*/
$loginFailed = true; // Default initialisation. It could
$loginFailed = true; // Default initialisation. It could
// change after the external authentication
$key = $uData['auth_source']; //'ldap','shibboleth'...
@ -549,7 +549,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
* Process external authentication
* on the basis of the given login name
*/
$loginFailed = true; // Default initialisation. It could
$loginFailed = true; // Default initialisation. It could
// change after the external authentication
$key = $uData['auth_source']; //'ldap','shibboleth'...
@ -560,11 +560,11 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
} else {
// change after the external authentication
// login failed, Database::num_rows($result) <= 0
$loginFailed = true; // Default initialisation. It could
$loginFailed = true; // Default initialisation. It could
}
// login failed, Database::num_rows($result) <= 0
$loginFailed = true; // Default initialisation. It could
$loginFailed = true; // Default initialisation. It could
// change after the external authentication
/*
@ -592,7 +592,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
include_once($thisAuthSource['newUser']);
} else {
error_log(
'Chamilo Authentication external file' .
'Chamilo Authentication external file'.
' could not be found - this might prevent your system from using'.
' the authentication process in the user creation process',
0
@ -704,7 +704,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
online_logout(null, false);
$osso->logout(); //redirects and exits
}
} elseif (api_get_setting('openid_authentication')=='true') {
} elseif (api_get_setting('openid_authentication') == 'true') {
if (!empty($_POST['openid_url'])) {
include api_get_path(SYS_CODE_PATH).'auth/openid/login.php';
openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php');
@ -717,7 +717,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
if ($res['status'] == 'success') {
$id1 = Database::escape_string($res['openid.identity']);
//have another id with or without the final '/'
$id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/');
$id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/');
//lookup the user in the main database
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT user_id, username, password, auth_source, active, expiration_date
@ -726,14 +726,14 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
OR openid = '$id2' ";
$result = Database::query($sql);
if ($result !== false) {
if (Database::num_rows($result)>0) {
if (Database::num_rows($result) > 0) {
$uData = Database::fetch_array($result);
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
//the authentification of this user is managed by Chamilo itself
// check if the account is active (not locked)
if ($uData['active']=='1') {
if ($uData['active'] == '1') {
// check if the expiration date has not been reached
if ($uData['expiration_date'] > date('Y-m-d H:i:s')
|| empty($uData['expiration_date'])
@ -812,7 +812,7 @@ if (!empty($cidReq) && (!isset($_SESSION['_cid']) ||
(isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid']))
) {
$cidReset = true;
$gidReset = true; // As groups depend from courses, group id is reset
$gidReset = true; // As groups depend from courses, group id is reset
}
/* USER INIT */
@ -956,8 +956,8 @@ if (isset($cidReset) && $cidReset) {
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
if (!empty($_GET['id_session'])) {
$sql = 'SELECT name FROM '.$tbl_session . '
WHERE id="'.intval($_GET['id_session']) . '"';
$sql = 'SELECT name FROM '.$tbl_session.'
WHERE id="'.intval($_GET['id_session']).'"';
$rs = Database::query($sql);
if (Database::num_rows($rs)) {
list($_SESSION['session_name']) = Database::fetch_array($rs);
@ -1044,7 +1044,7 @@ if (isset($cidReset) && $cidReset) {
// Moreover, if we want to track a course with another session it can be usefull
if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) {
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"';
$sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"';
$rs = Database::query($sql);
if (Database::num_rows($rs)) {
list($_SESSION['session_name']) = Database::fetch_array($rs);
@ -1168,7 +1168,7 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) {
}
}
$url = api_get_path(WEB_CODE_PATH).'auth/inscription.php';
header("Location:". $url);
header("Location:".$url);
exit;
}
}
@ -1188,8 +1188,8 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) {
if (Database::num_rows($result) > 0) { // this user have a recorded state for this course
$cuData = Database::fetch_array($result, 'ASSOC');
$is_courseAdmin = (bool)($cuData['status'] == 1);
$is_courseTutor = (bool)($cuData['is_tutor'] == 1);
$is_courseAdmin = (bool) ($cuData['status'] == 1);
$is_courseTutor = (bool) ($cuData['is_tutor'] == 1);
$is_courseMember = true;
}
@ -1200,7 +1200,7 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) {
// This user has no status related to this course
// The user is subscribed in a session? The user is a Session coach a Session admin ?
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -1505,12 +1505,12 @@ if ((isset($cas_login) && $cas_login && exist_firstpage_parameter()) ||
($logging_in && exist_firstpage_parameter())
) {
$redirectCourseDir = api_get_firstpage_parameter();
api_delete_firstpage_parameter(); // delete the cookie
api_delete_firstpage_parameter(); // delete the cookie
if (!isset($_SESSION['request_uri'])) {
if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
$_SESSION['noredirection'] = false;
$_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
$_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
}
}
} elseif (api_user_is_login() && exist_firstpage_parameter()) {
@ -1518,7 +1518,7 @@ if ((isset($cas_login) && $cas_login && exist_firstpage_parameter()) ||
api_delete_firstpage_parameter(); // delete the cookie
if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
$_SESSION['noredirection'] = false;
$_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
$_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
}
}

@ -11,7 +11,7 @@ ini_set('display_errors', '1');
ini_set('log_errors', '1');
error_reporting(-1);
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__.'/../../vendor/autoload.php';
define('SYSTEM_INSTALLATION', 1);
define('INSTALL_TYPE_UPDATE', 'update');
@ -24,7 +24,7 @@ require_once '../inc/lib/api.lib.php';
session_start();
require_once api_get_path(LIBRARY_PATH) . 'database.constants.inc.php';
require_once api_get_path(LIBRARY_PATH).'database.constants.inc.php';
require_once 'install.lib.php';
$action = isset($_POST['a']) ? $_POST['a'] : null;

@ -22,7 +22,7 @@ if (isset($_SESSION['gradebook'])) {
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[]= array(
$interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
@ -62,8 +62,8 @@ if (isset($_GET['mode']) && in_array($_GET['mode'], array('gallery', 'default'))
$term_array = array();
$specific_fields = get_specific_field_list();
foreach ($specific_fields as $specific_field) {
if (!empty($_REQUEST['sf_'. $specific_field['code']])) {
$values = $_REQUEST['sf_'. $specific_field['code']];
if (!empty($_REQUEST['sf_'.$specific_field['code']])) {
$values = $_REQUEST['sf_'.$specific_field['code']];
if (in_array('__all__', $values)) {
$sf_terms_for_code = xapian_get_all_terms(1000, $specific_field['code']);
foreach ($sf_terms_for_code as $term) {
@ -75,7 +75,7 @@ foreach ($specific_fields as $specific_field) {
foreach ($values as $term) {
if (!empty($term)) {
$prefix = $specific_field['code'];
$term_array[] = chamilo_get_boolean_query($prefix . $term);
$term_array[] = chamilo_get_boolean_query($prefix.$term);
}
}
}
@ -93,9 +93,9 @@ foreach ($specific_fields as $specific_field) {
// Get right group of terms to show on multiple select.
$fixed_queries = array();
$course_filter = null;
if (($cid=api_get_course_id()) != -1 ) {
if (($cid = api_get_course_id()) != -1) {
// Results only from actual course.
$course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
$course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
}
if (count($term_array)) {
@ -145,12 +145,12 @@ if ($count > 0) {
}
if ($mode == 'gallery') {
$title = $a_prefix.str_replace('_', ' ', $result['title']). $a_suffix;
$title = $a_prefix.str_replace('_', ' ', $result['title']).$a_suffix;
$blocks[] = array(1 =>
$a_prefix .'<img src="'.$result['thumbnail'].'" />'. $a_suffix .'<br />'.$title.'<br />'.$result['author'],
$a_prefix.'<img src="'.$result['thumbnail'].'" />'.$a_suffix.'<br />'.$title.'<br />'.$result['author'],
);
} else {
$title = '<div style="text-align:left;">'. $a_prefix . $result['title']. $a_suffix .(!empty($result['author']) ? ' '.$result['author'] : '').'<div>';
$title = '<div style="text-align:left;">'.$a_prefix.$result['title'].$a_suffix.(!empty($result['author']) ? ' '.$result['author'] : '').'<div>';
$blocks[] = array(1 => $title);
}
}
@ -169,12 +169,12 @@ if (count($blocks) > 0) {
);
$get_params = '';
foreach ($specific_fields as $specific_field) {
if (isset($_REQUEST['sf_'. $specific_field['code']])) {
$values = $_REQUEST['sf_'. $specific_field['code']];
if (isset($_REQUEST['sf_'.$specific_field['code']])) {
$values = $_REQUEST['sf_'.$specific_field['code']];
//Sortable additional_parameters doesn't accept multi dimensional arrays
//$additional_parameters[ 'sf_'. $specific_field['code'] ] = $values;
foreach ( $values as $value ) {
$get_params .= '&sf_' . $specific_field['code'] .'[]='. $value;
foreach ($values as $value) {
$get_params .= '&sf_'.$specific_field['code'].'[]='.$value;
}
$get_params .= '&';
}

@ -51,7 +51,7 @@ function search_coachs($needle)
' LIMIT 10';
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql = 'SELECT username, lastname, firstname
@ -76,7 +76,7 @@ function search_coachs($needle)
$return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\''.$user['username'].'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
}
}
$xajax_response -> addAssign('ajax_list_coachs','innerHTML', api_utf8_encode($return));
$xajax_response -> addAssign('ajax_list_coachs', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
$xajax -> processRequests();
@ -138,7 +138,7 @@ $form = new FormValidator('add_session', 'post', $urlAction);
$form->addElement('header', $tool_name);
$result = SessionManager::setForm($form);
$htmlHeadXtra[] ='
$htmlHeadXtra[] = '
<script>
$(function() {
'.$result['js'].'
@ -148,7 +148,7 @@ $(function() {
$form->addButtonNext(get_lang('NextStep'));
if (!$formSent) {
$formDefaults['access_start_date'] = $formDefaults['display_start_date'] = api_get_local_time();
$formDefaults['access_start_date'] = $formDefaults['display_start_date'] = api_get_local_time();
$formDefaults['coach_username'] = api_get_user_id();
} else {
$formDefaults['name'] = api_htmlentities($name, ENT_QUOTES, $charset);
@ -173,7 +173,7 @@ if ($form->validate()) {
$id_visibility = $params['session_visibility'];
$duration = isset($params['duration']) ? $params['duration'] : null;
$description = $params['description'];
$showDescription = isset($params['show_description']) ? 1: 0;
$showDescription = isset($params['show_description']) ? 1 : 0;
$sendSubscriptionNotification = isset($params['send_subscription_notification']);
$isThisImageCropped = isset($params['picture_crop_result']);
@ -210,7 +210,7 @@ if ($form->validate()) {
if ($return == strval(intval($return))) {
// integer => no error on session creation
header('Location: add_courses_to_session.php?id_session=' . $return . '&add=true&msg=');
header('Location: add_courses_to_session.php?id_session='.$return.'&add=true&msg=');
exit();
}
}
@ -223,7 +223,7 @@ if (!empty($return)) {
echo '<div class="actions">';
echo '<a href="../session/session_list.php">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$form->display();

@ -80,7 +80,7 @@ $form->setDefaults(array('score' => $filter_score));
if (!$exportToXLS) {
Display :: display_header(get_lang('Reporting'));
$actionsLeft = $actionsRight ='';
$actionsLeft = $actionsRight = '';
if ($global) {
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/my_progress.php">'.
Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM);
@ -93,9 +93,9 @@ if (!$exportToXLS) {
}
$actionsRight .= '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exerciseId.'&'.$courseLink.'">'.
Display::return_icon('export_excel.png',get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print()">'.
Display::return_icon('printer.png',get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
$menuItems[] = Display::url(
Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32),
@ -199,7 +199,7 @@ if (!empty($courseList) && is_array($courseList)) {
$countExercises = Database::store_result($result);
$exerciseSessionCount = $countExercises[0]['count'];
$exerciseCount = $exerciseCount + $exerciseCount * count($newSessionList) + $exerciseSessionCount;
$exerciseCount = $exerciseCount + $exerciseCount * count($newSessionList) + $exerciseSessionCount;
// Add course and session list.
if ($exerciseCount == 0) {
@ -416,7 +416,7 @@ function export_complete_report_xls($filename, $array)
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ExamNotTaken'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, sprintf(get_lang('ExamPassX'), $filter_score) . '%');
$worksheet->setCellValueByColumnAndRow($column, $line, sprintf(get_lang('ExamPassX'), $filter_score).'%');
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ExamFail'));
$column++;
@ -593,10 +593,10 @@ function processStudentList($filter_score, $global, $exercise, $courseInfo, $ses
$percentageScore = 0;
if ($weighting != 0) {
$percentageScore = round(($score*100)/$weighting);
$percentageScore = round(($score * 100) / $weighting);
}
if ($attempts['count'] > 0 ) {
if ($attempts['count'] > 0) {
$taken++;
}
@ -639,7 +639,7 @@ function processStudentList($filter_score, $global, $exercise, $courseInfo, $ses
} else {
$score = '-';
$userRow .= '<td>';
$userRow .= '-';
$userRow .= '-';
$tempArray[] = '-';
$userRow .= '</td>';
@ -693,13 +693,13 @@ function processStudentList($filter_score, $global, $exercise, $courseInfo, $ses
// Exam taken
$html .= '<td>';
$html .= $taken;
$globalRow[]= $taken;
$globalRow[] = $taken;
$html .= '</td>';
// Exam NOT taken
$html .= '<td>';
$html .= $not_taken = $totalStudents - $taken;
$globalRow[]= $not_taken;
$globalRow[] = $not_taken;
$html .= '</td>';
// Exam pass
@ -710,19 +710,19 @@ function processStudentList($filter_score, $global, $exercise, $courseInfo, $ses
}
$html .= $total_with_parameter_score;
$globalRow[]= $total_with_parameter_score;
$globalRow[] = $total_with_parameter_score;
$html .= '</td>';
// Exam fail
$html .= '<td>';
$html .= $fail = $taken - $total_with_parameter_score;
$globalRow[]= $fail;
$globalRow[] = $fail;
$html .= '</td>';
$html .= '<td>';
$html .= $totalStudents;
$globalRow[]= $totalStudents;
$globalRow[] = $totalStudents;
$html .= '</td>';

@ -22,9 +22,9 @@ SessionManager::protect_teacher_session_edit($id_session);
// setting breadcrumbs
if (api_is_platform_admin()) {
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session, "name" => get_lang('SessionOverview'));
}
$allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
$extra_field_list = [];
@ -39,7 +39,7 @@ if ($allowTutors == 'true') {
$tool_name = get_lang('SubscribeUsersToSession');
$add_type = 'unique';
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
@ -51,7 +51,7 @@ if ($allowTutors == 'true') {
if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
//if is enabled to filter and is a "<select>" field type
if ($extra_field[8]==1 && $extra_field[2]==4 ) {
if ($extra_field[8] == 1 && $extra_field[2] == 4) {
$new_field_list[] = array(
'name' => $extra_field[3],
'variable' => $extra_field[1],
@ -74,7 +74,7 @@ if ($allowTutors == 'true') {
if (!empty($needle) && !empty($type)) {
//normal behaviour
if ($type == 'any_session' && $needle == 'false') {
if ($type == 'any_session' && $needle == 'false') {
$type = 'multiple';
$needle = '';
}
@ -88,7 +88,7 @@ if ($allowTutors == 'true') {
$cond_user_id = '';
//Only for single & multiple
if (in_array($type, array('single','multiple'))) {
if (in_array($type, array('single', 'multiple'))) {
if (!empty($id_session)) {
$id_session = intval($id_session);
// check id_user from session_rel_user table
@ -98,11 +98,11 @@ if ($allowTutors == 'true') {
$user_ids = array();
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_row($res)) {
$user_ids[] = (int)$row[0];
$user_ids[] = (int) $row[0];
}
}
if (count($user_ids) > 0) {
$cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')';
$cond_user_id = ' AND user.user_id NOT IN('.implode(",", $user_ids).')';
}
}
}
@ -138,7 +138,7 @@ if ($allowTutors == 'true') {
break;
}
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
switch ($type) {
@ -183,11 +183,11 @@ if ($allowTutors == 'true') {
}
$rs = Database::query($sql);
$i=0;
$i = 0;
if ($type == 'single') {
while ($user = Database::fetch_array($rs)) {
$i++;
if ($i<=10) {
if ($i <= 10) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
} else {
@ -195,7 +195,7 @@ if ($allowTutors == 'true') {
}
}
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
$xajax_response -> addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return));
} else {
$return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
while ($user = Database :: fetch_array($rs)) {
@ -203,7 +203,7 @@ if ($allowTutors == 'true') {
$return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
$xajax_response -> addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
}
}
@ -260,7 +260,7 @@ if ($allowTutors == 'true') {
</script>';
$form_sent = 0;
$firstLetterUser = $firstLetterSession='';
$firstLetterUser = $firstLetterSession = '';
$UserList = $SessionList = array();
$sessions = array();
$noPHP_SELF = true;
@ -272,7 +272,7 @@ if ($allowTutors == 'true') {
$UserList = $_POST['sessionUsersList'];
if (!is_array($UserList)) {
$UserList=array();
$UserList = array();
}
if ($form_sent == 1) {
@ -302,7 +302,7 @@ if ($allowTutors == 'true') {
WHERE u.status <> ".DRH." AND u.status<>6 $order_clause";
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql = "SELECT u.user_id, lastname, firstname, username, session_id
@ -321,7 +321,7 @@ if ($allowTutors == 'true') {
$result = Database::query($sql);
$users = Database::store_result($result);
foreach ($users as $user) {
$sessionUsersList[$user['user_id']] = $user ;
$sessionUsersList[$user['user_id']] = $user;
}
unset($users); //clean to free memory
} else {
@ -333,7 +333,7 @@ if ($allowTutors == 'true') {
foreach ($new_field_list as $new_field) {
$varname = 'field_'.$new_field['variable'];
if (UserManager::is_extra_field_available($new_field['variable'])) {
if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
$use_extra_fields = true;
$extra_field_result[] = UserManager::get_extra_user_data_by_value(
$new_field['variable'],
@ -347,9 +347,9 @@ if ($allowTutors == 'true') {
if ($use_extra_fields) {
$final_result = array();
if (count($extra_field_result)>1) {
for($i=0;$i<count($extra_field_result)-1;$i++) {
if (is_array($extra_field_result[$i+1])) {
if (count($extra_field_result) > 1) {
for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
if (is_array($extra_field_result[$i + 1])) {
$final_result = array_intersect(
$extra_field_result[$i],
$extra_field_result[$i + 1]
@ -360,17 +360,17 @@ if ($allowTutors == 'true') {
$final_result = $extra_field_result[0];
}
$where_filter ='';
$where_filter = '';
if (api_is_multiple_url_enabled()) {
if (is_array($final_result) && count($final_result)>0) {
$where_filter = " AND u.user_id IN ('".implode("','",$final_result)."') ";
if (is_array($final_result) && count($final_result) > 0) {
$where_filter = " AND u.user_id IN ('".implode("','", $final_result)."') ";
} else {
//no results
$where_filter = " AND u.user_id = -1";
}
} else {
if (is_array($final_result) && count($final_result)>0) {
$where_filter = " WHERE u.user_id IN ('".implode("','",$final_result)."') ";
if (is_array($final_result) && count($final_result) > 0) {
$where_filter = " WHERE u.user_id IN ('".implode("','", $final_result)."') ";
} else {
//no results
$where_filter = " WHERE u.user_id = -1";
@ -399,7 +399,7 @@ if ($allowTutors == 'true') {
$order_clause";
}
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql = "SELECT u.user_id, lastname, firstname, username, session_id
@ -416,7 +416,7 @@ if ($allowTutors == 'true') {
}
$result = Database::query($sql);
$users = Database::store_result($result,'ASSOC');
$users = Database::store_result($result, 'ASSOC');
foreach ($users as $uid => $user) {
if ($user['session_id'] != $id_session) {
@ -441,7 +441,7 @@ if ($allowTutors == 'true') {
WHERE u.status <> ".DRH." AND u.status<>6 $order_clause";
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql = "SELECT u.user_id, lastname, firstname, username, session_id
@ -457,11 +457,11 @@ if ($allowTutors == 'true') {
}
}
$result = Database::query($sql);
$users = Database::store_result($result,'ASSOC');
$users = Database::store_result($result, 'ASSOC');
foreach ($users as $uid => $user) {
if ($user['session_id'] == $id_session) {
$sessionUsersList[$user['user_id']] = $user;
if (array_key_exists($user['user_id'],$nosessionUsersList)) {
if (array_key_exists($user['user_id'], $nosessionUsersList)) {
unset($nosessionUsersList[$user['user_id']]);
}
}
@ -483,20 +483,20 @@ if ($allowTutors == 'true') {
<div class="actions">
<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>&nbsp;|&nbsp;<?php echo $link_add_group; ?>
</div>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
<?php echo '<legend>'.$tool_name.' (' . $session->getName() . ') </legend>'; ?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
<?php echo '<legend>'.$tool_name.' ('.$session->getName().') </legend>'; ?>
<?php
if ($add_type === 'multiple') {
if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0 ) {
if (is_array($new_field_list) && count($new_field_list) > 0) {
echo '<h3>'.get_lang('FilterUsers').'</h3>';
foreach ($new_field_list as $new_field) {
echo $new_field['name'];
$varname = 'field_'.$new_field['variable'];
echo '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) {
$checked='';
foreach ($new_field['data'] as $option) {
$checked = '';
if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option[1]) {
$checked = 'selected="true"';
@ -544,7 +544,7 @@ if ($allowTutors == 'true') {
<?php
foreach ($nosessionUsersList as $uid => $enreg) {
?>
<option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option>
<option value="<?php echo $uid; ?>" <?php if (in_array($uid, $UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option>
<?php
}
?>
@ -596,7 +596,7 @@ if ($allowTutors == 'true') {
</div>
<select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" class="span5">
<?php
foreach($sessionUsersList as $enreg) {
foreach ($sessionUsersList as $enreg) {
?>
<option value="<?php echo $enreg['user_id']; ?>"><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
<?php

@ -9,7 +9,7 @@ use Chamilo\UserBundle\Entity\User;
$course_plugin = 'bbb'; //needed in order to load the plugin lang variables
$cidReset = true;
require_once __DIR__ . '/../../main/inc/global.inc.php';
require_once __DIR__.'/../../main/inc/global.inc.php';
api_protect_admin_script();
@ -51,7 +51,7 @@ foreach ($meetings as &$meeting) {
/** @var User $participant */
$participant = $meetingParticipant['participant'];
$meeting['participants'][] = $participant->getCompleteName()
. ' (' . $participant->getEmail() . ')';
. ' ('.$participant->getEmail().')';
}
}
@ -98,9 +98,9 @@ if (!$bbb->isServerRunning()) {
}
$htmlHeadXtra[] = api_get_js_simple(
api_get_path(WEB_PLUGIN_PATH) . 'bbb/resources/utils.js'
api_get_path(WEB_PLUGIN_PATH).'bbb/resources/utils.js'
);
$htmlHeadXtra[] = "<script>var _p = {web_plugin: '" . api_get_path(WEB_PLUGIN_PATH). "'}</script>";
$htmlHeadXtra[] = "<script>var _p = {web_plugin: '".api_get_path(WEB_PLUGIN_PATH)."'}</script>";
$tpl = new Template($tool_name);
$tpl->assign('meetings', $meetings);
@ -112,7 +112,7 @@ $actions = [];
if ($meetings) {
$actions[] = Display::toolbarButton(
get_lang('ExportInExcel'),
api_get_self() . '?' . http_build_query([
api_get_self().'?'.http_build_query([
'action' => 'export',
'search_meeting_start' => $dateStart,
'search_meeting_end' => $dateEnd

@ -1,5 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__ . '/../../main/inc/global.inc.php';
require_once __DIR__.'/../../main/inc/global.inc.php';
require_once __DIR__.'/CourseBlockPlugin.php';

@ -1191,7 +1191,7 @@ class Course
*/
public function hasPicture()
{
return file_exists(api_get_path(SYS_COURSE_PATH) . $this->directory . '/course-pic85x85.png');
return file_exists(api_get_path(SYS_COURSE_PATH).$this->directory.'/course-pic85x85.png');
}
/**
@ -1206,9 +1206,9 @@ class Course
}
if ($fullSize) {
return api_get_path(WEB_COURSE_PATH) . $this->directory . '/course-pic.png';
return api_get_path(WEB_COURSE_PATH).$this->directory.'/course-pic.png';
}
return api_get_path(WEB_COURSE_PATH) . $this->directory . '/course-pic85x85.png';
return api_get_path(WEB_COURSE_PATH).$this->directory.'/course-pic85x85.png';
}
}

Loading…
Cancel
Save