Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 9 years ago
parent d9edc1f9a3
commit d0b9df6c63
  1. 16
      main/admin/access_url_add_users_to_url.php
  2. 16
      main/admin/access_url_edit.php
  3. 36
      main/admin/add_sessions_to_usergroup.php
  4. 4
      main/admin/event_type.php
  5. 4
      main/admin/settings.php
  6. 4
      main/admin/statistics.php
  7. 12
      main/admin/teachers_time_by_session_report.php
  8. 2
      main/admin/update_schema.php
  9. 2
      main/auth/set_temp_password.php
  10. 4
      main/cron/document/index_all_docs.php
  11. 6
      main/document/exit_pixlr.php
  12. 42
      main/exercise/question_pool.php
  13. 28
      main/gradebook/lib/fe/resulttable.class.php
  14. 50
      main/gradebook/lib/fe/scoredisplayform.class.php
  15. 16
      main/gradebook/lib/fe/userform.class.php
  16. 22
      main/gradebook/lib/results_data_generator.class.php
  17. 36
      main/gradebook/lib/scoredisplay.class.php
  18. 6
      main/inc/lib/app_view.php
  19. 234
      main/inc/lib/message.lib.php
  20. 40
      main/reports/reports.php
  21. 192
      main/session/session_category_edit.php
  22. 14
      main/session/session_edit.php
  23. 6
      main/upload/form.document.php

