skala
Juan Carlos Raña 14 years ago
commit b5acff4e60
  1. 7
      documentation/changelog.html
  2. 4
      main/admin/configure_inscription.php
  3. 86
      main/admin/index.php
  4. 2
      main/admin/session_add.php
  5. 2
      main/admin/session_edit.php
  6. 1
      main/admin/settings.php
  7. 17
      main/admin/statistics/statistics.lib.php
  8. 6
      main/auth/conditional_login/complete_phone_number.php
  9. 47
      main/auth/conditional_login/conditional_login.php
  10. 34
      main/auth/lostPassword.php
  11. 3
      main/css/base.css
  12. 80
      main/document/showinframes.php
  13. 11
      main/exercice/exercise_submit.php
  14. 4
      main/exercice/question_pool.php
  15. 31
      main/inc/lib/banner.lib.php
  16. 11
      main/inc/lib/conditional_login.class.php
  17. 111
      main/inc/lib/course.lib.php
  18. 35
      main/inc/lib/display.lib.php
  19. 12
      main/inc/lib/document.lib.php
  20. 10
      main/inc/lib/fckeditor/editor/_source/internals/fck.js
  21. 4
      main/inc/lib/fckeditor/editor/fckeditor.original.html
  22. 2
      main/inc/lib/fckeditor/editor/js/fckeditorcode_gecko.js
  23. 2
      main/inc/lib/fckeditor/editor/js/fckeditorcode_ie.js
  24. 209
      main/inc/lib/formvalidator/Element/html_editor.php
  25. 20
      main/inc/lib/group_portal_manager.lib.php
  26. 70
      main/inc/lib/login.lib.php
  27. 189
      main/inc/lib/main_api.lib.php
  28. 85
      main/inc/lib/message.lib.php
  29. 4
      main/inc/lib/social.lib.php
  30. 66
      main/inc/lib/template.lib.php
  31. 21
      main/inc/lib/userportal.lib.php
  32. 65
      main/inc/local.inc.php
  33. 27
      main/mySpace/myStudents.php
  34. 2
      main/newscorm/lp_list.php
  35. 11
      main/newscorm/lp_view.php
  36. 4
      main/newscorm/scorm_api.php
  37. 12
      main/social/group_members.php
  38. 6
      main/social/group_topics.php
  39. 4
      main/social/message_for_group_form.inc.php
  40. 2
      main/template/default/layout/footer.tpl
  41. 2
      main/template/default/layout/head.tpl
  42. 45
      main/template/default/layout/hot_courses.tpl
  43. 149
      main/template/default/layout/topbar.tpl
  44. 40
      main/tracking/userLog.php
  45. 44
      main/tracking/userlogCSV.php
  46. 4
      main/user/class.php
  47. 6
      main/user/subscribe_class.php
  48. 115
      main/user/subscribe_user.php
  49. 126
      main/user/user.php
  50. 10
      main/user/userInfo.php

@ -200,11 +200,10 @@ This version of Chamilo only includes new features:
</ul>
<h3>Known issues</h3>
<ul>
<li>
<b>Document title:</b> The option to NOT use a document title different than the filename in the documents tool has been removed. This means that if this setting was not set to the default option in your Chamilo option or if you have a very old installation that you have been upgrading over the years, you might experience problems accessing the documents. In this case, we recommend contacting an official provider of Chamilo to take this migration in charge.
</li>
<li><b>Document title:</b> The option to NOT use a document title different than the filename in the documents tool has been removed. This means that if this setting was not set to the default option in your Chamilo option or if you have a very old installation that you have been upgrading over the years, you might experience problems accessing the documents. In this case, we recommend contacting an official provider of Chamilo to take this migration in charge.</li>
<li>During upgrade, if your database ends with "c_", the installation process will report errors in the PHP error log. This is due to a check on the new c_id field for database normalization, but is not important. The corresponding logging code can be disabled in database.lib.php</li>
<li>Agenda regression: because we implemented a much more usable and familiar agenda for most of you, and because we lacked some time to go into the details, we have temporarily removed the possibility to make an event visible to specific users (they are always visible to all the course users right now) - see task #5201 for details</li>
<li>Exercises: When reviewing an exercise, hotspot questions results are not remembered see #3980</li>
</ul>
<h3>Third-Party Libraries additions/updates</h3>
@ -684,7 +683,7 @@ This version of Chamilo only includes a few minor new features:
<li>If you used split users directories before v1.8.8 in combination with the "My files" feature (if it existed at all at that point), you will probably have a problem now, as the code in the previous version was wrong and was saving the personal portfolio file in another directory than the user's. Sorry about that. If you need professional assistance, see the http://www.chamilo.org/ website under support -> professional support for official providers who could help you. And don't forget to keep a backup. If you don't understand a thing about what I'm talking about, you are probable not concerned by this bug, so don't worry too much.</li>
<li>For some reason, we have been reported unsuccessful migrations from 1.8.7 to 1.8.7.1 whereby the course_rel_user table was not integrally copied. We recommend keeping your database backup until you're sure every student/course relationship was copied (comparing the lines in the table before and after migration might help you)</li>
<li>Document tool: when moving an HTML file using the "move" funcionality, images, videos and any incrusted file in that HTML will not be moved automatically see #1278 </li>
<li>Hotpotatoes: When taking a Hotpotato exam added to Chamilo there is a javascript error, this bug can be only reproduced using Google Chrome see #3332</li>
<li>Hotpotatoes: When taking a Hotpotato exam added to Chamilo there is a javascript error, this bug can be only reproduced using Google Chrome see #3332</li>
</ul>
<h3>Deprecated features</h3>