@ -30,8 +30,8 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
/* Header */ /* Header */
$tool_name = get_lang('AddUsersToURL'); $tool_name = get_lang('AddUsersToURL');
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); $interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
Display :: display_header($tool_name); Display :: display_header($tool_name);
@ -46,8 +46,8 @@ api_display_tool_title($tool_name);
if ($_POST['form_sent']) { if ($_POST['form_sent']) {
$form_sent = $_POST['form_sent']; $form_sent = $_POST['form_sent'];
$users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ; $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array();
$url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
$first_letter_user = $_POST['first_letter_user']; $first_letter_user = $_POST['first_letter_user'];
foreach ($users as $key => $value) { foreach ($users as $key => $value) {
$users[$key] = intval($value); $users[$key] = intval($value);
@ -70,7 +70,7 @@ if (empty($first_letter_user)) {
$sql = "SELECT count(*) as nb_users FROM $tbl_user"; $sql = "SELECT count(*) as nb_users FROM $tbl_user";
$result = Database::query($sql); $result = Database::query($sql);
$num_row = Database::fetch_array($result); $num_row = Database::fetch_array($result);
if ($num_row['nb_users']>1000) { if ($num_row['nb_users'] > 1000) {
//if there are too much users to gracefully handle with the HTML select list, //if there are too much users to gracefully handle with the HTML select list,
// assign a default filter on users names // assign a default filter on users names
$first_letter_user = 'A'; $first_letter_user = 'A';
@ -101,7 +101,7 @@ unset($result);
<td width="40%" align="center"> <td width="40%" align="center">
<b><?php echo get_lang('UserList'); ?></b> <b><?php echo get_lang('UserList'); ?></b>
<br/><br/> <br/><br/>
<?php echo get_lang('Select').' ' ; echo $target_name == 'firstname'? get_lang('FirstName') : get_lang('LastName'); ?> <?php echo get_lang('Select').' '; echo $target_name == 'firstname' ? get_lang('FirstName') : get_lang('LastName'); ?>
<select name="first_letter_user" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"> <select name="first_letter_user" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();">
<option value="">--</option> <option value="">--</option>
<?php <?php
@ -120,7 +120,7 @@ unset($result);
<?php <?php
foreach ($db_users as $user) { foreach ($db_users as $user) {
?> ?>
<option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>> <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
<?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?> <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
</option> </option>
<?php <?php
@ -136,7 +136,7 @@ unset($result);
<?php <?php
foreach ($db_urls as $url_obj) { foreach ($db_urls as $url_obj) {
?> ?>
<option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>> <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>>
<?php echo $url_obj['url']; ?> <?php echo $url_obj['url']; ?>
</option> </option>
<?php <?php

@ -36,19 +36,19 @@ if ($form->validate()) {
if (substr($url, strlen($url) - 1, strlen($url)) == '/') { if (substr($url, strlen($url) - 1, strlen($url)) == '/') {
UrlManager::update($url_id, $url, $description, $active); UrlManager::update($url_id, $url, $description, $active);
} else { } else {
UrlManager::update($url_id, $url . '/', $description, $active); UrlManager::update($url_id, $url.'/', $description, $active);
} }
// URL Images // URL Images
$url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/'; $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
$image_fields = array("url_image_1", "url_image_2", "url_image_3"); $image_fields = array("url_image_1", "url_image_2", "url_image_3");
foreach ($image_fields as $image_field) { foreach ($image_fields as $image_field) {
if ($_FILES[$image_field]['error'] == 0) { if ($_FILES[$image_field]['error'] == 0) {
// Hardcoded: only PNG files allowed // Hardcoded: only PNG files allowed
$fileFields = explode('.', $_FILES[$image_field]['name']); $fileFields = explode('.', $_FILES[$image_field]['name']);
if (end($fileFields) == 'png') { if (end($fileFields) == 'png') {
if (file_exists($url_images_dir . $url_id . '_' . $image_field . '.png')) { if (file_exists($url_images_dir.$url_id.'_'.$image_field.'.png')) {
// if the file exists, we have to remove it before move_uploaded_file // if the file exists, we have to remove it before move_uploaded_file
unlink($url_images_dir . $url_id . '_' . $image_field . '.png'); unlink($url_images_dir.$url_id.'_'.$image_field.'.png');
} }
move_uploaded_file( move_uploaded_file(
$_FILES[$image_field]['tmp_name'], $_FILES[$image_field]['tmp_name'],
@ -69,7 +69,7 @@ if ($form->validate()) {
UrlManager::add($url, $description, $active); UrlManager::add($url, $description, $active);
} else { } else {
//create //create
UrlManager::add($url . '/', $description, $active); UrlManager::add($url.'/', $description, $active);
} }
$message = get_lang('URLAdded'); $message = get_lang('URLAdded');
$url_to_go = 'access_urls.php'; $url_to_go = 'access_urls.php';
@ -80,14 +80,14 @@ if ($form->validate()) {
// URL Images // URL Images
$url .= (substr($url, strlen($url) - 1, strlen($url)) == '/') ? '' : '/'; $url .= (substr($url, strlen($url) - 1, strlen($url)) == '/') ? '' : '/';
$url_id = UrlManager::get_url_id($url); $url_id = UrlManager::get_url_id($url);
$url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/'; $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
$image_fields = array("url_image_1", "url_image_2", "url_image_3"); $image_fields = array("url_image_1", "url_image_2", "url_image_3");
foreach ($image_fields as $image_field) { foreach ($image_fields as $image_field) {
if ($_FILES[$image_field]['error'] == 0) { if ($_FILES[$image_field]['error'] == 0) {
// Hardcoded: only PNG files allowed // Hardcoded: only PNG files allowed
$fileFields = explode('.', $_FILES[$image_field]['name']); $fileFields = explode('.', $_FILES[$image_field]['name']);
if (end($fileFields) == 'png') { if (end($fileFields) == 'png') {
move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png'); move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir.$url_id.'_'.$image_field.'.png');
} }
// else fail silently // else fail silently
} }
@ -97,7 +97,7 @@ if ($form->validate()) {
Security::clear_token(); Security::clear_token();
$tok = Security::get_token(); $tok = Security::get_token();
Display::addFlash(Display::return_message($message)); Display::addFlash(Display::return_message($message));
header('Location: ' . $url_to_go . '?sec_token=' . $tok); header('Location: '.$url_to_go.'?sec_token='.$tok);
exit(); exit();
} }
} else { } else {

@ -21,16 +21,16 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true); api_protect_admin_script(true);
// setting breadcrumbs // setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'usergroups.php','name' => get_lang('Classes')); $interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
// Database Table Definitions // Database Table Definitions
// setting the name of the tool // setting the name of the tool
$tool_name=get_lang('SubscribeClassToSessions'); $tool_name = get_lang('SubscribeClassToSessions');
$add_type = 'multiple'; $add_type = 'multiple';
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){ if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']); $add_type = Security::remove_XSS($_REQUEST['add_type']);
} }
@ -65,10 +65,10 @@ function remove_item(origin) {
function display_advanced_search () { function display_advanced_search () {
if ($("#advancedSearch").css("display") == "none") { if ($("#advancedSearch").css("display") == "none") {
$("#advancedSearch").css("display","block"); $("#advancedSearch").css("display","block");
$("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\'); $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
} else { } else {
$("#advancedSearch").css("display","none"); $("#advancedSearch").css("display","none");
$("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\'); $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
} }
} }
@ -82,7 +82,7 @@ function validate_filter() {
$form_sent = 0; $form_sent = 0;
$errorMsg = ''; $errorMsg = '';
$sessions=array(); $sessions = array();
$usergroup = new UserGroup(); $usergroup = new UserGroup();
$id = intval($_GET['id']); $id = intval($_GET['id']);
if (isset($_POST['form_sent']) && $_POST['form_sent']) { if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@ -117,7 +117,7 @@ $ajax_search = $add_type == 'unique' ? true : false;
//checking for extra field with filter on //checking for extra field with filter on
function search_usergroup_sessions($needle,$type) { function search_usergroup_sessions($needle, $type) {
global $elements_in; global $elements_in;
$xajax_response = new xajaxResponse(); $xajax_response = new xajaxResponse();
$return = ''; $return = '';
@ -155,24 +155,24 @@ Display::display_header($tool_name);
$add = (empty($_GET['add']) ? '' : Security::remove_XSS($_GET['add'])); $add = (empty($_GET['add']) ? '' : Security::remove_XSS($_GET['add']));
if ($add_type == 'multiple') { if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="' . api_get_self() . '?add=' . $add . '&add_type=unique">'. $link_add_type_unique = '<a href="'.api_get_self().'?add='.$add.'&add_type=unique">'.
Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
} else { } else {
$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
$link_add_type_multiple = '<a href="' . api_get_self() . '?add=' . $add . '&add_type=multiple">'. $link_add_type_multiple = '<a href="'.api_get_self().'?add='.$add.'&add_type=multiple">'.
Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
} }
echo '<div class="actions">'; echo '<div class="actions">';
echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; echo '<a href="usergroups.php">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="javascript://" class="advanced_parameters" style="margin-top: 8px" onclick="display_advanced_search();"><span id="img_plus_and_minus">&nbsp;'. echo '<a href="javascript://" class="advanced_parameters" style="margin-top: 8px" onclick="display_advanced_search();"><span id="img_plus_and_minus">&nbsp;'.
Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>'; Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>';
echo '</div>'; echo '</div>';
echo '<div id="advancedSearch" style="display: none">'. get_lang('SearchSessions'); ?> : echo '<div id="advancedSearch" style="display: none">'.get_lang('SearchSessions'); ?> :
<input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()"> <input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()">
</div> </div>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
<?php <?php
echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
echo Display::input('hidden', 'id', $id); echo Display::input('hidden', 'id', $id);
@ -191,7 +191,7 @@ if (!empty($errorMsg)) {
<td align="center"><b><?php echo get_lang('SessionsInGroup') ?> :</b></td> <td align="center"><b><?php echo get_lang('SessionsInGroup') ?> :</b></td>
</tr> </tr>
<?php if ($add_type=='multiple') { ?> <?php if ($add_type == 'multiple') { ?>
<tr> <tr>
<td align="center"> <td align="center">
<?php echo get_lang('FirstLetterSessions'); ?> : <?php echo get_lang('FirstLetterSessions'); ?> :
@ -210,7 +210,7 @@ if (!empty($errorMsg)) {
<td align="center"> <td align="center">
<div id="content_source"> <div id="content_source">
<?php <?php
if (!($add_type=='multiple')) { if (!($add_type == 'multiple')) {
?> ?>
<input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
<div id="ajax_list_users_single"></div> <div id="ajax_list_users_single"></div>
@ -218,7 +218,7 @@ if (!empty($errorMsg)) {
} else { } else {
?> ?>
<div id="ajax_list_multiple"> <div id="ajax_list_multiple">
<?php echo Display::select('elements_not_in_name',$elements_not_in, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?> <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'), false); ?>
</div> </div>
<?php <?php
} }
@ -249,7 +249,7 @@ if (!empty($errorMsg)) {
</td> </td>
<td align="center"> <td align="center">
<?php <?php
echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'),false ); echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'), false);
unset($sessionUsersList); unset($sessionUsersList);
?> ?>
</td> </td>

@ -48,7 +48,7 @@ if ($action == 'modEventType') {
$ets = Event::get_all_event_types(); $ets = Event::get_all_event_types();
$languages = api_get_languages(); $languages = api_get_languages();
$ajaxPath = api_get_path(WEB_CODE_PATH) . 'inc/ajax/events.ajax.php'; $ajaxPath = api_get_path(WEB_CODE_PATH).'inc/ajax/events.ajax.php';
$action_array = array( $action_array = array(
array( array(
@ -324,7 +324,7 @@ echo Display::actions($action_array);
<select class="col-md-6" multiple="1" id="eventList" onchange="confirmMessage(this.name); return false;" name="eventList"> <select class="col-md-6" multiple="1" id="eventList" onchange="confirmMessage(this.name); return false;" name="eventList">
<?php <?php
foreach ($event_config as $key => $config) { foreach ($event_config as $key => $config) {
echo '<option value="' . $key . '">' . $config['name_lang_var'] . '</option>'; echo '<option value="'.$key.'">'.$config['name_lang_var'].'</option>';
} }
?> ?>
</select> </select>

@ -67,7 +67,7 @@ if (isset($_GET['delete_watermark'])) {
Display::addFlash(Display::return_message(get_lang('FileDeleted'))); Display::addFlash(Display::return_message(get_lang('FileDeleted')));
} }
if (isset($_GET['action']) && $_GET['action'] == 'delete_grading') { if (isset($_GET['action']) && $_GET['action'] == 'delete_grading') {
$id = intval($_GET['id']); $id = intval($_GET['id']);
api_delete_setting_option($id); api_delete_setting_option($id);
} }
@ -233,7 +233,7 @@ if (!empty($_GET['category']) &&
// Set true for allow_message_tool variable if social tool is actived // Set true for allow_message_tool variable if social tool is actived
foreach ($convert_byte_to_mega_list as $item) { foreach ($convert_byte_to_mega_list as $item) {
if (isset($values[$item])) { if (isset($values[$item])) {
$values[$item] = round($values[$item]*1024*1024); $values[$item] = round($values[$item] * 1024 * 1024);
} }
} }

@ -5,13 +5,13 @@
* @package chamilo.admin * @package chamilo.admin
*/ */
$cidReset=true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(); api_protect_admin_script();
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('Statistics'); $tool_name = get_lang('Statistics');
Display::display_header($tool_name); Display::display_header($tool_name);
Display::display_footer(); Display::display_footer();

@ -13,7 +13,7 @@ use Chamilo\CourseBundle\Entity\Repository\CStudentPublicationRepository;
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php'; require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
if (!api_is_platform_admin(true) && !api_is_teacher()) { if (!api_is_platform_admin(true) && !api_is_teacher()) {
api_not_allowed(true); api_not_allowed(true);
@ -53,7 +53,7 @@ if ($session) {
foreach ($sessionCourses as $sessionCourse) { foreach ($sessionCourses as $sessionCourse) {
$course = $sessionCourse->getCourse(); $course = $sessionCourse->getCourse();
$coursesInfo[$course->getId()] = $course->getCode(); $coursesInfo[$course->getId()] = $course->getCode();
$criteria = Criteria::create()->where( $criteria = Criteria::create()->where(
Criteria::expr()->eq('status', Session::COACH) Criteria::expr()->eq('status', Session::COACH)
); );
@ -167,9 +167,9 @@ if (isset($_GET['export']) && $session && ($coursesInfo && $usersInfo)) {
} }
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH) . 'mySpace/', 'name' => get_lang('Reporting')]; $interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'mySpace/', 'name' => get_lang('Reporting')];
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH) . 'mySpace/session.php', 'url' => api_get_path(WEB_CODE_PATH).'mySpace/session.php',
'name' => get_lang('FollowedSessions') 'name' => get_lang('FollowedSessions')
]; ];
@ -183,11 +183,11 @@ if ($session) {
$actions = Display::url( $actions = Display::url(
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM), Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM),
api_get_self() . '?' . http_build_query(['export' => 'csv', 'session' => $session->getId()]) api_get_self().'?'.http_build_query(['export' => 'csv', 'session' => $session->getId()])
); );
$actions .= Display::url( $actions .= Display::url(
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM), Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM),
api_get_self() . '?' . http_build_query(['export' => 'xls', 'session' => $session->getId()]) api_get_self().'?'.http_build_query(['export' => 'xls', 'session' => $session->getId()])
); );
$view->assign( $view->assign(

@ -60,5 +60,5 @@ if (!empty($sqlList)) {
} }
Display::display_header(get_lang('SyncDatabaseWithSchema')); Display::display_header(get_lang('SyncDatabaseWithSchema'));
echo $content ; echo $content;
Display::display_footer(); Display::display_footer();

@ -12,7 +12,7 @@ use ChamiloSession as Session;
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null; $course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null; $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
$user_id = api_get_user_id(); $user_id = api_get_user_id();

@ -33,7 +33,7 @@ $allowed_extensions = array(
'html', 'html',
'htm', 'htm',
); );
$courses_list = CourseManager::get_courses_list(); $courses_list = CourseManager::get_courses_list();
// Simulating empty specific fields (this is necessary for indexing) // Simulating empty specific fields (this is necessary for indexing)
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@ -49,7 +49,7 @@ foreach ($courses_list as $course) {
$title = Database::escape_string($_GET['doc']); $title = Database::escape_string($_GET['doc']);
$sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'"; $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'";
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res)>0) { if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_array($res)) { while ($row = Database::fetch_array($res)) {
$doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path']; $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
$extensions = preg_split("/[\/\\.]/", $doc_path); $extensions = preg_split("/[\/\\.]/", $doc_path);

@ -23,13 +23,13 @@ unset($_SESSION['paint_file']);
unset($_SESSION['whereami']); unset($_SESSION['whereami']);
unset($_SESSION['temp_realpath_image']); unset($_SESSION['temp_realpath_image']);
if (!isset($_SESSION['exit_pixlr'])){ if (!isset($_SESSION['exit_pixlr'])) {
$location=api_get_path(WEB_CODE_PATH).'document/document.php'; $location = api_get_path(WEB_CODE_PATH).'document/document.php';
echo '<script>window.parent.location.href="'.$location.'"</script>'; echo '<script>window.parent.location.href="'.$location.'"</script>';
api_not_allowed(true); api_not_allowed(true);
} else { } else {
echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>'; echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>';
$location=api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']); $location = api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
echo '<script>window.parent.location.href="'.$location.'"</script>'; echo '<script>window.parent.location.href="'.$location.'"</script>';
unset($_SESSION['exit_pixlr']); unset($_SESSION['exit_pixlr']);
} }

@ -48,7 +48,7 @@ if (empty($objExercise) && !empty($fromExercise)) {
} }
$nameTools = get_lang('QuestionPool'); $nameTools = get_lang('QuestionPool');
$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
if (!empty($objExercise)) { if (!empty($objExercise)) {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
@ -73,7 +73,7 @@ if ($is_allowedToEdit) {
if ($old_question_obj) { if ($old_question_obj) {
$old_question_obj->updateTitle( $old_question_obj->updateTitle(
$old_question_obj->selectTitle() . ' - ' . get_lang('Copy') $old_question_obj->selectTitle().' - '.get_lang('Copy')
); );
//Duplicating the source question, in the current course //Duplicating the source question, in the current course
$new_id = $old_question_obj->duplicate($current_course); $new_id = $old_question_obj->duplicate($current_course);
@ -107,7 +107,7 @@ if ($is_allowedToEdit) {
} }
// destruction of the Question object // destruction of the Question object
unset($objQuestionTmp); unset($objQuestionTmp);
} elseif($recup && $fromExercise) { } elseif ($recup && $fromExercise) {
// gets an existing question and copies it into a new exercise // gets an existing question and copies it into a new exercise
$objQuestionTmp = Question :: read($recup); $objQuestionTmp = Question :: read($recup);
// if the question exists // if the question exists
@ -139,7 +139,7 @@ if ($is_allowedToEdit) {
$old_question_obj = Question::read($old_question_id, $origin_course_id); $old_question_obj = Question::read($old_question_id, $origin_course_id);
if ($old_question_obj) { if ($old_question_obj) {
$old_question_obj->updateTitle( $old_question_obj->updateTitle(
$old_question_obj->selectTitle() . ' - ' . get_lang('Copy') $old_question_obj->selectTitle().' - '.get_lang('Copy')
); );
//Duplicating the source question, in the current course //Duplicating the source question, in the current course
@ -167,16 +167,16 @@ if ($is_allowedToEdit) {
} }
} }
} }
Session::write('objExercise',$objExercise); Session::write('objExercise', $objExercise);
} }
} }
if (isset($_SESSION['gradebook'])){ if (isset($_SESSION['gradebook'])) {
$gradebook= $_SESSION['gradebook']; $gradebook = $_SESSION['gradebook'];
} }
if (!empty($gradebook) && $gradebook=='view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook')); $interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook'));
} }
// if admin of course // if admin of course
@ -216,11 +216,11 @@ if (isset($type)) {
} }
if (isset($fromExercise) && $fromExercise > 0) { if (isset($fromExercise) && $fromExercise > 0) {
echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$fromExercise.'">'. echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$fromExercise.'">'.
Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
$titleAdd = get_lang('AddQuestionToTest'); $titleAdd = get_lang('AddQuestionToTest');
} else { } else {
echo '<a href="exercise.php?'.api_get_cidreq().'">'. echo '<a href="exercise.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
echo "<a href='admin.php?exerciseId=0'>".Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM)."</a>"; echo "<a href='admin.php?exerciseId=0'>".Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM)."</a>";
$titleAdd = get_lang('ManageAllQuestions'); $titleAdd = get_lang('ManageAllQuestions');
} }
@ -249,7 +249,7 @@ $session_select_list = array();
foreach ($sessionList as $item) { foreach ($sessionList as $item) {
$session_select_list[$item['session_id']] = $item['session_name']; $session_select_list[$item['session_id']] = $item['session_name'];
} }
$select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam); $select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
echo Display::form_row($labelFormRow, $select_session_html); echo Display::form_row($labelFormRow, $select_session_html);
// Course list, get course list of session, or for course where user is admin // Course list, get course list of session, or for course where user is admin
@ -290,7 +290,7 @@ foreach ($course_list as $item) {
$course_select_list[$courseItemId] .= $courseInfo['title']; $course_select_list[$courseItemId] .= $courseInfo['title'];
} }
$select_course_html = Display::select( $select_course_html = Display::select(
'selected_course', 'selected_course',
$course_select_list, $course_select_list,
$selected_course, $selected_course,
@ -346,9 +346,9 @@ $my_exercise_list = array();
$my_exercise_list['0'] = get_lang('AllExercises'); $my_exercise_list['0'] = get_lang('AllExercises');
$my_exercise_list['-1'] = get_lang('OrphanQuestions'); $my_exercise_list['-1'] = get_lang('OrphanQuestions');
if (is_array($exercise_list)) { if (is_array($exercise_list)) {
foreach($exercise_list as $row) { foreach ($exercise_list as $row) {
$my_exercise_list[$row['id']] = ""; $my_exercise_list[$row['id']] = "";
if ($row['id'] == $fromExercise && $selected_course == api_get_course_int_id()) { if ($row['id'] == $fromExercise && $selected_course == api_get_course_int_id()) {
$my_exercise_list[$row['id']] = ">&nbsp;&nbsp;&nbsp;&nbsp;"; $my_exercise_list[$row['id']] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
} }
$my_exercise_list[$row['id']] .= $row['title']; $my_exercise_list[$row['id']] .= $row['title'];
@ -358,7 +358,7 @@ if (is_array($exercise_list)) {
if ($exercise_id_changed == 1) { if ($exercise_id_changed == 1) {
reset_menu_lvl_type(); reset_menu_lvl_type();
} }
$select_exercise_html = Display::select( $select_exercise_html = Display::select(
'exerciseId', 'exerciseId',
$my_exercise_list, $my_exercise_list,
$exerciseId, $exerciseId,
@ -391,7 +391,7 @@ echo Display::form_row(get_lang('Difficulty'), $select_difficulty_html);
$question_list = Question::get_question_type_list(); $question_list = Question::get_question_type_list();
$new_question_list = array(); $new_question_list = array();
$new_question_list['-1'] = get_lang('All'); $new_question_list['-1'] = get_lang('All');
if (!empty($_course)) { if (!empty($_course)) {
$objExercise = new Exercise(); $objExercise = new Exercise();
$objExercise->read($fromExercise); $objExercise->read($fromExercise);
@ -464,7 +464,7 @@ if ($exerciseId > 0) {
ORDER BY question_order"; ORDER BY question_order";
$result = Database::query($sql); $result = Database::query($sql);
while($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
$mainQuestionList[] = $row; $mainQuestionList[] = $row;
} }
} elseif ($exerciseId == -1) { } elseif ($exerciseId == -1) {
@ -477,11 +477,11 @@ if ($exerciseId > 0) {
crc.c_id = $selected_course AND crc.c_id = $selected_course AND
crc.category_id = $courseCategoryId"; crc.category_id = $courseCategoryId";
} }
if (isset($exerciseLevel) && $exerciseLevel!= -1 ) { if (isset($exerciseLevel) && $exerciseLevel != -1) {
$level_where = ' AND level='.$exerciseLevel; $level_where = ' AND level='.$exerciseLevel;
} }
$answer_where = ''; $answer_where = '';
if (isset($answerType) && $answerType >0 -1 ) { if (isset($answerType) && $answerType > 0 - 1) {
$answer_where = ' AND type='.$answerType; $answer_where = ' AND type='.$answerType;
} }
@ -521,7 +521,7 @@ if ($exerciseId > 0) {
$level_where $answer_where $level_where $answer_where
)"; )";
$result = Database::query($sql); $result = Database::query($sql);
while($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
$mainQuestionList[] = $row; $mainQuestionList[] = $row;
} }
} else { } else {

@ -18,7 +18,7 @@ class ResultTable extends SortableTable
/** /**
* Constructor * Constructor
*/ */
public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false) public function __construct($evaluation, $results = array(), $iscourse, $addparams = null, $forprint = false)
{ {
parent:: __construct( parent:: __construct(
'resultlist', 'resultlist',
@ -37,10 +37,10 @@ class ResultTable extends SortableTable
$this->set_additional_parameters($addparams); $this->set_additional_parameters($addparams);
} }
$scoredisplay = ScoreDisplay::instance(); $scoredisplay = ScoreDisplay::instance();
$column= 0; $column = 0;
if ($this->iscourse == '1') { if ($this->iscourse == '1') {
$this->set_header($column++, '', false); $this->set_header($column++, '', false);
$this->set_form_actions(array ( $this->set_form_actions(array(
'delete' => get_lang('Delete') 'delete' => get_lang('Delete')
)); ));
} }
@ -63,7 +63,7 @@ class ResultTable extends SortableTable
/** /**
* Function used by SortableTable to get total number of items in the table * Function used by SortableTable to get total number of items in the table
*/ */
public function get_total_number_of_items () public function get_total_number_of_items()
{ {
return $this->datagen->get_total_results_count(); return $this->datagen->get_total_results_count();
} }
@ -116,7 +116,7 @@ class ResultTable extends SortableTable
// generate the data to display // generate the data to display
$sortable_data = array(); $sortable_data = array();
foreach ($data_array as $item) { foreach ($data_array as $item) {
$row = array (); $row = array();
if ($this->iscourse == '1') { if ($this->iscourse == '1') {
$row[] = $item['result_id']; $row[] = $item['result_id'];
} }
@ -128,13 +128,13 @@ class ResultTable extends SortableTable
$row[] = $item['firstname']; $row[] = $item['firstname'];
} }
$row[] = Display::bar_progress($item['percentage_score'], false, $item['score']); $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']);
//$row[] = Display::bar_progress($item['percentage_score'], true); //$row[] = Display::bar_progress($item['percentage_score'], true);
if ($scoredisplay->is_custom()) { if ($scoredisplay->is_custom()) {
$row[] = $item['display']; $row[] = $item['display'];
} }
if (!$this->forprint) { if (!$this->forprint) {
$row[] = $this->build_edit_column ($item); $row[] = $this->build_edit_column($item);
} }
$sortable_data[] = $row; $sortable_data[] = $row;
} }
@ -147,17 +147,17 @@ class ResultTable extends SortableTable
$locked_status = $this->evaluation->get_locked(); $locked_status = $this->evaluation->get_locked();
if (api_is_allowed_to_edit(null, true) && $locked_status == 0) { if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
//api_is_course_admin() //api_is_course_admin()
$edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. $edit_column = '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>'; Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>';
$edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. $edit_column .= ' <a href="'.api_get_self().'?delete_mark='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>'; Display::return_icon('delete.png', get_lang('Delete'), '', '22').'</a>';
} }
if ($this->evaluation->get_course_code() == null) { if ($this->evaluation->get_course_code() == null) {
$edit_column .= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">'; $edit_column .= '&nbsp;<a href="'.api_get_self().'?resultdelete='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'" onclick="return confirmationuser();">';
$edit_column .= Display::return_icon('delete.png', get_lang('Delete')); $edit_column .= Display::return_icon('delete.png', get_lang('Delete'));
$edit_column .= '</a>'; $edit_column .= '</a>';
$edit_column .= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">'; $edit_column .= '&nbsp;<a href="user_stats.php?userid='.$item['id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">';
$edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics')); $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics'));
$edit_column .= '</a>'; $edit_column .= '</a>';
} }
@ -168,7 +168,7 @@ class ResultTable extends SortableTable
$doc_url = $link->get_view_url($item['id']); $doc_url = $link->get_view_url($item['id']);
if ($doc_url != null) { if ($doc_url != null) {
$edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">'; $edit_column .= '&nbsp;<a href="'.$doc_url.'" target="_blank">';
$edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>'; $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>';
} }
} }

@ -14,28 +14,28 @@ class ScoreDisplayForm extends FormValidator
* @param $form_name * @param $form_name
* @param null $action * @param null $action
*/ */
public function __construct($form_name, $action= null) public function __construct($form_name, $action = null)
{ {
parent::__construct($form_name, 'post', $action); parent::__construct($form_name, 'post', $action);
$displayscore = ScoreDisplay::instance(); $displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings(); $customdisplays = $displayscore->get_custom_score_display_settings();
$nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1'; $nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
$this->setDefaults(array ( $this->setDefaults(array(
'scorecolpercent' => $displayscore->get_color_split_value() 'scorecolpercent' => $displayscore->get_color_split_value()
)); ));
$this->addElement('hidden', 'maxvalue', '100'); $this->addElement('hidden', 'maxvalue', '100');
$this->addElement('hidden', 'minvalue', '0'); $this->addElement('hidden', 'minvalue', '0');
$counter= 1; $counter = 1;
//setting the default values //setting the default values
if (is_array($customdisplays)) { if (is_array($customdisplays)) {
foreach ($customdisplays as $customdisplay) { foreach ($customdisplays as $customdisplay) {
$this->setDefaults(array ( $this->setDefaults(array(
'endscore[' . $counter . ']' => $customdisplay['score'], 'endscore['.$counter.']' => $customdisplay['score'],
'displaytext[' . $counter . ']' => $customdisplay['display'] 'displaytext['.$counter.']' => $customdisplay['display']
)); ));
$counter++; $counter++;
} }
@ -46,7 +46,7 @@ class ScoreDisplayForm extends FormValidator
$this->addElement('header', get_lang('ScoreEdit')); $this->addElement('header', get_lang('ScoreEdit'));
if ($displayscore->is_coloring_enabled()) { if ($displayscore->is_coloring_enabled()) {
$this->addElement('html', '<b>'.get_lang('ScoreColor') . '</b>'); $this->addElement('html', '<b>'.get_lang('ScoreColor').'</b>');
$this->addElement( $this->addElement(
'text', 'text',
'scorecolpercent', 'scorecolpercent',
@ -63,14 +63,14 @@ class ScoreDisplayForm extends FormValidator
} }
$this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric'); $this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array('scorecolpercent','maxvalue'), get_lang('Over100'), 'compare', '<='); $this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array('scorecolpercent','minvalue'), get_lang('UnderMin'), 'compare', '>'); $this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
} }
//Settings for the scoring system //Settings for the scoring system
if ($displayscore->is_custom()) { if ($displayscore->is_custom()) {
$this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>'); $this->addElement('html', '<br /><b>'.get_lang('ScoringSystem').'</b>');
$this->addElement('static', null, null, get_lang('ScoreInfo')); $this->addElement('static', null, null, get_lang('ScoreInfo'));
$this->setDefaults(array( $this->setDefaults(array(
'beginscore' => '0' 'beginscore' => '0'
@ -82,10 +82,10 @@ class ScoreDisplayForm extends FormValidator
'input-size' => 2 'input-size' => 2
)); ));
for ($counter= 1; $counter <= 20; $counter++) { for ($counter = 1; $counter <= 20; $counter++) {
$renderer =& $this->defaultRenderer(); $renderer = & $this->defaultRenderer();
$elementTemplateTwoLabel = $elementTemplateTwoLabel =
'<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';"> '<div id='.$counter.' style="display: '.(($counter <= $nr_items) ? 'inline' : 'none').';">
<!-- BEGIN required --><span class="form_required">*</span> <!-- END required --> <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
@ -110,23 +110,23 @@ class ScoreDisplayForm extends FormValidator
'; ';
$elementTemplateTwoLabel2 =' $elementTemplateTwoLabel2 = '
<div class="col-sm-2"> <div class="col-sm-2">
<!-- BEGIN error --><span class="form_error">{error}</span> <!-- BEGIN error --><span class="form_error">{error}</span>
<!-- END error --> <!-- END error -->
{element} {element}
</div> </div>
<div class="col-sm-1"> <div class="col-sm-1">
<a href="javascript:plusItem(' . ($counter+1) . ')"> <a href="javascript:plusItem(' . ($counter + 1).')">
<img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a> <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="plus-'.($counter + 1).'" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a>
<a href="javascript:minItem(' . ($counter) . ')"> <a href="javascript:minItem(' . ($counter).')">
<img style="display: '.(($counter>=$nr_items && $counter!=1)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a> <img style="display: '.(($counter >= $nr_items && $counter != 1) ? 'inline' : 'none').';" id="min-'.$counter.'" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a>
</div> </div>
</div> </div>
</div>'; </div>';
$scorebetw = array(); $scorebetw = array();
$this->addElement('text', 'endscore[' . $counter . ']', null, array ( $this->addElement('text', 'endscore['.$counter.']', null, array(
'size' => 5, 'size' => 5,
'maxlength' => 5, 'maxlength' => 5,
'id' => 'txta-'.$counter, 'id' => 'txta-'.$counter,
@ -143,11 +143,11 @@ class ScoreDisplayForm extends FormValidator
'id' => 'txtb-'.$counter, 'id' => 'txtb-'.$counter,
) )
); );
$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']'); $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore['.$counter.']');
$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']'); $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext['.$counter.']');
$this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric'); $this->addRule('endscore['.$counter.']', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<='); $this->addRule(array('endscore['.$counter.']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>'); $this->addRule(array('endscore['.$counter.']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
} }
} }

@ -9,7 +9,7 @@
*/ */
class UserForm extends FormValidator class UserForm extends FormValidator
{ {
const TYPE_USER_INFO= 1; const TYPE_USER_INFO = 1;
const TYPE_SIMPLE_SEARCH = 3; const TYPE_SIMPLE_SEARCH = 3;
/** /**
@ -20,15 +20,15 @@ class UserForm extends FormValidator
* @param method * @param method
* @param action * @param action
*/ */
public function __construct($form_type, $user, $form_name, $method= 'post', $action= null) public function __construct($form_type, $user, $form_name, $method = 'post', $action = null)
{ {
parent::__construct($form_name, $method, $action); parent::__construct($form_name, $method, $action);
$this->form_type= $form_type; $this->form_type = $form_type;
if (isset ($user)) { if (isset ($user)) {
$this->user_info= $user; $this->user_info = $user;
} }
if (isset ($result_object)) { if (isset ($result_object)) {
$this->result_object= $result_object; $this->result_object = $result_object;
} }
if ($this->form_type == self::TYPE_USER_INFO) { if ($this->form_type == self::TYPE_USER_INFO) {
$this->build_user_info_form(); $this->build_user_info_form();
@ -46,7 +46,7 @@ class UserForm extends FormValidator
'keyword' => Security::remove_XSS($_GET['search']) 'keyword' => Security::remove_XSS($_GET['search'])
)); ));
} }
$renderer =& $this->defaultRenderer(); $renderer = & $this->defaultRenderer();
$renderer->setCustomElementTemplate('<span>{element}</span> '); $renderer->setCustomElementTemplate('<span>{element}</span> ');
$this->addElement('text', 'keyword', ''); $this->addElement('text', 'keyword', '');
$this->addButtonSearch(get_lang('Search'), 'submit'); $this->addButtonSearch(get_lang('Search'), 'submit');
@ -62,7 +62,7 @@ class UserForm extends FormValidator
$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']); $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
} }
$this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']); $this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>'); $this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:'.$this->user_info['email'].'">'.$this->user_info['email'].'</a>');
$this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']); $this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
$this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']); $this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
$this->addButtonSave(get_lang('Back'), 'submit'); $this->addButtonSave(get_lang('Back'), 'submit');
@ -73,7 +73,7 @@ class UserForm extends FormValidator
parent::display(); parent::display();
} }
function setDefaults($defaults= array(), $filter = null) function setDefaults($defaults = array(), $filter = null)
{ {
parent::setDefaults($defaults, $filter); parent::setDefaults($defaults, $filter);
} }

@ -38,7 +38,7 @@ class ResultsDataGenerator
/** /**
* Get total number of results (rows) * Get total number of results (rows)
*/ */
public function get_total_results_count () public function get_total_results_count()
{ {
return count($this->results); return count($this->results);
} }
@ -54,12 +54,12 @@ class ResultsDataGenerator
* 4 ['score'] : student's score * 4 ['score'] : student's score
* 5 ['display'] : custom score display (only if custom scoring enabled) * 5 ['display'] : custom score display (only if custom scoring enabled)
*/ */
public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf=false) public function get_data($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf = false)
{ {
// do some checks on count, redefine if invalid value // do some checks on count, redefine if invalid value
$number_decimals = api_get_setting('gradebook_number_decimals'); $number_decimals = api_get_setting('gradebook_number_decimals');
if (!isset($count)) { if (!isset($count)) {
$count = count ($this->results) - $start; $count = count($this->results) - $start;
} }
if ($count < 0) { if ($count < 0) {
$count = 0; $count = 0;
@ -67,11 +67,11 @@ class ResultsDataGenerator
$scoredisplay = ScoreDisplay::instance(); $scoredisplay = ScoreDisplay::instance();
// generate actual data array // generate actual data array
$table = array(); $table = array();
foreach($this->results as $result) { foreach ($this->results as $result) {
$user = array(); $user = array();
$info = api_get_user_info($result->get_user_id()); $info = api_get_user_info($result->get_user_id());
$user['id'] = $result->get_user_id(); $user['id'] = $result->get_user_id();
if ($pdf){ if ($pdf) {
$user['username'] = $info['username']; $user['username'] = $info['username'];
} }
$user['result_id'] = $result->get_id(); $user['result_id'] = $result->get_id();
@ -93,7 +93,7 @@ class ResultsDataGenerator
true true
) )
); );
if ($pdf && $number_decimals == null){ if ($pdf && $number_decimals == null) {
$user['scoreletter'] = $result->get_score(); $user['scoreletter'] = $result->get_score();
} }
if ($scoredisplay->is_custom()) { if ($scoredisplay->is_custom()) {
@ -134,13 +134,13 @@ class ResultsDataGenerator
* @param boolean $realscore * @param boolean $realscore
* @result string The score as we want to show it * @result string The score as we want to show it
*/ */
private function get_score_display ($score, $realscore, $ignore_score_color = false) private function get_score_display($score, $realscore, $ignore_score_color = false)
{ {
if ($score != null) { if ($score != null) {
$scoredisplay = ScoreDisplay::instance(); $scoredisplay = ScoreDisplay::instance();
$type = SCORE_CUSTOM; $type = SCORE_CUSTOM;
if ($realscore === true) { if ($realscore === true) {
$type = SCORE_DIV_PERCENT ; $type = SCORE_DIV_PERCENT;
} }
return $scoredisplay->display_score( return $scoredisplay->display_score(
@ -174,10 +174,10 @@ class ResultsDataGenerator
} }
} }
function sort_by_mask ($item1, $item2) function sort_by_mask($item1, $item2)
{ {
$score1 = (isset($item1['score']) ? array($item1['score'],$this->evaluation->get_max()) : null); $score1 = (isset($item1['score']) ? array($item1['score'], $this->evaluation->get_max()) : null);
$score2 = (isset($item2['score']) ? array($item2['score'],$this->evaluation->get_max()) : null); $score2 = (isset($item2['score']) ? array($item2['score'], $this->evaluation->get_max()) : null);
return ScoreDisplay::compare_scores_by_custom_display($score1, $score2); return ScoreDisplay::compare_scores_by_custom_display($score1, $score2);
} }
} }

@ -34,7 +34,7 @@ class ScoreDisplay
/** /**
* Compare the custom display of 2 scores, can be useful in sorting * Compare the custom display of 2 scores, can be useful in sorting
*/ */
public static function compare_scores_by_custom_display ($score1, $score2) public static function compare_scores_by_custom_display($score1, $score2)
{ {
if (!isset($score1)) { if (!isset($score1)) {
return (isset($score2) ? 1 : 0); return (isset($score2) ? 1 : 0);
@ -47,7 +47,7 @@ class ScoreDisplay
if ($custom1 == $custom2) { if ($custom1 == $custom2) {
return 0; return 0;
} else { } else {
return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1); return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1);
} }
} }
} }
@ -78,7 +78,7 @@ class ScoreDisplay
//Setting custom enabled //Setting custom enabled
$value = api_get_setting('gradebook_score_display_custom'); $value = api_get_setting('gradebook_score_display_custom');
$value = $value['my_display_custom']; $value = $value['my_display_custom'];
$this->custom_enabled = $value == 'true' ? true : false; $this->custom_enabled = $value == 'true' ? true : false;
if ($this->custom_enabled) { if ($this->custom_enabled) {
$params = array('category = ?' => array('Gradebook')); $params = array('category = ?' => array('Gradebook'));
@ -95,10 +95,10 @@ class ScoreDisplay
sort($portal_displays); sort($portal_displays);
} }
$this->custom_display = $portal_displays; $this->custom_display = $portal_displays;
if (count($this->custom_display)>0) { if (count($this->custom_display) > 0) {
$value = api_get_setting('gradebook_score_display_upperlimit'); $value = api_get_setting('gradebook_score_display_upperlimit');
$value = $value['my_display_upperlimit']; $value = $value['my_display_upperlimit'];
$this->upperlimit_included = $value == 'true' ? true : false; $this->upperlimit_included = $value == 'true' ? true : false;
$this->custom_display_conv = $this->convert_displays($this->custom_display); $this->custom_display_conv = $this->convert_displays($this->custom_display);
} }
} }
@ -109,7 +109,7 @@ class ScoreDisplay
//Load course settings //Load course settings
if ($this->custom_enabled) { if ($this->custom_enabled) {
$this->custom_display = $this->get_custom_displays(); $this->custom_display = $this->get_custom_displays();
if (count($this->custom_display)> 0) { if (count($this->custom_display) > 0) {
$this->custom_display_conv = $this->convert_displays($this->custom_display); $this->custom_display_conv = $this->convert_displays($this->custom_display);
} }
} }
@ -180,7 +180,7 @@ class ScoreDisplay
} }
$sql = 'SELECT id FROM '.$tbl_gradebook_category.' $sql = 'SELECT id FROM '.$tbl_gradebook_category.'
WHERE course_code = "'.$curr_course_code.'" '. $session_condition; WHERE course_code = "'.$curr_course_code.'" '.$session_condition;
$rs = Database::query($sql); $rs = Database::query($sql);
$category_id = 0; $category_id = 0;
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
@ -249,7 +249,7 @@ class ScoreDisplay
); );
$tbl_display = Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY); $tbl_display = Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
foreach($display as $value => $text) { foreach ($display as $value => $text) {
$params = array( $params = array(
'score' => $value, 'score' => $value,
'display' => $text, 'display' => $text,
@ -305,7 +305,7 @@ class ScoreDisplay
$my_score = $score == 0 ? 1 : $score; $my_score = $score == 0 ? 1 : $score;
if ($type == SCORE_BAR) { if ($type == SCORE_BAR) {
$percentage = $my_score[0]/$my_score[1]*100; $percentage = $my_score[0] / $my_score[1] * 100;
return Display::bar_progress($percentage); return Display::bar_progress($percentage);
} }
@ -346,7 +346,7 @@ class ScoreDisplay
case SCORE_PERCENT: // XX % case SCORE_PERCENT: // XX %
return $this->display_as_percent($score); return $this->display_as_percent($score);
case SCORE_DIV_PERCENT: // X / Y (XX %) case SCORE_DIV_PERCENT: // X / Y (XX %)
return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'; return $this->display_as_div($score).' ('.$this->display_as_percent($score).')';
case SCORE_AVERAGE: // XX % case SCORE_AVERAGE: // XX %
return $this->display_as_percent($score); return $this->display_as_percent($score);
case SCORE_DECIMAL: // 0.50 (X/Y) case SCORE_DECIMAL: // 0.50 (X/Y)
@ -356,7 +356,7 @@ class ScoreDisplay
if (!empty($custom)) { if (!empty($custom)) {
$custom = ' - '.$custom; $custom = ' - '.$custom;
} }
return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom; return $this->display_as_div($score).' ('.$this->display_as_percent($score).')'.$custom;
case SCORE_DIV_SIMPLE_WITH_CUSTOM: // X - Good! case SCORE_DIV_SIMPLE_WITH_CUSTOM: // X - Good!
$custom = $this->display_custom($score); $custom = $this->display_custom($score);
@ -408,9 +408,9 @@ class ScoreDisplay
*/ */
private function display_as_decimal($score) private function display_as_decimal($score)
{ {
$score_denom = ($score[1]==0) ? 1 : $score[1]; $score_denom = ($score[1] == 0) ? 1 : $score[1];
return $this->format_score($score[0]/$score_denom); return $this->format_score($score[0] / $score_denom);
} }
/** /**
@ -418,9 +418,9 @@ class ScoreDisplay
*/ */
private function display_as_percent($score) private function display_as_percent($score)
{ {
$score_denom = ($score[1]==0) ? 1 : $score[1]; $score_denom = ($score[1] == 0) ? 1 : $score[1];
return $this->format_score($score[0]/$score_denom*100) . ' %'; return $this->format_score($score[0] / $score_denom * 100).' %';
} }
/** /**
@ -436,7 +436,7 @@ class ScoreDisplay
} else { } else {
$score[0] = isset($score[0]) ? $this->format_score($score[0]) : 0; $score[0] = isset($score[0]) ? $this->format_score($score[0]) : 0;
$score[1] = isset($score[1]) ? $this->format_score($score[1]) : 0; $score[1] = isset($score[1]) ? $this->format_score($score[1]) : 0;
return $score[0] . ' / ' . $score[1]; return $score[0].' / '.$score[1];
} }
} }
@ -446,7 +446,7 @@ class ScoreDisplay
*/ */
private function display_custom($score) private function display_custom($score)
{ {
$my_score_denom= ($score[1]==0) ? 1 : $score[1]; $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
$scaledscore = $score[0] / $my_score_denom; $scaledscore = $score[0] / $my_score_denom;
if ($this->upperlimit_included) { if ($this->upperlimit_included) {
foreach ($this->custom_display_conv as $displayitem) { foreach ($this->custom_display_conv as $displayitem) {
@ -510,7 +510,7 @@ class ScoreDisplay
ORDER BY score'; ORDER BY score';
$result = Database::query($sql); $result = Database::query($sql);
return Database::store_result($result,'ASSOC'); return Database::store_result($result, 'ASSOC');
} }
/** /**

@ -27,7 +27,7 @@ class View
if (is_dir($path)) { if (is_dir($path)) {
$this->tool_path = $path; $this->tool_path = $path;
} else { } else {
throw new Exception('View::__construct() $path directory does not exist ' . $path); throw new Exception('View::__construct() $path directory does not exist '.$path);
} }
} }
} }
@ -39,7 +39,7 @@ class View
public function set_data($data) public function set_data($data)
{ {
if (!is_array($data)) { if (!is_array($data)) {
throw new Exception('View::set_data() $data must to be an array, you have sent a' . gettype( $data )); throw new Exception('View::set_data() $data must to be an array, you have sent a'.gettype($data));
} }
$this->data = $data; $this->data = $data;
} }
@ -49,7 +49,7 @@ class View
* @param string layout view * @param string layout view
* @param string $layout * @param string $layout
*/ */
public function set_layout( $layout ) public function set_layout($layout)
{ {
$this->layout = $layout; $this->layout = $layout;
} }

@ -29,7 +29,7 @@ class MessageManager
if (!isset($count)) { if (!isset($count)) {
$cacheAvailable = api_get_configuration_value('apc'); $cacheAvailable = api_get_configuration_value('apc');
if ($cacheAvailable === true) { if ($cacheAvailable === true) {
$var = api_get_configuration_value('apc_prefix') . 'social_messages_unread_u_' . $userId; $var = api_get_configuration_value('apc_prefix').'social_messages_unread_u_'.$userId;
if (apcu_exists($var)) { if (apcu_exists($var)) {
$count = apcu_fetch($var); $count = apcu_fetch($var);
} else { } else {
@ -57,7 +57,7 @@ class MessageManager
$sql = "SELECT COUNT(id) as count $sql = "SELECT COUNT(id) as count
FROM $table FROM $table
WHERE WHERE
user_receiver_id=" . api_get_user_id() . " AND user_receiver_id=".api_get_user_id()." AND
msg_status = " . MESSAGE_STATUS_UNREAD; msg_status = " . MESSAGE_STATUS_UNREAD;
$result = Database::query($sql); $result = Database::query($sql);
$row = Database::fetch_assoc($result); $row = Database::fetch_assoc($result);
@ -72,9 +72,9 @@ class MessageManager
{ {
$table_message = Database::get_main_table(TABLE_MESSAGE); $table_message = Database::get_main_table(TABLE_MESSAGE);
if ($unread) { if ($unread) {
$condition_msg_status = ' msg_status = ' . MESSAGE_STATUS_UNREAD . ' '; $condition_msg_status = ' msg_status = '.MESSAGE_STATUS_UNREAD.' ';
} else { } else {
$condition_msg_status = ' msg_status IN(' . MESSAGE_STATUS_NEW . ',' . MESSAGE_STATUS_UNREAD . ') '; $condition_msg_status = ' msg_status IN('.MESSAGE_STATUS_NEW.','.MESSAGE_STATUS_UNREAD.') ';
} }
$keyword = Session::read('message_search_keyword'); $keyword = Session::read('message_search_keyword');
@ -87,7 +87,7 @@ class MessageManager
$sql = "SELECT COUNT(id) as number_messages $sql = "SELECT COUNT(id) as number_messages
FROM $table_message FROM $table_message
WHERE $condition_msg_status AND WHERE $condition_msg_status AND
user_receiver_id=" . api_get_user_id() . " user_receiver_id=".api_get_user_id()."
$keywordCondition $keywordCondition
"; ";
$result = Database::query($sql); $result = Database::query($sql);
@ -135,7 +135,7 @@ class MessageManager
msg_status as col4 msg_status as col4
FROM $table_message FROM $table_message
WHERE WHERE
user_receiver_id=" . api_get_user_id() . " AND user_receiver_id=".api_get_user_id()." AND
msg_status IN (0,1) msg_status IN (0,1)
$keywordCondition $keywordCondition
ORDER BY col$column $direction ORDER BY col$column $direction
@ -160,10 +160,10 @@ class MessageManager
$link = '&f=social'; $link = '&f=social';
} }
$userInfo = api_get_user_info($result[1]); $userInfo = api_get_user_info($result[1]);
$message[1] = '<a ' . $class . ' href="view_message.php?id=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name']; $message[1] = '<a '.$class.' href="view_message.php?id='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name'];
$message[3] = '<a href="new_message.php?re_id=' . $result[0] . $link . '">' . $message[3] = '<a href="new_message.php?re_id='.$result[0].$link.'">'.
Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a>' . Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" href="inbox.php?action=deleteone&id=' . $result[0] . $link . '">' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>'; '&nbsp;&nbsp;<a onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" href="inbox.php?action=deleteone&id='.$result[0].$link.'">'.Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
$message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
foreach ($message as $key => $value) { foreach ($message as $key => $value) {
@ -268,7 +268,7 @@ class MessageManager
//@todo it's possible to edit a message? yes, only for groups //@todo it's possible to edit a message? yes, only for groups
if ($edit_message_id) { if ($edit_message_id) {
$query = " UPDATE $table_message SET $query = " UPDATE $table_message SET
update_date = '" . $now . "', update_date = '".$now."',
content = '".Database::escape_string($content)."' content = '".Database::escape_string($content)."'
WHERE id = '$edit_message_id' "; WHERE id = '$edit_message_id' ";
Database::query($query); Database::query($query);
@ -437,7 +437,7 @@ class MessageManager
$message = sprintf( $message = sprintf(
get_lang('CopyOfMessageSentToXUser'), get_lang('CopyOfMessageSentToXUser'),
$userInfo['complete_name'] $userInfo['complete_name']
) . ' <br />' . $message; ).' <br />'.$message;
self::send_message_simple( self::send_message_simple(
$drhInfo['user_id'], $drhInfo['user_id'],
@ -485,7 +485,7 @@ class MessageManager
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
// update parent_id for other user receiver // update parent_id for other user receiver
$sql = "UPDATE $table_message SET parent_id = " . $row['id'] . " $sql = "UPDATE $table_message SET parent_id = ".$row['id']."
WHERE id = $message_id"; WHERE id = $message_id";
Database::query($sql); Database::query($sql);
} }
@ -504,7 +504,7 @@ class MessageManager
$user_receiver_id = intval($user_receiver_id); $user_receiver_id = intval($user_receiver_id);
$id = intval($id); $id = intval($id);
$sql = "SELECT * FROM $table_message $sql = "SELECT * FROM $table_message
WHERE id=" . $id . " AND msg_status<>4"; WHERE id=".$id." AND msg_status<>4";
$rs = Database::query($sql); $rs = Database::query($sql);
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
@ -514,7 +514,7 @@ class MessageManager
$query = "UPDATE $table_message $query = "UPDATE $table_message
SET msg_status = 3 SET msg_status = 3
WHERE WHERE
user_receiver_id=" . $user_receiver_id . " AND user_receiver_id=".$user_receiver_id." AND
id = " . $id; id = " . $id;
Database::query($query); Database::query($query);
@ -604,13 +604,13 @@ class MessageManager
$path_user_info['dir'] = UserManager::getUserPathById($message_user_id, 'system'); $path_user_info['dir'] = UserManager::getUserPathById($message_user_id, 'system');
} }
$path_message_attach = $path_user_info['dir'] . 'message_attachments/'; $path_message_attach = $path_user_info['dir'].'message_attachments/';
// If this directory does not exist - we create it. // If this directory does not exist - we create it.
if (!file_exists($path_message_attach)) { if (!file_exists($path_message_attach)) {
@mkdir($path_message_attach, api_get_permissions_for_new_directories(), true); @mkdir($path_message_attach, api_get_permissions_for_new_directories(), true);
} }
$new_path = $path_message_attach . $new_file_name; $new_path = $path_message_attach.$new_file_name;
if (is_uploaded_file($file_attach['tmp_name'])) { if (is_uploaded_file($file_attach['tmp_name'])) {
@copy($file_attach['tmp_name'], $new_path); @copy($file_attach['tmp_name'], $new_path);
} }
@ -645,7 +645,7 @@ class MessageManager
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
$path = $row['path']; $path = $row['path'];
$attach_id = $row['id']; $attach_id = $row['id'];
$new_path = $path . '_DELETED_' . $attach_id; $new_path = $path.'_DELETED_'.$attach_id;
if (!empty($group_id)) { if (!empty($group_id)) {
$userGroup = new UserGroup(); $userGroup = new UserGroup();
@ -661,9 +661,9 @@ class MessageManager
); );
} }
$path_message_attach = $path_user_info['dir'] . 'message_attachments/'; $path_message_attach = $path_user_info['dir'].'message_attachments/';
if (is_file($path_message_attach . $path)) { if (is_file($path_message_attach.$path)) {
if (rename($path_message_attach . $path, $path_message_attach . $new_path)) { if (rename($path_message_attach.$path, $path_message_attach.$new_path)) {
$sql = "UPDATE $table_message_attach set path='$new_path' $sql = "UPDATE $table_message_attach set path='$new_path'
WHERE id ='$attach_id'"; WHERE id ='$attach_id'";
Database::query($sql); Database::query($sql);
@ -688,8 +688,8 @@ class MessageManager
$sql = "UPDATE $table_message SET msg_status = '0' $sql = "UPDATE $table_message SET msg_status = '0'
WHERE WHERE
msg_status<>4 AND msg_status<>4 AND
user_receiver_id=" . intval($user_id) . " AND user_receiver_id=".intval($user_id)." AND
id='" . intval($message_id) . "'"; id='" . intval($message_id)."'";
Database::query($sql); Database::query($sql);
} }
@ -709,8 +709,8 @@ class MessageManager
$sql = "UPDATE $table_message SET $sql = "UPDATE $table_message SET
msg_status = '$type' msg_status = '$type'
WHERE WHERE
user_receiver_id=" . intval($user_id) . " AND user_receiver_id=".intval($user_id)." AND
id='" . intval($message_id) . "'"; id='" . intval($message_id)."'";
Database::query($sql); Database::query($sql);
} }
@ -727,7 +727,7 @@ class MessageManager
} }
$table_message = Database::get_main_table(TABLE_MESSAGE); $table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT * FROM $table_message $query = "SELECT * FROM $table_message
WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'"; WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'";
$result = Database::query($query); $result = Database::query($query);
return $row = Database::fetch_array($result); return $row = Database::fetch_array($result);
@ -749,7 +749,7 @@ class MessageManager
$sql = "SELECT * FROM $table_message $sql = "SELECT * FROM $table_message
WHERE WHERE
group_id= $group_id AND group_id= $group_id AND
msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "') msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
ORDER BY id"; ORDER BY id";
$rs = Database::query($sql); $rs = Database::query($sql);
$data = array(); $data = array();
@ -777,7 +777,7 @@ class MessageManager
$sql = "SELECT * FROM $table_message $sql = "SELECT * FROM $table_message
WHERE WHERE
group_id = $group_id AND group_id = $group_id AND
msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "') msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
ORDER BY id "; ORDER BY id ";
$rs = Database::query($sql); $rs = Database::query($sql);
@ -826,7 +826,7 @@ class MessageManager
$sql = "SELECT * FROM $table_message $sql = "SELECT * FROM $table_message
WHERE WHERE
parent_id='$parent_id' AND parent_id='$parent_id' AND
msg_status <> " . MESSAGE_STATUS_OUTBOX . " msg_status <> ".MESSAGE_STATUS_OUTBOX."
$condition_group_id $condition_group_id
ORDER BY send_date DESC $condition_limit "; ORDER BY send_date DESC $condition_limit ";
$rs = Database::query($sql); $rs = Database::query($sql);
@ -854,8 +854,8 @@ class MessageManager
$table_message = Database::get_main_table(TABLE_MESSAGE); $table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT id FROM $table_message $query = "SELECT id FROM $table_message
WHERE WHERE
user_receiver_id = " . intval($user_id) . " AND user_receiver_id = ".intval($user_id)." AND
id = '" . intval($id) . "'"; id = '" . intval($id)."'";
$result = Database::query($query); $result = Database::query($query);
$num = Database::num_rows($result); $num = Database::num_rows($result);
if ($num > 0) { if ($num > 0) {
@ -903,8 +903,8 @@ class MessageManager
msg_status as col5 msg_status as col5
FROM $table_message FROM $table_message
WHERE WHERE
user_sender_id=" . api_get_user_id() . " AND user_sender_id=".api_get_user_id()." AND
msg_status=" . MESSAGE_STATUS_OUTBOX . " msg_status=" . MESSAGE_STATUS_OUTBOX."
$keywordCondition $keywordCondition
ORDER BY col$column $direction ORDER BY col$column $direction
LIMIT $from, $number_of_items"; LIMIT $from, $number_of_items";
@ -913,7 +913,7 @@ class MessageManager
$message_list = array(); $message_list = array();
while ($result = Database::fetch_row($sql_result)) { while ($result = Database::fetch_row($sql_result)) {
if ($request === true) { if ($request === true) {
$message[0] = '<input type="checkbox" value=' . $result[0] . ' name="out[]">'; $message[0] = '<input type="checkbox" value='.$result[0].' name="out[]">';
} else { } else {
$message[0] = ($result[0]); $message[0] = ($result[0]);
} }
@ -921,20 +921,20 @@ class MessageManager
$result[2] = Security::remove_XSS($result[2]); $result[2] = Security::remove_XSS($result[2]);
$userInfo = api_get_user_info($result[4]); $userInfo = api_get_user_info($result[4]);
if ($request === true) { if ($request === true) {
$message[1] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . $userInfo['complete_name'] . '</a>'; $message[1] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.$userInfo['complete_name'].'</a>';
$message[2] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . str_replace("\\", "", $result[2]) . '</a>'; $message[2] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\", "", $result[2]).'</a>';
$message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same $message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
$message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox(' . $result[0] . ')" href="javascript:void(0)" >' . $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)" >'.
Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>'; Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
} else { } else {
$link = ''; $link = '';
if (isset($_GET['f']) && $_GET['f'] == 'social') { if (isset($_GET['f']) && $_GET['f'] == 'social') {
$link = '&f=social'; $link = '&f=social';
} }
$message[1] = '<a ' . $class . ' onclick="show_sent_message (' . $result[0] . ')" href="../messages/view_message.php?id_send=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name']; $message[1] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name'];
$message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
$message[3] = '<a href="outbox.php?action=deleteone&id=' . $result[0] . '&' . $link . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" >' . $message[3] = '<a href="outbox.php?action=deleteone&id='.$result[0].'&'.$link.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" >'.
Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>'; Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
} }
foreach ($message as $key => $value) { foreach ($message as $key => $value) {
@ -967,8 +967,8 @@ class MessageManager
$sql = "SELECT COUNT(id) as number_messages $sql = "SELECT COUNT(id) as number_messages
FROM $table_message FROM $table_message
WHERE WHERE
msg_status=" . MESSAGE_STATUS_OUTBOX . " AND msg_status=".MESSAGE_STATUS_OUTBOX." AND
user_sender_id=" . api_get_user_id() . " user_sender_id=" . api_get_user_id()."
$keywordCondition $keywordCondition
"; ";
$result = Database::query($sql); $result = Database::query($sql);
@ -993,25 +993,25 @@ class MessageManager
if (isset($message_id) && is_numeric($message_id)) { if (isset($message_id) && is_numeric($message_id)) {
$query = "SELECT * FROM $table_message $query = "SELECT * FROM $table_message
WHERE WHERE
user_sender_id = " . api_get_user_id() . " AND user_sender_id = ".api_get_user_id()." AND
id = " . $message_id . " AND id = " . $message_id." AND
msg_status = 4;"; msg_status = 4;";
$result = Database::query($query); $result = Database::query($query);
} }
} else { } else {
if (is_numeric($message_id) && !empty($message_id)) { if (is_numeric($message_id) && !empty($message_id)) {
$query = "UPDATE $table_message SET $query = "UPDATE $table_message SET
msg_status = '" . MESSAGE_STATUS_NEW . "' msg_status = '".MESSAGE_STATUS_NEW."'
WHERE WHERE
user_receiver_id=" . api_get_user_id() . " AND user_receiver_id=" . api_get_user_id()." AND
id='" . $message_id . "'"; id='" . $message_id."'";
Database::query($query); Database::query($query);
$query = "SELECT * FROM $table_message $query = "SELECT * FROM $table_message
WHERE WHERE
msg_status<>4 AND msg_status<>4 AND
user_receiver_id=" . api_get_user_id() . " AND user_receiver_id=".api_get_user_id()." AND
id='" . $message_id . "'"; id='" . $message_id."'";
$result = Database::query($query); $result = Database::query($query);
} }
} }
@ -1044,27 +1044,27 @@ class MessageManager
if ($source == 'outbox') { if ($source == 'outbox') {
$message_content .= '<div class="col-md-12">'; $message_content .= '<div class="col-md-12">';
$message_content .= '<ul class="list-message">'; $message_content .= '<ul class="list-message">';
$message_content .= '<li>' . $user_image . '</li>'; $message_content .= '<li>'.$user_image.'</li>';
$message_content .= '<li><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> '; $message_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> ';
$message_content .= api_strtolower(get_lang('To')) . '&nbsp;<b>' . $receiverUserInfo['complete_name'].'</b></li>'; $message_content .= api_strtolower(get_lang('To')).'&nbsp;<b>'.$receiverUserInfo['complete_name'].'</b></li>';
$message_content .= '<li>' . Display::dateToStringAgoAndLongDate($row['send_date']) . '</li>'; $message_content .= '<li>'.Display::dateToStringAgoAndLongDate($row['send_date']).'</li>';
$message_content .= '</ul>'; $message_content .= '</ul>';
$message_content .= '</div>'; $message_content .= '</div>';
} else { } else {
$message_content .= '<div class="col-md-12">'; $message_content .= '<div class="col-md-12">';
$message_content .= '<ul class="list-message">'; $message_content .= '<ul class="list-message">';
$message_content .= '<li>' . $user_image . '</li>'; $message_content .= '<li>'.$user_image.'</li>';
$message_content .= '<li><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> </li>'; $message_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> </li>';
$message_content .= '<li>'. Display::dateToStringAgoAndLongDate($row['send_date']) . '</li>'; $message_content .= '<li>'.Display::dateToStringAgoAndLongDate($row['send_date']).'</li>';
$message_content .= '</ul>'; $message_content .= '</ul>';
$message_content .= '</div>'; $message_content .= '</div>';
} }
$message_content .= '</div>'; $message_content .= '</div>';
} else { } else {
if ($source == 'outbox') { if ($source == 'outbox') {
$message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . $receiverUserInfo['complete_name'] . '</b>'; $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.$receiverUserInfo['complete_name'].'</b>';
} else { } else {
$message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . get_lang('Me') . '</b>'; $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
} }
} }
@ -1072,26 +1072,26 @@ class MessageManager
<hr style="color:#ddd" /> <hr style="color:#ddd" />
<table width="100%"> <table width="100%">
<tr> <tr>
<td valign=top class="view-message-content">' . str_replace("\\", "", $content) . '</td> <td valign=top class="view-message-content">' . str_replace("\\", "", $content).'</td>
</tr> </tr>
</table> </table>
<div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div> <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>
<div style="padding: 15px 0px 5px 0px">'; <div style="padding: 15px 0px 5px 0px">';
$social_link = ''; $social_link = '';
if (isset($_GET['f']) && $_GET['f'] == 'social') { if (isset($_GET['f']) && $_GET['f'] == 'social') {
$social_link = 'f=social'; $social_link = 'f=social';
} }
if ($source == 'outbox') { if ($source == 'outbox') {
$message_content .= '<a href="outbox.php?' . $social_link . '">' . $message_content .= '<a href="outbox.php?'.$social_link.'">'.
Display::return_icon('back.png', get_lang('ReturnToOutbox')) . '</a> &nbsp'; Display::return_icon('back.png', get_lang('ReturnToOutbox')).'</a> &nbsp';
} else { } else {
$message_content .= '<a href="inbox.php?' . $social_link . '">' . $message_content .= '<a href="inbox.php?'.$social_link.'">'.
Display::return_icon('back.png', get_lang('ReturnToInbox')) . '</a> &nbsp'; Display::return_icon('back.png', get_lang('ReturnToInbox')).'</a> &nbsp';
$message_content .= '<a href="new_message.php?re_id=' . $message_id . '&' . $social_link . '">' . $message_content .= '<a href="new_message.php?re_id='.$message_id.'&'.$social_link.'">'.
Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a> &nbsp'; Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a> &nbsp';
} }
$message_content .= '<a href="inbox.php?action=deleteone&id=' . $message_id . '&' . $social_link . '" >' . $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.
Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>&nbsp'; Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp';
$message_content .= '</div></td> $message_content .= '</div></td>
<td width=10></td> <td width=10></td>
@ -1109,8 +1109,8 @@ class MessageManager
public static function get_user_id_by_email($user_email) public static function get_user_id_by_email($user_email)
{ {
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = 'SELECT user_id FROM ' . $tbl_user . ' $sql = 'SELECT user_id FROM '.$tbl_user.'
WHERE email="' . Database::escape_string($user_email) . '";'; WHERE email="' . Database::escape_string($user_email).'";';
$rs = Database::query($sql); $rs = Database::query($sql);
$row = Database::fetch_array($rs, 'ASSOC'); $row = Database::fetch_array($rs, 'ASSOC');
if (isset($row['user_id'])) { if (isset($row['user_id'])) {
@ -1170,7 +1170,7 @@ class MessageManager
$items = $topic['count']; $items = $topic['count'];
$reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies'); $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies');
$label = '<i class="fa fa-envelope"></i> ' . $items . ' ' . $reply_label; $label = '<i class="fa fa-envelope"></i> '.$items.' '.$reply_label;
$topic['title'] = trim($topic['title']); $topic['title'] = trim($topic['title']);
if (empty($topic['title'])) { if (empty($topic['title'])) {
@ -1182,31 +1182,31 @@ class MessageManager
'h4', 'h4',
Display::url( Display::url(
Security::remove_XSS($topic['title'], STUDENT, true), Security::remove_XSS($topic['title'], STUDENT, true),
api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $group_id . '&topic_id=' . $topic['id'] api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$group_id.'&topic_id='.$topic['id']
), array('class' => 'title') ), array('class' => 'title')
); );
$actions = ''; $actions = '';
if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || if ($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
$my_group_role == GROUP_USER_PERMISSION_MODERATOR $my_group_role == GROUP_USER_PERMISSION_MODERATOR
) { ) {
$actions = '<br />' . Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic['id'], array('class' => 'btn btn-default')); $actions = '<br />'.Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH).'social/group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic['id'], array('class' => 'btn btn-default'));
} }
$date = ''; $date = '';
if ($topic['send_date'] != $topic['update_date']) { if ($topic['send_date'] != $topic['update_date']) {
if (!empty($topic['update_date'])) { if (!empty($topic['update_date'])) {
$date .= '<i class="fa fa-calendar"></i> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']); $date .= '<i class="fa fa-calendar"></i> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']);
} }
} else { } else {
$date .= '<i class="fa fa-calendar"></i> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']); $date .= '<i class="fa fa-calendar"></i> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']);
} }
$html .= '<div class="date">' . $label . ' - ' . $date . $actions . '</div>'; $html .= '<div class="date">'.$label.' - '.$date.$actions.'</div>';
$html .= '</div>'; $html .= '</div>';
$image = $user_sender_info['avatar']; $image = $user_sender_info['avatar'];
$user_info = '<div class="author"><img class="img-responsive img-circle" src="' . $image . '" alt="' . $name . '" width="64" height="64" title="' . $name . '" /></div>'; $user_info = '<div class="author"><img class="img-responsive img-circle" src="'.$image.'" alt="'.$name.'" width="64" height="64" title="'.$name.'" /></div>';
$user_info .= '<div class="name"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp;</a></div>'; $user_info .= '<div class="name"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
$html .= '<div class="col-xs-4 col-md-2">'; $html .= '<div class="col-xs-4 col-md-2">';
$html .= $user_info; $html .= $user_info;
@ -1284,7 +1284,7 @@ class MessageManager
'group_id' => $group_id, 'group_id' => $group_id,
'message_id' => $main_message['id'], 'message_id' => $main_message['id'],
'action' => 'edit_message_group', 'action' => 'edit_message_group',
'anchor_topic' => 'topic_' . $main_message['id'], 'anchor_topic' => 'topic_'.$main_message['id'],
'topics_page_nr' => $topic_page_nr, 'topics_page_nr' => $topic_page_nr,
'items_page_nr' => $items_page_nr, 'items_page_nr' => $items_page_nr,
'topic_id' => $main_message['id'] 'topic_id' => $main_message['id']
@ -1292,7 +1292,7 @@ class MessageManager
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$links .= Display::url( $links .= Display::url(
Display::returnFontAwesomeIcon('trash'), Display::returnFontAwesomeIcon('trash'),
'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id, 'group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic_id,
[ [
'class' => 'btn btn-default' 'class' => 'btn btn-default'
] ]
@ -1317,7 +1317,7 @@ class MessageManager
'group_id' => $group_id, 'group_id' => $group_id,
'message_id' => $main_message['id'], 'message_id' => $main_message['id'],
'action' => 'reply_message_group', 'action' => 'reply_message_group',
'anchor_topic' => 'topic_' . $main_message['id'], 'anchor_topic' => 'topic_'.$main_message['id'],
'topics_page_nr' => $topic_page_nr, 'topics_page_nr' => $topic_page_nr,
'topic_id' => $main_message['id'] 'topic_id' => $main_message['id']
]); ]);
@ -1335,31 +1335,31 @@ class MessageManager
$links .= '</div>'; $links .= '</div>';
$links .= '</div>'; $links .= '</div>';
$title = '<h4>' . Security::remove_XSS($main_message['title'], STUDENT, true) . $links . '</h4>'; $title = '<h4>'.Security::remove_XSS($main_message['title'], STUDENT, true).$links.'</h4>';
$userPicture = $user_sender_info['avatar']; $userPicture = $user_sender_info['avatar'];
$main_content .= '<div class="row">'; $main_content .= '<div class="row">';
$main_content .= '<div class="col-md-2">'; $main_content .= '<div class="col-md-2">';
$main_content .= '<div class="avatar-author">'; $main_content .= '<div class="avatar-author">';
$main_content .= '<img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" />'; $main_content .= '<img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" />';
$main_content .= '</div>'; $main_content .= '</div>';
$main_content .= '</div>'; $main_content .= '</div>';
$date = ''; $date = '';
if ($main_message['send_date'] != $main_message['update_date']) { if ($main_message['send_date'] != $main_message['update_date']) {
if (!empty($main_message['update_date'])) { if (!empty($main_message['update_date'])) {
$date = '<div class="date"> '. Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>'; $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($main_message['update_date']).'</div>';
} }
} else { } else {
$date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>'; $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
} }
$attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
$main_content .= '<div class="col-md-10">'; $main_content .= '<div class="col-md-10">';
$user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . '</a>'; $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'</a>';
$main_content .= '<div class="message-content"> '; $main_content .= '<div class="message-content"> ';
$main_content .= '<div class="username">' . $user_link . '</div>'; $main_content .= '<div class="username">'.$user_link.'</div>';
$main_content .= $date ; $main_content .= $date;
$main_content .= '<div class="message">'. $main_message['content'] . $attachment . '</div></div>'; $main_content .= '<div class="message">'.$main_message['content'].$attachment.'</div></div>';
$main_content .= '</div>'; $main_content .= '</div>';
$main_content .= '</div>'; $main_content .= '</div>';
@ -1380,7 +1380,7 @@ class MessageManager
if (empty($topic['id'])) { if (empty($topic['id'])) {
continue; continue;
} }
$items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null; $items_page_nr = isset($_GET['items_'.$topic['id'].'_page_nr']) ? intval($_GET['items_'.$topic['id'].'_page_nr']) : null;
$links = ''; $links = '';
$links .= '<div class="pull-right">'; $links .= '<div class="pull-right">';
$html_items = ''; $html_items = '';
@ -1390,36 +1390,36 @@ class MessageManager
$links .= '<div class="btn-group btn-group-sm">'; $links .= '<div class="btn-group btn-group-sm">';
if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) { if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
$links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Edit') . '" title="' . get_lang('Edit') . '">' . $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
Display::returnFontAwesomeIcon('pencil') . '</a>'; Display::returnFontAwesomeIcon('pencil').'</a>';
} }
$links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Reply') . '" title="' . get_lang('Reply') . '">'; $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
$links .= Display::returnFontAwesomeIcon('commenting') . '</a>'; $links .= Display::returnFontAwesomeIcon('commenting').'</a>';
$links .= '</div>'; $links .= '</div>';
$links .= '</div>'; $links .= '</div>';
$userPicture = $user_sender_info['avatar']; $userPicture = $user_sender_info['avatar'];
$user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp</a>'; $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp</a>';
$html_items .= '<div class="row">'; $html_items .= '<div class="row">';
$html_items .= '<div class="col-md-2">'; $html_items .= '<div class="col-md-2">';
$html_items .= '<div class="avatar-author"><img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" /></div>'; $html_items .= '<div class="avatar-author"><img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" /></div>';
$html_items .= '</div>'; $html_items .= '</div>';
$date = ''; $date = '';
if ($topic['send_date'] != $topic['update_date']) { if ($topic['send_date'] != $topic['update_date']) {
if (!empty($topic['update_date'])) { if (!empty($topic['update_date'])) {
$date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' '. get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>'; $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</div>';
} }
} else { } else {
$date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>'; $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
} }
$attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
$html_items .= '<div class="col-md-10">'; $html_items .= '<div class="col-md-10">';
$html_items .= '<div class="message-content">'; $html_items .= '<div class="message-content">';
$html_items .= $links; $html_items .= $links;
$html_items .= '<div class="username">' . $user_link . '</div>'; $html_items .= '<div class="username">'.$user_link.'</div>';
$html_items .= $date; $html_items .= $date;
$html_items .= '<div class="message">' . Security::remove_XSS($topic['content'], STUDENT, true) . '</div>' . $attachment . '</div>'; $html_items .= '<div class="message">'.Security::remove_XSS($topic['content'], STUDENT, true).'</div>'.$attachment.'</div>';
$html_items .= '</div>'; $html_items .= '</div>';
$html_items .= '</div>'; $html_items .= '</div>';
@ -1431,8 +1431,8 @@ class MessageManager
$indent = intval($topic['indent_cnt']) * $base_padding + $base_padding; $indent = intval($topic['indent_cnt']) * $base_padding + $base_padding;
} }
$html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_' . $topic['id'])); $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_'.$topic['id']));
$html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:' . $indent . 'px')); $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:'.$indent.'px'));
$array_html_items[] = array($html_items); $array_html_items[] = array($html_items);
} }
@ -1446,7 +1446,7 @@ class MessageManager
); );
if (!empty($array_html_items)) { if (!empty($array_html_items)) {
$html .= Display::return_sortable_grid( $html .= Display::return_sortable_grid(
'items_' . $topic['id'], 'items_'.$topic['id'],
array(), array(),
$array_html_items, $array_html_items,
$options, $options,
@ -1537,14 +1537,14 @@ class MessageManager
$rs_file = Database::query($sql); $rs_file = Database::query($sql);
if (Database::num_rows($rs_file) > 0) { if (Database::num_rows($rs_file) > 0) {
$attach_icon = Display::return_icon('attachment.gif', ''); $attach_icon = Display::return_icon('attachment.gif', '');
$archiveURL = api_get_path(WEB_CODE_PATH) . 'messages/download.php?type=' . $type . '&file='; $archiveURL = api_get_path(WEB_CODE_PATH).'messages/download.php?type='.$type.'&file=';
while ($row_file = Database::fetch_array($rs_file)) { while ($row_file = Database::fetch_array($rs_file)) {
$archiveFile = $row_file['path']; $archiveFile = $row_file['path'];
$filename = $row_file['filename']; $filename = $row_file['filename'];
$filesize = format_file_size($row_file['size']); $filesize = format_file_size($row_file['size']);
$filecomment = Security::remove_XSS($row_file['comment']); $filecomment = Security::remove_XSS($row_file['comment']);
$filename = Security::remove_XSS($filename); $filename = Security::remove_XSS($filename);
$links_attach_file[] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $archiveFile . '">' . $filename . '</a>&nbsp;(' . $filesize . ')' . (!empty($filecomment) ? '&nbsp;-&nbsp;<i>' . $filecomment . '</i>' : ''); $links_attach_file[] = $attach_icon.'&nbsp;<a href="'.$archiveURL.$archiveFile.'">'.$filename.'</a>&nbsp;('.$filesize.')'.(!empty($filecomment) ? '&nbsp;-&nbsp;<i>'.$filecomment.'</i>' : '');
} }
} }
} }
@ -1563,7 +1563,7 @@ class MessageManager
$sql = "SELECT * FROM $tbl_message $sql = "SELECT * FROM $tbl_message
WHERE WHERE
id = '$message_id' AND id = '$message_id' AND
msg_status <> '" . MESSAGE_STATUS_DELETED . "' "; msg_status <> '".MESSAGE_STATUS_DELETED."' ";
$res = Database::query($sql); $res = Database::query($sql);
$item = array(); $item = array();
if (Database::num_rows($res) > 0) { if (Database::num_rows($res) > 0) {
@ -1690,7 +1690,7 @@ class MessageManager
Session::write('message_sent_search_keyword', $keyword); Session::write('message_sent_search_keyword', $keyword);
$success = get_lang('SelectedMessagesDeleted') . '&nbsp</b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>'; $success = get_lang('SelectedMessagesDeleted').'&nbsp</b><br /><a href="outbox.php?'.$social_link.'">'.get_lang('BackToOutbox').'</a>';
$html = null; $html = null;
if (isset($_REQUEST['action'])) { if (isset($_REQUEST['action'])) {
@ -1798,7 +1798,7 @@ class MessageManager
ON m.user_sender_id = u.user_id ON m.user_sender_id = u.user_id
WHERE WHERE
m.user_receiver_id = $userId AND m.user_receiver_id = $userId AND
m.msg_status = " . MESSAGE_STATUS_UNREAD . " m.msg_status = ".MESSAGE_STATUS_UNREAD."
AND m.id > $lastId AND m.id > $lastId
ORDER BY m.send_date DESC"; ORDER BY m.send_date DESC";
@ -1887,11 +1887,11 @@ class MessageManager
); );
$tplMailBody->assign('user', $user); $tplMailBody->assign('user', $user);
$tplMailBody->assign('is_western_name_order', api_is_western_name_order()); $tplMailBody->assign('is_western_name_order', api_is_western_name_order());
$tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH) . 'admin/user_edit.php?user_id=' . $user->getId()); $tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user->getId());
$layoutContent = $tplMailBody->get_template('mail/new_user_mail_to_admin.tpl'); $layoutContent = $tplMailBody->get_template('mail/new_user_mail_to_admin.tpl');
$emailsubject = '[' . get_lang('UserRegistered') . '] ' . $user->getUsername(); $emailsubject = '['.get_lang('UserRegistered').'] '.$user->getUsername();
$emailbody = $tplMailBody->fetch($layoutContent); $emailbody = $tplMailBody->fetch($layoutContent);
$admins = UserManager::get_all_administrators(); $admins = UserManager::get_all_administrators();
@ -1922,8 +1922,8 @@ class MessageManager
*/ */
public static function failedSentMailErrors() public static function failedSentMailErrors()
{ {
$base = api_get_path(SYS_ARCHIVE_PATH) . 'mail/'; $base = api_get_path(SYS_ARCHIVE_PATH).'mail/';
$mailq = $base . 'mailq'; $mailq = $base.'mailq';
if (!file_exists($mailq) || !is_readable($mailq)) { if (!file_exists($mailq) || !is_readable($mailq)) {
return false; return false;
@ -1944,7 +1944,7 @@ class MessageManager
$mail_queue[$i]['code'] = $codeMatches[2]; $mail_queue[$i]['code'] = $codeMatches[2];
} }
$fullMail = $base . $mail_queue[$i]['code']; $fullMail = $base.$mail_queue[$i]['code'];
$mailFile = fopen($fullMail, 'r'); $mailFile = fopen($fullMail, 'r');
//Get the reason of mail fail //Get the reason of mail fail
@ -1967,7 +1967,7 @@ class MessageManager
//Get the time of mail fail //Get the time of mail fail
if (preg_match('/^\s?(\d+)(\D+)\s+(.*)$/', $line, $timeMatches)) { if (preg_match('/^\s?(\d+)(\D+)\s+(.*)$/', $line, $timeMatches)) {
$mail_queue[$i]['time'] = $timeMatches[1] . $timeMatches[2]; $mail_queue[$i]['time'] = $timeMatches[1].$timeMatches[2];
} elseif (preg_match('/^(\s+)((.*)@(.*))\s+(.*)$/', $line, $emailMatches)) { } elseif (preg_match('/^(\s+)((.*)@(.*))\s+(.*)$/', $line, $emailMatches)) {
$mail_queue[$i]['mail'] = $emailMatches[2]; $mail_queue[$i]['mail'] = $emailMatches[2];
$i++; $i++;

@ -11,7 +11,7 @@
$cidReset = true; $cidReset = true;
// including files // including files
require_once __DIR__ . '/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
require_once 'reports.lib.php'; require_once 'reports.lib.php';
require_once 'multiquery.lib.php'; require_once 'multiquery.lib.php';
@ -39,16 +39,16 @@ if ($_REQUEST['format'] == 'link') {
$kv = array(); $kv = array();
foreach ($_POST as $key => $value) { foreach ($_POST as $key => $value) {
if ($key != 'format') { if ($key != 'format') {
$kv[] = $key . '=' . urlencode($value); $kv[] = $key.'='.urlencode($value);
} }
} }
$query_string = join("&", $kv); $query_string = join("&", $kv);
die('<a href="reports.php?format=directlink&' . $query_string . '">' . get_lang('ReportTypeLink') . '</a>'); die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>');
} }
if ($_REQUEST['format'] == 'directlink') { if ($_REQUEST['format'] == 'directlink') {
foreach (array('jquery.dataTables.min.js') as $js) { foreach (array('jquery.dataTables.min.js') as $js) {
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/' . $js . '" type="text/javascript" language="javascript"></script>' . "\n"; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n";
} }
$htmlCSSXtra[] = 'dataTable.css'; $htmlCSSXtra[] = 'dataTable.css';
@ -77,11 +77,11 @@ if ($_REQUEST['format'] == 'csv') {
$kv = array(); $kv = array();
foreach ($_POST as $key => $value) { foreach ($_POST as $key => $value) {
if ($key != 'format') { if ($key != 'format') {
$kv[] = $key . '=' . urlencode($value); $kv[] = $key.'='.urlencode($value);
} }
} }
$query_string = join("&", $kv); $query_string = join("&", $kv);
die('<a href="reports.php?format=downloadcsv&' . $query_string . '">' . get_lang('DownloadFile') . '</a>'); die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>');
} else { } else {
if ($_REQUEST['format'] == 'downloadcsv') { if ($_REQUEST['format'] == 'downloadcsv') {
if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'], if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'],
@ -120,7 +120,7 @@ if (is_array($reports_template[$_REQUEST['type']])) {
//die(get_lang('NoDataAvailable')); //die(get_lang('NoDataAvailable'));
} }
} else { } else {
die('<b>' . get_lang('ErrorWhileBuildingReport') . '</b>'); die('<b>'.get_lang('ErrorWhileBuildingReport').'</b>');
} }
if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') { if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
@ -130,14 +130,14 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
echo '<script type="text/javascript" charset="utf-8"> echo '<script type="text/javascript" charset="utf-8">
$(document).ready(function() { $(document).ready(function() {
$("#reportsData' . $idsuffix . '").dataTable({ $("#reportsData' . $idsuffix.'").dataTable({
"oLanguage": "oLanguage":
{ {
"sProcessing": "Traitement en cours...", "sProcessing": "Traitement en cours...",
"sLengthMenu": "Afficher _MENU_ éléments", "sLengthMenu": "Afficher _MENU_ éléments",
"sZeroRecords": "Aucun élément à afficher", "sZeroRecords": "Aucun élément à afficher",
"sInfo": "Affichage de l' . "'" . 'élement _START_ à _END_ sur _TOTAL_ éléments", "sInfo": "Affichage de l' . "'".'élement _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l' . "'" . 'élement 0 à 0 sur 0 éléments", "sInfoEmpty": "Affichage de l' . "'".'élement 0 à 0 sur 0 éléments",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)", "sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "", "sInfoPostFix": "",
"sSearch": "Rechercher :", "sSearch": "Rechercher :",
@ -152,7 +152,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
}); });
} ); } );
</script>'; </script>';
echo '<table id="reportsData' . $idsuffix . '" class="display">'; // FIXME style echo '<table id="reportsData'.$idsuffix.'" class="display">'; // FIXME style
// counting fields // counting fields
$nfields = multiquery_num_fields($result); $nfields = multiquery_num_fields($result);
@ -163,7 +163,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
$columns[$i] = multiquery_field_name($result, $i); $columns[$i] = multiquery_field_name($result, $i);
if (substr($columns[$i], -5, 5) != '_link') { if (substr($columns[$i], -5, 5) != '_link') {
$column_islink[$i] = false; $column_islink[$i] = false;
echo '<th>' . $columns[$i] . '</th>'; echo '<th>'.$columns[$i].'</th>';
} else { } else {
$columns_islink[$i] = true; $columns_islink[$i] = true;
} }
@ -173,8 +173,8 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
$columns_flip = array_flip($columns); $columns_flip = array_flip($columns);
$columns_link = array(); $columns_link = array();
for ($i = 0; $i < $nfields; $i++) { for ($i = 0; $i < $nfields; $i++) {
if ($column_islink[$i] == false && array_key_exists($columns[$i] . '_link', $columns_flip)) { if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) {
$columns_link[$i] = $columns_flip[$columns[$i] . '_link']; $columns_link[$i] = $columns_flip[$columns[$i].'_link'];
} else { } else {
$columns_link[$i] = ''; $columns_link[$i] = '';
} }
@ -187,12 +187,12 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
if ($columns_link[$i] != '') // link is defined if ($columns_link[$i] != '') // link is defined
{ {
if (substr($columns_link[$i], 0, 10) == 'javascript') { if (substr($columns_link[$i], 0, 10) == 'javascript') {
echo '<td><a href="#" onclick="' . $row[$columns_link[$i]] . '">' . $row[$i] . '</a></td>'; echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
} else { } else {
echo '<td><a href="' . $row[$columns_link[$i]] . '">' . $row[$i] . '</a></td>'; echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
} }
} else { } else {
echo '<td>' . $row[$i] . '</td>'; echo '<td>'.$row[$i].'</td>';
} }
} }
} }
@ -220,7 +220,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
$columns[$i] = multiquery_field_name($result, $i); $columns[$i] = multiquery_field_name($result, $i);
if (substr($columns[$i], -5, 5) != '_link') { if (substr($columns[$i], -5, 5) != '_link') {
$column_islink[$i] = false; $column_islink[$i] = false;
echo csv_escaping($columns[$i]) . ','; echo csv_escaping($columns[$i]).',';
} else { } else {
$columns_islink[$i] = true; $columns_islink[$i] = true;
} }
@ -231,7 +231,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
for ($i = 0; $i < $nfields; $i++) { for ($i = 0; $i < $nfields; $i++) {
if (!$columns_islink[$i]) // ignore links if (!$columns_islink[$i]) // ignore links
{ {
echo csv_escaping($row[$i]) . ','; echo csv_escaping($row[$i]).',';
} }
} // fixme } // fixme
echo "\n"; echo "\n";
@ -245,7 +245,7 @@ function csv_escaping($value, $csv_separator = ',')
{ {
$value = str_replace('"', '""', $value); $value = str_replace('"', '""', $value);
if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value)) { if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value)) {
$value = '"' . $value . '"'; $value = '"'.$value.'"';
} }
return $value; return $value;
} }

@ -33,10 +33,10 @@ if (!$infos = Database::fetch_array($result)) {
exit(); exit();
} }
list($year_start,$month_start,$day_start)=explode('-',$infos['date_start']); list($year_start, $month_start, $day_start) = explode('-', $infos['date_start']);
list($year_end,$month_end,$day_end)=explode('-',$infos['date_end']); list($year_end, $month_end, $day_end) = explode('-', $infos['date_end']);
if (!api_is_platform_admin() && $infos['session_admin_id']!=$_user['user_id'] && !api_is_session_admin()) { if (!api_is_platform_admin() && $infos['session_admin_id'] != $_user['user_id'] && !api_is_session_admin()) {
api_not_allowed(true); api_not_allowed(true);
} }
@ -73,24 +73,24 @@ $thisDay = date('d');
// display the header // display the header
Display::display_header($tool_name); Display::display_header($tool_name);
if (!empty($return)) { if (!empty($return)) {
Display::display_error_message($return,false); Display::display_error_message($return, false);
} }
?> ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<form method="post" name="form" action="<?php echo api_get_self(); ?>?id=<?php echo $id; ?>" class="form-horizontal"> <form method="post" name="form" action="<?php echo api_get_self(); ?>?id=<?php echo $id; ?>" class="form-horizontal">
<input type="hidden" name="formSent" value="1"> <input type="hidden" name="formSent" value="1">
<legend><?php echo $tool_name;?> </legend> <legend><?php echo $tool_name; ?> </legend>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo get_lang('SessionName') ?></label> <label class="col-sm-3 control-label"><?php echo get_lang('SessionName') ?></label>
<div class="col-sm-6"> <div class="col-sm-6">
<input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>"> <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if ($formSent) echo api_htmlentities($name, ENT_QUOTES, $charset); else echo api_htmlentities($infos['name'], ENT_QUOTES, $charset); ?>">
</div> </div>
<div class="col-sm-3"></div> <div class="col-sm-3"></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-3 col-sm-6"> <div class="col-sm-offset-3 col-sm-6">
<?php echo get_lang('TheTimeLimitsAreReferential');?> <?php echo get_lang('TheTimeLimitsAreReferential'); ?>
<a href="javascript://" onclick="if(document.getElementById('options').style.display == 'none'){document.getElementById('options').style.display = 'block';}else{document.getElementById('options').style.display = 'none';}"><?php echo get_lang('EditTimeLimit') ?></a> <a href="javascript://" onclick="if(document.getElementById('options').style.display == 'none'){document.getElementById('options').style.display = 'block';}else{document.getElementById('options').style.display = 'none';}"><?php echo get_lang('EditTimeLimit') ?></a>
</div> </div>
</div> </div>
@ -100,58 +100,58 @@ if (!empty($return)) {
<div class="col-sm-6"> <div class="col-sm-6">
<select name="day_start"> <select name="day_start">
<option value="1">01</option> <option value="1">01</option>
<option value="2" <?php if($day_start == 2) echo 'selected="selected"'; ?> >02</option> <option value="2" <?php if ($day_start == 2) echo 'selected="selected"'; ?> >02</option>
<option value="3" <?php if($day_start == 3) echo 'selected="selected"'; ?> >03</option> <option value="3" <?php if ($day_start == 3) echo 'selected="selected"'; ?> >03</option>
<option value="4" <?php if($day_start == 4) echo 'selected="selected"'; ?> >04</option> <option value="4" <?php if ($day_start == 4) echo 'selected="selected"'; ?> >04</option>
<option value="5" <?php if($day_start == 5) echo 'selected="selected"'; ?> >05</option> <option value="5" <?php if ($day_start == 5) echo 'selected="selected"'; ?> >05</option>
<option value="6" <?php if($day_start == 6) echo 'selected="selected"'; ?> >06</option> <option value="6" <?php if ($day_start == 6) echo 'selected="selected"'; ?> >06</option>
<option value="7" <?php if($day_start == 7) echo 'selected="selected"'; ?> >07</option> <option value="7" <?php if ($day_start == 7) echo 'selected="selected"'; ?> >07</option>
<option value="8" <?php if($day_start == 8) echo 'selected="selected"'; ?> >08</option> <option value="8" <?php if ($day_start == 8) echo 'selected="selected"'; ?> >08</option>
<option value="9" <?php if($day_start == 9) echo 'selected="selected"'; ?> >09</option> <option value="9" <?php if ($day_start == 9) echo 'selected="selected"'; ?> >09</option>
<option value="10" <?php if($day_start == 10) echo 'selected="selected"'; ?> >10</option> <option value="10" <?php if ($day_start == 10) echo 'selected="selected"'; ?> >10</option>
<option value="11" <?php if($day_start == 11) echo 'selected="selected"'; ?> >11</option> <option value="11" <?php if ($day_start == 11) echo 'selected="selected"'; ?> >11</option>
<option value="12" <?php if($day_start == 12) echo 'selected="selected"'; ?> >12</option> <option value="12" <?php if ($day_start == 12) echo 'selected="selected"'; ?> >12</option>
<option value="13" <?php if($day_start == 13) echo 'selected="selected"'; ?> >13</option> <option value="13" <?php if ($day_start == 13) echo 'selected="selected"'; ?> >13</option>
<option value="14" <?php if($day_start == 14) echo 'selected="selected"'; ?> >14</option> <option value="14" <?php if ($day_start == 14) echo 'selected="selected"'; ?> >14</option>
<option value="15" <?php if($day_start == 15) echo 'selected="selected"'; ?> >15</option> <option value="15" <?php if ($day_start == 15) echo 'selected="selected"'; ?> >15</option>
<option value="16" <?php if($day_start == 16) echo 'selected="selected"'; ?> >16</option> <option value="16" <?php if ($day_start == 16) echo 'selected="selected"'; ?> >16</option>
<option value="17" <?php if($day_start == 17) echo 'selected="selected"'; ?> >17</option> <option value="17" <?php if ($day_start == 17) echo 'selected="selected"'; ?> >17</option>
<option value="18" <?php if($day_start == 18) echo 'selected="selected"'; ?> >18</option> <option value="18" <?php if ($day_start == 18) echo 'selected="selected"'; ?> >18</option>
<option value="19" <?php if($day_start == 19) echo 'selected="selected"'; ?> >19</option> <option value="19" <?php if ($day_start == 19) echo 'selected="selected"'; ?> >19</option>
<option value="20" <?php if($day_start == 20) echo 'selected="selected"'; ?> >20</option> <option value="20" <?php if ($day_start == 20) echo 'selected="selected"'; ?> >20</option>
<option value="21" <?php if($day_start == 21) echo 'selected="selected"'; ?> >21</option> <option value="21" <?php if ($day_start == 21) echo 'selected="selected"'; ?> >21</option>
<option value="22" <?php if($day_start == 22) echo 'selected="selected"'; ?> >22</option> <option value="22" <?php if ($day_start == 22) echo 'selected="selected"'; ?> >22</option>
<option value="23" <?php if($day_start == 23) echo 'selected="selected"'; ?> >23</option> <option value="23" <?php if ($day_start == 23) echo 'selected="selected"'; ?> >23</option>
<option value="24" <?php if($day_start == 24) echo 'selected="selected"'; ?> >24</option> <option value="24" <?php if ($day_start == 24) echo 'selected="selected"'; ?> >24</option>
<option value="25" <?php if($day_start == 25) echo 'selected="selected"'; ?> >25</option> <option value="25" <?php if ($day_start == 25) echo 'selected="selected"'; ?> >25</option>
<option value="26" <?php if($day_start == 26) echo 'selected="selected"'; ?> >26</option> <option value="26" <?php if ($day_start == 26) echo 'selected="selected"'; ?> >26</option>
<option value="27" <?php if($day_start == 27) echo 'selected="selected"'; ?> >27</option> <option value="27" <?php if ($day_start == 27) echo 'selected="selected"'; ?> >27</option>
<option value="28" <?php if($day_start == 28) echo 'selected="selected"'; ?> >28</option> <option value="28" <?php if ($day_start == 28) echo 'selected="selected"'; ?> >28</option>
<option value="29" <?php if($day_start == 29) echo 'selected="selected"'; ?> >29</option> <option value="29" <?php if ($day_start == 29) echo 'selected="selected"'; ?> >29</option>
<option value="30" <?php if($day_start == 30) echo 'selected="selected"'; ?> >30</option> <option value="30" <?php if ($day_start == 30) echo 'selected="selected"'; ?> >30</option>
<option value="31" <?php if($day_start == 31) echo 'selected="selected"'; ?> >31</option> <option value="31" <?php if ($day_start == 31) echo 'selected="selected"'; ?> >31</option>
</select> </select>
/ /
<select name="month_start"> <select name="month_start">
<option value="1">01</option> <option value="1">01</option>
<option value="2" <?php if($month_start == 2) echo 'selected="selected"'; ?> >02</option> <option value="2" <?php if ($month_start == 2) echo 'selected="selected"'; ?> >02</option>
<option value="3" <?php if($month_start == 3) echo 'selected="selected"'; ?> >03</option> <option value="3" <?php if ($month_start == 3) echo 'selected="selected"'; ?> >03</option>
<option value="4" <?php if($month_start == 4) echo 'selected="selected"'; ?> >04</option> <option value="4" <?php if ($month_start == 4) echo 'selected="selected"'; ?> >04</option>
<option value="5" <?php if($month_start == 5) echo 'selected="selected"'; ?> >05</option> <option value="5" <?php if ($month_start == 5) echo 'selected="selected"'; ?> >05</option>
<option value="6" <?php if($month_start == 6) echo 'selected="selected"'; ?> >06</option> <option value="6" <?php if ($month_start == 6) echo 'selected="selected"'; ?> >06</option>
<option value="7" <?php if($month_start == 7) echo 'selected="selected"'; ?> >07</option> <option value="7" <?php if ($month_start == 7) echo 'selected="selected"'; ?> >07</option>
<option value="8" <?php if($month_start == 8) echo 'selected="selected"'; ?> >08</option> <option value="8" <?php if ($month_start == 8) echo 'selected="selected"'; ?> >08</option>
<option value="9" <?php if($month_start == 9) echo 'selected="selected"'; ?> >09</option> <option value="9" <?php if ($month_start == 9) echo 'selected="selected"'; ?> >09</option>
<option value="10" <?php if($month_start == 10) echo 'selected="selected"'; ?> >10</option> <option value="10" <?php if ($month_start == 10) echo 'selected="selected"'; ?> >10</option>
<option value="11" <?php if($month_start == 11) echo 'selected="selected"'; ?> >11</option> <option value="11" <?php if ($month_start == 11) echo 'selected="selected"'; ?> >11</option>
<option value="12" <?php if($month_start == 12) echo 'selected="selected"'; ?> >12</option> <option value="12" <?php if ($month_start == 12) echo 'selected="selected"'; ?> >12</option>
</select> </select>
/ /
<select name="year_start"> <select name="year_start">
<?php <?php
for($i=$thisYear-5;$i <= ($thisYear+5);$i++) for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++)
{ ?> { ?>
<option value="<?php echo $i; ?>" <?php if($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> <option value="<?php echo $i; ?>" <?php if ($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
<?php <?php
} ?> } ?>
</select> </select>
@ -163,61 +163,61 @@ if (!empty($return)) {
<div class="col-sm-6"> <div class="col-sm-6">
<select name="day_end"> <select name="day_end">
<option value="0">--</option> <option value="0">--</option>
<option value="1" <?php if($day_end == 1) echo 'selected="selected"'; ?> >01</option> <option value="1" <?php if ($day_end == 1) echo 'selected="selected"'; ?> >01</option>
<option value="2" <?php if($day_end == 2) echo 'selected="selected"'; ?> >02</option> <option value="2" <?php if ($day_end == 2) echo 'selected="selected"'; ?> >02</option>
<option value="3" <?php if($day_end == 3) echo 'selected="selected"'; ?> >03</option> <option value="3" <?php if ($day_end == 3) echo 'selected="selected"'; ?> >03</option>
<option value="4" <?php if($day_end == 4) echo 'selected="selected"'; ?> >04</option> <option value="4" <?php if ($day_end == 4) echo 'selected="selected"'; ?> >04</option>
<option value="5" <?php if($day_end == 5) echo 'selected="selected"'; ?> >05</option> <option value="5" <?php if ($day_end == 5) echo 'selected="selected"'; ?> >05</option>
<option value="6" <?php if($day_end == 6) echo 'selected="selected"'; ?> >06</option> <option value="6" <?php if ($day_end == 6) echo 'selected="selected"'; ?> >06</option>
<option value="7" <?php if($day_end == 7) echo 'selected="selected"'; ?> >07</option> <option value="7" <?php if ($day_end == 7) echo 'selected="selected"'; ?> >07</option>
<option value="8" <?php if($day_end == 8) echo 'selected="selected"'; ?> >08</option> <option value="8" <?php if ($day_end == 8) echo 'selected="selected"'; ?> >08</option>
<option value="9" <?php if($day_end == 9) echo 'selected="selected"'; ?> >09</option> <option value="9" <?php if ($day_end == 9) echo 'selected="selected"'; ?> >09</option>
<option value="10" <?php if($day_end == 10) echo 'selected="selected"'; ?> >10</option> <option value="10" <?php if ($day_end == 10) echo 'selected="selected"'; ?> >10</option>
<option value="11" <?php if($day_end == 11) echo 'selected="selected"'; ?> >11</option> <option value="11" <?php if ($day_end == 11) echo 'selected="selected"'; ?> >11</option>
<option value="12" <?php if($day_end == 12) echo 'selected="selected"'; ?> >12</option> <option value="12" <?php if ($day_end == 12) echo 'selected="selected"'; ?> >12</option>
<option value="13" <?php if($day_end == 13) echo 'selected="selected"'; ?> >13</option> <option value="13" <?php if ($day_end == 13) echo 'selected="selected"'; ?> >13</option>
<option value="14" <?php if($day_end == 14) echo 'selected="selected"'; ?> >14</option> <option value="14" <?php if ($day_end == 14) echo 'selected="selected"'; ?> >14</option>
<option value="15" <?php if($day_end == 15) echo 'selected="selected"'; ?> >15</option> <option value="15" <?php if ($day_end == 15) echo 'selected="selected"'; ?> >15</option>
<option value="16" <?php if($day_end == 16) echo 'selected="selected"'; ?> >16</option> <option value="16" <?php if ($day_end == 16) echo 'selected="selected"'; ?> >16</option>
<option value="17" <?php if($day_end == 17) echo 'selected="selected"'; ?> >17</option> <option value="17" <?php if ($day_end == 17) echo 'selected="selected"'; ?> >17</option>
<option value="18" <?php if($day_end == 18) echo 'selected="selected"'; ?> >18</option> <option value="18" <?php if ($day_end == 18) echo 'selected="selected"'; ?> >18</option>
<option value="19" <?php if($day_end == 19) echo 'selected="selected"'; ?> >19</option> <option value="19" <?php if ($day_end == 19) echo 'selected="selected"'; ?> >19</option>
<option value="20" <?php if($day_end == 20) echo 'selected="selected"'; ?> >20</option> <option value="20" <?php if ($day_end == 20) echo 'selected="selected"'; ?> >20</option>
<option value="21" <?php if($day_end == 21) echo 'selected="selected"'; ?> >21</option> <option value="21" <?php if ($day_end == 21) echo 'selected="selected"'; ?> >21</option>
<option value="22" <?php if($day_end == 22) echo 'selected="selected"'; ?> >22</option> <option value="22" <?php if ($day_end == 22) echo 'selected="selected"'; ?> >22</option>
<option value="23" <?php if($day_end == 23) echo 'selected="selected"'; ?> >23</option> <option value="23" <?php if ($day_end == 23) echo 'selected="selected"'; ?> >23</option>
<option value="24" <?php if($day_end == 24) echo 'selected="selected"'; ?> >24</option> <option value="24" <?php if ($day_end == 24) echo 'selected="selected"'; ?> >24</option>
<option value="25" <?php if($day_end == 25) echo 'selected="selected"'; ?> >25</option> <option value="25" <?php if ($day_end == 25) echo 'selected="selected"'; ?> >25</option>
<option value="26" <?php if($day_end == 26) echo 'selected="selected"'; ?> >26</option> <option value="26" <?php if ($day_end == 26) echo 'selected="selected"'; ?> >26</option>
<option value="27" <?php if($day_end == 27) echo 'selected="selected"'; ?> >27</option> <option value="27" <?php if ($day_end == 27) echo 'selected="selected"'; ?> >27</option>
<option value="28" <?php if($day_end == 28) echo 'selected="selected"'; ?> >28</option> <option value="28" <?php if ($day_end == 28) echo 'selected="selected"'; ?> >28</option>
<option value="29" <?php if($day_end == 29) echo 'selected="selected"'; ?> >29</option> <option value="29" <?php if ($day_end == 29) echo 'selected="selected"'; ?> >29</option>
<option value="30" <?php if($day_end == 30) echo 'selected="selected"'; ?> >30</option> <option value="30" <?php if ($day_end == 30) echo 'selected="selected"'; ?> >30</option>
<option value="31" <?php if($day_end == 31) echo 'selected="selected"'; ?> >31</option> <option value="31" <?php if ($day_end == 31) echo 'selected="selected"'; ?> >31</option>
</select> </select>
/ /
<select name="month_end"> <select name="month_end">
<option value="0">--</option> <option value="0">--</option>
<option value="1" <?php if($month_end == 1) echo 'selected="selected"'; ?> >01</option> <option value="1" <?php if ($month_end == 1) echo 'selected="selected"'; ?> >01</option>
<option value="2" <?php if($month_end == 2) echo 'selected="selected"'; ?> >02</option> <option value="2" <?php if ($month_end == 2) echo 'selected="selected"'; ?> >02</option>
<option value="3" <?php if($month_end == 3) echo 'selected="selected"'; ?> >03</option> <option value="3" <?php if ($month_end == 3) echo 'selected="selected"'; ?> >03</option>
<option value="4" <?php if($month_end == 4) echo 'selected="selected"'; ?> >04</option> <option value="4" <?php if ($month_end == 4) echo 'selected="selected"'; ?> >04</option>
<option value="5" <?php if($month_end == 5) echo 'selected="selected"'; ?> >05</option> <option value="5" <?php if ($month_end == 5) echo 'selected="selected"'; ?> >05</option>
<option value="6" <?php if($month_end == 6) echo 'selected="selected"'; ?> >06</option> <option value="6" <?php if ($month_end == 6) echo 'selected="selected"'; ?> >06</option>
<option value="7" <?php if($month_end == 7) echo 'selected="selected"'; ?> >07</option> <option value="7" <?php if ($month_end == 7) echo 'selected="selected"'; ?> >07</option>
<option value="8" <?php if($month_end == 8) echo 'selected="selected"'; ?> >08</option> <option value="8" <?php if ($month_end == 8) echo 'selected="selected"'; ?> >08</option>
<option value="9" <?php if($month_end == 9) echo 'selected="selected"'; ?> >09</option> <option value="9" <?php if ($month_end == 9) echo 'selected="selected"'; ?> >09</option>
<option value="10" <?php if($month_end == 10) echo 'selected="selected"'; ?> >10</option> <option value="10" <?php if ($month_end == 10) echo 'selected="selected"'; ?> >10</option>
<option value="11" <?php if($month_end == 11) echo 'selected="selected"'; ?> >11</option> <option value="11" <?php if ($month_end == 11) echo 'selected="selected"'; ?> >11</option>
<option value="12" <?php if($month_end == 12) echo 'selected="selected"'; ?> >12</option> <option value="12" <?php if ($month_end == 12) echo 'selected="selected"'; ?> >12</option>
</select> </select>
/ /
<select name="year_end"> <select name="year_end">
<option value="0">----</option> <option value="0">----</option>
<?php <?php
for($i=$thisYear-5;$i <= ($thisYear+5);$i++) for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++)
{ ?> { ?>
<option value="<?php echo $i; ?>" <?php if($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> <option value="<?php echo $i; ?>" <?php if ($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
<?php <?php
} ?> } ?>
</select> </select>
@ -238,7 +238,7 @@ if (!empty($return)) {
<script> <script>
<?php if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n"; ?> <?php if ($year_start == "0000") echo "setDisable(document.form.nolimit);\r\n"; ?>
function setDisable(select){ function setDisable(select){
document.form.day_start.disabled = (select.checked) ? true : false; document.form.day_start.disabled = (select.checked) ? true : false;
document.form.month_start.disabled = (select.checked) ? true : false; document.form.month_start.disabled = (select.checked) ? true : false;

@ -56,8 +56,8 @@ $id_coach = $sessionInfo['id_coach'];
$tool_name = get_lang('EditSession'); $tool_name = get_lang('EditSession');
//$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); //$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => "session_list.php","name" => get_lang('SessionList')); $interbreadcrumb[] = array('url' => "session_list.php", "name" => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name" => get_lang('SessionOverview')); $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id, "name" => get_lang('SessionOverview'));
if (isset($_POST['formSent']) && $_POST['formSent']) { if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent = 1; $formSent = 1;
@ -71,7 +71,7 @@ $sql = "SELECT user_id,lastname,firstname,username
WHERE status='1'".$order_clause; WHERE status='1'".$order_clause;
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $table_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$sql = "SELECT DISTINCT u.user_id,lastname,firstname,username $sql = "SELECT DISTINCT u.user_id,lastname,firstname,username
@ -87,7 +87,7 @@ $coaches = Database::store_result($result);
$thisYear = date('Y'); $thisYear = date('Y');
$coachesOption = array( $coachesOption = array(
'' => '----- ' . get_lang('None') . ' -----' '' => '----- '.get_lang('None').' -----'
); );
foreach ($coaches as $coach) { foreach ($coaches as $coach) {
@ -107,7 +107,7 @@ if ($categoriesList != false) {
} }
} }
$formAction = api_get_self() . '?'; $formAction = api_get_self().'?';
$formAction .= http_build_query(array( $formAction .= http_build_query(array(
'page' => Security::remove_XSS($_GET['page']), 'page' => Security::remove_XSS($_GET['page']),
'id' => $id 'id' => $id
@ -158,7 +158,7 @@ if ($form->validate()) {
$duration = null; $duration = null;
} }
$description = $params['description']; $description = $params['description'];
$showDescription = isset($params['show_description']) ? 1: 0; $showDescription = isset($params['show_description']) ? 1 : 0;
$sendSubscriptionNotification = isset($params['send_subscription_notification']); $sendSubscriptionNotification = isset($params['send_subscription_notification']);
$isThisImageCropped = isset($params['picture_crop_result']); $isThisImageCropped = isset($params['picture_crop_result']);
@ -195,7 +195,7 @@ if ($form->validate()) {
if ($return) { if ($return) {
Display::addFlash(Display::return_message(get_lang('Updated'))); Display::addFlash(Display::return_message(get_lang('Updated')));
header('Location: resume_session.php?id_session=' . $return); header('Location: resume_session.php?id_session='.$return);
exit(); exit();
} }
} }

@ -12,8 +12,8 @@
*/ */
$noPHP_SELF = false; $noPHP_SELF = false;
$nameTools = get_lang('FileUpload'); $nameTools = get_lang('FileUpload');
$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT)); $interbreadcrumb[] = array("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT));
Display::display_header($nameTools,"Doc"); Display::display_header($nameTools, "Doc");
//show the title //show the title
api_display_tool_title($nameTools.$add_group_to_title); api_display_tool_title($nameTools.$add_group_to_title);
?> ?>
@ -21,7 +21,7 @@ api_display_tool_title($nameTools.$add_group_to_title);
<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"> <div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;">
</div> </div>
<div id="upload_form_div" name="form_div" style="display:block;"> <div id="upload_form_div" name="form_div" style="display:block;">
<form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', ''));?>','upload_form_div');"> <form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', '')); ?>','upload_form_div');">
<input type="hidden" name="curdirpath" value="<?php echo $path; ?>"> <input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
<input type="hidden" name="tool" value="<?php echo $my_tool; ?>"> <input type="hidden" name="tool" value="<?php echo $my_tool; ?>">
<input type="file" name="user_file"> <input type="file" name="user_file">

Loading…
Cancel
Save