@ -301,10 +301,6 @@ if (get_setting('allow_terms_conditions') == 'true') {
$form->addElement('hidden', 'legal_accept_type', $term_preview['version'].':'.$term_preview['language_id']);
$form->addElement('hidden', 'legal_info', $term_preview['legal_id'].':'.$term_preview['language_id']);
/*if (isset($_SESSION['term_and_condition']['user_id']) && isset($_SESSION['term_and_condition']['password'])) {
$form->addElement('hidden', 'login', $_SESSION['term_and_condition']['user_id']);
$form->addElement('hidden', 'password', $_SESSION['term_and_condition']['password']);
}*/
if ($term_preview['type'] == 1) {
$form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>');
$form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required');

@ -175,65 +175,37 @@ if (api_is_platform_admin()) {
}
/* Sessions */
$blocks['sessions']['icon'] = Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
$blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
$search_form = ' <form method="GET" class="form-search" action="session_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['sessions']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=>'session_list.php', 'label' => get_lang('ListSession'));
$items[] = array('url'=>'session_add.php', 'label' => get_lang('AddSession'));
$items[] = array('url'=>'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
$items[] = array('url'=>'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession'));
}
$items[] = array('url'=>'session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
$items[] = array('url'=>'../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
//if (api_get_setting('use_session_mode') == 'true') {
if (true) {
$blocks['sessions']['icon'] = Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
$blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
$search_form = ' <form method="GET" class="form-search" action="session_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['sessions']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=>'session_list.php', 'label' => get_lang('ListSession'));
$items[] = array('url'=>'session_add.php', 'label' => get_lang('AddSession'));
$items[] = array('url'=>'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
$items[] = array('url'=>'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession'));
}
$items[] = array('url'=>'session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
$items[] = array('url'=>'../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
if (api_is_platform_admin()) {
if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) { // option only visible in development mode. Enable through code if required
$items[] = array('url'=>'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
}
$items[] = array('url'=>'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
}
$items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
$blocks['sessions']['items'] = $items;
$blocks['sessions']['extra'] = null;
if (api_is_platform_admin()) {
if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) { // option only visible in development mode. Enable through code if required
$items[] = array('url'=>'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
}
$items[] = array('url'=>'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
}
} elseif (api_is_platform_admin()) {
$items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
$blocks['sessions']['items'] = $items;
$blocks['sessions']['extra'] = null;
/*$blocks['classes']['items'] = $items;
$blocks['classes']['icon'] = Display::return_icon('group.gif', get_lang('AdminClasses'), array(), ICON_SIZE_SMALL, false);
$blocks['classes']['label'] = api_ucfirst(get_lang('AdminClasses'));
$search_form = ' <form method="POST" class="form-search" action="class_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">.'.get_lang('Search').'</button>
</form>';
$blocks['classes']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=>'class_list.php', 'label' => get_lang('ClassList'));
$items[] = array('url'=>'class_add.php', 'label' => get_lang('AddClasses'));
$items[] = array('url'=>'class_import.php', 'label' => get_lang('ImportClassListCSV'));
$items[] = array('url'=>'class_user_import.php', 'label' => get_lang('AddUsersToAClass'));
$items[] = array('url'=>'subscribe_class2course.php', 'label' => get_lang('AddClassesToACourse'));
$items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
$blocks['classes']['items'] = $items;
$blocks['classes']['extra'] = null;*/
}
/* Settings */
if (api_is_platform_admin()) {
@ -407,6 +379,7 @@ function check_system_version() {
// The number of users
$number_of_users = statistics::count_users();
$number_of_active_users = statistics::count_users(null,null,null,true);
$data = array(
'url' => api_get_path(WEB_PATH),
@ -415,6 +388,7 @@ function check_system_version() {
'version' => $system_version,
'numberofcourses' => $number_of_courses,
'numberofusers' => $number_of_users,
'numberofactiveusers' => $number_of_active_users,
//The donotlistcampus setting recovery should be improved to make
// it true by default - this does not affect numbers counting
'donotlistcampus' => api_get_setting('donotlistcampus'),

@ -155,7 +155,7 @@ echo '</div>';
<?php echo get_lang('SessionName') ?>
</label>
<div class="controls">
<input type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); ?>">
<input type="text" name="name" class="span4" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); ?>">
</div>
</div>

@ -115,7 +115,7 @@ if (!empty($return)) {
<?php echo get_lang('SessionName') ?>
</label>
<div class="controls">
<input 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 type="text" name="name" class="span4" 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="control-group">

@ -40,6 +40,7 @@ api_protect_admin_script();
// Settings to avoid
$settings_to_avoid = array(
'use_session_mode' => 'true',
'gradebook_enable' => 'false',
'example_material_course_creation' => 'true' // ON by default - now we have this option when we create a course
);

@ -48,10 +48,11 @@ class Statistics {
* Count users
* @param int optional, user status (COURSEMANAGER or STUDENT), if it's not setted it'll count all users.
* @param string optional, code of a course category. Default: count only users without filtering category
* @todo count invisible courses
* @param bool count invisible courses (todo)
* @param bool count only active users (false to only return currently active users)
* @return int Number of users counted
*/
function count_users($status = null, $category_code = null, $count_invisible_courses = true) {
function count_users($status = null, $category_code = null, $count_invisible_courses = true, $only_active = false) {
global $_configuration;
// Database table definitions
@ -60,19 +61,19 @@ class Statistics {
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id();
$active_filter = $only_active?' AND active=1':'';
$status_filter = isset($status)?' AND status = '.intval($status):'';
if ($_configuration['multiple_access_urls']) {
$status_filter = isset($status)?' AND status = '.intval($status):'';
$sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number FROM $user_table as u, $access_url_rel_user_table as url WHERE u.user_id=url.user_id AND access_url_id='".$current_url_id."' $status_filter ";
$sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number FROM $user_table as u, $access_url_rel_user_table as url WHERE u.user_id=url.user_id AND access_url_id='".$current_url_id."' $status_filter $active_filter";
if (isset ($category_code)) {
$sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number FROM $course_user_table cu, $course_table c, $access_url_rel_user_table as url WHERE c.code = cu.course_code AND c.category_code = '".Database::escape_string($category_code)."' AND cu.user_id=url.user_id AND access_url_id='".$current_url_id."' $status_filter ";
$sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number FROM $course_user_table cu, $course_table c, $access_url_rel_user_table as url WHERE c.code = cu.course_code AND c.category_code = '".Database::escape_string($category_code)."' AND cu.user_id=url.user_id AND access_url_id='".$current_url_id."' $status_filter $active_filter";
}
} else {
$status_filter = isset($status)?' WHERE status = '.intval($status):'';
$sql = "SELECT COUNT(DISTINCT(user_id)) AS number FROM $user_table $status_filter ";
$sql = "SELECT COUNT(DISTINCT(user_id)) AS number FROM $user_table WHERE 1=1 $status_filter $active_filter";
if (isset ($category_code)) {
$status_filter = isset($status)?' AND status = '.intval($status):'';
$sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number FROM $course_user_table cu, $course_table c WHERE c.code = cu.course_code AND c.category_code = '".Database::escape_string($category_code)."' $status_filter ";
$sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number FROM $course_user_table cu, $course_table c WHERE c.code = cu.course_code AND c.category_code = '".Database::escape_string($category_code)."' $status_filter $active_filter";
}
}

@ -1,7 +1,7 @@
<?php
require_once(dirname(__FILE__).'/../../inc/global.inc.php');
//require_once (api_get_path(LIBRARY_PATH).'conditionallogin.lib.php'); moved to autologin
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
/* For licensing terms, see /license.txt */
require_once dirname(__FILE__).'/../../inc/global.inc.php';
$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php';
if (! isset($_SESSION['conditional_login']['uid']))

@ -1,10 +1,22 @@
<?php
/*
This scrip is included by local.inc.php to redirect users to some url if some conditions are satisfied. Please populate the $dc_conditions array with a conditional function and an url. If the conditional function returns true the user will be redirected to URL at login
/* For licensing terms, see /license.txt */
This array must be filled for this module to work. This is an example asking the user to enter his phone number if it is empty. Note you can enter more than one condition in the array. They will be checked in the array order.
/*
This script is included by local.inc.php to redirect users to some url if some conditions are satisfied.
* Please populate the $dc_conditions array with a conditional function and an url.
* If the conditional function returns true the user will be redirected to URL at login.
* This array must be filled for this module to work.
* This is an example asking the user to enter his phone number if it is empty.
* Note you can enter more than one condition in the array. They will be checked in the array order.
*/
$dc_conditions = array();
array_push($dc_conditions, array(
// 'conditional_function' => 'check_platform_legal_conditions',
// 'url' => api_get_path(WEB_CODE_PATH).'auth/inscription.php'
));
//array_push($dc_conditions, array(
// 'conditional_function' => 'dc_check_phone_number',
// 'url' => api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'
@ -19,7 +31,7 @@ require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
*/
function dc_check_phone_number($user){
$uInfo = UserManager::get_user_info_by_id($user['user_id']);
if ( empty($uInfo['phone'])) {
if (empty($uInfo['phone'])) {
return true;
}
return false;
@ -27,5 +39,28 @@ function dc_check_phone_number($user){
function dc_check_first_login($user){
$uInfo = UserManager::get_user_info_by_id($user['user_id']);
return(($uInfo['extra']['already_logged_in'] === 'false'));
}
return $uInfo['extra']['already_logged_in'] === 'false';
}
function check_platform_legal_conditions($user) {
if (api_get_setting('allow_terms_conditions') == 'true') {
$term_and_condition_status = api_check_term_condition($user['user_id']);
// @todo not sure why we need the login password and update_term_status
if ($term_and_condition_status === false) {
$_SESSION['term_and_condition'] = array('user_id' => $user['user_id'],
//'login' => $user['username'],
//'password' => $user['password'],
//'update_term_status' => true,
);
return true;
/*header('Location: '.api_get_path(WEB_CODE_PATH).'auth/inscription.php');
exit;*/
} else {
unset($_SESSION['term_and_condition']);
return false;
}
} else {
//No validation
return true;
}
}

@ -109,36 +109,12 @@ if (isset($_GET['reset']) && isset($_GET['id'])) {
if ($form->validate()) {
$values = $form->exportValues();
$users_related_to_username = Login::get_user_accounts_by_username($values['user']);
if(strpos($values['user'],'@')){
$user = strtolower($values['user']);
$email = TRUE;
} else {
$user = strtolower($values['user']);
$email = FALSE;
}
$condition = '';
if ($email) {
$condition = "LOWER(email) = '".Database::escape_string($user)."' ";
} else {
$condition = "LOWER(username) = '".Database::escape_string($user)."'";
}
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$query = "SELECT user_id AS uid, lastname AS lastName, firstname AS firstName, ".
"username AS loginName, password, email, status AS status, ".
"official_code, phone, picture_uri, creator_id ".
"FROM ".$tbl_user." ".
"WHERE ( $condition ) ";
$result = Database::query($query);
$num_rows = Database::num_rows($result);
if ($result && $num_rows > 0) {
$by_username = true;
$users = Database::store_result($result);
foreach ($users as $user ) {
if ($users_related_to_username) {
$by_username = true;
foreach ($users_related_to_username as $user) {
if ($_configuration['password_encryption'] != 'none') {
Login::handle_encrypted_password($user, $by_username);
} else {

@ -2548,7 +2548,8 @@ div.admin_section h4 {
}
.topics_grid_item {
/* margin-left:20px; */
border-bottom: 1px solid #CCCCCC;
margin-bottom: 20px;
}
#div_content_table {

@ -173,34 +173,6 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
// });';
}
if (!$jplayer_supported) {
$htmlHeadXtra[] = '<script type="text/javascript">
<!--
var jQueryFrameReadyConfigPath = \''.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js\';
-->
</script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';
$htmlHeadXtra[] = '<script>
<!--
var updateContentHeight = function() {
//HeaderHeight = document.getElementById("header").offsetHeight;
//FooterHeight = document.getElementById("footer").offsetHeight;
//document.getElementById("mainFrame").style.height = ((docHeight-(parseInt(HeaderHeight)+parseInt(FooterHeight)))+60)+"px";
my_iframe = document.getElementById("mainFrame");
//this doesnt seem to work in IE 7,8,9
new_height = my_iframe.contentWindow.document.body.scrollHeight;
my_iframe.height = my_iframe.contentWindow.document.body.scrollHeight + "px";
};
// Fixes the content height of the frame
window.onload = function() {
updateContentHeight();
'.$js_glossary_in_documents.'
}
-->
</script>';
}
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
@ -220,6 +192,8 @@ if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
</script>';
}
$execute_iframe = true;
if ($jplayer_supported) {
$extension = api_strtolower($pathinfo['extension']);
@ -251,11 +225,46 @@ if ($jplayer_supported) {
'.$jquery.'
});
</script>';
$execute_iframe = false;
}
if ($show_web_odf) {
$execute_iframe = false;
}
$is_nanogong_available = $pathinfo['extension']=='wav' && preg_match('/_chnano_.wav/i', $file_url_web) && api_get_setting('enable_nanogong') == 'true';
if ($is_nanogong_available){
$execute_iframe = false;
}
if (!$jplayer_supported && $execute_iframe) {
$htmlHeadXtra[] = '<script type="text/javascript">
<!--
var jQueryFrameReadyConfigPath = \''.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js\';
-->
</script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';
$htmlHeadXtra[] = '<script>
<!--
var updateContentHeight = function() {
my_iframe = document.getElementById("mainFrame");
//this doesnt seem to work in IE 7,8,9
new_height = my_iframe.contentWindow.document.body.scrollHeight;
my_iframe.height = my_iframe.contentWindow.document.body.scrollHeight + "px";
};
// Fixes the content height of the frame
window.onload = function() {
updateContentHeight();
'.$js_glossary_in_documents.'
}
-->
</script>';
}
Display::display_header('');
$execute_iframe = true;
echo '<div align="center">';
$file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
@ -268,19 +277,17 @@ if (in_array(strtolower($pathinfo['extension']) , array('html', "htm"))) {
if ($show_web_odf) {
//echo Display::url(get_lang('Show'), api_get_path(WEB_CODE_PATH).'document/edit_odf.php?id='.$document_data['id'], array('class' => 'btn'));
echo '<div id="odf"></div>';
$execute_iframe = false;
echo '<div id="odf"></div>';
}
echo '</div>';
if ($jplayer_supported) {
if ($jplayer_supported) {
echo '<br /><div class="span12" style="margin:0 auto; width:100%; text-align:center;">';
echo DocumentManager::generate_video_preview($document_data);
echo '</div>';
$execute_iframe = false;
echo '</div>';
}
if ($pathinfo['extension']=='wav' && preg_match('/_chnano_.wav/i', $file_url_web) && api_get_setting('enable_nanogong') == 'true'){
if ($is_nanogong_available){
echo '<div align="center">';
echo '<br/>';
echo '<applet id="applet" archive="../inc/lib/nanogong/nanogong.jar" code="gong.NanoGong" width="160" height="40">';
@ -289,8 +296,7 @@ if ($pathinfo['extension']=='wav' && preg_match('/_chnano_.wav/i', $file_url_web
echo '<param name="ShowTime" value="true" />';
echo '<param name="ShowRecordButton" value="false" />';
echo '</applet>';
echo '</div>';
$execute_iframe = false;
echo '</div>';
}
if ($execute_iframe) {

@ -740,8 +740,7 @@ if (!empty($error)) {
$number_of_hotspot_questions = 0;
$onsubmit = '';
$i = 0;
//i have a doubt in this line cvargas
//var_dump($questionList);
if (!strcmp($questionList[0], '') === 0) {
foreach ($questionList as $questionId) {
$i++;
@ -782,6 +781,8 @@ if (!empty($error)) {
//$(this).find(".exercise_save_now_button").hide();
$(this).removeClass("question_highlight");
});
$(".no_remind_highlight").hide();
});
@ -973,6 +974,12 @@ if (!empty($error)) {
$user_choice = $attempt_list[$questionId];
$remind_highlight = '';
//Hides questions when reviewing a ALL_ON_ONE_PAGE exercise see #4542 no_remind_highlight class hide with jquery
if ($objExercise->type == ALL_ON_ONE_PAGE && isset($_GET['reminder']) && $_GET['reminder'] == 2) {
$remind_highlight = 'no_remind_highlight';
}
$exercise_actions = '';
$is_remind_on = false;

@ -288,10 +288,6 @@ echo '<input type="hidden" name="fromExercise" value="'.$fromExercise.'">';
$session_list = SessionManager::get_sessions_by_coach(api_get_user_id());
$tabAttrParam = array('class'=>'chzn-select', 'onchange'=>'submit_form(this)'); // when sessions are used
$labelFormRow = get_lang('Session');
if (api_get_setting('use_session_mode') == 'false') {
$tabAttrParam = array('style'=>'visibility:hidden', 'onchange'=>'submit_form(this)');
$labelFormRow = "";
}
$session_select_list = array();
foreach($session_list as $item) {
$session_select_list[$item['id']] = $item['name'];

@ -25,22 +25,17 @@ function get_tabs() {
$navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage');
// My Courses
if (api_get_setting('use_session_mode')=='true') {
if(api_is_allowed_to_create_course()) {
// Link to my courses for teachers
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
$navigation['mycourses']['title'] = get_lang('MyCourses');
} else {
// Link to my courses for students
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
} else {
// Link to my courses
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
if(api_is_allowed_to_create_course()) {
// Link to my courses for teachers
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
$navigation['mycourses']['title'] = get_lang('MyCourses');
} else {
// Link to my courses for students
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
// My Profile
$navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
@ -197,7 +192,7 @@ function return_notification_menu() {
}
// Display the who's online for the session
if (api_get_setting('use_session_mode') == 'true' && isset($user_id) && api_get_session_id() != 0) {
if (isset($user_id) && api_get_session_id() != 0) {
$html .= '<li><a href="'.api_get_path(WEB_PATH).'whoisonlinesession.php?id_coach='.$user_id.'&amp;referer='.urlencode($_SERVER['REQUEST_URI']).'" target="_top">'.
Display::return_icon('session.png', get_lang('UsersConnectedToMySessions'), array(), ICON_SIZE_TINY).' </a></li>';
}
@ -490,7 +485,7 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
break;
default:
if (api_get_setting('use_session_mode') == 'true' && api_get_session_id() != -1 ) {
if (api_get_session_id() != -1 ) {
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
} else {
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name']).' '.$course_title;

@ -1,14 +1,17 @@
<?php
// Conditional login
// Used to implement the loading of custom pages
// 2011, Noel Dieschburg <noel@cblue.be>
/* For licensing terms, see /license.txt */
/*
* Conditional login
* Used to implement the loading of custom pages
* 2011, Noel Dieschburg <noel@cblue.be>
*/
class ConditionalLogin {
public static function check_conditions($user) {
if (file_exists(api_get_path(SYS_PATH).'main/auth/conditional_login/conditional_login.php')) {
include_once api_get_path(SYS_PATH).'main/auth/conditional_login/conditional_login.php';
if (isset($dc_conditions)){
if (isset($dc_conditions)) {
foreach ($dc_conditions as $dc_condition) {
if (isset($dc_condition['conditional_function']) && $dc_condition['conditional_function']($user)) {
$_SESSION['conditional_login']['uid'] = $user['user_id'];

@ -1323,7 +1323,7 @@ class CourseManager {
// students subscribed to the course through a session
if (api_get_setting('use_session_mode') == 'true' && $with_session) {
if ($with_session) {
$sql_query = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." WHERE course_code = '$course_code' AND status<>2";
if ($session_id != 0) {
$sql_query .= ' AND id_session = '.$session_id;
@ -2782,9 +2782,7 @@ class CourseManager {
$html .= '<div class="row">';
$html .= '<div class="span7">';
$html .= ' <div class="row">';
$html .= '<div class="span1">';
if (!empty($params['link'])) {
$html .= '<a class="thumbnail" href="'.$params['link'].'">';
$html .= $params['icon'];
@ -2853,14 +2851,12 @@ class CourseManager {
$rs_special_course = Database::query($sql);
$number_of_courses = Database::num_rows($rs_special_course);
$key = 0;
$status_icon = '';
$html = '';
if ($number_of_courses > 0) {
while ($course = Database::fetch_array($rs_special_course)) {
$course_info = api_get_course_info($course['code']);
$params = array();
// Get notifications.
//$course['id_session'] = null;
@ -2876,7 +2872,7 @@ class CourseManager {
$params['icon'] = Display::return_icon('blackboard.png', $course_info['title'], array(), ICON_SIZE_LARGE);
$params['right_actions'] = '';
$params['right_actions'] = '';
if (api_is_platform_admin()) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
@ -2889,9 +2885,11 @@ class CourseManager {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
}
} else {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course['real_id'].'_0', 'class'=>'document_preview_container'));
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course['real_id'].'_0', 'class'=>'document_preview_container'));
}
}
}
@ -2912,7 +2910,11 @@ class CourseManager {
$params['title'] = $course_title;
$params['link'] = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/?id_session=0&amp;autoreg=1';
$params['notifications'] = $show_notification;
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $show_notification;
}
$html .= self::course_item_html($params, false);
$key++;
}
@ -2993,7 +2995,6 @@ class CourseManager {
$result = Database::query($sql_select_courses);
$key = 0;
$status_icon = '';
$html = '';
// Browse through all courses.
@ -3026,12 +3027,14 @@ class CourseManager {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
}
} else {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container'));
} else {
if ($course_info['status'] == COURSEMANAGER) {
$params['right_actions'].= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container'));
} else {
if ($course_info['status'] == COURSEMANAGER) {
$params['right_actions'].= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
}
}
}
}
@ -3057,7 +3060,10 @@ class CourseManager {
$params['icon'] = $status_icon;
$params['title'] = $course_title;
$params['teachers'] = $teachers;
$params['notifications'] = $show_notification;
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $show_notification;
}
$is_subcontent = true;
if (empty($user_category_id)) {
@ -3138,7 +3144,7 @@ class CourseManager {
$course_info['id_session'] = $session_id;
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
if (!$nosession) {
global $now, $date_start, $date_end;
}
@ -3152,30 +3158,6 @@ class CourseManager {
$user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_info['code']);
// Function logic - act on the data.
/*
$is_virtual_course = CourseManager :: is_virtual_course_from_system_code($course_info['code']);
if ($is_virtual_course) {
// If the current user is also subscribed in the real course to which this
// virtual course is linked, we don't need to display the virtual course entry in
// the course list - it is combined with the real course entry.
$target_course_code = CourseManager :: get_target_of_linked_course($course_info['code']);
$is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course(api_get_user_id(), $target_course_code);
if ($is_subscribed_in_target_course) {
return; //do not display this course entry
}
}
$has_virtual_courses = CourseManager :: has_virtual_courses_from_code($course_info['code'], api_get_user_id());
if ($has_virtual_courses) {
$return_result = CourseManager :: determine_course_title_from_course_info(api_get_user_id(), $course_info);
$course_display_title = $return_result['name'];
$course_display_code = $return_result['code'];
} else {
$course_display_title = $course_info['name'];
$course_display_code = $course_info['official_code'];
}*/
$is_coach = api_is_coach($course_info['id_session'], $course['code']);
// Display course entry.
@ -3185,7 +3167,7 @@ class CourseManager {
if ($session_accessible) {
if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) {
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
if (!$nosession) {
if (empty($course_info['id_session'])) {
$course_info['id_session'] = 0;
}
@ -3210,9 +3192,12 @@ class CourseManager {
$params['title'] = $session_title;
$params['right_actions'] = '';
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_'.$course_info['id_session'].'" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_'.$course_info['id_session'], 'class'=>'document_preview_container'));
if ($course_visibility != COURSE_VISIBILITY_CLOSED) {
if ($load_dirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_'.$course_info['id_session'].'" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_'.$course_info['id_session'], 'class'=>'document_preview_container'));
}
}
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
@ -3220,7 +3205,7 @@ class CourseManager {
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
if (!$nosession) {
$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code'], self::USER_SEPARATOR, true);
$course_coachs = CourseManager::get_coachs_from_course_to_string($course_info['id_session'], $course['code'], self::USER_SEPARATOR, true);
@ -3228,7 +3213,7 @@ class CourseManager {
$params['teachers'] = $teacher_list;
}
if (($course_info['status'] == STUDENT && !empty($course_info['id_session'])) || ($is_coach && $course_info['status'] != COURSEMANAGER)) {
$params['coaches'] = $course_coachs;
$params['coaches'] = $course_coachs;
}
} else {
$params['teachers'] = $teacher_list;
@ -3238,7 +3223,9 @@ class CourseManager {
$session_title .= isset($course['special_course']) ? ' '.Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : '';
// Display the "what's new" icons
$session_title .= Display :: show_notification($course_info);
if ($course_visibility != COURSE_VISIBILITY_CLOSED) {
$session_title .= Display :: show_notification($course_info);
}
$params['title'] = $session_title;
$params['extra'] = '';
@ -3246,7 +3233,7 @@ class CourseManager {
$html = self::course_item_html($params, true);
$session_category_id = null;
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
if (!$nosession) {
$session = '';
$active = false;
if (!empty($course_info['session_name'])) {
@ -3678,7 +3665,8 @@ class CourseManager {
}
}
$table_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$table_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
//@todo all dates in the tracking_course_access, last_access are in the DB time (NOW) not UTC
/*
@ -3691,8 +3679,11 @@ class CourseManager {
//$table_course_access table uses the now() and interval ...
$sql = "SELECT COUNT(course_access_id) course_count, course_code FROM $table_course_access
WHERE login_course_date <= now() AND login_course_date > DATE_SUB(now(), INTERVAL $days DAY)
$sql = "SELECT COUNT(course_access_id) course_count, a.course_code, visibility FROM $table_course c INNER JOIN $table_course_access a
ON (c.code = a.course_code)
WHERE login_course_date <= now() AND
login_course_date > DATE_SUB(now(), INTERVAL $days DAY) AND
visibility <> '".COURSE_VISIBILITY_CLOSED."'
GROUP BY course_code
ORDER BY course_count DESC
LIMIT $limit";
@ -3704,25 +3695,25 @@ class CourseManager {
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
foreach ($courses as &$my_course) {
$course_info = api_get_course_info($my_course['course_code']);
$course_info = api_get_course_info($my_course['course_code']);
$my_course['extra_info'] = $course_info;
$my_course['extra_info']['go_to_course_button'] = '';
//Course visibility
if (api_is_platform_admin() || (
$course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD ||
($course_info['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM && api_user_is_login()) || in_array($course_info['real_id'], $my_course_code_list) && $course_info['visibility'] != COURSE_VISIBILITY_CLOSED )
($course_info['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM && api_user_is_login()) || in_array($course_info['real_id'], $my_course_code_list))
) {
$my_course['extra_info']['go_to_course_button'] = Display::url(get_lang('GoToCourse'), api_get_path(WEB_COURSE_PATH).$my_course['extra_info']['path'].'/index.php', array('class' => 'btn btn-primary'));
$my_course['extra_info']['go_to_course_button'] = Display::url(get_lang('GoToCourse'), api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php', array('class' => 'btn btn-primary'));
}
//Description
$my_course['extra_info']['description_button'] = '';
if ($course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || in_array($course_info['real_id'], $my_course_code_list) ) {
$my_course['extra_info']['description_button'] = Display::url(get_lang('Description'), api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=show_course_information&code='.$my_course['course_code'], array('class' => 'ajax btn'));
$my_course['extra_info']['description_button'] = Display::url(get_lang('Description'), api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=show_course_information&code='.$course_info['code'], array('class' => 'ajax btn'));
}
$my_course['extra_info']['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($my_course['course_code']);
$my_course['extra_info']['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
$point_info = self::get_course_ranking($course_info['real_id'], 0);
$my_course['extra_info']['rating_html'] = Display::return_rating_system('star_'.$course_info['real_id'], $ajax_url.'&amp;course_id='.$course_info['real_id'], $point_info);
}

@ -1005,37 +1005,6 @@ class Display {
return $table->toHtml();
}
/**
* Display dashboard link
*
*/
/*function display_dashboard_link() {
echo '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}*/
/**
* Display edit course list links
*
*/
/*function display_edit_course_list_links() {
echo '<li><a href="main/auth/courses.php">'.get_lang('CourseManagement').'</a></li>';
}*/
/**
* Show history sessions
*
*/
/*
function display_history_course_session() {
if (api_get_setting('use_session_mode') == 'true') {
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
echo '<li><a href="user_portal.php">'.get_lang('DisplayTrainingList').'</a></li>';
} else {
echo '<li><a href="user_portal.php?history=1">'.get_lang('HistoryTrainingSessions').'</a></li>';
}
}
}*/
/**
* Returns the "what's new" icon notifications
*
@ -1251,12 +1220,12 @@ class Display {
function get_session_title_box($session_id) {
global $nosession;
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
if (!$nosession) {
global $now, $date_start, $date_end;
}
$output = array();
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
if (!$nosession) {
$main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session_category = Database :: get_main_table(TABLE_MAIN_SESSION_CATEGORY);

@ -797,11 +797,11 @@ class DocumentManager {
}
if (!empty($document_id)) {
$sql= 'SELECT a.insert_user_id, b.readonly FROM '.$TABLE_PROPERTY.' a,'.$TABLE_DOCUMENT.' b
$sql= "SELECT a.insert_user_id, b.readonly FROM $TABLE_PROPERTY a, $TABLE_DOCUMENT b
WHERE
a.c_id = $course_id AND
b.c_id = $course_id AND
a.ref = b.id and a.ref='.$document_id.' LIMIT 1';
a.ref = b.id and a.ref= $document_id LIMIT 1";
$resultans = Database::query($sql);
$doc_details = Database ::fetch_array($resultans, 'ASSOC');
@ -1306,7 +1306,7 @@ class DocumentManager {
}
$sql='UPDATE '.$tbl_category.' SET document_id="'.Database::escape_string($document_id).'"
WHERE course_code="'.Database::escape_string($course_id).'" '.$sql_session;
$rs=Database::query($sql);
Database::query($sql);
}
/**
@ -1461,7 +1461,7 @@ class DocumentManager {
$default_certificate=self::get_default_certificate_id($course_id);
if ((int)$default_certificate==(int)$default_certificate_id) {
$tbl_category=Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$session_id=api_get_session_id();
$session_id = api_get_session_id();
if ($session_id==0 || is_null($session_id)) {
$sql_session='AND (session_id='.Database::escape_string($session_id).' OR isnull(session_id)) ';
} elseif ($session_id>0) {
@ -1471,8 +1471,8 @@ class DocumentManager {
}
$sql='UPDATE '.$tbl_category.' SET document_id=null
WHERE course_code="'.Database::escape_string($course_id).'" AND document_id="'.$default_certificate_id.'" '.$sql_session;
$rs=Database::query($sql);
WHERE course_code="'.Database::escape_string($course_id).'" AND document_id="'.$default_certificate_id.'" '.$sql_session;
Database::query($sql);
}
}

@ -381,10 +381,10 @@ var FCK =
var oRegex ;
if ( sTags.length > 0 )
{
oRegex = new RegExp( '<(' + sTags + ')(?!\w|:)', 'gi' ) ;
oRegex = new RegExp( '<(' + sTags + ')(?!\w|:)', 'gi' ) ;
html = html.replace( oRegex, '<FCK:$1' ) ;
oRegex = new RegExp( '<\/(' + sTags + ')>', 'gi' ) ;
oRegex = new RegExp( '<\/(' + sTags + ')>', 'gi' ) ;
html = html.replace( oRegex, '<\/FCK:$1>' ) ;
}
@ -398,8 +398,10 @@ var FCK =
sTags = 'META' ;
if ( FCKBrowserInfo.IsIE )
sTags += '|HR' ;
oRegex = new RegExp( '<((' + sTags + ')(?=\\s|>|/)[\\s\\S]*?)/?>', 'gi' ) ;
//Fixes bug when editing meta tags see BT#4370
//oRegex = new RegExp( '<((' + sTags + ')(?=\\s|>|/)[\\s\\S]*?)/?>', 'gi' ) ;
oRegex = new RegExp( '<((' + sTags + ')(?=\s|>)[\s\S]*?)/?>', 'gi' ) ;
html = html.replace( oRegex, '<FCK:$1 />' ) ;
return html ;

@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
@ -375,7 +375,7 @@ function WaitForActive( editorInstance, newStatus )
// Gecko and Webkit browsers don't calculate well the IFRAME size so we must
// recalculate it every time the window size changes.
if ( FCKBrowserInfo.IsGecko || ( FCKBrowserInfo.IsSafari && !FCKBrowserInfo.IsSafari3 ) )
if ( FCKBrowserInfo.IsGecko || ( FCKBrowserInfo.IsSafari && !FCKBrowserInfo.IsSafari3 ) )
{
window.onresize = function( e )
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,120 +1,115 @@
<?php
/* For licensing terms, see /license.txt */
require_once 'HTML/QuickForm/textarea.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/fckeditor.php';
require_once api_get_path(LIBRARY_PATH) . 'fckeditor/fckeditor.php';
/**
* A html editor field to use with QuickForm
*/
class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
{
/**
* Full page
*/
var $fullPage;
var $fck_editor;
/**
* Class constructor
* @param string HTML editor name/id
* @param string HTML editor label
* @param string Attributes for the textarea
* @param array $editor_config Optional configuration settings for the online editor.
*/
function HTML_QuickForm_html_editor($elementName = null, $elementLabel = null, $attributes = null, $config = null)
{
// The global variable $fck_attribute has been deprecated. It stays here for supporting old external code.
global $fck_attribute;
* A html editor field to use with QuickForm
*/
class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea {
/**
* Full page
*/
var $fullPage;
var $fck_editor;
/**
* Class constructor
* @param string HTML editor name/id
* @param string HTML editor label
* @param string Attributes for the textarea
* @param array $editor_config Optional configuration settings for the online editor.
*/
function HTML_QuickForm_html_editor($elementName = null, $elementLabel = null, $attributes = null, $config = null) {
// The global variable $fck_attribute has been deprecated. It stays here for supporting old external code.
global $fck_attribute;
HTML_QuickForm_element :: HTML_QuickForm_element($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'html_editor';
$this->fullPage = false;
$name = $this->getAttribute('name');
$this->fck_editor = new FCKeditor($name);
HTML_QuickForm_element :: HTML_QuickForm_element($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'html_editor';
$this->fullPage = false;
$this->fck_editor->ToolbarSet = $fck_attribute['ToolbarSet'];
$this->fck_editor->Width = !empty($fck_attribute['Width']) ? $fck_attribute['Width'] : '990';
$this->fck_editor->Height = !empty($fck_attribute['Height']) ? $fck_attribute['Height'] : '400';
//We get the optionnals config parameters in $fck_attribute array
$this->fck_editor->Config = !empty($fck_attribute['Config']) ? $fck_attribute['Config'] : array();
$name = $this->getAttribute('name');
$this -> fck_editor = new FCKeditor($name);
// This is an alternative (a better) way to pass configuration data to the editor.
if (is_array($config)) {
foreach ($config as $key => $value) {
$this->fck_editor->Config[$key] = $config[$key];
}
if (isset($config['ToolbarSet'])) {
$this->fck_editor->ToolbarSet = $config['ToolbarSet'];
}
if (isset($config['Width'])) {
$this->fck_editor->Width = $config['Width'];
}
if (isset($config['Height'])) {
$this->fck_editor->Height = $config['Height'];
}
if (isset($config['FullPage'])) {
$this->fullPage = is_bool($config['FullPage']) ? $config['FullPage'] : ($config['FullPage'] === 'true');
}
}
}
$this->fck_editor->ToolbarSet = $fck_attribute['ToolbarSet'] ;
$this -> fck_editor->Width = !empty($fck_attribute['Width']) ? $fck_attribute['Width'] : '990';
$this -> fck_editor->Height = !empty($fck_attribute['Height']) ? $fck_attribute['Height'] : '400';
//We get the optionnals config parameters in $fck_attribute array
$this -> fck_editor->Config = !empty($fck_attribute['Config']) ? $fck_attribute['Config'] : array();
/**
* Check if the browser supports FCKeditor
*
* @access public
* @return boolean
*/
function browserSupported() {
return FCKeditor :: IsCompatible();
}
// This is an alternative (a better) way to pass configuration data to the editor.
if (is_array($config)) {
foreach ($config as $key => $value) {
$this->fck_editor->Config[$key] = $config[$key];
}
if (isset($config['ToolbarSet'])) {
$this->fck_editor->ToolbarSet = $config['ToolbarSet'];
}
if (isset($config['Width'])) {
$this->fck_editor->Width = $config['Width'];
}
if (isset($config['Height'])) {
$this->fck_editor->Height = $config['Height'];
}
if (isset($config['FullPage'])) {
$this->fullPage = is_bool($config['FullPage']) ? $config['FullPage'] : ($config['FullPage'] === 'true');
}
}
}
/**
* Return the HTML editor in HTML
* @return string
*/
function toHtml() {
$value = $this->getValue();
if ($this->fullPage) {
if (strlen(trim($value)) == 0) {
// TODO: To be considered whether here to be added DOCTYPE, language and character set declarations.
$value = '<html><head><title></title><style type="text/css" media="screen, projection">/*<![CDATA[*/body{font-family: arial, verdana, helvetica, sans-serif;font-size: 12px;}/*]]>*/</style></head><body></body></html>';
$this->setValue($value);
}
}
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
return $this->build_FCKeditor();
}
}
/**
* Check if the browser supports FCKeditor
*
* @access public
* @return boolean
*/
function browserSupported()
{
return FCKeditor :: IsCompatible();
}
/**
* Return the HTML editor in HTML
* @return string
*/
function toHtml()
{
$value = $this->getValue();
if ($this->fullPage) {
if (strlen(trim($value)) == 0) {
// TODO: To be considered whether here to be added DOCTYPE, language and character set declarations.
$value = '<html><head><title></title><style type="text/css" media="screen, projection">/*<![CDATA[*/body{font-family: arial, verdana, helvetica, sans-serif;font-size: 12px;}/*]]>*/</style></head><body></body></html>';
$this->setValue($value);
}
}
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
return $this->build_FCKeditor();
}
}
/**
* Returns the htmlarea content in HTML
*@return string
*/
function getFrozenHtml()
{
return $this->getValue();
}
/**
* Build this element using FCKeditor
*/
function build_FCKeditor()
{
$result = '';
if(! FCKeditor :: IsCompatible())
{
return parent::toHTML();
}
$this->fck_editor->Value= $this->getValue();
$result .= $this->fck_editor->CreateHtml();
/**
* Returns the htmlarea content in HTML
* @return string
*/
function getFrozenHtml() {
return $this->getValue();
}
//Add a link to open the allowed html tags window
//$result .= '<small><a href="#" onclick="MyWindow=window.open('."'".api_get_path(WEB_CODE_PATH)."help/allowed_html_tags.php?fullpage=". ($this->fullPage ? '1' : '0')."','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600,left=200,top=20'".'); return false;">'.get_lang('AllowedHTMLTags').'</a></small>';
return $result;
}
/**
* Build this element using FCKeditor
*/
function build_FCKeditor() {
if (!FCKeditor :: IsCompatible()) {
return parent::toHTML();
}
$this->fck_editor->Value = $this->getValue();
$result = $this->fck_editor->CreateHtml();
//Add a link to open the allowed html tags window
//$result .= '<small><a href="#" onclick="MyWindow=window.open('."'".api_get_path(WEB_CODE_PATH)."help/allowed_html_tags.php?fullpage=". ($this->fullPage ? '1' : '0')."','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600,left=200,top=20'".'); return false;">'.get_lang('AllowedHTMLTags').'</a></small>';
return $result;
}
}

@ -156,8 +156,7 @@ class GroupPortalManager {
public static function get_group_data($group_id)
{
$table = Database :: get_main_table(TABLE_MAIN_GROUP);
$group_id = intval($group_id);
$user_condition = '';
$group_id = intval($group_id);
$sql = "SELECT id, name, description, picture_uri, url, visibility FROM $table WHERE id = $group_id ";
$res = Database::query($sql);
$item = array();
@ -296,8 +295,7 @@ class GroupPortalManager {
$tag = Database :: get_main_table(TABLE_MAIN_TAG);
$table_group_rel_tag = Database :: get_main_table(TABLE_MAIN_GROUP_REL_TAG);
$group_id = intval($group_id);
$user_condition = '';
$sql = "SELECT tag FROM $tag t INNER JOIN $table_group_rel_tag gt ON (gt.tag_id= t.id) WHERE gt.group_id = $group_id ";
$res = Database::query($sql);
$tags = array();
@ -326,8 +324,7 @@ class GroupPortalManager {
* @return array Database::store_result of the result
* @author Julio Montoya
* */
public static function get_groups_by_user($user_id = '', $relation_type = GROUP_USER_PERMISSION_READER, $with_image = false) {
$where = '';
public static function get_groups_by_user($user_id = '', $relation_type = GROUP_USER_PERMISSION_READER, $with_image = false) {
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
$tbl_group = Database::get_main_table(TABLE_MAIN_GROUP);
$user_id = intval($user_id);
@ -365,8 +362,7 @@ class GroupPortalManager {
* @return array with group content
* @author Julio Montoya
* */
public static function get_groups_by_popularity($num = 6, $with_image = true) {
$where = '';
public static function get_groups_by_popularity($num = 6, $with_image = true) {
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
$tbl_group = Database::get_main_table(TABLE_MAIN_GROUP);
if (empty($num)) {
@ -403,8 +399,7 @@ class GroupPortalManager {
* @return array with group content
* @author Julio Montoya
* */
public static function get_groups_by_age($num = 6, $with_image = true) {
$where = '';
public static function get_groups_by_age($num = 6, $with_image = true) {
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
$tbl_group = Database::get_main_table(TABLE_MAIN_GROUP);
@ -647,7 +642,7 @@ class GroupPortalManager {
$sql = "UPDATE $table_group_rel_user
SET relation_type = ".intval($relation_type)." WHERE user_id = $user_id AND group_id = $group_id" ;
$result = Database::query($sql);
Database::query($sql);
}
@ -823,8 +818,7 @@ class GroupPortalManager {
$medium = self::resize_picture($source_file, 85);
$normal = self::resize_picture($source_file, 200);
$big = new Image($source_file); // This is the original picture.
$ok = false;
$big = new Image($source_file); // This is the original picture.
$ok = $small->send_image($path.'small_'.$filename)
&& $medium->send_image($path.'medium_'.$filename)
&& $normal->send_image($path.'big_'.$filename)

@ -21,7 +21,7 @@ class Login
/**
* Get user account list
*
* @param unknown_type $user
* @param array $user array with keys: email, password, uid, loginName
* @param boolean $reset
* @param boolean $by_username
* @return unknown
@ -80,7 +80,7 @@ class Login
/**
* This function sends the actual password to the user
*
* @param unknown_type $user
* @param int $user
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/
public static function send_password_to_user($user, $by_username = false)
@ -125,8 +125,7 @@ class Login
*
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/
public static function handle_encrypted_password($user, $by_username = false)
{
public static function handle_encrypted_password($user, $by_username = false) {
global $_configuration;
$email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT
@ -382,21 +381,20 @@ class Login
Session::write('_real_cid', $_real_cid);
// if a session id has been given in url, we store the session
if (api_get_setting('use_session_mode') == 'true') {
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
if (!empty($_GET['id_session'])) {
$_SESSION['id_session'] = intval($_GET['id_session']);
$sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"';
$rs = Database::query($sql);
list($_SESSION['session_name']) = Database::fetch_array($rs);
} else {
Session::erase('session_name');
Session::erase('id_session');
}
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
if (!empty($_GET['id_session'])) {
$_SESSION['id_session'] = intval($_GET['id_session']);
$sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"';
$rs = Database::query($sql);
list($_SESSION['session_name']) = Database::fetch_array($rs);
} else {
Session::erase('session_name');
Session::erase('id_session');
}
if (!isset($_SESSION['login_as'])) {
@ -785,5 +783,39 @@ class Login
}
}
}
/**
* Returns true if user exists in the platform when asking the password
*
* @param string $username (email or username)
* @return boolean
*/
function get_user_accounts_by_username($username) {
if (strpos($username,'@')){
$username = api_strtolower($username);
$email = true;
} else {
$username = api_strtolower($username);
$email = false;
}
$condition = '';
if ($email) {
$condition = "LOWER(email) = '".Database::escape_string($username)."' ";
} else {
$condition = "LOWER(username) = '".Database::escape_string($username)."'";
}
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$query = "SELECT user_id AS uid, lastname AS lastName, firstname AS firstName, username AS loginName, password, email,
status AS status, official_code, phone, picture_uri, creator_id
FROM $tbl_user
WHERE ( $condition AND active = 1) ";
$result = Database::query($query);
$num_rows = Database::num_rows($result);
if ($result && $num_rows > 0) {
return Database::store_result($result);
}
return false;
}
}

@ -4583,144 +4583,115 @@ function api_is_course_visible_for_user($userid = null, $cid = null) {
return true;
}
if (api_get_setting('use_session_mode') != 'true') {
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT tutor_id, status
FROM $course_user_table
WHERE user_id = '$userid' AND relation_type<>".COURSE_RELATION_TYPE_RRHH."
AND course_code = '$cid'
LIMIT 1";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
// This user have a recorded state for this course.
$cuData = Database::fetch_array($result);
$sql = "SELECT
tutor_id, status, role
FROM $tbl_course_user
WHERE
user_id = '$userid'
AND
relation_type <> '".COURSE_RELATION_TYPE_RRHH."'
AND
course_code = '$cid'
LIMIT 1";
$is_courseMember = true;
$is_courseTutor = ($cuData['tutor_id' ] == 1);
$is_courseAdmin = ($cuData['status'] == 1);
$result = Database::query($sql);
} else {
// This user has no status related to this course.
$is_courseMember = false;
$is_courseAdmin = false;
$is_courseTutor = false;
}
if (Database::num_rows($result) > 0) {
// This user has got a recorded state for this course.
$cuData = Database::fetch_array($result);
$is_courseAdmin = ($is_courseAdmin || $is_platformAdmin);
} else {
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$_courseUser['role'] = $cuData['role'];
$is_courseMember = true;
$is_courseTutor = ($cuData['tutor_id' ] == 1);
$is_courseAdmin = ($cuData['status'] == 1);
}
if (!$is_courseAdmin) {
// This user has no status related to this course.
// Is it the session coach or the session admin?
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql = "SELECT
tutor_id, status, role
FROM $tbl_course_user
WHERE
user_id = '$userid'
AND
relation_type <> '".COURSE_RELATION_TYPE_RRHH."'
AND
course_code = '$cid'
session.id_coach, session_admin_id, session.id
FROM
$tbl_session as session
INNER JOIN $tbl_session_course
ON session_rel_course.id_session = session.id
AND session_rel_course.course_code = '$cid'
LIMIT 1";
$result = Database::query($sql);
$row = Database::store_result($result);
if (Database::num_rows($result) > 0) {
// This user has got a recorded state for this course.
$cuData = Database::fetch_array($result);
$_courseUser['role'] = $cuData['role'];
$is_courseMember = true;
$is_courseTutor = ($cuData['tutor_id' ] == 1);
$is_courseAdmin = ($cuData['status'] == 1);
if ($row[0]['id_coach'] == $userid) {
$_courseUser['role'] = 'Professor';
$is_courseMember = true;
$is_courseTutor = true;
$is_courseAdmin = false;
$is_courseCoach = true;
$is_sessionAdmin = false;
Session::write('_courseUser',$_courseUser);
}
if (!$is_courseAdmin) {
// This user has no status related to this course.
// Is it the session coach or the session admin?
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql = "SELECT
session.id_coach, session_admin_id, session.id
FROM
$tbl_session as session
INNER JOIN $tbl_session_course
ON session_rel_course.id_session = session.id
AND session_rel_course.course_code = '$cid'
elseif ($row[0]['session_admin_id'] == $userid) {
$_courseUser['role'] = 'Professor';
$is_courseMember = false;
$is_courseTutor = false;
$is_courseAdmin = false;
$is_courseCoach = false;
$is_sessionAdmin = true;
} else {
// Check if the current user is the course coach.
$sql = "SELECT 1
FROM $tbl_session_course
WHERE session_rel_course.course_code = '$cid'
AND session_rel_course.id_coach = '$userid'
LIMIT 1";
$result = Database::query($sql);
$row = Database::store_result($result);
if ($row[0]['id_coach'] == $userid) {
//if ($row = Database::fetch_array($result)) {
if (Database::num_rows($result) > 0 ) {
$_courseUser['role'] = 'Professor';
$is_courseMember = true;
$is_courseTutor = true;
$is_courseAdmin = false;
$is_courseCoach = true;
$is_sessionAdmin = false;
Session::write('_courseUser',$_courseUser);
}
elseif ($row[0]['session_admin_id'] == $userid) {
$_courseUser['role'] = 'Professor';
$is_courseMember = false;
$is_courseTutor = false;
$is_courseAdmin = false;
$is_courseCoach = false;
$is_sessionAdmin = true;
} else {
// Check if the current user is the course coach.
$sql = "SELECT 1
FROM $tbl_session_course
WHERE session_rel_course.course_code = '$cid'
AND session_rel_course.id_coach = '$userid'
LIMIT 1";
$result = Database::query($sql);
//if ($row = Database::fetch_array($result)) {
if (Database::num_rows($result) > 0 ) {
$_courseUser['role'] = 'Professor';
$is_courseMember = true;
$is_courseTutor = true;
$is_courseCoach = true;
$is_sessionAdmin = false;
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT status FROM $tbl_user
WHERE user_id = $userid LIMIT 1";
$sql = "SELECT status FROM $tbl_user
WHERE user_id = $userid LIMIT 1";
$result = Database::query($sql);
$result = Database::query($sql);
if (Database::result($result, 0, 0) == 1) {
$is_courseAdmin = true;
} else {
$is_courseAdmin = false;
}
if (Database::result($result, 0, 0) == 1) {
$is_courseAdmin = true;
} else {
// Check if the user is a student is this session.
$sql = "SELECT id
FROM $tbl_session_course_user
WHERE id_user = '$userid'
AND course_code = '$cid'
LIMIT 1";
if (Database::num_rows($result) > 0) {
// This user haa got a recorded state for this course.
while ($row = Database::fetch_array($result)) {
$is_courseMember = true;
$is_courseTutor = false;
$is_courseAdmin = false;
$is_sessionAdmin = false;
}
$is_courseAdmin = false;
}
} else {
// Check if the user is a student is this session.
$sql = "SELECT id
FROM $tbl_session_course_user
WHERE id_user = '$userid'
AND course_code = '$cid'
LIMIT 1";
if (Database::num_rows($result) > 0) {
// This user haa got a recorded state for this course.
while ($row = Database::fetch_array($result)) {
$is_courseMember = true;
$is_courseTutor = false;
$is_courseAdmin = false;
$is_sessionAdmin = false;
}
}
}
}
}
}
switch ($visibility) {
case COURSE_VISIBILITY_OPEN_WORLD:

@ -885,7 +885,8 @@ class MessageManager
* @param int group id
*/
public static function display_messages_for_group($group_id) {
global $my_group_role;
global $my_group_role;
$rows = self::get_messages_by_group($group_id);
$topics_per_page = 10;
$html_messages = '';
@ -904,7 +905,7 @@ class MessageManager
$new_topics = array();
foreach($topics as $id => $value) {
foreach ($topics as $id => $value) {
$rows = null;
$rows = self::get_messages_by_group_by_message($group_id, $value['id']);
if (!empty($rows)) {
@ -922,43 +923,59 @@ class MessageManager
foreach ($new_topics as $index => $topic) {
$html = '';
// topics
$indent = 0;
//$indent = 0;
$user_sender_info = UserManager::get_user_info_by_id($topic['user_sender_id']);
$files_attachments = self::get_links_message_attachment_files($topic['id']);
//$files_attachments = self::get_links_message_attachment_files($topic['id']);
$name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']);
$html .= '<div class="topic_div">';
$html .= '<div class="row">';
$items = $topic['count'];
$reply_label = ($items == 1) ? get_lang('GroupReply'): get_lang('GroupReplies');
$html .= '<table width="100%"><tr><td width="20px" valign="top">';
$html .= Display::div(Display::tag('span', $items).$reply_label, array('class' =>'group_discussions_replies'));
$html .= '</td><td width="150px" valign="top">';
$topic['title'] = trim($topic['title']);
if (empty($topic['title'])) {
$topic['title'] = get_lang('Untitled');
}
$title = Display::tag('h4', Display::url(Security::remove_XSS($topic['title'], STUDENT, true), 'group_topics.php?id='.$group_id.'&topic_id='.$topic['id']));
$date = '';
$link = '';
if ($topic['send_date']!=$topic['update_date']) {
if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00' ) {
$date .= '<div class="message-group-date" > <i>'.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</i></div>';
}
} else {
$items = $topic['count'];
$reply_label = ($items == 1) ? get_lang('GroupReply'): get_lang('GroupReplies');
$html .= '<div class="span1">';
$html .= Display::div(Display::tag('span', $items).$reply_label, array('class' =>'group_discussions_replies'));
$html .= '</div>';
$topic['title'] = trim($topic['title']);
if (empty($topic['title'])) {
$topic['title'] = get_lang('Untitled');
}
$html .= '<div class="span4">';
$html .= Display::tag('h4', Display::url(Security::remove_XSS($topic['title'], STUDENT, true), 'group_topics.php?id='.$group_id.'&topic_id='.$topic['id']));
if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $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'));
}
$date = '';
if ($topic['send_date']!=$topic['update_date']) {
if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00' ) {
$date .= '<div class="message-group-date" > <i>'.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</i></div>';
}
} else {
$date .= '<div class="message-group-date"> <i>'.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</i></div>';
}
$image_path = UserManager::get_user_picture_path_by_id($topic['user_sender_id'], 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$user_info = '<td valign="top"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a>';
$user_info .= '<div class="message-group-author"><img src="'.$image_repository.$existing_image.'" alt="'.$name.'" width="32" height="32" title="'.$name.'" /></div>';
$user_info .= '<div class="message-group-author">'.$user.'</div></td>';
//$date.
$html .= Display::div($title.Security::remove_XSS(cut($topic['content'], 150), STUDENT, true).$user_info, array('class'=>'group_discussions_info')).'</td></table>';
}
$html .= $date.$actions;
$html .= '</div>';
$image_path = UserManager::get_user_picture_path_by_id($topic['user_sender_id'], 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$user_info = '<td valign="top"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a>';
$user_info .= '<div class="message-group-author"><img src="'.$image_repository.$existing_image.'" alt="'.$name.'" width="32" height="32" title="'.$name.'" /></div>';
$user_info .= '</td>';
$html .= '<div class="span2">';
$html .= $user_info;
$html .= '</div>';
//group_topics.php?action=delete&id=3&topic_id=6
//$date.
//$html .= Display::div($title.Security::remove_XSS(cut($topic['content'], 150), STUDENT, true).$user_info, array('class'=>'group_discussions_info')).' </tr> '.$actions.'</table>';
$html .= '</div>'; //rounded_div

@ -386,7 +386,7 @@ class SocialManager extends UserManager {
*/
public static function get_logged_user_course_html($my_course, $count) {
global $nosession, $nbDigestEntries, $orderKey, $digest, $thisCourseSysCode;
if (api_get_setting('use_session_mode')=='true' && !$nosession) {
if (!$nosession) {
global $now, $date_start, $date_end;
}
//initialise
@ -477,7 +477,7 @@ class SocialManager extends UserManager {
$result .= '</li>';
$result .= '</div>';
if (api_get_setting('use_session_mode')=='true' && !$nosession) {
if (!$nosession) {
$session = '';
$active = false;
if (!empty($my_course['session_name'])) {

@ -12,39 +12,6 @@ require_once api_get_path(LIBRARY_PATH) . 'symfony/Twig/Autoloader.php';
class Template {
public static function get_icon_path($image, $size = ICON_SIZE_SMALL) {
return Display:: return_icon($image, '', array(), $size, $show_text = false, $return_only_path = true);
}
public static function format_date($timestamp, $format = null) {
return api_format_date($timestamp, $format);
}
/**
* Return the item's url key:
*
* c_id=xx&id=xx
*
* @param object $item
* @return string
*/
public static function key($item){
$id = isset($item->id) ? $item->id : null;
$c_id = isset($item->c_id) ? $item->c_id : null;
$result = '';
if($c_id){
$result = "c_id=$c_id";
}
if($id){
if($result){
$result .= "&amp;id=$id";
}else{
$result .= "&amp;id=$id";
}
}
return $result;
}
var $style = 'default'; //see the template folder
var $preview_theme = null;
var $theme; // the chamilo theme public_admin, chamilo, chamilo_red, etc
@ -169,6 +136,39 @@ class Template {
}
}
}
}
public static function get_icon_path($image, $size = ICON_SIZE_SMALL) {
return Display:: return_icon($image, '', array(), $size, $show_text = false, $return_only_path = true);
}
public static function format_date($timestamp, $format = null) {
return api_format_date($timestamp, $format);
}
/**
* Return the item's url key:
*
* c_id=xx&id=xx
*
* @param object $item
* @return string
*/
public static function key($item){
$id = isset($item->id) ? $item->id : null;
$c_id = isset($item->c_id) ? $item->c_id : null;
$result = '';
if($c_id){
$result = "c_id=$c_id";
}
if($id){
if($result){
$result .= "&amp;id=$id";
}else{
$result .= "&amp;id=$id";
}
}
return $result;
}
function set_help($help_input = null) {

@ -189,7 +189,7 @@ class IndexManager {
if ($show_course_link) {
if (!api_is_drh() && !api_is_session_admin()) {
$html .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseManagement').'</a></li>';
$html .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseCatalog').'</a></li>';
} else {
$html .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}
@ -824,15 +824,14 @@ class IndexManager {
//Course management
if ($show_course_link) {
if (!api_is_drh()) {
$my_account_content .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseManagement').'</a></li>';
if (api_get_setting('use_session_mode') == 'true') {
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
$my_account_content .= '<li><a href="user_portal.php">'.get_lang('DisplayTrainingList').'</a></li>';
} else {
$my_account_content .= '<li><a href="user_portal.php?history=1" class="history course">'.get_lang('HistoryTrainingSessions').'</a></li>';
}
}
$my_account_content .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseCatalog').'</a></li>';
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
$my_account_content .= '<li><a href="user_portal.php">'.get_lang('DisplayTrainingList').'</a></li>';
} else {
$my_account_content .= '<li><a href="user_portal.php?history=1" class="history course">'.get_lang('HistoryTrainingSessions').'</a></li>';
}
} else {
$my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}
@ -898,7 +897,7 @@ class IndexManager {
// Sessions and courses that are not in a session category.
// If we're not in the history view...
if (!isset($_GET['history'])) { //
if (!isset($_GET['history'])) {
//Display special courses
$html .= CourseManager :: display_special_courses($user_id, $this->load_directories_preview);
//Display courses

@ -227,8 +227,8 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
$login = $_POST['login'];
$password = $_POST['password'];
}
//lookup the user in the main database
//Lookup the user in the main database
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT user_id, username, password, auth_source, active, expiration_date, status FROM $user_table
WHERE username = '".Database::escape_string($login)."'";
@ -238,38 +238,19 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
$uData = Database::fetch_array($result);
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE || $uData['auth_source'] == CAS_AUTH_SOURCE) {
//the authentification of this user is managed by Chamilo itself
//The authentification of this user is managed by Chamilo itself
$password = api_get_encrypted_password(trim(stripslashes($password)));
if (api_get_setting('allow_terms_conditions')=='true') {
if ($password == $uData['password'] AND (trim($login) == $uData['username']) OR $cas_login ) {
$temp_user_id = $uData['user_id'];
$term_and_condition_status = api_check_term_condition($temp_user_id);//false or true
if ($term_and_condition_status === false) {
$_SESSION['term_and_condition'] = array('user_id' => $temp_user_id,
'login' => $login,
'password' => $password,
'update_term_status' => true,
);
header('Location: '.api_get_path(WEB_CODE_PATH).'auth/inscription.php');
exit;
} else {
unset($_SESSION['term_and_condition']);
}
}
}
// Check the user's password
if ( ($password == $uData['password'] OR $cas_login) AND (trim($login) == $uData['username'])) {
if ( ($password == $uData['password'] OR $cas_login) AND (trim($login) == $uData['username'])) {
$update_type = UserManager::get_extra_user_data_by_field($uData['user_id'], 'update_type');
$update_type= $update_type['update_type'];
if (!empty($extAuthSource[$update_type]['updateUser']) && file_exists($extAuthSource[$update_type]['updateUser'])) {
include_once $extAuthSource[$update_type]['updateUser'];
}
// Check if the account is active (not locked)
if ($uData['active']=='1') {
if ($uData['active'] == '1') {
// Check if the expiration date has not been reached
if ($uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date'] == '0000-00-00 00:00:00') {
@ -689,22 +670,22 @@ if (isset($cidReset) && $cidReset) {
Session::write('_course', $_course);
// if a session id has been given in url, we store the session
if (api_get_setting('use_session_mode') == 'true') {
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
if (!empty($_GET['id_session'])) {
$_SESSION['id_session'] = intval($_GET['id_session']);
$sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_SESSION['id_session']) . '"';
$rs = Database::query($sql);
list($_SESSION['session_name']) = Database::fetch_array($rs);
} else {
Session::erase('session_name');
Session::erase('id_session');
}
}
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
if (!empty($_GET['id_session'])) {
$_SESSION['id_session'] = intval($_GET['id_session']);
$sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_SESSION['id_session']) . '"';
$rs = Database::query($sql);
list($_SESSION['session_name']) = Database::fetch_array($rs);
} else {
Session::erase('session_name');
Session::erase('id_session');
}
if (!isset($_SESSION['login_as'])) {
//Course login

@ -385,7 +385,7 @@ if (!empty($student_id)) {
$session_name = '';
$nb_login = Tracking :: count_login_per_student($user_info['user_id'], $_GET['course']);
//get coach and session_name if there is one and if session_mode is activated
if (api_get_setting('use_session_mode') == 'true' && $session_id > 0) {
if ($session_id > 0) {
$session_info = api_get_session_info($session_id);
$course_coachs = api_get_coachs_from_course($session_id, $course_code);
@ -850,14 +850,14 @@ if (empty($_GET['details'])) {
get_lang('Score'),
get_lang('Attempts')
);
$t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
$sql_exercices = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
WHERE quiz.c_id = ".$info_course['real_id']." AND
active='1' AND
quiz.session_id = $session_id
(quiz.session_id = $session_id OR quiz.session_id = 0)
ORDER BY quiz.title ASC ";
$result_exercices = Database::query($sql_exercices);
$i = 0;
if (Database :: num_rows($result_exercices) > 0) {
@ -892,18 +892,19 @@ if (empty($_GET['details'])) {
echo '<td align="center">';
$sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
WHERE exe_exo_id="'.$exercise_id.'" AND
exe_user_id="'.$student_id.'" AND
exe_cours_id="'.$course_code.'" AND
status = "" AND
orig_lp_id = 0 AND
WHERE exe_exo_id ="'.$exercise_id.'" AND
exe_user_id ="'.$student_id.'" AND
exe_cours_id ="'.$course_code.'" AND
session_id ="'.$session_id.'" AND
status = "" AND
orig_lp_id = 0 AND
orig_lp_item_id = 0
ORDER BY exe_date DESC LIMIT 1';
$result_last_attempt = Database::query($sql_last_attempt);
if (Database :: num_rows($result_last_attempt) > 0) {
$id_last_attempt = Database :: result($result_last_attempt, 0, 0);
if ($count_attempts > 0)
echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&student='.$student_id.'&origin='.(empty($_GET['origin'])?'tracking':Security::remove_XSS($_GET['origin'])).'"> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$session_id.'&student='.$student_id.'&origin='.(empty($_GET['origin'])?'tracking':Security::remove_XSS($_GET['origin'])).'"> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
}
echo '</td>';
@ -977,8 +978,7 @@ if (empty($_GET['details'])) {
$links = Tracking::count_student_visited_links($student_id, $course_code, $session_id);
$chat_last_connection = Tracking::chat_last_connection($student_id, $course_code, $session_id);
$documents = Tracking::count_student_downloaded_documents($student_id, $course_code, $session_id);
$uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $session_id);
$uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $session_id);
$csv_content[] = array (
get_lang('Student_publication'),
@ -1038,8 +1038,7 @@ if (empty($_GET['details'])) {
</table>
<?php
} //end details
} //end details
}
if ($export_csv) {
ob_end_clean();

@ -438,7 +438,7 @@ if (!empty($flat_list)) {
//if (api_get_setting('pdf_export_watermark_enable') == 'true') {
$export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">
'.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_SMALL).'</a>';
'.Display::return_icon('pdf.png', get_lang('ExportToPDFOnlyHTMLAndImages'),'',ICON_SIZE_SMALL).'</a>';
//}
/* DELETE COMMAND */

@ -372,7 +372,7 @@ if (Database::num_rows($res_media) > 0) {
<!-- end media player layout -->
<!-- TOC layout -->
<div id="toc_id" name="toc_name" style="overflow: auto; padding:0;margin-top:20px;width:100%">
<div id="toc_id" name="toc_name" style="overflow: auto; padding:0;margin-top:0px;width:100%;float:left">
<div id="learning_path_toc">
<?php echo $_SESSION['oLP']->get_html_toc(); ?>
@ -380,7 +380,7 @@ if (Database::num_rows($res_media) > 0) {
<!-- log message layout -->
<div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:150px;overflow:auto;margin:4px">
<div id="log_content"></div>
<div id="log_content_cleaner" style="color: white;">.</div>
<div id="log_content_cleaner" style="cursor: pointer; color:blue;"><?php echo get_lang('Clean'); ?></div>
</div>
<!-- end log message layout -->
<?php } ?>
@ -414,7 +414,12 @@ if (Database::num_rows($res_media) > 0) {
var hauteurHeader = document.getElementById('header').offsetHeight;
var hauteurAuthorImg = document.getElementById('author_image').offsetHeight;
var hauteurAuthorName = document.getElementById('author_name').offsetHeight;
var hauteurMedia = document.getElementById('lp_media_file').offsetHeight;
var hauteurMedia = 0;
if ($("#lp_media_file").length != 0) {
hauteurMedia = document.getElementById('lp_media_file').offsetHeight;
}
var hauteurTitre = document.getElementById('scorm_title').offsetHeight;
var hauteurAction = 0;
if (document.getElementById('actions_lp')) hauteurAction = document.getElementById('actions_lp').offsetHeight;

@ -1495,7 +1495,9 @@ function switch_item(current_item, next_item){
url: "lp_nav.php",
data: "",
success: function(tmp_data) {
$("#lp_media_file").html(tmp_data);
if ($("#lp_media_file").length != 0) {
$("#lp_media_file").html(tmp_data);
}
}
});
return true;

@ -57,7 +57,7 @@ if (isset($_GET['action']) && $_GET['action']=='delete') {
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::delete_user_rel_group($user_join, $group_id);
$show_message = get_lang('UserDeleted');
$show_message = Display::return_message(get_lang('UserDeleted'));
}
}
@ -67,7 +67,7 @@ if (isset($_GET['action']) && $_GET['action']=='set_moderator') {
//if i'm the admin
if (GroupPortalManager::is_group_admin($group_id)) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
$show_message = get_lang('UserChangeToModerator');
$show_message = Display::return_message(get_lang('UserChangeToModerator'));
}
}
@ -77,12 +77,10 @@ if (isset($_GET['action']) && $_GET['action']=='delete_moderator') {
//only group admins can do that
if (GroupPortalManager::is_group_admin($group_id)) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_READER);
$show_message = get_lang('UserChangeToReader');
$show_message = Display::return_message(get_lang('UserChangeToReader'));
}
}
$users = GroupPortalManager::get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000);
$new_member_list = array();
@ -92,10 +90,6 @@ $social_right_content = '<h2>'.$group_info['name'].'</h2>';
$social_right_content .= '<div style="width:90%">';
if (! empty($show_message)){
$social_right_content .= Display :: return_message($show_message,'confirmation', false);
}
foreach($users as $user) {
switch ($user['relation_type']) {
case GROUP_USER_PERMISSION_ADMIN:

@ -37,10 +37,12 @@ if (empty($group_id)) {
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
if (api_is_platform_admin()) {
$group_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
if (api_is_platform_admin() || in_array($group_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
GroupPortalManager::delete_topic($group_id, $topic_id);
header("Location: groups.php?id=$group_id&action=show_message&msg=topic_deleted");
}
}
}
// save message group

@ -16,8 +16,8 @@ if (api_get_setting('allow_social_tool') !='true') {
api_not_allowed();
}
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/fckeditor.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
$tok = Security::get_token();
@ -112,7 +112,7 @@ $page_topic = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1
<a href="javascript://" onclick="return add_image_form()">
<?php echo get_lang('AddOneMoreFile') ?></a>
</div>
(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)
(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)
<br />
<br />

@ -74,7 +74,7 @@ $(document).ready( function() {
});
var tip_options = {
placement : 'right',
placement : 'right'
}
$('.boot-tooltip').tooltip(tip_options);

@ -219,7 +219,7 @@ $(function() {
modal : true,
width : width_value,
height : height_value,
resizable : resizable_value,
resizable : resizable_value
});
});
//prevent the browser to follow the link

@ -27,33 +27,36 @@ $(document).ready( function() {
<div class="span9">
{{"HottestCourses"|display_page_header}}
</div>
{% for hot_course in hot_courses %}
<div class="span9">
<div class="well_border">
<div class="row">
<div class="span2">
<div class="thumbnail">
<img src="{{ hot_course.extra_info.course_image }}" />
{# html_image file=$hot_course.extra_info.course_image #}
{% for hot_course in hot_courses %}
{% if hot_course.extra_info.title %}
<div class="span9">
<div class="well_border">
<div class="row">
<div class="span2">
<div class="thumbnail">
<img src="{{ hot_course.extra_info.course_image }}" />
{# html_image file=$hot_course.extra_info.course_image #}
</div>
</div>
</div>
<div class="span6">
<div class="categories-course-description">
<h3>{{ hot_course.extra_info.name }}</h3>
<h5>{{ hot_course.extra_info.teachers }}</h5>
{{ hot_course.extra_info.rating_html }}
<div class="span6">
<div class="categories-course-description">
<h3>{{ hot_course.extra_info.title}}</h3>
<h5>{{ hot_course.extra_info.teachers }}</h5>
{{ hot_course.extra_info.rating_html }}
</div>
<p>
{{ hot_course.extra_info.go_to_course_button }}
{{ hot_course.extra_info.description_button }}
</p>
</div>
<p>
{{ hot_course.extra_info.go_to_course_button }}
{{ hot_course.extra_info.description_button }}
</p>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</section>
{% endif %}

@ -11,85 +11,82 @@
<a class="brand" href="{{ _p.web }}">{{"siteName"|get_setting }}</a>
{% if _u.logged %}
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="{{ _p.web }}user_portal.php"> {{ "MyCourses"|get_lang }}</a></li>
{#
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{'Teaching'|get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}create_course/add_course.php">{{"AddCourse"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}auth/courses.php">{{"Catalog"|get_lang }}</a></li>
</ul>
</li>
#}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{'Tracking'|get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}mySpace/">{{"CoursesReporting"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}mySpace/index.php?view=admin">{{"AdminReports"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}tracking/exams.php">{{"ExamsReporting"|get_lang }}</a></li>
<li class="divider"></li>
<li><a href="{{ _p.web_main }}dashboard/">{{"Dashboard"|get_lang }}</a></li>
</ul>
</li>
{% if _u.is_admin == 1 %}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{'Administration'|get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}admin/">{{"Home"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/user_list.php">{{"UserList"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/course_list.php">{{"CourseList"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/session_list.php">{{"SessionList"|get_lang }}</a></li>
<li class="divider"></li>
<li><a href="{{ _p.web_main }}admin/settings.php">{{"Settings"|get_lang }}</a></li>
<li class="divider"></li>
<li><a href="{{ _p.web_main }}admin/settings.php?category=Plugins">{{"Plugins"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/settings.php?category=Regions">{{"Regions"|get_lang }}</a></li>
</ul>
</li>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="{{ _p.web }}user_portal.php">{{"MyCourses"|get_lang }}</a></li>
{#
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{'Teaching'|get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}create_course/add_course.php">{{"AddCourse"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}auth/courses.php">{{"Catalog"|get_lang }}</a></li>
</ul>
</li>
#}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{'Tracking'|get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}mySpace/">{{"CoursesReporting"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}mySpace/index.php?view=admin">{{"AdminReports"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}tracking/exams.php">{{"ExamsReporting"|get_lang }}</a></li>
<li class="divider"></li>
<li><a href="{{ _p.web_main }}dashboard/">{{"Dashboard"|get_lang }}</a></li>
</ul>
</li>
{% if _u.is_admin == 1 %}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{'Administration'|get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}admin/">{{"Home"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/user_list.php">{{"UserList"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/course_list.php">{{"CourseList"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/session_list.php">{{"SessionList"|get_lang }}</a></li>
<li class="divider"></li>
<li><a href="{{ _p.web_main }}admin/settings.php">{{"Settings"|get_lang }}</a></li>
<li class="divider"></li>
<li><a href="{{ _p.web_main }}admin/settings.php?category=Plugins">{{"Plugins"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/settings.php?category=Regions">{{"Regions"|get_lang }}</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ 'Add' | get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}admin/user_add.php">{{"User"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/course_add.php">{{"Course"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/session_add.php">{{"Session"|get_lang }}</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ 'Add' | get_lang }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}admin/user_add.php">{{"User"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/course_add.php">{{"Course"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}admin/session_add.php">{{"Session"|get_lang }}</a></li>
</ul>
</li>
{% endif %}
</ul>
{% if _u.is_admin == 1 %}
<form class="navbar-search pull-left" action="{{ _p.web_main }}admin/user_list.php" method="get">
<input type="text" class="search-query span2" placeholder="{{'SearchUsers'|get_lang }}" name="keyword">
</form>
{% endif %}
</ul>
{% endif %}
{% if _u.is_admin == 1 %}
<form class="navbar-search pull-left" action="{{ _p.web_main }}admin/user_list.php" method="get">
<input type="text" class="search-query span2" placeholder="{{'SearchUsers'|get_lang }}" name="keyword">
</form>
{% endif %}
{% if _u.logged %}
<ul class="nav pull-right">
<li><a href="{{ _p.web_main }}social/home.php"><img src="{{ _u.avatar_small }}"/></a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ _u.complete_name }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}social/home.php">{{"Profile"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}calendar/agenda_js.php?type=personal">{{"MyAgenda"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}messages/inbox.php">{{"Messages"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}auth/my_progress.php">{{"MyReporting"|get_lang }}</a></li>
<!--<li class="divider"></li>
<li><a href="{{ _p.web_main }}social/invitations.php">{{"PendingInvitations"|get_lang }}</a></li> -->
</ul>
</li>
<li><a href="{{ _p.web }}index.php?logout=logout">{{ "Logout" | get_lang }}</a></li>
</ul>
{% endif %}
</div>
</div> <!-- /container-->
<ul class="nav pull-right">
<li><a href="{{ _p.web_main }}social/home.php"><img src="{{ _u.avatar_small }}"/></a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ _u.complete_name }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ _p.web_main }}social/home.php">{{"Profile"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}calendar/agenda_js.php?type=personal">{{"MyAgenda"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}messages/inbox.php">{{"Messages"|get_lang }}</a></li>
<li><a href="{{ _p.web_main }}auth/my_progress.php">{{"MyReporting"|get_lang }}</a></li>
<!--<li class="divider"></li>
<li><a href="{{ _p.web_main }}social/invitations.php">{{"PendingInvitations"|get_lang }}</a></li> -->
</ul>
</li>
<li><a href="{{ _p.web }}index.php?logout=logout">{{ "Logout" | get_lang }}</a></li>
</ul>
</div> <!-- /nav collapse -->
{% endif %}
</div> <!-- /container-fluid-->
</div><!-- /navbar-inner -->
</div><!-- /navbar -->
</div><!-- /topbar -->
<div id="topbar_push"></div>
{% endif %}

@ -78,20 +78,18 @@ $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_U
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
if (api_get_setting('use_session_mode') == "true") {
$sql = "SELECT 1
FROM $tbl_session_course_user AS session_course_user
INNER JOIN $tbl_session AS session
ON session_course_user.id_session = session.id
AND ((date_start<=NOW()
AND date_end>=NOW())
OR (date_start='0000-00-00' AND date_end='0000-00-00'))
WHERE id_session='".$_SESSION['id_session']."' AND course_code='$_cid'";
//echo $sql;
$result=Database::query($sql);
if(!Database::num_rows($result)){
$disabled = true;
}
$sql = "SELECT 1
FROM $tbl_session_course_user AS session_course_user
INNER JOIN $tbl_session AS session
ON session_course_user.id_session = session.id
AND ((date_start<=NOW()
AND date_end>=NOW())
OR (date_start='0000-00-00' AND date_end='0000-00-00'))
WHERE id_session='".$_SESSION['id_session']."' AND course_code='$_cid'";
//echo $sql;
$result=Database::query($sql);
if(!Database::num_rows($result)){
$disabled = true;
}
$tbl_learnpath_main = Database::get_course_table(TABLE_LP_MAIN);
@ -133,15 +131,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
echo "<h4>".get_lang('ListStudents')."</h4>";
if( $is_allowedToTrackEverybodyInCourse ) {
// if user can track everybody : list user of course
if(api_get_setting('use_session_mode')) {
$sql = "SELECT count(user_id)
FROM $TABLECOURSUSER
WHERE course_code = '".Database::escape_string($_cid)."' AND relation_type<>".COURSE_RELATION_TYPE_RRHH."";
} else {
$sql = "SELECT count(id_user)
FROM $tbl_session_course_user
WHERE course_code = '".Database::escape_string($_cid)."'";
}
$sql = "SELECT count(user_id)
FROM $TABLECOURSUSER
WHERE course_code = '".Database::escape_string($_cid)."' AND relation_type<>".COURSE_RELATION_TYPE_RRHH."";
} else {
// if user can only track one group : list users of this group
$sql = "SELECT count(user)

@ -68,23 +68,21 @@ $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
if(api_get_setting('use_session_mode') == "true") {
$sql = "SELECT 1
FROM $tbl_session_course_user AS session_course_user
INNER JOIN $tbl_session AS session
ON session_course_user.id_session = session.id
AND ((date_start<=NOW()
AND date_end>=NOW())
OR (date_start='0000-00-00' AND date_end='0000-00-00'))
WHERE id_session='".$_SESSION['id_session']."' AND course_code='$_cid'";
//echo $sql;
$result=Database::query($sql);
if(!Database::num_rows($result)){
$disabled = true;
}
$sql = "SELECT 1
FROM $tbl_session_course_user AS session_course_user
INNER JOIN $tbl_session AS session
ON session_course_user.id_session = session.id
AND ((date_start<=NOW()
AND date_end>=NOW())
OR (date_start='0000-00-00' AND date_end='0000-00-00'))
WHERE id_session='".$_SESSION['id_session']."' AND course_code='$_cid'";
//echo $sql;
$result=Database::query($sql);
if(!Database::num_rows($result)){
$disabled = true;
}
$tbl_learnpath_main = Database::get_course_table(TABLE_LP_MAIN);
$tbl_learnpath_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW);
@ -122,17 +120,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse))
if( $is_allowedToTrackEverybodyInCourse )
{
// if user can track everybody : list user of course
if(api_get_setting('use_session_mode')) {
$sql = "SELECT count(user_id)
FROM $TABLECOURSUSER
WHERE course_code = '$_cid' AND relation_type<>".COURSE_RELATION_TYPE_RRHH."";
}
else {
$sql = "SELECT count(id_user)
FROM $tbl_session_course_user
WHERE course_code = '$_cid'";
}
// if user can track everybody : list user of course
$sql = "SELECT count(user_id)
FROM $TABLECOURSUSER
WHERE course_code = '$_cid' AND relation_type<>".COURSE_RELATION_TYPE_RRHH."";
}
else
{

@ -15,9 +15,7 @@ $this_section = SECTION_COURSES;
*/
api_protect_course_script();
if (api_get_setting('use_session_mode')=='true') {
api_not_allowed();
}
api_not_allowed();
$tool_name = get_lang("Classes");
//extra entries in breadcrumb

@ -12,9 +12,9 @@ $language_file = array('registration','admin');
include ('../inc/global.inc.php');
$this_section = SECTION_COURSES;
if (!api_is_allowed_to_edit()) api_not_allowed(true);
if(api_get_setting('use_session_mode')=='true') {
api_not_allowed(true);
}
api_not_allowed(true);
/*
MAIN CODE

@ -201,8 +201,11 @@ if (api_is_western_name_order()) {
$table->set_header($col ++, get_lang('LastName'));
$table->set_header($col ++, get_lang('FirstName'));
}
$table->set_header($col ++, get_lang('Email'));
$table->set_column_filter($col -1, 'email_filter');
if (api_get_setting('show_email_addresses') == 'true') {
$table->set_header($col ++, get_lang('Email'));
$table->set_column_filter($col -1, 'email_filter');
}
$table->set_header($col ++, get_lang('Active'),false);
$table->set_column_filter($col -1, 'active_filter');
$table->set_header($col ++, get_lang('Actions'), false);
@ -248,7 +251,7 @@ function get_number_of_users() {
$url_access_id = api_get_current_access_url_id();
if ($url_access_id !=-1) {
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = "SELECT COUNT(u.user_id) FROM $user_table u
$sql = "SELECT COUNT(u.user_id) FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu on u.user_id = cu.id_user and course_code='".api_get_course_id()."' AND id_session ='".api_get_session_id()."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id)
@ -293,7 +296,7 @@ function get_number_of_users() {
}
}
} else {
$sql = "SELECT COUNT(u.user_id)
$sql = "SELECT COUNT(u.user_id)
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
@ -383,23 +386,39 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$table_user_field_values = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES);
// adding teachers
// adding teachers
$is_western_name_order = api_is_western_name_order();
if (api_get_setting('show_email_addresses') == 'true') {
$select_fields = "u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6";
} else {
$select_fields = "u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.active AS col4,
u.user_id AS col5";
}
if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
// adding a teacher through a session
if (!empty($_SESSION["id_session"])) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu on u.user_id = cu.id_user AND course_code='".$_SESSION['_course']['id']."' AND id_session ='".$_SESSION["id_session"]."' ";
@ -417,17 +436,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
} else {
// adding a teacher NOT through a session
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
@ -449,17 +458,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$url_access_id = api_get_current_access_url_id();
if ($url_access_id !=-1) {
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
INNER JOIN $tbl_url_rel_user as url_rel_user ON (url_rel_user.user_id = u.user_id) ";
@ -482,17 +481,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
} else {
// adding a student
if (!empty($_SESSION["id_session"])) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu on u.user_id = cu.id_user and course_code='".$_SESSION['_course']['id']."' AND id_session ='".$_SESSION["id_session"]."' ";
@ -510,17 +499,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
} else {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
@ -544,17 +523,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
if ($url_access_id !=-1) {
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
INNER JOIN $tbl_url_rel_user as url_rel_user
@ -608,7 +577,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$res = Database::query($sql);
$users = array ();
while ($user = Database::fetch_row($res)) {
while ($user = Database::fetch_row($res)) {
$users[] = $user;
$_SESSION['session_user_id'][] = $user[0];
if ($is_western_name_order) {

@ -89,11 +89,21 @@ if (api_is_allowed_to_edit(null, true)) {
$extra_fields = UserManager::get_extra_user_data(api_get_user_id(), false, false, false, true);
$extra_fields = array_keys($extra_fields);
if ($sort_by_first_name) {
$a_users[0] = array('id', get_lang('FirstName'), get_lang('LastName'), get_lang('Email'), get_lang('Phone'), get_lang('OfficialCode'), get_lang('Active'));
} else {
$a_users[0] = array('id', get_lang('LastName'), get_lang('FirstName'), get_lang('Email'), get_lang('Phone'), get_lang('OfficialCode'), get_lang('Active'));
}
$select_email_condition = '';
if (api_get_setting('show_email_addresses') == 'true') {
$select_email_condition = ' user.email, ';
if ($sort_by_first_name) {
$a_users[0] = array('id', get_lang('FirstName'), get_lang('LastName'), get_lang('Email'), get_lang('Phone'), get_lang('OfficialCode'), get_lang('Active'));
} else {
$a_users[0] = array('id', get_lang('LastName'), get_lang('FirstName'), get_lang('Email'), get_lang('Phone'), get_lang('OfficialCode'), get_lang('Active'));
}
} else {
if ($sort_by_first_name) {
$a_users[0] = array('id', get_lang('FirstName'), get_lang('LastName'), get_lang('Phone'), get_lang('OfficialCode'), get_lang('Active'));
} else {
$a_users[0] = array('id', get_lang('LastName'), get_lang('FirstName'), get_lang('Phone'), get_lang('OfficialCode'), get_lang('Active'));
}
}
$legal = '';
@ -113,64 +123,64 @@ if (api_is_allowed_to_edit(null, true)) {
$a_users[0] = array_merge($a_users[0], $extra_fields);
// users subscribed to the course through a session
if (api_get_setting('use_session_mode') == 'true') {
if (api_get_session_id()) {
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql_query = "SELECT DISTINCT user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", user.email, phone, user.official_code, active $legal
FROM $table_session_course_user as session_course_user, $table_users as user ";
if ($_configuration['multiple_access_urls']) {
$sql_query .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
}
$sql_query .=" WHERE course_code = '$course_code' AND session_course_user.id_user = user.user_id ";
$sql_query .= ' AND id_session = '.$session_id;
if ($_configuration['multiple_access_urls']) {
$sql_query .= " AND user.user_id = au.user_id AND access_url_id = $current_access_url_id ";
}
//only users no coaches/teachers
$sql_query .= " AND session_course_user.status = 0 ";
$sql_query .= $sort_by_first_name ? ' ORDER BY user.firstname, user.lastname' : ' ORDER BY user.lastname, user.firstname';
$rs = Database::query($sql_query);
$counter = 1;
while ($user = Database:: fetch_array($rs, 'ASSOC')) {
if (isset($user['legal_agreement'])) {
if ($user['legal_agreement'] == 1) {
$user['legal_agreement'] = get_lang('Yes');
} else {
$user['legal_agreement'] = get_lang('No');
}
if (api_get_session_id()) {
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql_query = "SELECT DISTINCT user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", $select_email_condition phone, user.official_code, active $legal
FROM $table_session_course_user as session_course_user, $table_users as user ";
if ($_configuration['multiple_access_urls']) {
$sql_query .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
}
$sql_query .=" WHERE course_code = '$course_code' AND session_course_user.id_user = user.user_id ";
$sql_query .= ' AND id_session = '.$session_id;
if ($_configuration['multiple_access_urls']) {
$sql_query .= " AND user.user_id = au.user_id AND access_url_id = $current_access_url_id ";
}
//only users no coaches/teachers
$sql_query .= " AND session_course_user.status = 0 ";
$sql_query .= $sort_by_first_name ? ' ORDER BY user.firstname, user.lastname' : ' ORDER BY user.lastname, user.firstname';
$rs = Database::query($sql_query);
$counter = 1;
while ($user = Database:: fetch_array($rs, 'ASSOC')) {
if (isset($user['legal_agreement'])) {
if ($user['legal_agreement'] == 1) {
$user['legal_agreement'] = get_lang('Yes');
} else {
$user['legal_agreement'] = get_lang('No');
}
}
$extra_fields = UserManager::get_extra_user_data($user['user_id'], false, false, false, true);
if (!empty($extra_fields)) {
foreach($extra_fields as $key => $extra_value) {
$user[$key] = $extra_value;
}
$extra_fields = UserManager::get_extra_user_data($user['user_id'], false, false, false, true);
if (!empty($extra_fields)) {
foreach($extra_fields as $key => $extra_value) {
$user[$key] = $extra_value;
}
}
$data[] = $user;
if ($_GET['type'] == 'pdf') {
if ($is_western_name_order) {
$user_pdf = array($counter, $user['official_code'], $user['firstname'].', '.$user['lastname'] );
} else {
$user_pdf = array($counter, $user['official_code'], $user['lastname'].', '.$user['firstname'] );
}
$a_users[] = $user_pdf;
} else {
$a_users[] = $user;
}
$data[] = $user;
if ($_GET['type'] == 'pdf') {
if ($is_western_name_order) {
$user_pdf = array($counter, $user['official_code'], $user['firstname'].', '.$user['lastname'] );
} else {
$user_pdf = array($counter, $user['official_code'], $user['lastname'].', '.$user['firstname'] );
}
$counter++;
}
}
}
$a_users[] = $user_pdf;
} else {
$a_users[] = $user;
}
$counter++;
}
}
if ($session_id == 0) {
// users directly subscribed to the course
$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql_query = "SELECT DISTINCT user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", user.email, phone, user.official_code, active $legal
$sql_query = "SELECT DISTINCT user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", $select_email_condition phone, user.official_code, active $legal
FROM $table_course_user as course_user, $table_users as user ";
if ($_configuration['multiple_access_urls']) {
$sql_query .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
@ -344,10 +354,6 @@ if ( api_is_allowed_to_edit(null, true)) {
$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&type=pdf">'.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a> ';
$actions .= "<a href=\"../group/group.php?".api_get_cidreq()."\">".Display::return_icon('group.png', get_lang("GroupUserManagement"),'',ICON_SIZE_MEDIUM)."</a>";
if (api_get_setting('use_session_mode') == 'false') {
$actions .= ' <a class="btn" href="class.php?'.api_get_cidreq().'">'.get_lang('Classes').'</a>';
}
// Build search-form
$form = new FormValidator('search_user', 'get', '', '', null, false);
$renderer = & $form->defaultRenderer();

@ -402,8 +402,10 @@ elseif ($displayMode == "viewContentEdit") {
echo "<td><button class=\"save\" type=\"submit\" name=\"submit\">".get_lang('SaveChanges')."</button></td>\n", "</tr>", "</table>", "</form>\n";
echo "<p>".Display :: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
if (api_get_setting('show_email_addresses') == 'true') {
echo "<p>".Display :: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
}
if (api_get_setting('extended_profile') == 'true') {
if (!empty($mainUserInfo['competences']))
@ -522,10 +524,6 @@ elseif ($displayMode == "viewContentEdit") {
if (api_get_setting("show_email_addresses") == "true") {
echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
} else {
if (api_is_allowed_to_edit()) {
echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
}
}
if (api_get_setting('extended_profile') == 'true') {

Loading…
Cancel
Save