Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

1.9.x
Yannick Warnier 11 years ago
commit a6ad6c1cbc
  1. 44
      custompages/first_login.php
  2. 11
      custompages/language.php
  3. 13
      custompages/loggedout.php
  4. 14
      custompages/lostpassword.php
  5. 94
      main/admin/add_courses_to_session.php
  6. 29
      main/admin/add_users_to_usergroup.php
  7. 189
      main/admin/resume_session.php
  8. 80
      main/admin/session_add.php
  9. 42
      main/admin/session_edit.php
  10. 1
      main/admin/session_list.php
  11. 1
      main/admin/usergroup_user_import.php
  12. 138
      main/auth/inscription.php
  13. 37
      main/auth/lostPassword.php
  14. 22
      main/calendar/agenda.lib.php
  15. 1
      main/course_home/course_home.php
  16. 15
      main/course_info/infocours.php
  17. 1
      main/coursecopy/classes/CourseBuilder.class.php
  18. 1
      main/coursecopy/classes/CourseSelectForm.class.php
  19. 450
      main/coursecopy/copy_course_session.php
  20. 10
      main/document/document.php
  21. 4
      main/document/edit_document.php
  22. 48
      main/document/showinframes.php
  23. 15
      main/exercice/aiken.php
  24. 38
      main/exercice/exercise.lib.php
  25. 76
      main/exercice/export/aiken/aiken_import.inc.php
  26. 18
      main/exercice/export/exercise_import.inc.php
  27. 38
      main/exercice/qti2.php
  28. BIN
      main/img/icons/22/export_doc.png
  29. BIN
      main/img/icons/22/save_pack_na.png
  30. 46
      main/inc/lib/course.lib.php
  31. 23
      main/inc/lib/display.lib.php
  32. 59
      main/inc/lib/document.lib.php
  33. 4
      main/inc/lib/fckeditor/editor/_source/internals/fckselection_gecko.js
  34. 3
      main/inc/lib/fckeditor/editor/js/fckeditorcode_gecko.js
  35. 60
      main/inc/lib/main_api.lib.php
  36. 37
      main/inc/lib/nanogong.lib.php
  37. 10
      main/inc/lib/pear/HTML/QuickForm/label.php
  38. 261
      main/inc/lib/sessionmanager.lib.php
  39. 50
      main/inc/lib/social.lib.php
  40. 205
      main/inc/lib/tracking.lib.php
  41. 11
      main/inc/lib/usermanager.lib.php
  42. 4
      main/inc/lib/userportal.lib.php
  43. 15
      main/newscorm/learnpath.class.php
  44. 72
      main/newscorm/learnpathList.class.php
  45. 8
      main/newscorm/lp_add_audio.php
  46. 6
      main/newscorm/lp_controller.php
  47. 28
      main/newscorm/lp_list.php
  48. 35
      main/newscorm/lp_view.php
  49. 152
      main/session/index.php
  50. 1
      main/template/default/agenda/month.tpl
  51. 1
      main/template/default/learnpath/record_voice.tpl
  52. 12
      main/webservices/registration.soap.php
  53. 4
      whoisonline.php

@ -16,29 +16,29 @@ require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
if (! isset($_SESSION['conditional_login']['uid']))
die("Not Authorised");
if (isset($_POST['password'])){
$u = UserManager::get_user_info_by_id($_SESSION['conditional_login']['uid']);
if ($_POST['password'] != $_POST['password2']) {
header('Location: '. api_get_self().'?invalid=2');
exit();
}
if (empty($_POST['password'])){ //|| !api_check_password($password)) { //Pass must be at least 5 char long with 2 digits and 3 letters
header('Location: '. api_get_self().'?invalid=1');
exit();
}
$password = $_POST['password'];
$updated = UserManager::update_user($u['user_id'], $u['firstname'], $u['lastname'], $u['username'], $password, $u['auth_source'], $u['email'], $u['status'], $u['official_code'], $u['phone'], $u['picture_uri'], $u['expiration_date'], $u['active'], $u['creator_id'], $u['hr_dept_id'], null, $u['language'],'');
if (isset($_POST['password'])) {
$u = UserManager::get_user_info_by_id($_SESSION['conditional_login']['uid']);
if ($_POST['password'] != $_POST['password2']) {
header('Location: '. api_get_self().'?invalid=2');
exit();
}
if (empty($_POST['password'])){ //|| !api_check_password($password)) { //Pass must be at least 5 char long with 2 digits and 3 letters
header('Location: '. api_get_self().'?invalid=1');
exit();
}
$password = $_POST['password'];
$updated = UserManager::update_user($u['user_id'], $u['firstname'], $u['lastname'], $u['username'], $password, $u['auth_source'], $u['email'], $u['status'], $u['official_code'], $u['phone'], $u['picture_uri'], $u['expiration_date'], $u['active'], $u['creator_id'], $u['hr_dept_id'], null, $u['language'],'');
if ($updated) {
UserManager::update_extra_field_value($u['user_id'], 'already_logged_in', 'true');
ConditionalLogin::login();
}
if ($updated) {
UserManager::update_extra_field_value($u['user_id'], 'already_logged_in', 'true');
ConditionalLogin::login();
}
}
if ($_GET['invalid'] == 1) {
$error_message = get_lang('CurrentPasswordEmptyOrIncorrect');
$error_message = get_lang('CurrentPasswordEmptyOrIncorrect');
}
if ($_GET['invalid'] == 2) {
$error_message = get_lang('PassTwo');
$error_message = get_lang('PassTwo');
}
/**
* HTML output
@ -59,11 +59,11 @@ if ($_GET['invalid'] == 2) {
<script type="text/javascript" src="/main/inc/lib/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (top.location != location)
if (top.location != location)
top.location.href = document.location.href ;
// Handler pour la touche retour
$('input').keyup(function(e) {
$('input').keyup(function(e) {
if (e.keyCode == 13) {
$('#changepassword-form').submit();
}
@ -80,12 +80,12 @@ if ($_GET['invalid'] == 2) {
<img src="/custompages/images/header.png" alt="Logo" />
</div> <!-- #header -->
<h2> <?php echo custompages_get_lang('FirstLogin');?> </h2>
<div id="changepassword-form-box" class="form-box">
<div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword');?> </div>
<?php if (isset($error_message)) {
echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
}?>
}?>
<form id="changepassword-form" class="form" method="post">
<div>
<label for="password">*<?php echo custompages_get_lang('langPass');?></label>

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Definition of language-related functions for cases where th user isn't
* Definition of language-related functions for cases where th user isn't
* logged in yet
* @package chamilo.custompages
*/
@ -35,11 +35,11 @@ function custompages_get_lang($variable) {
return get_lang($variable, null, $_SESSION['user_language_choice']);
}
$language_file = array('courses', 'index', 'registration', 'admin','userInfo');
$available_langs = array('en','fr');
$language_file = array('courses', 'index', 'registration', 'admin', 'userInfo');
$available_langs = array('en', 'fr', 'es');
$chamilo_langs = array(null => 'english', 'en' => 'english', 'fr' => 'french', 'nl' => 'dutch', 'de' => 'german', 'es' => 'spanish');
$lang_match = $chamilo_langs[get_preferred_language($available_langs)];
// recover previous value ...
// recover previous value ...
if (isset($_SESSION['user_language_choice']))
$lang_match = $_SESSION['user_language_choice'];
@ -52,5 +52,6 @@ if (isset($_REQUEST['lang']) && !empty($_REQUEST['lang']) && in_array($_REQUEST[
$lang_match = $chamilo_langs[$_REQUEST['lang']];
}
$_user['language'] = $lang_match;
$_SESSION['user_language_choice'] = $lang_match;
?>

@ -8,12 +8,11 @@
* Init
*/
$called_direcly = !function_exists('api_get_path');
if ($called_direcly)
{
if ($called_direcly) {
return '';
}
require_once('language.php');
require_once 'language.php';
$www = api_get_path('WEB_PATH');
/**
@ -31,12 +30,10 @@ $www = api_get_path('WEB_PATH');
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="/custompages/style-ie6.css" />
<![endif]-->
<script type="text/javascript" src="<?php echo $www ?>main/inc/lib/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (top.location != location)
if (top.location != location)
top.location.href = document.location.href ;
});
</script>
@ -58,7 +55,7 @@ $www = api_get_path('WEB_PATH');
<a href="<?php echo $www . 'user_portal.php'; ?>">Go to your portal</a>
<div id="footer">
<img src="<?php echo $www ?>/custompages/images/footer.png" alt="footer"/>
</div>
</div>
</div>
</div>
</body>
</html>

@ -3,19 +3,15 @@
/**
* Quick form to ask for password reminder.
* @package chamilo.custompages
*/
/**
* Initialization
*/
require_once('../../main/inc/global.inc.php');
require_once('../../main/inc/global.inc.php');
require_once('language.php');
/**
* HTML
*/
?>
<html>
<head>
<title>Password recovery</title>
<title><?php echo custompages_get_lang('LostPassword');?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--[if !IE 6]><!-->
<link rel="stylesheet" type="text/css" href="../../custompages/style.css" />
@ -27,7 +23,7 @@ require_once('language.php');
<script type="text/javascript">
$(document).ready(function() {
// Handler pour la touche retour
$('input').keyup(function(e) {
$('input').keyup(function(e) {
if (e.keyCode == 13) {
$('#lostpassword-form').submit();
}

@ -20,7 +20,7 @@ $add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
SessionManager::protect_session_edit($id_session);
$xajax = new xajax();
$xajax->registerFunction (array('search_courses', 'AddCourseToSession', 'search_courses'));
$xajax->registerFunction(array('search_courses', 'AddCourseToSession', 'search_courses'));
// Setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
@ -47,29 +47,25 @@ if(isset($_GET['add_type']) && $_GET['add_type']!=''){
$page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null;
$xajax -> processRequests();
$xajax->processRequests();
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = '
<script type="text/javascript">
function add_course_to_session (code, content) {
$htmlHeadXtra[] = '<script>
function add_course_to_session(code, content) {
document.getElementById("course_to_add").value = "";
document.getElementById("ajax_list_courses_single").innerHTML = "";
destination = document.getElementById("destination");
for (i=0;i<destination.length;i++) {
if(destination.options[i].text == content) {
return false;
return false;
}
}
destination.options[destination.length] = new Option(content,code);
destination.selectedIndex = -1;
sortOptions(destination.options);
}
function remove_item(origin)
{
for(var i = 0 ; i<origin.options.length ; i++) {
@ -81,17 +77,17 @@ function remove_item(origin)
}
</script>';
$formSent=0;
$errorMsg=$firstLetterCourse=$firstLetterSession='';
$CourseList=$SessionList=array();
$courses=$sessions=array();
$noPHP_SELF=true;
$formSent = 0;
$errorMsg = $firstLetterCourse = $firstLetterSession = '';
$CourseList = $SessionList = array();
$courses = $sessions = array();
$noPHP_SELF = true;
if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent = $_POST['formSent'];
$firstLetterCourse = $_POST['firstLetterCourse'];
$firstLetterSession = $_POST['firstLetterSession'];
$CourseList = $_POST['SessionCoursesList'];
$formSent = $_POST['formSent'];
$firstLetterCourse = $_POST['firstLetterCourse'];
$firstLetterSession = $_POST['firstLetterSession'];
$CourseList = $_POST['SessionCoursesList'];
if (!is_array($CourseList)) {
$CourseList = array();
}
@ -105,21 +101,20 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$existingCourses = Database::store_result($rs);
// Updating only the RRHH users?? why?
//$sql="SELECT id_user FROM $tbl_session_rel_user WHERE id_session = $id_session AND relation_type=".COURSE_RELATION_TYPE_RRHH." ";
$sql = "SELECT id_user FROM $tbl_session_rel_user WHERE id_session = $id_session ";
$result = Database::query($sql);
$UserList = Database::store_result($result);
$sql = "SELECT id_user FROM $tbl_session_rel_user WHERE id_session = $id_session ";
$result = Database::query($sql);
$UserList = Database::store_result($result);
foreach($CourseList as $enreg_course) {
foreach ($CourseList as $enreg_course) {
$enreg_course = Database::escape_string($enreg_course);
$exists = false;
foreach($existingCourses as $existingCourse) {
if($enreg_course == $existingCourse['course_code']) {
$exists=true;
}
}
if(!$exists) {
foreach ($existingCourses as $existingCourse) {
if ($enreg_course == $existingCourse['course_code']) {
$exists = true;
}
}
if (!$exists) {
$sql_insert_rel_course= "INSERT INTO $tbl_session_rel_course(id_session,course_code) VALUES('$id_session','$enreg_course')";
Database::query($sql_insert_rel_course);
@ -131,7 +126,8 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$nbr_users=0;
foreach ($UserList as $enreg_user) {
$enreg_user = Database::escape_string($enreg_user['id_user']);
$sql_insert = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user(id_session,course_code,id_user) VALUES('$id_session','$enreg_course','$enreg_user')";
$sql_insert = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user(id_session,course_code,id_user)
VALUES('$id_session','$enreg_course','$enreg_user')";
Database::query($sql_insert);
if(Database::affected_rows()) {
$nbr_users++;
@ -149,7 +145,6 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
Database::query("DELETE FROM $tbl_session_rel_course WHERE course_code='".$existingCourse['course_code']."' AND id_session=$id_session");
Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE course_code='".$existingCourse['course_code']."' AND id_session=$id_session");
SessionManager::unInstallCourse($id_session, $course_info['real_id']);
}
}
$nbr_courses=count($CourseList);
@ -168,12 +163,12 @@ Display::display_header($tool_name);
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$add.'&add_type=unique">'.
Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').' ';
} else {
$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'&nbsp;&nbsp;&nbsp;';
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$add.'&add_type=multiple">'.
Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
// the form header
@ -205,7 +200,6 @@ if ($ajax_search) {
INNER JOIN $tbl_course_rel_access_url url_course ON (url_course.course_code=course.code)
WHERE access_url_id = $access_url_id
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
}
}
@ -239,7 +233,7 @@ if ($ajax_search) {
}
$result = Database::query($sql);
$Courses = Database::store_result($result);
foreach($Courses as $course) {
foreach ($Courses as $course) {
if ($course['id_session'] == $id_session) {
$sessionCourses[$course['code']] = $course ;
} else {
@ -254,8 +248,7 @@ unset($Courses);
<input type="hidden" name="formSent" value="1" />
<?php
if(!empty($errorMsg))
{
if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg); //main API
}
?>
@ -295,10 +288,11 @@ if (!($add_type == 'multiple')) {
?>
<div id="ajax_list_courses_multiple">
<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:360px;"> <?php
foreach($nosessionCourses as $enreg)
{
foreach($nosessionCourses as $enreg) {
?>
<option value="<?php echo $enreg['code']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option>
<option value="<?php echo $enreg['code']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>>
<?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
</option>
<?php
}
?></select>
@ -324,7 +318,7 @@ unset($nosessionCourses);
?>
<br /><br /><br /><br /><br /><br />
<?php
if(isset($_GET['add'])) {
if (isset($_GET['add'])) {
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('NextStep').'</button>';
} else {
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeCoursesToSession').'</button>';
@ -334,11 +328,11 @@ unset($nosessionCourses);
<td width="45%" align="center"><select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" style="width:360px;">
<?php
foreach($sessionCourses as $enreg)
{
foreach($sessionCourses as $enreg) {
?>
<option value="<?php echo $enreg['code']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES); ?>"><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option>
<option value="<?php echo $enreg['code']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES); ?>">
<?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
</option>
<?php
}
unset($sessionCourses);
@ -347,7 +341,7 @@ unset($sessionCourses);
</tr>
</table>
</form>
<script type="text/javascript">
<script>
function moveItem(origin , destination) {
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {
@ -374,7 +368,7 @@ function sortOptions(options) {
}
}
function mysort(a, b){
function mysort(a, b) {
if(a.text.toLowerCase() > b.text.toLowerCase()){
return 1;
}
@ -384,7 +378,7 @@ function mysort(a, b){
return 0;
}
function valide(){
function valide() {
var options = document.getElementById('destination').options;
for (i = 0 ; i<options.length ; i++)
options[i].selected = true;

@ -87,7 +87,7 @@ function change_select(val) {
$form_sent = 0;
$errorMsg = '';
$extra_field_list= UserManager::get_extra_fields();
$extra_field_list = UserManager::get_extra_fields();
$new_field_list = array();
if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
@ -125,6 +125,24 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
}
}
if (isset($_GET['action']) && $_GET['action'] == 'export') {
$groupInfo = $usergroup->get($id);
$users = $usergroup->getUserListByUserGroup($id);
if (!empty($users)) {
require_once api_get_path(LIBRARY_PATH) . 'export.lib.inc.php';
$data = array(
array('UserName', 'ClassName')
);
foreach ($users as $user) {
$data[] = array($user['username'], $groupInfo['name']);
}
$filename = 'export_user_class_' . api_get_local_time();
Export::export_table_csv($data, $filename);
exit;
}
}
//Filter by Extra Fields
$use_extra_fields = false;
@ -182,9 +200,9 @@ if ($searchForm->validate()) {
$filterData = $searchForm->getSubmitValues();
}
$data = $usergroup->get($id);
$list_in = $usergroup->get_users_by_usergroup($id);
$list_all = $usergroup->get_users_by_usergroup();
$data = $usergroup->get($id);
$list_in = $usergroup->get_users_by_usergroup($id);
$list_all = $usergroup->get_users_by_usergroup();
$order = array('lastname');
if (api_is_western_name_order()) {
@ -280,6 +298,9 @@ echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_op
echo '<a href="usergroup_user_import.php">'.
Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?id='.$id.'&action=export">'.
Display::return_icon('export_csv.png', get_lang('Export'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo '<div id="advanced_search_options" style="display:none">';

@ -24,26 +24,42 @@ $interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmi
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = 'SELECT name, nbr_courses, nbr_users, nbr_classes, DATE_FORMAT(date_start,"%d-%m-%Y") as date_start, DATE_FORMAT(date_end,"%d-%m-%Y") as date_end, lastname, firstname, username, session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id, visibility
FROM '.$tbl_session.' LEFT JOIN '.$tbl_user.' ON id_coach = user_id
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = 'SELECT
name,
nbr_courses,
nbr_users,
nbr_classes,
DATE_FORMAT(date_start,"%d-%m-%Y") as date_start,
DATE_FORMAT(date_end,"%d-%m-%Y") as date_end,
lastname,
firstname,
username,
session_admin_id,
nb_days_access_before_beginning,
nb_days_access_after_end,
session_category_id,
visibility
FROM '.$tbl_session.'
LEFT JOIN '.$tbl_user.'
ON id_coach = user_id
WHERE '.$tbl_session.'.id='.$id_session;
$rs = Database::query($sql);
$session = Database::store_result($rs);
$session = $session[0];
$sql = 'SELECT name FROM '.$tbl_session_category.' WHERE id = "'.intval($session['session_category_id']).'"';
$sql = 'SELECT name FROM '.$tbl_session_category.'
WHERE id = "'.intval($session['session_category_id']).'"';
$rs = Database::query($sql);
$session_category = '';
@ -57,18 +73,31 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
$url_id = api_get_current_access_url_id();
switch($action) {
switch ($action) {
case 'move_up':
SessionManager::moveUp($id_session, $_GET['course_code']);
header('Location: resume_session.php?id_session='.$id_session);
exit;
break;
case 'move_down':
SessionManager::moveDown($id_session, $_GET['course_code']);
header('Location: resume_session.php?id_session='.$id_session);
exit;
break;
case 'add_user_to_url':
$user_id = $_REQUEST['user_id'];
$result = UrlManager::add_user_to_url($user_id, $url_id);
$user_info = api_get_user_info($user_id);
if ($result) {
$message = Display::return_message(get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']), 'confirm');
$message = Display::return_message(
get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']),
'confirm'
);
}
break;
case 'delete':
$idChecked = $_GET['idChecked'];
if(is_array($idChecked)) {
if (is_array($idChecked)) {
$my_temp = array();
foreach ($idChecked as $id){
$my_temp[]= Database::escape_string($id);// forcing the escape_string
@ -84,7 +113,7 @@ switch($action) {
Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'");
}
if(!empty($_GET['class'])){
if (!empty($_GET['class'])){
Database::query("DELETE FROM $tbl_session_rel_class WHERE session_id='$id_session' AND class_id=".Database::escape_string($_GET['class']));
$nbr_affected_rows=Database::affected_rows();
Database::query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$id_session'");
@ -113,9 +142,14 @@ if (!empty($message)) {
echo $message;
}
echo Display::page_header(Display::return_icon('session.png', get_lang('Session')).' '.$session['name']);
echo Display::page_header(
Display::return_icon('session.png', get_lang('Session')).' '.$session['name']
);
$url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "session_edit.php?page=resume_session.php&id=$id_session");
$url = Display::url(
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
"session_edit.php?page=resume_session.php&id=$id_session"
);
echo Display::page_subheader(get_lang('GeneralProperties').$url);
?>
@ -139,7 +173,6 @@ echo Display::page_subheader(get_lang('GeneralProperties').$url);
echo get_lang('NoTimeLimits');
else {
if ($session['date_start'] != '00-00-0000') {
//$session['date_start'] = Display::tag('i', get_lang('NoTimeLimits'));
$session['date_start'] = get_lang('From').' '.$session['date_start'];
} else {
$session['date_start'] = '';
@ -176,7 +209,14 @@ echo Display::page_subheader(get_lang('GeneralProperties').$url);
<?php echo api_ucfirst(get_lang('SessionVisibility')) ?> :
</td>
<td>
<?php if ($session['visibility']==1) echo get_lang('ReadOnly'); elseif($session['visibility']==2) echo get_lang('Visible');elseif($session['visibility']==3) echo api_ucfirst(get_lang('Invisible')) ?>
<?php
if ($session['visibility']==1)
echo get_lang('ReadOnly');
elseif($session['visibility']==2)
echo get_lang('Visible');
elseif($session['visibility']==3)
echo api_ucfirst(get_lang('Invisible'));
?>
</td>
</tr>
@ -201,7 +241,10 @@ if ($multiple_url_is_on) {
<?php
$url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "add_courses_to_session.php?page=resume_session.php&id_session=$id_session");
$url = Display::url(
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
"add_courses_to_session.php?page=resume_session.php&id_session=$id_session"
);
echo Display::page_subheader(get_lang('CourseList').$url);
?>
@ -211,37 +254,56 @@ echo Display::page_subheader(get_lang('CourseList').$url);
<tr>
<th width="35%"><?php echo get_lang('CourseTitle'); ?></th>
<th width="30%"><?php echo get_lang('CourseCoach'); ?></th>
<th width="20%"><?php echo get_lang('UsersNumber'); ?></th>
<th width="15%"><?php echo get_lang('Actions'); ?></th>
<th width="10%"><?php echo get_lang('UsersNumber'); ?></th>
<th width="25%"><?php echo get_lang('Actions'); ?></th>
</tr>
<?php
if ($session['nbr_courses'] == 0){
if ($session['nbr_courses'] == 0) {
echo '<tr>
<td colspan="4">'.get_lang('NoCoursesForThisSession').'</td>
</tr>';
} else {
// select the courses
$orderBy = "ORDER BY title";
if (SessionManager::orderCourseIsEnabled()) {
$orderBy = "ORDER BY position";
}
$sql = "SELECT code,title,visual_code, nbr_users
FROM $tbl_course,$tbl_session_rel_course
WHERE course_code = code
AND id_session='$id_session'
ORDER BY title";
$result=Database::query($sql);
$courses=Database::store_result($result);
FROM $tbl_course, $tbl_session_rel_course
WHERE
course_code = code AND
id_session='$id_session'
$orderBy";
$result = Database::query($sql);
$courses = Database::store_result($result);
$count = 0;
foreach ($courses as $course) {
//select the number of users
$sql = " SELECT count(*) FROM $tbl_session_rel_user sru, $tbl_session_rel_course_rel_user srcru
WHERE srcru.id_user = sru.id_user AND srcru.id_session = sru.id_session AND srcru.course_code = '".Database::escape_string($course['code'])."'
AND sru.relation_type<>".SESSION_RELATION_TYPE_RRHH." AND srcru.id_session = '".intval($id_session)."'";
$sql = "SELECT count(*)
FROM $tbl_session_rel_user sru, $tbl_session_rel_course_rel_user srcru
WHERE
srcru.id_user = sru.id_user AND
srcru.id_session = sru.id_session AND
srcru.course_code = '".Database::escape_string($course['code'])."' AND
sru.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND
srcru.id_session = '".intval($id_session)."'";
$rs = Database::query($sql);
$course['nbr_users'] = Database::result($rs,0,0);
$course['nbr_users'] = Database::result($rs, 0, 0);
// Get coachs of the courses in session
$sql = "SELECT user.lastname,user.firstname,user.username FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
WHERE session_rcru.id_user = user.user_id AND session_rcru.id_session = '".intval($id_session)."' AND session_rcru.course_code ='".Database::escape_string($course['code'])."' AND session_rcru.status=2";
$sql = "SELECT user.lastname,user.firstname,user.username
FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
WHERE
session_rcru.id_user = user.user_id AND
session_rcru.id_session = '".intval($id_session)."' AND
session_rcru.course_code ='".Database::escape_string($course['code'])."' AND
session_rcru.status=2";
$rs = Database::query($sql);
$coachs = array();
@ -259,6 +321,36 @@ if ($session['nbr_courses'] == 0){
$coach = get_lang('None');
}
$orderButtons = null;
if (SessionManager::orderCourseIsEnabled()) {
$upIcon = 'up.png';
$urlUp = api_get_self().'?id_session='.$id_session.'&course_code='.$course['code'].'&action=move_up&list='.$list;
if ($count == 0) {
$upIcon = 'up_na.png';
$urlUp = '#';
}
$orderButtons = Display::url(
Display::return_icon($upIcon, get_lang('MoveUp')),
$urlUp
);
$downIcon = 'down.png';
$downUrl = api_get_self().'?id_session='.$id_session.'&course_code='.$course['code'].'&action=move_down&list='.$list;
if ($count +1 == count($courses)) {
$downIcon = 'down_na.png';
$downUrl = '#';
}
$orderButtons .= Display::url(
Display::return_icon($downIcon, get_lang('MoveDown')),
$downUrl
);
}
$orig_param = '&origin=resume_session';
//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
echo '
@ -268,13 +360,16 @@ if ($session['nbr_courses'] == 0){
<td>'.$course['nbr_users'].'</td>
<td>
<a href="'.api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session.'">'.Display::return_icon('course_home.gif', get_lang('Course')).'</a>
'.$orderButtons.'
<a href="session_course_user_list.php?id_session='.$id_session.'&course_code='.$course['code'].'">'.Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>
<a href="'.api_get_path(WEB_CODE_PATH).'/user/user_import.php?action=import&cidReq='.$course['code'].'&id_session='.$id_session.'">'.Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), null, ICON_SIZE_SMALL).'</a>
<a href="../tracking/courseLog.php?id_session='.$id_session.'&cidReq='.$course['code'].$orig_param.'&hide_course_breadcrumb=1">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;
<a href="session_course_edit.php?id_session='.$id_session.'&page=resume_session.php&course_code='.$course['code'].''.$orig_param.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&idChecked[]='.$course['code'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>
</td>
</tr>';
$count++;
}
}
?>
@ -283,8 +378,14 @@ if ($session['nbr_courses'] == 0){
<?php
$url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "add_users_to_session.php?page=resume_session.php&id_session=$id_session");
$url .= Display::url(Display::return_icon('import_csv.png', get_lang('ImportUsers'), array(), ICON_SIZE_SMALL), "session_user_import.php?id_session=$id_session");
$url = Display::url(
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
"add_users_to_session.php?page=resume_session.php&id_session=$id_session"
);
$url .= Display::url(
Display::return_icon('import_csv.png', get_lang('ImportUsers'), array(), ICON_SIZE_SMALL),
"session_user_import.php?id_session=$id_session"
);
echo Display::page_subheader(get_lang('UserList').$url);
?>
@ -360,4 +461,10 @@ if ($session['nbr_users']==0) {
</table>
<?php
// footer
Display :: display_footer();
Display :: display_footer();
/*
ALTER TABLE session_rel_course ADD COLUMN position int;
ALTER TABLE session_rel_course ADD COLUMN category varchar(255);
*
*/

@ -97,29 +97,46 @@ function fill_coach_field (username) {
if ($_POST['formSent']) {
$formSent = 1;
$name = $_POST['name'];
$year_start = $_POST['year_start'];
$month_start = $_POST['month_start'];
$day_start = $_POST['day_start'];
$year_end = $_POST['year_end'];
$month_end = $_POST['month_end'];
$day_end = $_POST['day_end'];
$nb_days_acess_before = $_POST['nb_days_acess_before'];
$nb_days_acess_after = $_POST['nb_days_acess_after'];
//$nolimit = $_POST['nolimit'];
$coach_username = $_POST['coach_username'];
$id_session_category = $_POST['session_category'];
$id_visibility = $_POST['session_visibility'];
$end_limit = $_POST['end_limit'];
$start_limit = $_POST['start_limit'];
$name = $_POST['name'];
$year_start = $_POST['year_start'];
$month_start = $_POST['month_start'];
$day_start = $_POST['day_start'];
$year_end = $_POST['year_end'];
$month_end = $_POST['month_end'];
$day_end = $_POST['day_end'];
$nb_days_acess_before = $_POST['nb_days_acess_before'];
$nb_days_acess_after = $_POST['nb_days_acess_after'];
$coach_username = $_POST['coach_username'];
$id_session_category = $_POST['session_category'];
$id_visibility = $_POST['session_visibility'];
$end_limit = $_POST['end_limit'];
$start_limit = $_POST['start_limit'];
$duration = isset($_POST['duration']) ? $_POST['duration'] : null;
if (empty($end_limit) && empty($start_limit)) {
$nolimit = 1;
} else {
$nolimit = null;
}
$return = SessionManager::create_session($name,$year_start,$month_start,$day_start,$year_end,$month_end,$day_end,$nb_days_acess_before,$nb_days_acess_after,$nolimit,$coach_username, $id_session_category,$id_visibility, $start_limit, $end_limit);
$return = SessionManager::create_session(
$name,
$year_start,
$month_start,
$day_start,
$year_end,
$month_end,
$day_end,
$nb_days_acess_before,
$nb_days_acess_after,
$nolimit,
$coach_username,
$id_session_category,
$id_visibility,
$start_limit,
$end_limit,
$duration
);
if ($return == strval(intval($return))) {
// integer => no error on session creation
@ -394,6 +411,23 @@ for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
</div>
</div>
<?php
if (SessionManager::durationPerUserIsEnabled()) {
?>
<div class="control-group">
<label class="control-label">
<?php echo get_lang('SessionDurationTitle') ?> <br />
</label>
<div class="controls">
<input id="duration" type="text" name="duration" class="span1" maxlength="50" value="">
<br />
<?php echo get_lang('SessionDurationDescription') ?>
</div>
</div>
<?php
}
?>
<div class="control-group">
<div class="controls">
@ -433,6 +467,8 @@ function disable_endtime(select) {
end_div.style.display = 'block';
else
end_div.style.display = 'none';
emptyDuration();
}
function disable_starttime(select) {
@ -441,7 +477,15 @@ function disable_starttime(select) {
start_div.style.display = 'block';
else
start_div.style.display = 'none';
emptyDuration();
}
function emptyDuration() {
if ($('#duration').val()) {
$('#duration').val('');
}
}
</script>
<?php
Display::display_footer();
Display::display_footer();

@ -60,7 +60,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$id_coach = $_POST['id_coach'];
$id_session_category = $_POST['session_category'];
$id_visibility = $_POST['session_visibility'];
$duration = isset($_POST['duration']) ? $_POST['duration'] : null;
$description = isset($_POST['description']) ? $_POST['description'] : null;
$showDescription = isset($_POST['show_description']) ? 1 : 0;
@ -91,7 +91,8 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$start_limit,
$end_limit,
$description,
$showDescription
$showDescription,
$duration
);
if ($return == strval(intval($return))) {
@ -376,6 +377,29 @@ if (!empty($return)) {
<?php } ?>
<?php
if (SessionManager::durationPerUserIsEnabled()) {
if (empty($infos['duration'])) {
$duration = null;
} else {
$duration = $infos['duration'];
}
?>
<div class="control-group">
<label class="control-label">
<?php echo get_lang('SessionDurationTitle') ?> <br />
</label>
<div class="controls">
<input id="duration" type="text" name="duration" class="span1" maxlength="50" value="<?php if($formSent) echo Security::remove_XSS($duration); else echo $duration; ?>">
<br />
<?php echo get_lang('SessionDurationDescription') ?>
</div>
</div>
<?php
}
?>
<div class="control-group">
<div class="controls">
<button class="save" type="submit" value="<?php echo get_lang('ModifyThisSession') ?>"><?php echo get_lang('ModifyThisSession') ?></button>
@ -386,9 +410,11 @@ if (!empty($return)) {
<script type="text/javascript">
<?php if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n"; ?>
<?php
//if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n";
?>
function setDisable(select){
function setDisable(select) {
document.form.day_start.disabled = (select.checked) ? true : false;
document.form.month_start.disabled = (select.checked) ? true : false;
@ -419,6 +445,7 @@ function disable_endtime(select) {
end_div.style.display = 'block';
else
end_div.style.display = 'none';
emptyDuration();
}
function disable_starttime(select) {
@ -427,6 +454,13 @@ function disable_starttime(select) {
start_div.style.display = 'block';
else
start_div.style.display = 'none';
emptyDuration();
}
function emptyDuration() {
if ($('#duration').val()) {
$('#duration').val('');
}
}
</script>

@ -62,7 +62,6 @@ $actions = '
$(function() {
$("#course_name").on("change", function() {
var courseId = $(this).val();
console.log(courseId);
window.location = "'.$url.'?course_id="+courseId;
});
});

@ -150,6 +150,7 @@ $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$errors = array();
if ($form->validate()) {
$users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users_classes);

@ -334,40 +334,66 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
$form->addElement('button', 'submit', get_lang('RegisterUser'), array('class' => 'btn btn-primary btn-large'));
if ($form->validate()) {
//$values = $form->exportValues();
$values = $form->getSubmitValues(1);
$values['username'] = api_substr($values['username'], 0, USERNAME_MAX_LENGTH); //make *sure* the login isn't too long
//make *sure* the login isn't too long
$values['username'] = api_substr($values['username'], 0, USERNAME_MAX_LENGTH);
if (api_get_setting('allow_registration_as_teacher') == 'false') {
$values['status'] = STUDENT;
}
// Added by Ivan Tcholakov, 06-MAR-2008.
if (empty($values['official_code'])) {
$values['official_code'] = api_strtoupper($values['username']);
$values['official_code'] = api_strtoupper($values['username']);
}
if (api_get_setting('login_is_email') == 'true') {
$values['username'] = $values['email'];
}
if ($user_already_registered_show_terms && api_get_setting('allow_terms_conditions') == 'true') {
if ($user_already_registered_show_terms &&
api_get_setting('allow_terms_conditions') == 'true'
) {
$user_id = $_SESSION['term_and_condition']['user_id'];
$is_admin = UserManager::is_admin($user_id);
Session::write('is_platformAdmin', $is_admin);
} else {
// Creates a new user
$user_id = UserManager::create_user($values['firstname'], $values['lastname'], $values['status'], $values['email'], $values['username'], $values['pass1'], $values['official_code'], $values['language'], $values['phone'], $picture_uri, PLATFORM_AUTH_SOURCE, null, 1, 0, null, null, true);
$user_id = UserManager::create_user(
$values['firstname'],
$values['lastname'],
$values['status'],
$values['email'],
$values['username'],
$values['pass1'],
$values['official_code'],
$values['language'],
$values['phone'],
null,
PLATFORM_AUTH_SOURCE,
null,
1,
0,
null,
null,
true
);
// Register extra fields
$extras = array();
foreach ($values as $key => $value) {
if (substr($key, 0, 6) == 'extra_') { //an extra field
$extras[substr($key,6)] = $value;
if (substr($key, 0, 6) == 'extra_') {
//an extra field
$extras[substr($key, 6)] = $value;
} elseif (strpos($key, 'remove_extra_') !== false) {
$extra_value = Security::filter_filename(urldecode(key($value)));
// To remove from user_field_value and folder
UserManager::update_extra_field_value($user_id, substr($key,13), $extra_value);
UserManager::update_extra_field_value(
$user_id,
substr($key,13),
$extra_value
);
}
}
@ -396,7 +422,7 @@ if ($form->validate()) {
}
if ($user_id) {
// storing the extended profile
// Storing the extended profile
$store_extended = false;
$sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_USER)." SET ";
if (api_get_setting('extended_profile') == 'true' && api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true') {
@ -427,15 +453,38 @@ if ($form->validate()) {
Database::query($sql);
}
// if the account has to be approved then we set the account to inactive, sent a mail to the platform admin and exit the page.
$course_code_redirect = Session::read('course_redirect');
// Saving user to course if it was set.
if (!empty($course_code_redirect)) {
$course_info = api_get_course_info($course_code_redirect);
if (!empty($course_info)) {
if (in_array(
$course_info['visibility'],
array(
COURSE_VISIBILITY_OPEN_PLATFORM,
COURSE_VISIBILITY_OPEN_WORLD
)
)
) {
CourseManager::subscribe_user(
$user_id,
$course_info['code']
);
}
}
}
/* If the account has to be approved then we set the account to inactive,
sent a mail to the platform admin and exit the page.*/
if (api_get_setting('allow_registration') == 'approval') {
$TABLE_USER = Database::get_main_table(TABLE_MAIN_USER);
// 1. set account inactive
$sql = "UPDATE ".$TABLE_USER." SET active='0' WHERE user_id='".$user_id."'";
$sql = "UPDATE $TABLE_USER SET active='0' WHERE user_id = ".$user_id;
Database::query($sql);
// 2. Send mail to all platform admin
$emailsubject = get_lang('ApprovalForNewAccount',null,$values['language']).': '.$values['username'];
$emailbody = get_lang('ApprovalForNewAccount',null,$values['language'])."\n";
$emailbody .= get_lang('UserName',null,$values['language']).': '.$values['username']."\n";
@ -449,12 +498,28 @@ if ($form->validate()) {
}
$emailbody .= get_lang('Email',null,$values['language']).': '.$values['email']."\n";
$emailbody .= get_lang('Status',null,$values['language']).': '.$values['status']."\n\n";
$url_edit = Display::url(api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id, api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id);
$url_edit = Display::url(
api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id,
api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id
);
$emailbody .= get_lang('ManageUser',null,$values['language']).": $url_edit";
$admins = UserManager::get_all_administrators();
foreach ($admins as $admin_info) {
MessageManager::send_message($admin_info['user_id'], $emailsubject, $emailbody, null, null, null, null, null, null, $user_id);
MessageManager::send_message(
$admin_info['user_id'],
$emailsubject,
$emailbody,
null,
null,
null,
null,
null,
null,
$user_id
);
}
// 3. exit the page
@ -471,8 +536,7 @@ if ($form->validate()) {
// Terms & Conditions
if (api_get_setting('allow_terms_conditions') == 'true') {
// update the terms & conditions
// Update the terms & conditions.
if (isset($values['legal_accept_type'])) {
$cond_array = explode(':', $values['legal_accept_type']);
if (!empty($cond_array[0]) && !empty($cond_array[1])) {
@ -497,7 +561,7 @@ if ($form->validate()) {
Session::write('_user', $_user);
Session::write('is_allowedCreateCourse', $is_allowedCreateCourse);
//stats
// Stats
event_login();
// last user login date is now
@ -507,9 +571,11 @@ if ($form->validate()) {
$text_after_registration = '<p>'.get_lang('Dear', null, $_user['language']).' '.stripslashes(Security::remove_XSS($recipient_name)).',<br /><br />'.get_lang('PersonalSettings',null,$_user['language']).".</p>";
$form_data = array( 'button' => Display::button('next', get_lang('Next', null, $_user['language']), array('class' => 'btn btn-primary btn-large')),
'message' => null,
'action' => api_get_path(WEB_PATH).'user_portal.php');
$form_data = array(
'button' => Display::button('next', get_lang('Next', null, $_user['language']), array('class' => 'btn btn-primary btn-large')),
'message' => null,
'action' => api_get_path(WEB_PATH).'user_portal.php'
);
if (api_get_setting('allow_terms_conditions') == 'true' && $user_already_registered_show_terms) {
$form_data['action'] = api_get_path(WEB_PATH).'user_portal.php';
@ -547,7 +613,8 @@ if ($form->validate()) {
*
* You can send to your students an URL like this
* http://chamilodev.beeznest.com/main/auth/inscription.php?c=ABC&e=3
* Where "c" is the course code and "e" is the exercise Id, after a succesfull registration the user will be sent to the course or exercise
* Where "c" is the course code and "e" is the exercise Id, after a successful
* registration the user will be sent to the course or exercise
*
*/
$course_code_redirect = Session::read('course_redirect');
@ -555,23 +622,34 @@ if ($form->validate()) {
if (!empty($course_code_redirect)) {
$course_info = api_get_course_info($course_code_redirect);
if (!empty($course_info)) {
if (in_array($course_info['visibility'], array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))) {
if (in_array($course_info['visibility'],
array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))
) {
$user_id = api_get_user_id();
if (CourseManager::subscribe_user($user_id, $course_info['code'])) {
if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['code'])) {
$form_data['action'] = $course_info['course_public_url'];
$form_data['message'] = sprintf(get_lang('YouHaveBeenRegisteredToCourseX'), $course_info['title']);
$form_data['button'] = Display::button('next', get_lang('GoToCourse', null, $_user['language']), array('class' => 'btn btn-primary btn-large'));
$form_data['button'] = Display::button(
'next',
get_lang('GoToCourse', null, $_user['language']),
array('class' => 'btn btn-primary btn-large')
);
$exercise_redirect = intval(Session::read('exercise_redirect'));
$objExercise = new Exercise();
$result = $objExercise->read($exercise_id);
$result = $objExercise->read($exercise_redirect);
if (!empty($exercise_redirect) && !empty($result)) {
$form_data['action'] = api_get_path(WEB_CODE_PATH).'exercice/overview.php?exerciseId='.intval($exercise_redirect).'&cidReq='.$course_info['code'];
$form_data['action'] = api_get_path(WEB_CODE_PATH).'exercice/overview.php?exerciseId='.$exercise_redirect.'&cidReq='.$course_info['code'];
$form_data['message'] .= '<br />'.get_lang('YouCanAccessTheExercise');
$form_data['button'] = Display::button('next', get_lang('Go', null, $_user['language']), array('class' => 'btn btn-primary btn-large'));
$form_data['button'] = Display::button(
'next',
get_lang('Go', null, $_user['language']),
array('class' => 'btn btn-primary btn-large')
);
}
if (!empty($form_data['action'])) {
header('Location: '.$form_data['action']);
exit;
@ -592,7 +670,7 @@ if ($form->validate()) {
}
$text_after_registration .= $form_register->return_form();
//Just in case
// Just in case
Session::erase('course_redirect');
Session::erase('exercise_redirect');

@ -24,19 +24,19 @@ require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
// Custom pages
// Had to move the form handling in here, because otherwise there would
// Had to move the form handling in here, because otherwise there would
// already be some display output.
global $_configuration;
if (CustomPages::enabled()) {
//Reset Password when user goes to the link
if ($_GET['reset'] && $_GET['id']){
if ($_GET['reset'] && $_GET['id']) {
$mesg = Login::reset_password($_GET["reset"], $_GET["id"], true);
CustomPages::display(CustomPages::INDEX_UNLOGGED, array('info' => $mesg));
}
//Check email/username and do the right thing
if (isset ($_POST['user']) && isset ($_POST['email'])) {
if (isset($_POST['user']) && isset ($_POST['email'])) {
$user = $_POST['user'];
$email = $_POST['email'];
@ -57,16 +57,18 @@ if (CustomPages::enabled()) {
if ($result && $num_rows > 0) {
if ($num_rows > 1) {
$by_username = false; // more than one user
// more than one user
$by_username = false;
while ($data = Database::fetch_array($result)) {
$user[] = $data;
}
} else {
$by_username = true; // single user (valid user + email)
// single user (valid user + email)
$by_username = true;
$user = Database::fetch_array($result);
}
if ($_configuration['password_encryption'] != 'none') {
//Send email with secret link to user
// Send email with secret link to user
Login::handle_encrypted_password($user, $by_username);
} else {
Login::send_password_to_user($user, $by_username);
@ -75,9 +77,12 @@ if (CustomPages::enabled()) {
CustomPages::display(CustomPages::LOST_PASSWORD, array('error' => get_lang('NoUserAccountWithThisEmailAddress')));
}
} else {
CustomPages::display(CustomPages::LOGGED_OUT);
CustomPages::display(CustomPages::LOST_PASSWORD);
}
CustomPages::display(CustomPages::INDEX_UNLOGGED, array('info' => get_lang('YourPasswordHasBeenEmailed')));
CustomPages::display(
CustomPages::INDEX_UNLOGGED,
array('info' => get_lang('YourPasswordHasBeenEmailed'))
);
}
$tool_name = get_lang('LostPassword');
@ -91,9 +96,9 @@ if (api_get_setting('allow_lostpassword') == 'false') {
api_not_allowed();
}
if (isset($_GET['reset']) && isset($_GET['id'])) {
$message = Display::return_message(Login::reset_password($_GET["reset"], $_GET["id"], true), 'normal', false);
$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/lostPassword.php" class="btn" >'.get_lang('Back').'</a>';
if (isset($_GET['reset']) && isset($_GET['id'])) {
$message = Display::return_message(Login::reset_password($_GET["reset"], $_GET["id"], true), 'normal', false);
$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/lostPassword.php" class="btn" >'.get_lang('Back').'</a>';
echo $message;
} else {
$form = new FormValidator('lost_password');
@ -107,11 +112,11 @@ 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 ($users_related_to_username) {
$by_username = true;
$by_username = true;
foreach ($users_related_to_username as $user) {
if ($_configuration['password_encryption'] != 'none') {
Login::handle_encrypted_password($user, $by_username);
@ -120,9 +125,9 @@ if (isset($_GET['reset']) && isset($_GET['id'])) {
}
}
} else {
Display::display_warning_message(get_lang('NoUserAccountWithThisEmailAddress'));
Display::display_warning_message(get_lang('NoUserAccountWithThisEmailAddress'));
}
} else {
} else {
$form->display();
}
}

@ -1151,7 +1151,9 @@ class Agenda
if (empty($courseInfo)) {
return array();
}
$course_id = $courseInfo['real_id'];
if (empty($course_id)) {
return array();
}
@ -1183,6 +1185,7 @@ class Agenda
$session_id = intval($session_id);
if (is_array($group_memberships) && count($group_memberships) > 0) {
if (api_is_allowed_to_edit()) {
if (!empty($groupId)) {
$where_condition = "( ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) ";
@ -1197,8 +1200,15 @@ class Agenda
$where_condition = "( ip.to_user_id = $user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) ";
}
$sql = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref, to_user_id
FROM $tlb_course_agenda agenda INNER JOIN $tbl_property ip
$sql = "SELECT DISTINCT
agenda.*,
ip.visibility,
ip.to_group_id,
ip.insert_user_id,
ip.ref,
to_user_id
FROM $tlb_course_agenda agenda
INNER JOIN $tbl_property ip
ON (agenda.id = ip.ref AND agenda.c_id = ip.c_id)
WHERE
ip.tool ='".TOOL_CALENDAR_EVENT."' AND
@ -1208,17 +1218,19 @@ class Agenda
ip.c_id = $course_id
";
} else {
$visibilityCondition = "ip.visibility='1' AND";
$visibilityCondition = " ip.visibility='1' AND";
if (api_is_allowed_to_edit()) {
if ($user_id == 0) {
$where_condition = "";
} else {
$where_condition = "( ip.to_user_id=".$user_id. ") AND ";
$where_condition = " ( ip.to_user_id = ".$user_id. " OR ip.to_group_id='0' ) AND ";
}
$visibilityCondition = " (ip.visibility IN ('1', '0')) AND ";
} else {
$where_condition = "( ip.to_user_id=$user_id OR ip.to_group_id='0') AND ";
$where_condition = " ( ip.to_user_id = $user_id OR ip.to_group_id='0' ) AND ";
}
$sql = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref, to_user_id
FROM $tlb_course_agenda agenda INNER JOIN $tbl_property ip
ON (agenda.id = ip.ref AND agenda.c_id = ip.c_id)

@ -268,3 +268,4 @@ $tpl->assign('course_code', $course_code);
$tpl->display_one_col_template();
Session::erase('_gid');
DocumentManager::removeGeneratedAudioTempFile();

@ -291,7 +291,7 @@ $form->addElement('html', '</div></div>');
// LEARNING PATH
$form->addElement('html', '<div><h3>'.Display::return_icon('scorms.png', get_lang('ConfigLearnpath'),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('ConfigLearnpath')).'</h3><div>');
//Auto launch LP
// Auto launch LP
$group = array();
$group[]=$form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToALearningPath'), 1);
$group[]=$form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToTheLearningPathList'), 2);
@ -305,6 +305,13 @@ if (api_get_setting('allow_course_theme') == 'true') {
$group[]=$form->createElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
$form->addGroup($group, '', array(get_lang("AllowLearningPathTheme")), '');
}
/*
$group = array(
$form->createElement('radio', 'lp_return_link', get_lang('LpReturnLink'), get_lang('RedirectToTheLearningPathList'), 1),
$form->createElement('radio', 'lp_return_link', null, get_lang('RedirectToCourseHome'), 0)
);
$form->addGroup($group, '', array(get_lang("LpReturnLink")), '');
*/
if (is_settings_editable()) {
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
@ -420,6 +427,7 @@ if ($form->validate() && is_settings_editable()) {
'legal',
'activate_legal'
);
foreach ($updateValues as $index =>$value) {
$updateValues[$index] = Database::escape_string($value);
}
@ -451,11 +459,12 @@ if ($form->validate() && is_settings_editable()) {
);
}
$appPlugin->saveCourseSettingsHook($update_values);
$appPlugin->saveCourseSettingsHook($updateValues);
$cidReset = true;
$cidReq = $course_code;
require '../inc/local.inc.php';
header('Location: infocours.php?action=show_message&cidReq='.$course_code);
$url = api_get_path(WEB_CODE_PATH).'course_info/infocours.php?action=show_message&cidReq='.$course_code;
header("Location: $url");
exit;
}

@ -251,7 +251,6 @@ class CourseBuilder
$avoid_paths AND
d.session_id = 0
ORDER BY path";
var_dump($sql);
} else {
$sql = "SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
FROM $table_doc d INNER JOIN $table_prop p

@ -530,7 +530,6 @@ class CourseSelectForm
if (!empty($resources) && is_array($resources)) {
foreach ($resources as $id => $obj) {
$resource_is_used_elsewhere = $course->is_linked_resource($obj);
//var_dump($obj, $resource_is_used_elsewhere);
// check if document is in a quiz (audio/video)
if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) {
foreach($course->resources[RESOURCE_QUIZ] as $quiz) {

@ -31,13 +31,13 @@ $xajax = new xajax();
$xajax->registerFunction('search_courses');
if (!api_is_allowed_to_edit() && !api_is_session_admin()) {
api_not_allowed(true);
api_not_allowed(true);
}
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
api_set_memory_limit('256M');
ini_set('max_execution_time', 1800);
api_set_memory_limit('256M');
ini_set('max_execution_time', 1800);
}
$this_section = SECTION_PLATFORM_ADMIN;
@ -46,247 +46,223 @@ $nameTools = get_lang('CopyCourse');
$interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
// Database Table Definitions
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
/* FUNCTIONS */
function make_select_session_list($name, $sessions, $attr = array()) {
$attrs = '';
if (count($attr) > 0) {
foreach ($attr as $key => $value) {
$attrs .= ' '.$key.'="'.$value.'"';
}
}
$output = '<select name="'.$name.'" '.$attrs.'>';
if (count($sessions) == 0) {
$output .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option>';
} else {
$output .= '<option value = "0">'.get_lang('SelectASession').'</option>';
}
if (is_array($sessions)) {
foreach ($sessions as $session) {
$category_name = '';
function make_select_session_list($name, $sessions, $attr = array())
{
$attrs = '';
if (count($attr) > 0) {
foreach ($attr as $key => $value) {
$attrs .= ' '.$key.'="'.$value.'"';
}
}
$output = '<select name="'.$name.'" '.$attrs.'>';
if (count($sessions) == 0) {
$output .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option>';
} else {
$output .= '<option value = "0">'.get_lang('SelectASession').'</option>';
}
if (is_array($sessions)) {
foreach ($sessions as $session) {
$categoryName = '';
if (!empty($session['category_name'])) {
$category_name = ' ('.$session['category_name'].')';
$categoryName = ' ('.$session['category_name'].')';
}
$output .= '<option value="'.$session['id'].'">'.$session['name'].' '.$category_name.'</option>';
}
}
$output .= '</select>';
return $output;
$output .= '<option value="'.$session['id'].'">'.
$session['name'].' '.$categoryName.
'</option>';
}
}
$output .= '</select>';
return $output;
}
function display_form() {
$html = '';
$sessions = SessionManager::get_sessions_list(null, array('name ASC'));
// Actions
$html .= '<div class="actions">';
// Link back to the documents overview
$html .= '<a href="../admin/index.php">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
$html .= '</div>';
function display_form()
{
$html = '';
$sessions = SessionManager::get_sessions_list(null, array('name ASC'));
// Actions
$html .= '<div class="actions">';
// Link back to the documents overview
$html .= '<a href="../admin/index.php">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).
'</a>';
$html .= '</div>';
$html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'));
$html .= '<form name="formulaire" method="post" action="'.api_get_self().'" >';
$html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
// origin
$html .= '<tr><td width="15%"><b>'.get_lang('OriginCoursesFromSession').':</b></td>';
$html .= '<td width="10%" align="left">'.make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')).'</td>';
$html .= '<td width="50%"><div id="ajax_list_courses_origin">';
$html .= '<select id="origin" name="SessionCoursesListOrigin[]" style="width:380px;"></select></div></td></tr>';
//destination
$html .= '<tr><td width="15%"><b>'.get_lang('DestinationCoursesFromSession').':</b></td>';
$html .= '<form name="formulaire" method="post" action="'.api_get_self().'" >';
$html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
// origin
$html .= '<tr><td width="15%"><b>'.get_lang('OriginCoursesFromSession').':</b></td>';
$html .= '<td width="10%" align="left">'.make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')).'</td>';
$html .= '<td width="50%"><div id="ajax_list_courses_origin">';
$html .= '<select id="origin" name="SessionCoursesListOrigin[]" style="width:380px;"></select></div></td></tr>';
//destination
$html .= '<tr><td width="15%"><b>'.get_lang('DestinationCoursesFromSession').':</b></td>';
$html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">';
$html .= '<select name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
$html .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option></select ></div></td>';
$html .= '<td width="50%">';
$html .= '<div id="ajax_list_courses_destination">';
$html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>';
$html .= '</tr></table>';
$html .= '<h3>'.get_lang('TypeOfCopy').'</h3>';
$html .= '<select name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
$html .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option></select ></div></td>';
$html .= '<td width="50%">';
$html .= '<div id="ajax_list_courses_destination">';
$html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>';
$html .= '</tr></table>';
$html .= '<h3>'.get_lang('TypeOfCopy').'</h3>';
$html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
$html .= get_lang('FullCopy').'</label><br/>';
$html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items" disabled="disabled"/>';
$html .= ' '.get_lang('LetMeSelectItems').'</label><br/>';
$html .= '<label class="checkbox"><input type="checkbox" id="copy_base_content_id" name="copy_only_session_items" />'.get_lang('CopyOnlySessionItems').'</label><br /><br/>';
$html .= '<button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.get_lang('CopyCourse').'</button>';
$html .= '<button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.get_lang('CopyCourse').'</button>';
$html .= '</form>';
echo $html;
}
function search_courses($id_session, $type) {
global $tbl_course, $tbl_session_rel_course, $course_list;
$xajax_response = new XajaxResponse();
$select_destination = '';
if (!empty($type)) {
echo $html;
}
$id_session = intval($id_session);
function search_courses($id_session, $type)
{
global $tbl_course, $tbl_session_rel_course, $course_list;
$xajax_response = new XajaxResponse();
$select_destination = '';
$return = null;
if ($type == 'origin') {
if (!empty($type)) {
$id_session = intval($id_session);
if ($type == 'origin') {
$course_list = SessionManager::get_course_list_by_session_id($id_session);
$temp_course_list = array();
$return .= '<select id="origin" name="SessionCoursesListOrigin[]" style="width:380px;" onclick="javascript: checkSelected(this.id,\'copy_option_2\',\'title_option2\',\'destination\');">';
foreach ($course_list as $course) {
$temp_course_list[] = "'{$course['code']}'";
$course_title=str_replace("'","\'",$course_title);
$return .= '<option value="'.$course['code'].'" title="'.@htmlspecialchars($course['title'].' ('.$course['visual_code'].')', ENT_QUOTES, api_get_system_encoding()).'">'.$course['title'].' ('.$course['visual_code'].')</option>';
}
$temp_course_list = array();
$return .= '<select id="origin" name="SessionCoursesListOrigin[]" style="width:380px;" onclick="javascript: checkSelected(this.id,\'copy_option_2\',\'title_option2\',\'destination\');">';
$return .= '</select>';
$_SESSION['course_list'] = $temp_course_list;
$_SESSION['session_origin'] = $id_session;
// Build select for destination sessions where is not included current session from select origin
if (!empty($id_session)) {
$sessions = SessionManager::get_sessions_list(null, array('name ASC'));
$select_destination .= '<select name="sessions_list_destination" width="380px" onchange = "javascript: xajax_search_courses(this.value,\'destination\');">';
$select_destination .= '<option value = "0">-- '.get_lang('SelectASession').' --</option>';
foreach ($sessions as $session) {
if ($id_session == $session['id']) { continue; };
if (!empty($session['category_name'])) {
$session['category_name'] = ' ('.$session['category_name'].') ';
}
$select_destination .= '<option value="'.$session['id'].'">'.$session['name'].' '.$session['category_name'].'</option>';
}
$select_destination .= '</select>';
$xajax_response -> addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination));
} else {
$select_destination .= '<select name="sessions_list_destination" width="380px" onchange = "javascript: xajax_search_courses(this.value,\'destination\');">';
$select_destination .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option>';
$select_destination .= '</select>';
$xajax_response -> addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination));
}
foreach ($course_list as $course) {
$temp_course_list[] = "'{$course['code']}'";
$return .= '<option value="'.$course['code'].'" title="'.@htmlspecialchars($course['title'].' ('.$course['visual_code'].')', ENT_QUOTES, api_get_system_encoding()).'">'.$course['title'].' ('.$course['visual_code'].')</option>';
}
// Select multiple destination empty
$select_multiple_empty = '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;"></select>';
$return .= '</select>';
$_SESSION['course_list'] = $temp_course_list;
$_SESSION['session_origin'] = $id_session;
// Build select for destination sessions where is not included current session from select origin
if (!empty($id_session)) {
$sessions = SessionManager::get_sessions_list(null, array('name ASC'));
$select_destination .= '<select name="sessions_list_destination" width="380px" onchange = "javascript: xajax_search_courses(this.value,\'destination\');">';
$select_destination .= '<option value = "0">-- '.get_lang('SelectASession').' --</option>';
foreach ($sessions as $session) {
if ($id_session == $session['id']) { continue; };
if (!empty($session['category_name'])) {
$session['category_name'] = ' ('.$session['category_name'].') ';
}
$select_destination .= '<option value="'.$session['id'].'">'.$session['name'].' '.$session['category_name'].'</option>';
}
$select_destination .= '</select>';
$xajax_response -> addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination));
} else {
$select_destination .= '<select name="sessions_list_destination" width="380px" onchange = "javascript: xajax_search_courses(this.value,\'destination\');">';
$select_destination .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option>';
$select_destination .= '</select>';
$xajax_response -> addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination));
}
// Select multiple destination empty
$select_multiple_empty = '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;"></select>';
// Send response by ajax
$xajax_response -> addAssign('ajax_list_courses_origin', 'innerHTML', api_utf8_encode($return));
$xajax_response -> addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($select_multiple_empty));
} else {
//Left Select - Destination
$list_courses_origin = implode(',', $_SESSION['course_list']);
$session_origin = $_SESSION['session_origin'];
// Search courses by id_session where course codes is include en courses list destination
$sql = "SELECT c.code, c.visual_code, c.title, src.id_session
FROM $tbl_course c, $tbl_session_rel_course src
WHERE src.course_code = c.code
AND src.id_session = '".intval($id_session)."'";
//AND c.code IN ($list_courses_origin)";
$rs = Database::query($sql);
$course_list_destination = array();
$return .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" >';
while ($course = Database :: fetch_array($rs)) {
$course_list_destination[] = $course['code'];
$return .= '<option value="'.$course['code'].'" title="'.@htmlspecialchars($course['title'].' ('.$course['visual_code'].')', ENT_QUOTES, api_get_system_encoding()).'">'.$course['title'].' ('.$course['visual_code'].')</option>';
}
$return .= '</select>';
$_SESSION['course_list_destination'] = $course_list_destination;
// Send response by ajax
$xajax_response->addAssign(
'ajax_list_courses_destination',
'innerHTML',
api_utf8_encode($return)
);
}
}
// Send response by ajax
$xajax_response -> addAssign('ajax_list_courses_origin', 'innerHTML', api_utf8_encode($return));
$xajax_response -> addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($select_multiple_empty));
} else {
//Left Select - Destination
$list_courses_origin = implode(',', $_SESSION['course_list']);
$session_origin = $_SESSION['session_origin'];
// Search courses by id_session where course codes is include en courses list destination
$sql = "SELECT c.code, c.visual_code, c.title, src.id_session
FROM $tbl_course c, $tbl_session_rel_course src
WHERE src.course_code = c.code
AND src.id_session = '".intval($id_session)."'";
//AND c.code IN ($list_courses_origin)";
$rs = Database::query($sql);
$course_list_destination = array();
//onmouseover="javascript: this.disabled=true;" onmouseout="javascript: this.disabled=false;"
$return .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" >';
while ($course = Database :: fetch_array($rs)) {
$course_list_destination[] = $course['code'];
$course_title = str_replace("'", "\'", $course_title);
$return .= '<option value="'.$course['code'].'" title="'.@htmlspecialchars($course['title'].' ('.$course['visual_code'].')', ENT_QUOTES, api_get_system_encoding()).'">'.$course['title'].' ('.$course['visual_code'].')</option>';
}
$return .= '</select>';
$_SESSION['course_list_destination'] = $course_list_destination;
// Send response by ajax
$xajax_response -> addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($return));
/*
// Disable option from session courses list origin where if no the same con the destination
$sql = "SELECT c.code, c.visual_code, c.title, src.id_session
FROM $tbl_course c, $tbl_session_rel_course src
WHERE src.course_code = c.code
AND src.id_session = '".intval($session_origin)."'";
$result = Database::query($sql);
$return_option_disabled = '<select id="origin" name="SessionCoursesListOrigin[]" multiple="multiple" size="20" style="width:320px;" onclick="javascript: checkSelected(this.id,\'copy_option_2\',\'title_option2\',\'destination\');">';
while ($cours = Database :: fetch_array($result)) {
$course_title=str_replace("'", "\'", $course_title);
if (count($course_list_destination) > 0) {
if (!in_array($cours['code'], $course_list_destination)) {
$return_option_disabled .= '<optgroup style="color:#ccc" label="'.$cours['title'].' ('.$cours['visual_code'].')" >'.$cours['title'].' ('.$cours['visual_code'].')</optgroup>';
} else {
$return_option_disabled .= '<option value="'.$cours['code'].'" title="'.@htmlspecialchars($cours['title'].' ('.$cours['visual_code'].')', ENT_QUOTES, api_get_system_encoding()).'">'.$cours['title'].' ('.$cours['visual_code'].')</option>';
}
} else {
if (empty($id_session)) {
$return_option_disabled .= '<option value="'.$cours['code'].'" title="'.@htmlspecialchars($cours['title'].' ('.$cours['visual_code'].')', ENT_QUOTES, api_get_system_encoding()).'">'.$cours['title'].' ('.$cours['visual_code'].')</option>';
} else {
$return_option_disabled .= '<optgroup style="color:#ccc" label="'.$cours['title'].'('.$cours['visual_code'].')" >'.$cours['title'].' ('.$cours['visual_code'].')</optgroup>';
}
}
}
$return_option_disabled .= '</select>';*/
// Send response by ajax
//$xajax_response -> addAssign('ajax_list_courses_origin', 'innerHTML', api_utf8_encode($return_option_disabled));
}
}
return $xajax_response;
}
$xajax -> processRequests();
$xajax->processRequests();
/* HTML head extra */
$htmlHeadXtra[] = $xajax->getJavascript( api_get_path(WEB_LIBRARY_PATH).'xajax/');
$htmlHeadXtra[] = '<script type="text/javascript">
function checkSelected(id_select,id_radio,id_title,id_destination) {
var num=0;
obj_origin = document.getElementById(id_select);
obj_destination = document.getElementById(id_destination);
for (x=0;x<obj_origin.options.length;x++) {
if (obj_origin.options[x].selected) {
if (obj_destination.options.length > 0) {
for (y=0;y<obj_destination.options.length;y++) {
if (obj_origin.options[x].value == obj_destination.options[y].value) {
obj_destination.options[y].selected = true;
}
}
}
num++;
} else {
if (obj_destination.options.length > 0) {
for (y=0;y<obj_destination.options.length;y++) {
if (obj_origin.options[x].value == obj_destination.options[y].value) {
obj_destination.options[y].selected = false;
}
}
}
}
}
if (num == 1) {
document.getElementById(id_radio).disabled = false;
document.getElementById(id_title).style.color = \'#000\';
} else {
document.getElementById(id_radio).disabled = true;
document.getElementById(id_title).style.color = \'#aaa\';
}
}
function checkSelected(id_select,id_radio,id_title,id_destination) {
var num=0;
obj_origin = document.getElementById(id_select);
obj_destination = document.getElementById(id_destination);
for (x=0;x<obj_origin.options.length;x++) {
if (obj_origin.options[x].selected) {
if (obj_destination.options.length > 0) {
for (y=0;y<obj_destination.options.length;y++) {
if (obj_origin.options[x].value == obj_destination.options[y].value) {
obj_destination.options[y].selected = true;
}
}
}
num++;
} else {
if (obj_destination.options.length > 0) {
for (y=0;y<obj_destination.options.length;y++) {
if (obj_origin.options[x].value == obj_destination.options[y].value) {
obj_destination.options[y].selected = false;
}
}
}
}
}
if (num == 1) {
document.getElementById(id_radio).disabled = false;
document.getElementById(id_title).style.color = \'#000\';
} else {
document.getElementById(id_radio).disabled = true;
document.getElementById(id_title).style.color = \'#aaa\';
}
}
</script>';
Display::display_header($nameTools);
$with_base_content = true;
@ -294,22 +270,26 @@ if (isset($_POST['copy_only_session_items']) && $_POST['copy_only_session_items'
$with_base_content = false;
}
/* MAIN CODE */
if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy')) {
if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
(isset($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy')
) {
$destination_course = $origin_course = $destination_session = $origin_session = '';
if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') {
$destination_course = $_POST['destination_course'];
$origin_course = $_POST['origin_course'];
$destination_session = $_POST['destination_session'];
$origin_session = $_POST['origin_session'];
$course = CourseSelectForm :: get_posted_course('copy_course', $origin_session, $origin_course);
$course = CourseSelectForm::get_posted_course(
'copy_course',
$origin_session,
$origin_course
);
$cr = new CourseRestorer($course);
//$cr->set_file_option($_POST['same_file_name_option']);
$cr->restore($destination_course, $destination_session);
@ -334,23 +314,23 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (is
if (isset($_POST['sessions_list_origin'])) {
$origin_session = $_POST['sessions_list_origin'];
}
if ((is_array($arr_course_origin) && count($arr_course_origin) > 0) && !empty($destination_session)) {
//We need only one value
//We need only one value
if (count($arr_course_origin) > 1 || count($arr_course_destination) > 1) {
Display::display_error_message(get_lang('YouMustSelectACourseFromOriginalSession'));
Display::display_error_message(get_lang('YouMustSelectACourseFromOriginalSession'));
} else {
//foreach ($arr_course_origin as $course_origin) {
//first element of the array
$course_code = $arr_course_origin[0];
$course_destinatination = $arr_course_destination[0];
$course_origin = api_get_course_info($course_code);
$course_origin = api_get_course_info($course_code);
$cb = new CourseBuilder('', $course_origin);
$course = $cb->build($origin_session, $course_code, $with_base_content);
$cr = new CourseRestorer($course);
$cr = new CourseRestorer($course);
$cr->restore($course_destinatination, $destination_session);
}
Display::display_confirmation_message(get_lang('CopyFinished'));
display_form();
@ -386,19 +366,27 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (is
if ((is_array($arr_course_origin) && count($arr_course_origin) > 0) && !empty($destination_session)) {
Display::display_normal_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz'));
$course_origin = api_get_course_info($arr_course_origin[0]);
$course_origin = api_get_course_info($arr_course_origin[0]);
$cb = new CourseBuilder('', $course_origin);
$course = $cb->build($origin_session, $arr_course_origin[0], $with_base_content);
//$hidden_fields['same_file_name_option'] = $_POST['same_file_name_option'];
$hidden_fields['destination_course'] = $arr_course_destination[0];
$hidden_fields['origin_course'] = $arr_course_origin[0];
$hidden_fields['destination_session'] = $destination_session;
$hidden_fields['origin_session'] = $origin_session;
$hidden_fields['origin_session'] = $origin_session;
CourseSelectForm :: display_form($course, $hidden_fields, true);
echo '<div style="float:right"><a href="javascript:window.back();">'.Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('PlatformAdmin'), array('style' => 'vertical-align:middle')).get_lang('Back').'</a></div>';
echo '<div style="float:right"><a href="javascript:window.back();">'.
Display::return_icon(
'back.png',
get_lang('Back').' '.get_lang('To').' '.get_lang('PlatformAdmin'),
array('style' => 'vertical-align:middle')
).
get_lang('Back').'</a></div>';
} else {
Display::display_error_message(get_lang('You must select a course from original session and select a destination session'));
Display::display_error_message(
get_lang('You must select a course from original session and select a destination session')
);
display_form();
}
} else {

@ -48,18 +48,14 @@ require_once $lib_path.'fileManage.lib.php';
api_protect_course_script(true);
//erase temp nanogons' audio, image edit
if (isset($_SESSION['temp_audio_nanogong'])
&& !empty($_SESSION['temp_audio_nanogong'])
&& is_file($_SESSION['temp_audio_nanogong'])) {
unlink($_SESSION['temp_audio_nanogong']);
}
DocumentManager::removeGeneratedAudioTempFile();
if (isset($_SESSION['temp_realpath_image'])
&& !empty($_SESSION['temp_realpath_image'])
&& is_file($_SESSION['temp_realpath_image'])) {
unlink($_SESSION['temp_realpath_image']);
}
$courseInfo = api_get_course_info();
$course_dir = $courseInfo['directory'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
@ -1516,7 +1512,7 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$row = array();
$row['id'] = $document_data['id'];
$row['type'] = $document_data['filetype'];
// If the item is invisible, wrap it in a span with class invisible.
$is_visible = DocumentManager::is_visible_by_id(
$document_data['id'],

@ -308,7 +308,7 @@ if ($is_allowed_to_edit) {
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', api_get_user_id(), null, null, null, null, $current_session_id);
// Update parent folders
item_property_update_on_folder($_course, $dir, api_get_user_id());
header('Location: document.php?id='.$document_data['parent_id']);
header('Location: document.php?id='.$document_data['parent_id'].'&'.api_get_cidreq());
exit;
} else {
$msgError = get_lang('Impossible');
@ -366,7 +366,7 @@ $owner_id = $document_info['insert_user_id'];
$last_edit_date = $document_info['lastedit_date'];
if ($owner_id == api_get_user_id() || api_is_platform_admin() || $is_allowed_to_edit || GroupManager :: is_user_in_group(api_get_user_id(), api_get_group_id() )) {
$action = api_get_self().'?id='.$document_data['id'];
$action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq();
$form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical'));
// Form title

@ -64,7 +64,6 @@ $path_array = array_map('urldecode', $path_array);
$header_file = implode('/', $path_array);
$file = Security::remove_XSS(urldecode($document_data['path']));
$file_root = $course_info['path'].'/document'.str_replace('%2F', '/', $file);
$file_url_sys = api_get_path(SYS_COURSE_PATH).$file_root;
$file_url_web = api_get_path(WEB_COURSE_PATH).$file_root;
@ -377,49 +376,16 @@ if ($is_freemind_available) {
if ($is_nanogong_available) {
//make temp audio
$temp_folder=api_get_path(SYS_ARCHIVE_PATH).'temp/audio';
if (!file_exists($temp_folder)) {
@mkdir($temp_folder, api_get_permissions_for_new_directories(), true);
}
//make htaccess with allow from all, and file index.html into temp/audio
$htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess';
if (!file_exists($htaccess)) {
$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w');
if ($fp) {
fwrite($fp, $htaccess_content);
fclose($fp);
}
}
//encript temp name file
$name_crip = sha1(uniqid());//encript
$findext= explode(".", $file);
$extension= $findext[count($findext)-1];
$file_crip=$name_crip.'.'.$extension;
$file_url_web = DocumentManager::generateAudioTempFolder($file_url_sys);
//copy file to temp/audio directory
$from_sys=$file_url_sys;
$to_sys=api_get_path(SYS_ARCHIVE_PATH).'temp/audio/'.$file_crip;
if (file_exists($from_sys)) {
copy($from_sys, $to_sys);
}
//get file from tmp directory
$to_url = api_get_path(WEB_ARCHIVE_PATH).'temp/audio/'.$file_crip;
echo '<div align="center">';
echo '<a class="btn" href="'.$file_url_web.'" target="_blank">'.get_lang('Download').'</a>';
echo '<br/>';
echo '<br/>';
echo '<div align="center">';
echo '<a class="btn" href="'.$file_url_web.'" target="_blank">'.get_lang('Download').'</a>';
echo '<br/>';
echo '<br/>';
echo DocumentManager::readNanogongFile($to_url);
echo DocumentManager::readNanogongFile($to_url);
//erase temp file in tmp directory when return to documents
$_SESSION['temp_audio_nanogong']=$to_sys;
//erase temp file in tmp directory when return to documents
echo '</div>';
}

@ -40,19 +40,24 @@ if (!api_is_allowed_to_edit(null, true)) {
$interbreadcrumb[]= array ("url"=>"exercice.php", "name"=> get_lang('Exercices'));
$is_allowedToEdit = api_is_allowed_to_edit(null, true);
// display header
Display::display_header(get_lang('ImportAikenQuiz'), 'Exercises');
$msg = '';
$message = '';
// import file
if ((api_is_allowed_to_edit(null, true))) {
if (isset($_POST['submit'])) {
$msg = aiken_import_file($_FILES['userFile']);
$message = aiken_import_file($_FILES['userFile']);
if (is_numeric($message) && !empty($message)) {
header('Location: admin.php?' . api_get_cidreq() . '&exerciseId=' . $message);
exit;
}
}
}
// display header
Display::display_header(get_lang('ImportAikenQuiz'), 'Exercises');
// display Aiken form
aiken_display_form($msg);
aiken_display_form($message);
// display the footer
Display::display_footer();

@ -1534,7 +1534,7 @@ function get_all_exercises($course_info = null, $session_id = 0, $check_publicat
* Get exercise information by id
* @param int $exerciseId Exercise Id
* @param int $courseId The course ID (necessary as c_quiz.id is not unique)
* @return array Exercise info
* @return array Exercise info
*/
function get_exercise_by_id($exerciseId = 0, $courseId = null) {
$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST);
@ -1554,37 +1554,45 @@ function get_exercise_by_id($exerciseId = 0, $courseId = null) {
* @param array course data
* @param int session id
* @param int course c_id
* @param boolean only_active_exercices
* @param boolean $only_active_exercises
* @return array array with exercise data
* modified by Hubert Borderiou
*/
function get_all_exercises_for_course_id($course_info = null, $session_id = 0, $course_id=0, $only_active_exercises = true)
function get_all_exercises_for_course_id($course_info = null, $session_id = 0, $course_id = 0, $only_active_exercises = true)
{
$TBL_EXERCISES = Database :: get_course_table(TABLE_QUIZ_TEST);
$tab_select_param = array();
if (!$only_active_exercises) {
$sql_active_exercises = "";
if ($only_active_exercises) {
// Only active exercises.
$sql_active_exercises = "active = 1 AND ";
} else {
$sql_active_exercises = "active = ? AND";
$tab_select_param[] = '1';
// Not only active means visible and invisible NOT deleted (-2)
$sql_active_exercises = "active IN (1, 0) AND ";
}
$tab_select_param[] = $session_id;
$tab_select_param[] = $course_id;
if ($session_id == -1) {
$session_id = 0;
}
$params = array(
$session_id,
$course_id
);
if ($session_id == 0) {
$conditions = array('where'=>array("$sql_active_exercises session_id = ? AND c_id = ?" => $tab_select_param), 'order'=>'title');
$conditions = array(
'where' => array("$sql_active_exercises session_id = ? AND c_id = ?" => $params),
'order'=>'title'
);
} else {
//All exercises
$conditions = array('where'=>array("$sql_active_exercises (session_id = 0 OR session_id = ? ) AND c_id=?" => $tab_select_param), 'order'=>'title');
// All exercises
$conditions = array(
'where' => array("$sql_active_exercises (session_id = 0 OR session_id = ? ) AND c_id=?" => $params),
'order'=>'title'
);
}
return Database::select('*',$TBL_EXERCISES, $conditions);
return Database::select('*', $TBL_EXERCISES, $conditions);
}
/**

@ -80,7 +80,8 @@ function get_and_unzip_uploaded_exercise($baseWorkDir, $uploadPath) {
* Main function to import the Aiken exercise
* @return mixed True on success, error message on failure
*/
function aiken_import_exercise($file) {
function aiken_import_exercise($file)
{
global $exercise_info;
global $element_pile;
global $non_HTML_tag_to_avoid;
@ -97,43 +98,48 @@ function aiken_import_exercise($file) {
$uploadPath = '/';
// set some default values for the new exercise
$exercise_info = array ();
$exercise_info = array();
$exercise_info['name'] = preg_replace('/.(zip|txt)$/i', '', $file);
$exercise_info['question'] = array();
$element_pile = array ();
$element_pile = array();
// create parser and array to retrieve info from manifest
$element_pile = array (); //pile to known the depth in which we are
//$module_info = array (); //array to store the info we need
$element_pile = array(); //pile to known the depth in which we are
// if file is not a .zip, then we cancel all
// if file is not a .zip, then we cancel all
if (!preg_match('/.(zip|txt)$/i', $file)) {
Display :: display_error_message(get_lang('YouMustUploadAZipOrTxtFile'));
//Display :: display_error_message(get_lang('YouMustUploadAZipOrTxtFile'));
return 'YouMustUploadAZipOrTxtFile';
}
// unzip the uploaded file in a tmp directory
if (preg_match('/.(zip|txt)$/i', $file)) {
if (!get_and_unzip_uploaded_exercise($baseWorkDir, $uploadPath)) {
Display :: display_error_message(get_lang(''));
return 'ThereWasAProblemWithYourFile';
}
}
// find the different manifests for each question and parse them
$exerciseHandle = opendir($baseWorkDir);
//$question_number = 0;
$file_found = false;
$operation = false;
$result = false;
// parse every subdirectory to search txt question files
// Parse every subdirectory to search txt question files
while (false !== ($file = readdir($exerciseHandle))) {
if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") {
//find each manifest for each question repository found
$questionHandle = opendir($baseWorkDir . '/' . $file);
while (false !== ($questionFile = readdir($questionHandle))) {
if (preg_match('/.txt$/i', $questionFile)) {
$result = aiken_parse_file($exercise_info, $baseWorkDir, $file, $questionFile);
$result = aiken_parse_file(
$exercise_info,
$baseWorkDir,
$file,
$questionFile
);
$file_found = true;
}
}
@ -142,33 +148,35 @@ function aiken_import_exercise($file) {
$file_found = true;
} // else ignore file
}
if (!$file_found) {
//Display :: display_error_message(get_lang('NoTxtFileFoundInTheZip'));
$result = 'NoTxtFileFoundInTheZip';
}
if ($result !== true ) {
return $result;
}
//add exercise in tool
//1.create exercise
// Add exercise in tool
// 1.create exercise
$exercise = new Exercise();
$exercise->exercise = $exercise_info['name'];
$exercise->save();
$last_exercise_id = $exercise->selectId();
if (!empty($last_exercise_id)) {
//For each question found...
// For each question found...
foreach ($exercise_info['question'] as $key => $question_array) {
//2.create question
$question = new Aiken2Question();
$question->type = $question_array['type'];
$question->setAnswer();
$question->updateTitle($question_array['title']); // question (short)...
$question->updateDescription($question_array['description']); // question (long)...
$question->updateTitle($question_array['title']);
$question->updateDescription($question_array['description']);
$type = $question->selectType();
$question->type = constant($type); // type ...
$question->save($last_exercise_id); // save computed grade
$question->type = constant($type);
$question->save($last_exercise_id);
$last_question_id = $question->selectId();
//3.create answer
$answer = new Answer($last_question_id);
@ -176,10 +184,9 @@ function aiken_import_exercise($file) {
$max_score = 0;
foreach ($question_array['answer'] as $key => $answers) {
$key++;
$answer->new_answer[$key] = $answers['value']; // answer ...
//$answer->new_comment[$key] = $answers['feedback']; // comment ...
$answer->new_position[$key] = $key; // position ...
// correct answers ...
$answer->new_answer[$key] = $answers['value'];
$answer->new_position[$key] = $key;
// Correct answers ...
if (in_array($key, $question_array['correct_answers'])) {
$answer->new_correct[$key] = 1;
$answer->new_comment[$key] = $question_array['feedback'];
@ -196,8 +203,9 @@ function aiken_import_exercise($file) {
}
// delete the temp dir where the exercise was unzipped
my_delete($baseWorkDir . $uploadPath);
$operation = true;
$operation = $last_exercise_id;
}
return $operation;
}
@ -284,7 +292,7 @@ function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile)
{
if (strlen($info) < 40)
{
$exercise_info['question'][$question_index]['title'] = $info;
$exercise_info['question'][$question_index]['title'] = $info;
} else
{
//Question itself (use a 40-chars long title and a larger description)
@ -305,13 +313,13 @@ function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile)
}
/**
* This function will import the zip file with the respective qti2
* @param array $uploaded_file ($_FILES)
* Imports the zip file
* @param array $array_file ($_FILES)
*/
function aiken_import_file($array_file) {
$unzip = 0;
$process = process_uploaded_file($array_file);
$process = process_uploaded_file($array_file, false);
if (preg_match('/\.(zip|txt)$/i', $array_file['name'])) {
// if it's a zip, allow zip upload
$unzip = 1;
@ -319,11 +327,13 @@ function aiken_import_file($array_file) {
if ($process && $unzip == 1) {
$imported = aiken_import_exercise($array_file['name']);
if ($imported === true) {
header('Location: exercice.php?'.api_get_cidreq());
if (is_numeric($imported) && !empty($imported)) {
return $imported;
} else {
$msg = Display::return_message(get_lang($imported),'error');
$msg = Display::return_message(get_lang($imported), 'error');
return $msg;
}
}
}
}

@ -102,14 +102,14 @@ function import_exercise($file)
// if file is not a .zip, then we cancel all
if (!preg_match('/.zip$/i', $file)) {
Display :: display_error_message(get_lang('You must upload a zip file'));
return false;
return 'UplZipCorrupt';
}
// unzip the uploaded file in a tmp directory
if (!get_and_unzip_uploaded_exercise($baseWorkDir, $uploadPath)) {
Display :: display_error_message(get_lang('You must upload a zip file'));
return false;
return 'UplZipCorrupt';
}
// find the different manifests for each question and parse them.
@ -144,15 +144,14 @@ function import_exercise($file)
}
if (!$file_found) {
Display :: display_error_message(get_lang('No XML file found in the zip'));
return false;
return 'No XML file found in the zip';
}
if ($result == false) {
return false;
}
$doc = new DOMDocument();
$doc->load($filePath);
$encoding = $doc->encoding;
@ -207,9 +206,10 @@ function import_exercise($file)
// delete the temp dir where the exercise was unzipped
my_delete($baseWorkDir . $uploadPath);
$operation = true;
return $last_exercise_id;
}
return $operation;
return false;
}
/**
* We assume the file charset is UTF8

@ -10,7 +10,7 @@
* Code
*/
// name of the language file that needs to be included
$language_file = 'exercice';
$language_file = array('exercice', 'document');
// including the global Chamilo file
require_once '../inc/global.inc.php';
@ -62,7 +62,7 @@ function ch_qti2_display_form()
/**
* This function will import the zip file with the respective qti2
* @param array $uploaded_file ($_FILES)
* @param array $array_file ($_FILES)
*/
function ch_qti2_import_file($array_file)
{
@ -70,7 +70,9 @@ function ch_qti2_import_file($array_file)
$lib_path = api_get_path(LIBRARY_PATH);
require_once $lib_path.'fileUpload.lib.php';
require_once $lib_path.'fileManage.lib.php';
$process = process_uploaded_file($array_file);
$process = process_uploaded_file($array_file, false);
if (preg_match('/\.zip$/i', $array_file['name'])) {
// if it's a zip, allow zip upload
$unzip = 1;
@ -81,28 +83,32 @@ function ch_qti2_import_file($array_file)
require_once $main_path.'exercice/export/exercise_import.inc.php';
require_once $main_path.'exercice/export/qti2/qti2_classes.php';
$imported = import_exercise($array_file['name']);
return import_exercise($array_file['name']);
}
return 'langFileError';
}
$message = null;
if ($imported) {
header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/exercice.php?'.api_get_cidreq());
// import file
if ((api_is_allowed_to_edit(null, true))) {
if (isset($_POST['submit'])) {
$imported = ch_qti2_import_file($_FILES['userFile']);
if (is_numeric($imported) && !empty($imported)) {
header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
exit;
} else {
Display::display_error_message(get_lang('UplNoFileUploaded'));
return false;
$message = Display::return_message(get_lang($imported));
}
}
}
}
// Display header
Display::display_header(get_lang('ImportQtiQuiz'), 'Exercises');
// import file
if ((api_is_allowed_to_edit(null, true))) {
if (isset($_POST['submit'])) {
ch_qti2_import_file($_FILES['userFile']);
}
}
echo $message;
// display qti form
ch_qti2_display_form();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

@ -4583,7 +4583,8 @@ class CourseManager
'email_alert_to_teacher_on_new_user_in_course',
'enable_lp_auto_launch',
'pdf_export_watermark_text',
'show_system_folders'
'show_system_folders',
//'lp_return_link'
);
if (!empty($pluginCourseSettings)) {
$courseSettings = array_merge(
@ -4644,4 +4645,47 @@ class CourseManager
return Database::num_rows($result) > 0;
}
/**
* Get information from the track_e_course_access table
* @param int $sessionId
* @param int $userId
* @return array
*/
public static function getCourseAccessPerSessionAndUser($sessionId, $userId, $limit = null)
{
$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = "SELECT * FROM $table
WHERE session_id = $sessionId AND user_id = $userId";
if (!empty($limit)) {
$limit = intval($limit);
$sql .= " LIMIT $limit";
}
$result = Database::query($sql);
return Database::store_result($result);
}
/**
* Get information from the track_e_course_access table
* @param int $sessionId
* @param int $userId
* @return array
*/
public static function getFirstCourseAccessPerSessionAndUser($sessionId, $userId)
{
$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = "SELECT * FROM $table
WHERE session_id = $sessionId AND user_id = $userId
ORDER BY login_course_date ASC
LIMIT 1";
$result = Database::query($sql);
$courseAccess = array();
if (Database::num_rows($result)) {
$courseAccess = Database::fetch_array($result, 'ASSOC');
}
return $courseAccess;
}
}

@ -1205,6 +1205,7 @@ class Display
$notifications = array();
// Filter all last edits of all tools of the course
while ($res && ($item_property = Database::fetch_array($res))) {
// First thing to check is if the user never entered the tool
// or if his last visit was earlier than the last modification.
if ((!isset($lastTrackInCourseDate[$item_property['tool']])
@ -1217,12 +1218,15 @@ class Display
&& $item_property['tool'] != TOOL_NOTEBOOK
&& $item_property['tool'] != TOOL_CHAT)
)
)
)
// Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset.
&& ($item_property['visibility'] == '1'
|| ($course_info['status'] == '1' && $item_property['visibility'] == '0')
|| !isset($item_property['visibility'])))
{
|| !isset($item_property['visibility']))
) {
if ($course_info['real_id'] == 1) {
// var_dump($item_property);
}
// Also drop announcements and events that are not for the user or his group.
if (($item_property['tool'] == TOOL_ANNOUNCEMENT
|| $item_property['tool'] == TOOL_CALENDAR_EVENT)
@ -1250,6 +1254,12 @@ class Display
$notifications[$item_property['tool']] = $item_property;
}
}
if ($course_info['real_id'] == 1) {
/*var_dump($notifications);
exit;*/
}
// Show all tool icons where there is something new.
$retvalue = '&nbsp;';
while (list($key, $notification) = each($notifications)) {
@ -1378,6 +1388,10 @@ class Display
if (api_get_setting('show_session_coach') === 'true') {
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($session_info['firstname'], $session_info['lastname']);
}
if (isset($session_info['duration']) && !empty($session_info['duration'])) {
$daysLeft = SessionManager::getDayLeftInSession($session_id, api_get_user_id(), $session_info['duration']);
$session['duration'] = sprintf(get_lang('SessionDurationXDaysLeft'), $daysLeft);
}
$active = true;
} else {
$start = $stop = false;
@ -1715,7 +1729,8 @@ class Display
switch ($fileInfo['extension']) {
case 'wav':
if (isset($params['url'])) {
return DocumentManager::readNanogongFile($params['url']);
$url = DocumentManager::generateAudioTempFile(basename($file), $file);
return DocumentManager::readNanogongFile($url);
}
break;
case 'mp3':

@ -3899,7 +3899,6 @@ class DocumentManager
public static function readNanogongFile($file)
{
$nanoGongJarFile = api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar';
$html = '<applet id="applet" archive="'.$nanoGongJarFile.'" code="gong.NanoGong" width="160" height="95">';
$html .= '<param name="SoundFileURL" value="'.$file.'" />';
$html .= '<param name="ShowSaveButton" value="false" />';
@ -4026,4 +4025,62 @@ class DocumentManager
return false;
}
/**
* @param string $file ($document_data['path'])
* @param string $file_url_sys
* @return string
*/
public static function generateAudioTempFile($file, $file_url_sys)
{
//make temp audio
$temp_folder = api_get_path(SYS_ARCHIVE_PATH).'temp/audio';
if (!file_exists($temp_folder)) {
@mkdir($temp_folder, api_get_permissions_for_new_directories(), true);
}
//make htaccess with allow from all, and file index.html into temp/audio
$htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess';
if (!file_exists($htaccess)) {
$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w');
if ($fp) {
fwrite($fp, $htaccess_content);
fclose($fp);
}
}
//encript temp name file
$name_crip = sha1(uniqid());//encript
$findext= explode(".", $file);
$extension = $findext[count($findext)-1];
$file_crip = $name_crip.'.'.$extension;
//copy file to temp/audio directory
$from_sys = $file_url_sys;
$to_sys = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/'.$file_crip;
if (file_exists($from_sys)) {
copy($from_sys, $to_sys);
}
//get file from tmp directory
$_SESSION['temp_audio_nanogong'] = $to_sys;
return api_get_path(WEB_ARCHIVE_PATH).'temp/audio/'.$file_crip;
}
/**
* Erase temp nanogons' audio, image edit
*/
public static function removeGeneratedAudioTempFile()
{
if (isset($_SESSION['temp_audio_nanogong'])
&& !empty($_SESSION['temp_audio_nanogong'])
&& is_file($_SESSION['temp_audio_nanogong'])) {
unlink($_SESSION['temp_audio_nanogong']);
unset($_SESSION['temp_audio_nanogong']);
}
}
}

@ -183,9 +183,9 @@ FCKSelection.MoveToAncestorNode = function( nodeTagName )
var oNode ;
var oContainer = this.GetSelectedElement() ;
if ( ! oContainer )
/*if ( ! oContainer )
oContainer = this.GetSelection().getRangeAt(0).startContainer ;
*/
while ( oContainer )
{
if ( oContainer.nodeName.IEquals( nodeTagName ) )

File diff suppressed because one or more lines are too long

@ -2003,23 +2003,37 @@ function api_get_session_visibility($session_id, $course_code = null, $ignore_vi
$session_id = intval($session_id);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$sql = "SELECT
visibility,
date_start,
date_end,
nb_days_access_after_end,
nb_days_access_before_beginning
FROM $tbl_session
$sql = "SELECT * FROM $tbl_session
WHERE id = $session_id ";
$result = Database::query($sql);
if (Database::num_rows($result) > 0 ) {
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result, 'ASSOC');
$visibility = $original_visibility = $row['visibility'];
// I don't care the session visibility.
if ($row['date_start'] == '0000-00-00' && $row['date_end'] == '0000-00-00') {
// Session duration per student.
if (SessionManager::durationPerUserIsEnabled()) {
if (isset($row['duration']) && !empty($row['duration'])) {
$duration = $row['duration']*24*60*60;
$courseAccess = CourseManager::getFirstCourseAccessPerSessionAndUser(
$session_id,
api_get_user_id()
);
$currentTime = time();
$firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
if (($firstAccess + $duration) > $currentTime) {
return SESSION_AVAILABLE;
} else {
return SESSION_INVISIBLE;
}
}
}
return SESSION_AVAILABLE;
} else {
// If start date was set.
@ -3234,6 +3248,7 @@ function api_get_item_visibility($_course, $tool, $id, $session = 0)
if (!is_array($_course) || count($_course) == 0 || empty($tool) || empty($id)) {
return -1;
}
$tool = Database::escape_string($tool);
$id = intval($id);
$session = (int) $session;
@ -3595,28 +3610,30 @@ function api_get_track_item_property_history($tool, $ref)
* @param int course id
* @param string tool name, linked to 'rubrique' of the course tool_list (Warning: language sensitive !!)
* @param int id of the item itself, linked to key of every tool ('id', ...), "*" = all items of the tool
* @param int $session_id
*/
function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0)
{
$course_info = api_get_course_info_by_id($course_id);
if (empty($course_info)) {
return false;
}
$tool = Database::escape_string($tool);
$ref = intval($ref);
$course_id = intval($course_id);
$tool = Database::escape_string($tool);
$ref = intval($ref);
$course_id = $course_info['real_id'];
$session_id = intval($session_id);
// Definition of tables.
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = $course_info['real_id'];
$table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql = "SELECT * FROM $TABLE_ITEMPROPERTY
WHERE c_id = $course_id AND tool = '$tool' AND ref = $ref ";
if (!empty($session_id)) {
$session_id = intval($session_id);
$sql .= "AND id_session = $session_id ";
}
$sql = "SELECT * FROM $table
WHERE
c_id = $course_id AND
tool = '$tool' AND
ref = $ref AND
id_session = $session_id ";
$rs = Database::query($sql);
$row = array();
@ -3686,6 +3703,7 @@ function api_display_language_form($hide_if_no_choice = false) {
if (isset($_SESSION['user_language_choice'])) {
$user_selected_language = $_SESSION['user_language_choice'];
}
if (empty($user_selected_language)) {
$user_selected_language = api_get_setting('platformLanguage');
}
@ -3701,10 +3719,12 @@ function api_display_language_form($hide_if_no_choice = false) {
}
//-->
</script>';
// var_dump($user_selected_language);
$html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">';
$html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>';
$html .= '<select id="language_list" class="chzn-select" name="language_list" onchange="javascript: jumpMenu(\'parent\',this,0);">';
foreach ($original_languages as $key => $value) {
if ($folder[$key] == $user_selected_language) {
$option_end = ' selected="selected" >';

@ -230,18 +230,22 @@ class Nanogong
}
}
//temp_exe
// temp_exe
if ($load_from_database) {
//Load the real filename just if exists
if (isset($this->params['exe_id']) && isset($this->params['user_id']) && isset($this->params['question_id']) && isset($this->params['session_id']) && isset($this->params['course_id'])) {
if (isset($this->params['exe_id']) && isset($this->params['user_id']) &&
isset($this->params['question_id']) && isset($this->params['session_id']) && isset($this->params['course_id'])
) {
$attempt_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT filename FROM $attempt_table
WHERE exe_id = ".$this->params['exe_id']." AND
user_id = ".$this->params['user_id']." AND
question_id = ".$this->params['question_id']." AND
session_id = ".$this->params['session_id']." AND
course_code = '".$this->course_info['code']."' LIMIT 1";
WHERE
exe_id = ".$this->params['exe_id']." AND
user_id = ".$this->params['user_id']." AND
question_id = ".$this->params['question_id']." AND
session_id = ".$this->params['session_id']." AND
course_code = '".$this->course_info['code']."'
LIMIT 1";
$result = Database::query($sql);
$result = Database::fetch_row($result,'ASSOC');
@ -254,6 +258,7 @@ class Nanogong
if (is_file($this->store_path.$filename)) {
return $this->store_path.$filename;
}
return null;
}
@ -267,8 +272,8 @@ class Nanogong
*/
public function get_public_url($force_download = 0)
{
$params = $this->get_params(true);
$url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=get_file&download='.$force_download.'&'.$params;
//$params = $this->get_params(true);
//$url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=get_file&download='.$force_download.'&'.$params;
$params = $this->get_params();
$filename = basename($this->load_filename_if_exists());
$url = api_get_path(WEB_COURSE_PATH).$this->course_info['path'].'/exercises/'.$params['session_id'].'/'.$params['exercise_id'].'/'.$params['question_id'].'/'.$params['user_id'].'/'.$filename;
@ -320,6 +325,7 @@ class Nanogong
}
}
}
return 0;
}
@ -364,7 +370,6 @@ class Nanogong
$html .= '<div class="action_player">'.$actions.'</div>';
$html .= '<div class="nanogong_player">';
$html .= '<applet id="nanogong_player" archive="'.api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar" code="gong.NanoGong" width="250" height="95" ALIGN="middle">';
$html .= '<param name="ShowRecordButton" value="false" />'; // default true
$html .= '<param name="ShowSaveButton" value="false" />'; //you can save in local computer | (default true)
//echo '<param name="ShowAudioLevel" value="false" />'; // it displays the audiometer | (default true)
@ -375,7 +380,6 @@ class Nanogong
//echo '<param name="EndTime" value="65" />';
$html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
//$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
//echo '<param name="SamplingRate" value="32000" />';
//echo '<param name="MaxDuration" value="60" />';
@ -383,15 +387,10 @@ class Nanogong
$html .= '</applet>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div id="nanogong_warning">'.Display::return_message(
get_lang('BrowserDoesNotSupportNanogongPlayer'),
'warning'
).$download_button.'</div>';
$html .= '<div id="nanogong_warning">'.Display::return_message(get_lang('BrowserDoesNotSupportNanogongPlayer'), 'warning').$download_button.'</div>';
} elseif(in_array($path_info['extension'],array('mp3', 'ogg','wav'))) {
$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
$html .= '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skins/blue/jplayer.blue.monday.css" type="text/css">';
//$html .= '<link rel="stylesheet" href="' . $js_path . 'jquery-jplayer/skins/chamilo/jplayer.blue.monday.css" type="text/css">';
$html .= '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jquery.jplayer.min.js"></script>';
@ -405,8 +404,6 @@ class Nanogong
'count'=> 1
);
$jquery = DocumentManager::generate_jplayer_jquery($params);
$html .= '<script>
$(document).ready( function() {
//Experimental changes to preview mp3, ogg files

@ -1,4 +1,4 @@
<?php
<?php
/**
* HTML class for static data
* @example $form->addElement('label', 'My label', 'Content');
@ -18,7 +18,7 @@ require_once 'HTML/QuickForm/static.php';
* @since 3.0
* @deprecated Please use the templates rather than add raw HTML via this element
*/
class HTML_QuickForm_label extends HTML_QuickForm_static
class HTML_QuickForm_label extends HTML_QuickForm_static
{
// {{{ constructor
@ -47,7 +47,7 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
function accept(&$renderer, $required=false, $error=null) {
$renderer->renderHtml($this);
}
function toHtml() {
$for = $this->getLabelFor();
return '<div class="control-group ">
@ -56,11 +56,11 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
'.HTML_QuickForm_static::toHtml().'
</div>
</div>
';
} //end func toHtml
// }}}
} //end class HTML_QuickForm_html

@ -78,7 +78,8 @@ class SessionManager
$id_visibility,
$start_limit = true,
$end_limit = true,
$fix_name = false
$fix_name = false,
$duration = null
) {
global $_configuration;
@ -169,11 +170,28 @@ class SessionManager
}
if ($ready_to_create) {
$sql_insert = "INSERT INTO $tbl_session(name,date_start,date_end,id_coach,session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id,visibility)
VALUES('" . $name . "','$date_start','$date_end','$id_coach'," . api_get_user_id() . "," . $nb_days_acess_before . ", " . $nb_days_acess_after . ", " . $id_session_category . ", " . $id_visibility . ")";
Database::query($sql_insert);
$sql = "INSERT INTO $tbl_session(name,date_start,date_end,id_coach,session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id,visibility)
VALUES('" . $name . "','$date_start','$date_end','$id_coach'," . api_get_user_id() . "," . $nb_days_acess_before . ", " . $nb_days_acess_after . ", " . $id_session_category . ", " . $id_visibility . ")";
Database::query($sql);
$session_id = Database::insert_id();
if (self::durationPerUserIsEnabled()) {
$duration = intval($duration);
if (empty($duration)) {
$duration = null;
} else {
$sql = "UPDATE $tbl_session SET
date_start = '0000-00-00',
date_end = '0000-00-00'
WHERE id = $session_id";
Database::query($sql);
}
$sql = "UPDATE $tbl_session SET duration = $duration
WHERE id = $session_id";
Database::query($sql);
}
if (!empty($session_id)) {
/*
Sends a message to the user_id = 1
@ -1308,9 +1326,26 @@ class SessionManager
* The parameter id is a primary key
* */
public static function edit_session(
$id, $name, $year_start, $month_start, $day_start, $year_end, $month_end, $day_end, $nb_days_acess_before, $nb_days_acess_after, $nolimit, $id_coach, $id_session_category, $id_visibility, $start_limit = true, $end_limit = true, $description = null, $showDescription = null
)
{
$id,
$name,
$year_start,
$month_start,
$day_start,
$year_end,
$month_end,
$day_end,
$nb_days_acess_before,
$nb_days_acess_after,
$nolimit,
$id_coach,
$id_session_category,
$id_visibility,
$start_limit = true,
$end_limit = true,
$description = null,
$showDescription = null,
$duration = null
) {
$name = trim(stripslashes($name));
$year_start = intval($year_start);
$month_start = intval($month_start);
@ -1390,8 +1425,22 @@ class SessionManager
$showDescriptionCondition = ' show_description = "' . Database::escape_string($showDescription) . '" ,';
}
$sql = "UPDATE $tbl_session " .
"SET name='" . Database::escape_string($name) . "',
$durationCondition = null;
if (self::durationPerUserIsEnabled()) {
if (empty($duration)) {
$duration = null;
} else {
$date_start = '0000-00-00';
$date_end = "0000-00-00";
$duration = intval($duration);
}
$durationCondition = ' duration = "' . $duration . '" ,';
}
$sql = "UPDATE $tbl_session SET
name='" . Database::escape_string($name) . "',
date_start='" . $date_start . "',
date_end='" . $date_end . "',
id_coach='" . $id_coach . "',
@ -1400,8 +1449,10 @@ class SessionManager
session_category_id = " . $id_session_category . " ,
$descriptionCondition
$showDescriptionCondition
$durationCondition
visibility= " . $id_visibility . "
WHERE id='$id'";
Database::query($sql);
return $id;
}
@ -1482,9 +1533,12 @@ class SessionManager
* @return bool
*/
public static function suscribe_users_to_session(
$id_session, $user_list, $session_visibility = SESSION_VISIBLE_READ_ONLY, $empty_users = true, $send_email = false
)
{
$id_session,
$user_list,
$session_visibility = SESSION_VISIBLE_READ_ONLY,
$empty_users = true,
$send_email = false
) {
if ($id_session != strval(intval($id_session))) {
return false;
@ -1618,9 +1672,11 @@ class SessionManager
* @return bool
*/
public static function subscribe_users_to_session_course(
$user_list, $session_id, $course_code, $session_visibility = SESSION_VISIBLE_READ_ONLY
)
{
$user_list,
$session_id,
$course_code,
$session_visibility = SESSION_VISIBLE_READ_ONLY
) {
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -1965,7 +2021,10 @@ class SessionManager
{
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$return_value = false;
$sql = "SELECT course_code FROM $tbl_session_course WHERE id_session = " . Database::escape_string($session_id) . " AND course_code = '" . Database::escape_string($course_id) . "'";
$sql = "SELECT course_code FROM $tbl_session_course
WHERE
id_session = " . Database::escape_string($session_id) . " AND
course_code = '" . Database::escape_string($course_id) . "'";
$result = Database::query($sql);
$num = Database::num_rows($result);
if ($num > 0) {
@ -2614,7 +2673,7 @@ class SessionManager
* @param string $course_name
* @return array list of courses
*/
public static function get_course_list_by_session_id($session_id, $course_name = '')
public static function get_course_list_by_session_id($session_id, $course_name = '', $orderBy = 'title')
{
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@ -2625,12 +2684,16 @@ class SessionManager
$sql = "SELECT * FROM $tbl_course c
INNER JOIN $tbl_session_rel_course src ON c.code = src.course_code
WHERE src.id_session = '$session_id'";
if (!empty($course_name)) {
$course_name = Database::escape_string($course_name);
$sql .= " AND c.title LIKE '%$course_name%' ";
}
$sql .= "ORDER BY title;";
$orderBy = Database::escape_string($orderBy);
$sql .= "ORDER BY $orderBy";
$result = Database::query($sql);
$num_rows = Database::num_rows($result);
$courses = array();
@ -3015,7 +3078,24 @@ class SessionManager
$consider_end = false;
}
$sid = self::create_session($s['name'] . ' ' . get_lang('CopyLabelSuffix'), $s['year_start'], $s['month_start'], $s['day_start'], $s['year_end'], $s['month_end'], $s['day_end'], $s['nb_days_acess_before_beginning'], $s['nb_days_acess_after_end'], false, (int) $s['id_coach'], $s['session_category_id'], (int) $s['visibility'], $consider_start, $consider_end, true);
$sid = self::create_session(
$s['name'] . ' ' . get_lang('CopyLabelSuffix'),
$s['year_start'],
$s['month_start'],
$s['day_start'],
$s['year_end'],
$s['month_end'],
$s['day_end'],
$s['nb_days_acess_before_beginning'],
$s['nb_days_acess_after_end'],
false,
(int)$s['id_coach'],
$s['session_category_id'],
(int)$s['visibility'],
$consider_start,
$consider_end,
true
);
if (!is_numeric($sid) || empty($sid)) {
return false;
@ -4467,4 +4547,147 @@ class SessionManager
return self::checkSubscribeDrhToSessionList($userSessionList);
}
}
/**
* Courses re-ordering in resume_session.php flag see BT#8316
*/
public static function orderCourseIsEnabled()
{
global $_configuration;
if (isset($_configuration['session_course_ordering']) &&
$_configuration['session_course_ordering']
) {
return true;
}
return false;
}
/**
* @param string $direction (up/down)
* @param int $sessionId
* @param string $courseCode
* @return bool
*/
public function move($direction, $sessionId, $courseCode)
{
if (!self::orderCourseIsEnabled()) {
return false;
}
$sessionId = intval($sessionId);
$courseCode = Database::escape_string($courseCode);
$table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$courseList = self::get_course_list_by_session_id($sessionId, null, 'position');
$position = array();
$count = 0;
foreach ($courseList as $course) {
if ($course['position'] == '') {
$course['position'] = $count;
}
$position[$course['code']] = $course['position'];
// Saving current order.
$sql = "UPDATE $table SET position = $count
WHERE id_session = $sessionId AND course_code = '".$course['code']."'";
Database::query($sql);
$count++;
}
$found = false;
switch ($direction) {
case 'up':
$courseList = array_reverse($courseList);
break;
case 'down':
break;
}
foreach ($courseList as $course) {
if ($found) {
$nextId = $course['code'];
$nextOrder = $course['position'];
break;
}
if ($courseCode == $course['code']) {
$thisCourseCode = $course['code'];
$thisOrder = $course['position'];
$found = true;
}
}
$sql1 = "UPDATE $table SET position = '".intval($nextOrder)."'
WHERE id_session = $sessionId AND course_code = '".$thisCourseCode."'";
$sql2 = "UPDATE $table SET position = '".intval($thisOrder)."'
WHERE id_session = $sessionId AND course_code = '".$nextId."'";
Database::query($sql1);
Database::query($sql2);
return true;
}
/**
* @param int $sessionId
* @param string $courseCode
* @return bool
*/
public function moveUp($sessionId, $courseCode)
{
return self::move('up', $sessionId, $courseCode);
}
/**
* @param int $sessionId
* @param string $courseCode
* @return bool
*/
public function moveDown($sessionId, $courseCode)
{
return self::move('down', $sessionId, $courseCode);
}
/**
* Use the session duration to allow/block user access see BT#8317
* Needs "ALTER TABLE session ADD COLUMN duration int;"
*/
public static function durationPerUserIsEnabled()
{
global $_configuration;
if (isset($_configuration['session_duration_feature']) &&
$_configuration['session_duration_feature']
) {
return true;
}
return false;
}
/**
* @param int $userId
* @param int $sessionId
* @return int
*/
public function getDayLeftInSession($sessionId, $userId, $duration)
{
$courseAccess = CourseManager::getFirstCourseAccessPerSessionAndUser(
$sessionId,
$userId
);
$currentTime = time();
$firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
//var_dump(api_get_utc_datetime($firstAccess));
//var_dump($duration);
$endDateInSeconds = $firstAccess + $duration*24*60*60;
$leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24);
/*var_dump(api_get_utc_datetime($endDateInSeconds));
var_dump(api_get_utc_datetime($currentTime));*/
return $leftDays;
}
}

@ -884,16 +884,14 @@ class SocialManager extends UserManager
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $user_table WHERE user_id = ".$safe_user_id;
$result = Database::query($sql);
$html = null;
if (Database::num_rows($result) == 1) {
$user_object = Database::fetch_object($result);
$alt = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? '&nbsp;('.get_lang('Me').')' : '');
$status = get_status_from_code($user_object->status);
$interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList'));
Display::display_header($alt, null, $alt);
echo '<div class ="thumbnail">';
$html .= '<div class ="thumbnail">';
if (strlen(trim($user_object->picture_uri)) > 0) {
$sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system');
$sysdir = $sysdir_array['dir'];
@ -911,47 +909,47 @@ class SocialManager extends UserManager
$big_image_height = $big_image_size['height'];
$url_big_image = $big_image.'?rnd='.time();
//echo '<a href="javascript:void()" onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');" >';
echo '<img src="'.$fullurl.'" alt="'.$alt.'" />';
$html .= '<img src="'.$fullurl.'" alt="'.$alt.'" />';
} else {
echo Display::return_icon('unknown.jpg', get_lang('Unknown'));
$html .= Display::return_icon('unknown.jpg', get_lang('Unknown'));
}
if (!empty($status)) {
echo '<div class="caption">'.$status.'</div>';
$html .= '<div class="caption">'.$status.'</div>';
}
echo '</div>';
$html .= '</div>';
if (api_get_setting('show_email_addresses') == 'true') {
echo Display::encrypted_mailto_link($user_object->email, $user_object->email).'<br />';
$html .= Display::encrypted_mailto_link($user_object->email, $user_object->email).'<br />';
}
if ($user_object->competences) {
echo Display::page_subheader(get_lang('MyCompetences'));
echo '<p>'.$user_object->competences.'</p>';
$html .= Display::page_subheader(get_lang('MyCompetences'));
$html .= '<p>'.$user_object->competences.'</p>';
}
if ($user_object->diplomas) {
echo Display::page_subheader(get_lang('MyDiplomas'));
echo '<p>'.$user_object->diplomas.'</p>';
$html .= Display::page_subheader(get_lang('MyDiplomas'));
$html .= '<p>'.$user_object->diplomas.'</p>';
}
if ($user_object->teach) {
echo Display::page_subheader(get_lang('MyTeach'));
echo '<p>'.$user_object->teach.'</p>';
$html .= Display::page_subheader(get_lang('MyTeach'));
$html .= '<p>'.$user_object->teach.'</p>';
}
SocialManager::display_productions($user_object->user_id);
if ($user_object->openarea) {
echo Display::page_subheader(get_lang('MyPersonalOpenArea'));
echo '<p>'.$user_object->openarea.'</p>';
$html .= Display::page_subheader(get_lang('MyPersonalOpenArea'));
$html .= '<p>'.$user_object->openarea.'</p>';
}
} else {
Display::display_header(get_lang('UsersOnLineList'));
echo '<div class="actions-title">';
echo get_lang('UsersOnLineList');
echo '</div>';
$html .= '<div class="actions-title">';
$html .= get_lang('UsersOnLineList');
$html .= '</div>';
}
return $html;
}
/**
* Display productions in whoisonline
* Display productions in who is online
* @param int $user_id User id
*/
public static function display_productions($user_id)
@ -960,6 +958,7 @@ class SocialManager extends UserManager
$sysdir = $sysdir_array['dir'];
$webdir_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true);
$webdir = $webdir_array['dir'];
if (!is_dir($sysdir)) {
mkdir($sysdir, api_get_permissions_for_new_directories(), true);
}
@ -988,6 +987,11 @@ class SocialManager extends UserManager
}
}
/**
* @param string $content
* @param string $span_count
* @return string
*/
public static function social_wrapper_div($content, $span_count)
{
$span_count = intval($span_count);

@ -2817,12 +2817,13 @@ class Tracking
*/
static function show_user_progress($user_id, $session_id = 0, $extra_params = '', $show_courses = true)
{
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_access_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_access_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_access_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_access_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$user_id = intval($user_id);
// get course list
@ -2906,22 +2907,33 @@ class Tracking
);
$html .= '<table class="data_table" width="100%">';
$html .= '<tr>
'.Display::tag('th', get_lang('Course'), array('width'=>'300px')).'
'.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Progress'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Course'), array('width'=>'300px')).'
'.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Progress'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).'
'.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
'.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
</tr>';
foreach ($courses as $course_code => $course_title) {
$weighting = 0;
$total_time_login = Tracking :: get_time_spent_on_the_course($user_id, $course_code);
$time = api_time_to_hms($total_time_login);
$progress = Tracking :: get_avg_student_progress($user_id, $course_code);
$percentage_score = Tracking :: get_avg_student_score($user_id, $course_code, array());
$last_connection = Tracking :: get_last_connection_date_on_the_course($user_id, $course_code);
$total_time_login = Tracking :: get_time_spent_on_the_course(
$user_id,
$course_code
);
$time = api_time_to_hms($total_time_login);
$progress = Tracking :: get_avg_student_progress(
$user_id,
$course_code
);
$percentage_score = Tracking :: get_avg_student_score(
$user_id,
$course_code,
array()
);
$last_connection = Tracking :: get_last_connection_date_on_the_course(
$user_id,
$course_code
);
if (is_null($progress)) {
$progress = '0%';
@ -2967,97 +2979,100 @@ class Tracking
// Session list
if (!empty($course_in_session)) {
$main_session_graph = '';
//Load graphics only when calling to an specific session
$session_graph = array();
//if (!isset($_GET['session_id']) && !isset($_GET['course'])) {
//Load graphics only when calling to an specific session
$session_graph = array();
$all_exercise_graph_name_list = array();
$my_results = array();
$all_exercise_graph_list = array();
$all_exercise_start_time = array();
foreach ($course_in_session as $my_session_id => $session_data) {
$course_list = $session_data['course_list'];
$session_name = $session_data['name'];
$all_exercise_graph_name_list = array();
$my_results = array();
$all_exercise_graph_list = array();
$user_count = count(SessionManager::get_users_by_session($my_session_id));
$all_exercise_start_time = array();
$exercise_graph_name_list = array();
//$user_results = array();
$exercise_graph_list = array();
foreach ($course_in_session as $my_session_id => $session_data) {
foreach ($course_list as $course_data) {
$course_list = $session_data['course_list'];
$session_name = $session_data['name'];
$exercise_list = get_all_exercises($course_data, $my_session_id);
$user_count = count(SessionManager::get_users_by_session($my_session_id));
foreach ($exercise_list as $exercise_data) {
$exercise_obj = new Exercise($course_data['id']);
$exercise_obj->read($exercise_data['id']);
//Exercise is not necessary to be visible to show results check the result_disable configuration instead
//$visible_return = $exercise_obj->is_visible();
$exercise_graph_name_list = array();
//$user_results = array();
$exercise_graph_list = array();
if ($exercise_data['results_disabled'] == 0 || $exercise_data['results_disabled'] == 2) {
//if ($visible_return['value'] == true) {
$best_average = intval(get_best_average_score_by_exercise($exercise_data['id'], $course_data['code'], $my_session_id, $user_count));
$exercise_graph_list[] = $best_average;
$all_exercise_graph_list[] = $best_average;
foreach ($course_list as $course_data) {
$user_result_data = get_best_attempt_by_user(api_get_user_id(), $exercise_data['id'], $course_data['code'], $my_session_id);
$score = 0;
if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
$score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100);
}
//$user_results[] = $score;
$time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
$all_exercise_start_time[] = $time;
$my_results[] = $score;
if (count($exercise_list)<=10) {
$title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30);
$exercise_graph_name_list[]= $title;
$all_exercise_graph_name_list[] = $title;
} else {
// if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
$title = cut($exercise_data['title'], 30);
$exercise_graph_name_list[]= $title;
$all_exercise_graph_name_list[]= $title;
}
$exercise_list = get_all_exercises($course_data, $my_session_id);
foreach ($exercise_list as $exercise_data) {
$exercise_obj = new Exercise($course_data['id']);
$exercise_obj->read($exercise_data['id']);
//Exercise is not necessary to be visible to show results check the result_disable configuration instead
//$visible_return = $exercise_obj->is_visible();
if ($exercise_data['results_disabled'] == 0 || $exercise_data['results_disabled'] == 2) {
//if ($visible_return['value'] == true) {
$best_average = intval(get_best_average_score_by_exercise($exercise_data['id'], $course_data['code'], $my_session_id, $user_count));
$exercise_graph_list[] = $best_average;
$all_exercise_graph_list[] = $best_average;
$user_result_data = get_best_attempt_by_user(
api_get_user_id(),
$exercise_data['id'],
$course_data['code'],
$my_session_id
);
$score = 0;
if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
$score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100);
}
$time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
$all_exercise_start_time[] = $time;
$my_results[] = $score;
if (count($exercise_list)<=10) {
$title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30);
$exercise_graph_name_list[]= $title;
$all_exercise_graph_name_list[] = $title;
} else {
// if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
$title = cut($exercise_data['title'], 30);
$exercise_graph_name_list[]= $title;
$all_exercise_graph_name_list[]= $title;
}
}
}
}
}
//Complete graph
if (!empty($my_results) && !empty($all_exercise_graph_list)) {
asort($all_exercise_start_time);
// Complete graph
if (!empty($my_results) && !empty($all_exercise_graph_list)) {
asort($all_exercise_start_time);
//Fix exams order
$final_all_exercise_graph_name_list = array();
$my_results_final = array();
$final_all_exercise_graph_list = array();
//Fix exams order
$final_all_exercise_graph_name_list = array();
$my_results_final = array();
$final_all_exercise_graph_list = array();
foreach ($all_exercise_start_time as $key => $time) {
$label_time = '';
if (!empty($time)) {
$label_time = date('d-m-y', $time);
//$label_time = api_format_date($time, DATE_FORMAT_NUMBER);
}
$final_all_exercise_graph_name_list[] = $all_exercise_graph_name_list[$key].' '.$label_time;
$my_results_final[] = $my_results[$key];
$final_all_exercise_graph_list[] = $all_exercise_graph_list[$key];
foreach ($all_exercise_start_time as $key => $time) {
$label_time = '';
if (!empty($time)) {
$label_time = date('d-m-y', $time);
//$label_time = api_format_date($time, DATE_FORMAT_NUMBER);
}
$main_session_graph = self::generate_session_exercise_graph($final_all_exercise_graph_name_list, $my_results_final, $final_all_exercise_graph_list);
$final_all_exercise_graph_name_list[] = $all_exercise_graph_name_list[$key].' '.$label_time;
$my_results_final[] = $my_results[$key];
$final_all_exercise_graph_list[] = $all_exercise_graph_list[$key];
}
//}
$main_session_graph = self::generate_session_exercise_graph(
$final_all_exercise_graph_name_list,
$my_results_final,
$final_all_exercise_graph_list
);
}
$html .= Display::page_subheader(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions'));
$html .= '<table class="data_table" width="100%">';
//'.Display::tag('th', get_lang('DoneExercises'), array('class'=>'head')).'
$html .= '<tr>
'.Display::tag('th', get_lang('Session'), array('width'=>'300px')).'
'.Display::tag('th', get_lang('PublishedExercises'), array('width'=>'300px')).'
@ -3104,10 +3119,10 @@ class Tracking
}
}
//Average
$average = get_average_score_by_course($course_data['code'], $my_session_id);
// Average
$average = get_average_score_by_course($course_data['code'], $my_session_id);
$all_exercises += $count_exercises;
$all_exercises += $count_exercises;
$all_unanswered_exercises_by_user += $count_exercises - $answered_exercises;
//$all_done_exercise += $done_exercises;
@ -3122,7 +3137,7 @@ class Tracking
} else {
$html .= '<tr>';
}
$url = api_get_path(WEB_CODE_PATH)."session/?session_id={$my_session_id}";
$url = api_get_path(WEB_CODE_PATH)."session/index.php?session_id={$my_session_id}";
$html .= Display::tag('td', Display::url($session_name, $url, array('target'=>SESSION_LINK_TARGET)));
$html .= Display::tag('td', $all_exercises);
@ -3142,7 +3157,7 @@ class Tracking
$html .= '</table><br />';
$html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') );
//Checking selected session
// Checking selected session.
if (isset($_GET['session_id'])) {
$session_id_from_get = intval($_GET['session_id']);
@ -3218,7 +3233,7 @@ class Tracking
$html .= '<tr class="row_even">';
}
$url = api_get_course_url($course_code, $session_id_from_get);
$url = api_get_course_url($course_code, $session_id_from_get);
$course_url = Display::url($course_title, $url, array('target'=>SESSION_LINK_TARGET));
$html .= Display::tag('td', $course_url);
@ -3251,7 +3266,7 @@ class Tracking
$details .=Display::return_icon('2rightarrow_na.gif', get_lang('Details'));
} else {
$details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">';
$details .=Display::return_icon('2rightarrow.gif', get_lang('Details'));
$details .= Display::return_icon('2rightarrow.gif', get_lang('Details'));
}
$details .= '</a>';
$html .= Display::tag('td', $details, array('align'=>'center'));

@ -2656,8 +2656,13 @@ class UserManager
INNER JOIN $tbl_session_course sc
ON (scu.id_session = sc.id_session AND scu.course_code = sc.course_code)
$join_access_url
WHERE scu.id_user = $user_id AND scu.id_session = $session_id $where_access_url
ORDER BY code";
WHERE scu.id_user = $user_id AND scu.id_session = $session_id $where_access_url";
$orderBy = " ORDER BY code ";
if (SessionManager::orderCourseIsEnabled()) {
$orderBy = ' ORDER BY position';
}
$sql .= $orderBy;
$result = Database::query($sql);
@ -2686,7 +2691,7 @@ class UserManager
s.id_coach = $user_id
)
$where_access_url
ORDER BY code";
$orderBy";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {

@ -897,6 +897,9 @@ class IndexManager
}
}
$show_course_link = false;
$show_create_link = false;
// My account section
$my_account_content = '<ul class="nav nav-list">';
@ -1063,6 +1066,7 @@ class IndexManager
$params['icon'] = Display::return_icon('window_list.png', $session_box['title'], array('id' => 'session_img_'.$session_id), ICON_SIZE_LARGE);
$extra_info = !empty($session_box['coach']) ? $session_box['coach'] : null;
$extra_info .= !empty($session_box['coach']) ? ' - '.$session_box['dates'] : $session_box['dates'];
$extra_info .= isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
if (api_is_drh()) {
$session_link = $session_box['title'];

@ -2117,10 +2117,12 @@ class learnpath
$tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
// Getting all the information about the item.
$sql = "SELECT * FROM ".$tbl_lp_item." as lp INNER JOIN ".$tbl_lp_item_view." as lp_view on lp.id = lp_view.lp_item_id ".
"WHERE lp.id = '".$_SESSION['oLP']->current."' AND
lp.c_id = $course_id AND
lp_view.c_id = $course_id";
$sql = "SELECT * FROM ".$tbl_lp_item." as lp
INNER JOIN ".$tbl_lp_item_view." as lp_view on lp.id = lp_view.lp_item_id
WHERE
lp.id = '".$_SESSION['oLP']->current."' AND
lp.c_id = $course_id AND
lp_view.c_id = $course_id";
$result = Database::query($sql);
$row = Database::fetch_assoc($result);
$output = '';
@ -2151,11 +2153,12 @@ class learnpath
$audio = $row['audio'];
$file = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/audio/'.$audio;
$url = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document/audio/'.$audio;
$url = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document/audio/'.$audio.'?'.api_get_cidreq();
if (!file_exists($file)) {
$lpPathInfo = $_SESSION['oLP']->generate_lp_folder(api_get_course_info());
$file = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$lpPathInfo['dir'].$audio;
$url = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$lpPathInfo['dir'].$audio;
$url = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$lpPathInfo['dir'].$audio.'?'.api_get_cidreq();
}
$player = Display::getMediaPlayer(

@ -13,7 +13,8 @@
* @uses Database.lib.php to use the database
* @uses learnpath.class.php to generate learnpath objects to get in the list
*/
class learnpathList {
class learnpathList
{
public $list = array(); // Holds a flat list of learnpaths data from the database.
public $ref_list = array(); // Holds a list of references to the learnpaths objects (only filled by get_refs()).
public $alpha_list = array(); // Holds a flat list of learnpaths sorted by alphabetical name order.
@ -30,16 +31,17 @@ class learnpathList {
* @param int Optional session id (otherwise we use api_get_session_id())
* @return void
*/
function __construct($user_id, $course_code = '', $session_id = null, $order_by = null, $check_publication_dates = false) {
function __construct($user_id, $course_code = '', $session_id = null, $order_by = null, $check_publication_dates = false)
{
$course_info = api_get_course_info($course_code);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$this->course_code = $course_code;
$this->course_code = $course_code;
$this->user_id = $user_id;
$course_id = $course_info['real_id'];
if (empty($course_id)) {
return false;
}
@ -50,68 +52,81 @@ class learnpathList {
} else {
$session_id = api_get_session_id();
}
$condition_session = api_get_session_condition($session_id, true, true);
$order = "ORDER BY display_order ASC, name ASC";
if (isset($order_by)) {
$order = Database::parse_conditions(array('order'=>$order_by));
$order = Database::parse_conditions(array('order'=>$order_by));
}
$now = api_get_utc_datetime();
$time_conditions = '';
if ($check_publication_dates) {
$time_conditions = " AND ( (publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now' ) OR
(publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on = '0000-00-00 00:00:00') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on = '0000-00-00 00:00:00' ))
$time_conditions = " AND (
(publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now' ) OR
(publicated_on <> '0000-00-00 00:00:00' AND publicated_on < '$now' AND expired_on = '0000-00-00 00:00:00') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on <> '0000-00-00 00:00:00' AND expired_on > '$now') OR
(publicated_on = '0000-00-00 00:00:00' AND expired_on = '0000-00-00 00:00:00' ))
";
}
$sql = "SELECT * FROM $lp_table WHERE c_id = $course_id $time_conditions $condition_session $order";
$sql = "SELECT * FROM $lp_table
WHERE c_id = $course_id $time_conditions $condition_session $order";
$res = Database::query($sql);
$names = array();
while ($row = Database::fetch_array($res,'ASSOC')) {
// Check if published.
$pub = '';
// Use domesticate here instead of Database::escape_string because
// it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
// is done using domesticate()
$myname = domesticate($row['name']);
$mylink = 'newscorm/lp_controller.php?action=view&lp_id='.$row['id'].'&id_session='.$session_id;
$sql2="SELECT * FROM $tbl_tool WHERE c_id = $course_id AND (name='$myname' and image='scormbuilder.gif' and link LIKE '$mylink%')";
//error_log('New LP - learnpathList::__construct - getting visibility - '.$sql2, 0);
$sql2 = "SELECT * FROM $tbl_tool
WHERE
c_id = $course_id AND (
name='$myname' AND
image='scormbuilder.gif' AND
link LIKE '$mylink%'
)";
$res2 = Database::query($sql2);
if (Database::num_rows($res2) > 0) {
$row2 = Database::fetch_array($res2);
$pub = $row2['visibility'];
} else {
$pub = 'i';
}
// Check if visible.
$vis = api_get_item_visibility(api_get_course_info($course_code), 'learnpath', $row['id'], $session_id);
if (!empty($row['created_on']) && $row['created_on'] != '0000-00-00 00:00:00') {
$row['created_on'] = $row['created_on'];
} else {
$row['created_on'] = '';
}
if (!empty($row['modified_on']) && $row['modified_on'] != '0000-00-00 00:00:00') {
$row['modified_on'] = $row['modified_on'];
} else {
$row['modified_on'] = '';
}
if (!empty($row['publicated_on']) && $row['publicated_on'] != '0000-00-00 00:00:00') {
$row['publicated_on'] = $row['publicated_on'];
} else {
$row['publicated_on'] = '';
}
if (!empty($row['expired_on']) && $row['expired_on'] != '0000-00-00 00:00:00') {
$row['expired_on'] = $row['expired_on'];
} else {
$row['expired_on'] = '';
}
$this->list[$row['id']] = array(
'lp_type' => $row['lp_type'],
'lp_session' => $row['session_id'],
@ -122,12 +137,11 @@ class learnpathList {
'lp_force_commit' => $row['force_commit'],
'lp_maker' => stripslashes($row['content_maker']),
'lp_proximity' => $row['content_local'],
//'lp_encoding' => $row['default_encoding'],
'lp_encoding' => api_get_system_encoding(), // Chamilo 1.8.8: We intend always to use the system encoding.
'lp_encoding' => api_get_system_encoding(),
'lp_visibility' => $vis,
'lp_published' => $pub,
'lp_prevent_reinit' => $row['prevent_reinit'],
'seriousgame_mode' => $row['seriousgame_mode'],
'seriousgame_mode' => $row['seriousgame_mode'],
'lp_scorm_debug' => $row['debug'],
'lp_display_order' => $row['display_order'],
'lp_preview_image' => stripslashes($row['preview_image']),
@ -137,10 +151,10 @@ class learnpathList {
'modified_on' => $row['modified_on'],
'publicated_on' => $row['publicated_on'],
'expired_on' => $row['expired_on']
);
);
$names[$row['name']] = $row['id'];
}
$this->alpha_list = asort($names);
}
$this->alpha_list = asort($names);
}
/**
@ -176,7 +190,7 @@ class learnpathList {
$course = api_get_course_info($course_code);
//QUery
$sql = "SELECT * FROM $tbl_course_lp
WHERE c_id = %s "; //TODO AND session_id = %s ?
WHERE c_id = %s "; //TODO AND session_id = %s ?
$sql_query = sprintf($sql, $course['real_id']);
$result = Database::query($sql_query);

@ -86,11 +86,11 @@ $lpPathInfo = $_SESSION['oLP']->generate_lp_folder(api_get_course_info());
$file = null;
if (isset($lp_item->audio) && !empty($lp_item->audio)) {
$file = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/audio/'.$lp_item->audio;
$urlFile = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/audio/'.$lp_item->audio;
$urlFile = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/audio/'.$lp_item->audio.'?'.api_get_cidreq();
if (!file_exists($file)) {
$file = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$lpPathInfo['dir'].$lp_item->audio;
$urlFile = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$lpPathInfo['dir'].$lp_item->audio;
$urlFile = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$lpPathInfo['dir'].$lp_item->audio.'?'.api_get_cidreq();
}
}
@ -127,7 +127,9 @@ if (!empty($file)) {
$form->addElement('hidden', 'id', $lp_item_id);
if (!empty($file)) {
$audioPlayer = '<div id="preview">'.Display::getMediaPlayer($file, array('url' => $urlFile))."</div>";
$audioPlayer = '<div id="preview">'.
Display::getMediaPlayer($file, array('url' => $urlFile)).
"</div>";
$form->addElement('label', get_lang('Preview'), $audioPlayer);
}

@ -1109,7 +1109,11 @@ switch ($action) {
else {
$_SESSION['oLP']->save_current();
$_SESSION['oLP']->save_last();
header('location: '.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/?id_session='.api_get_session_id());
$url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
if (isset($_GET['redirectTo']) && $_GET['redirectTo'] == 'lp_list') {
$url = 'lp_controller.php?'.api_get_cidreq();
}
header('location: '.$url);
exit;
}
break;

@ -102,9 +102,13 @@ if ($is_allowed_to_edit) {
$token = Security::get_token();
/* DISPLAY SCORM LIST */
$list = new LearnpathList(api_get_user_id());
$userId = api_get_user_id();
$userInfo = api_get_user_info();
$list = new LearnpathList($userId);
$flat_list = $list->get_flat_list();
if (!empty($flat_list)) {
echo '<table class="data_table">';
echo '<tr>';
@ -129,8 +133,8 @@ if (!empty($flat_list)) {
$autolunch_exists = false;
foreach ($flat_list as $id => $details) {
// Validacion when belongs to a session
$session_img = api_get_session_image($details['lp_session'], $_user['status']);
// Validation when belongs to a session.
$session_img = api_get_session_image($details['lp_session'], $userInfo['status']);
if (!$is_allowed_to_edit && $details['lp_visibility'] == 0) {
// This is a student and this path is invisible, skip.
@ -138,15 +142,18 @@ if (!empty($flat_list)) {
}
// Check if the learnpath is visible for student.
if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, api_get_user_id())) {
if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, $userId)) {
continue;
}
$start_time = $end_time = '';
if (!$is_allowed_to_edit) {
$time_limits = false;
//This is an old LP (from a migration 1.8.7) so we do nothing
if ((empty($details['created_on']) || $details['created_on'] == '0000-00-00 00:00:00') && (empty($details['modified_on']) || $details['modified_on'] == '0000-00-00 00:00:00')) {
if ((empty($details['created_on']) || $details['created_on'] == '0000-00-00 00:00:00') &&
(empty($details['modified_on']) || $details['modified_on'] == '0000-00-00 00:00:00')
) {
$time_limits = false;
}
@ -154,6 +161,7 @@ if (!empty($flat_list)) {
if ($details['expired_on'] != '' && $details['expired_on'] != '0000-00-00 00:00:00') {
$time_limits = true;
}
if ($time_limits) {
// check if start time
if (!empty($details['publicated_on']) && $details['publicated_on'] != '0000-00-00 00:00:00' &&
@ -192,14 +200,17 @@ if (!empty($flat_list)) {
$url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
$name = Security::remove_XSS($details['lp_name']);
$extra = null;
if ($is_allowed_to_edit) {
$url_start_lp .= '&isStudentView=true';
$dsp_desc = '<em>'.$details['lp_maker'].'</em> '.(learnpath::is_lp_visible_for_student($id, api_get_user_id()) ? '' : ' - ('.get_lang('LPNotVisibleToStudent').')');
$studentVisibility = learnpath::is_lp_visible_for_student($id, $userId);
$dsp_desc = '<em>'.$details['lp_maker'].'</em> '.( $studentVisibility ? '' : ' - ('.get_lang('LPNotVisibleToStudent').')');
$extra = '<div class ="lp_content_type_label">'.$dsp_desc.'</div>';
}
$my_title = $name;
$icon_learnpath = Display::return_icon('learnpath.png', get_lang('LPName'), '', ICON_SIZE_SMALL);
if ($details['lp_visibility'] == 0) {
$my_title = Display::tag('font', $name, array('class' => 'invisible'));
$icon_learnpath = Display::return_icon('learnpath_na.png', get_lang('LPName'), '', ICON_SIZE_SMALL);
@ -218,12 +229,12 @@ if (!empty($flat_list)) {
$dsp_debug = '';
$dsp_order = '';
$progress = learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id());
$progress = learnpath::get_db_progress($id, $userId, '%', '', false, api_get_session_id());
if ($is_allowed_to_edit) {
$dsp_progress = '<td><center>'.$progress.'</center></td>';
} else {
$dsp_progress = '<td>'.learnpath::get_progress_bar('%', learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'</td>';
$dsp_progress = '<td>'.learnpath::get_progress_bar('%', learnpath::get_db_progress($id, $userId, '%', '', false, api_get_session_id())).'</td>';
}
$dsp_edit = '<td class="td_actions">';
@ -448,4 +459,5 @@ learnpath::generate_learning_path_folder($course_info);
//Deleting the objects
Session::erase('oLP');
Session::erase('lpobject');
DocumentManager::removeGeneratedAudioTempFile();
Display::display_footer();

@ -348,14 +348,33 @@ if ($is_allowed_to_edit) {
</a>
</td>
<td>';
if ($is_allowed_to_edit) {
echo '<a class="link no-border" href="lp_controller.php?isStudentView=false&action=return_to_course_homepage&'.api_get_cidreq().'" target="_self" onclick="javascript: window.parent.API.save_asset();">';
} else {
echo '<a class="link no-border" href="lp_controller.php?action=return_to_course_homepage&'.api_get_cidreq().'" target="_self" onclick="javascript: window.parent.API.save_asset();">';
}
echo get_lang('CourseHomepageLink').'
</a>
</td>
// Return to course home.
if ($is_allowed_to_edit) {
$url = 'lp_controller.php?isStudentView=false&action=return_to_course_homepage&' . api_get_cidreq();
} else {
$url = 'lp_controller.php?action=return_to_course_homepage&' . api_get_cidreq();
}
$name = get_lang('CourseHomepageLink');
// Return to lp list
if (api_get_course_setting('lp_return_link') == 1) {
$url .= '&redirectTo=lp_list';
$name = get_lang('LearningPathList');
}
echo Display::url(
$name,
$url,
array(
'class' => 'link no-border',
'target' => '_self',
'onclick' => 'javascript: window.parent.API.save_asset();'
)
);
echo '</td>
</tr>
</table>
</div>';

@ -40,11 +40,11 @@ if (isset($_SESSION['objExercise'])) {
Session::erase('objExercise');
}
$session_info = SessionManager::fetch($session_id);
$session_list = SessionManager::get_sessions_by_coach(api_get_user_id());
$course_list = SessionManager::get_course_list_by_session_id($session_id);
$session_info = SessionManager::fetch($session_id);
$session_list = SessionManager::get_sessions_by_coach(api_get_user_id());
$course_list = SessionManager::get_course_list_by_session_id($session_id);
//Getting all sessions where I'm subscribed
// Getting all sessions where I'm subscribed
$new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
$user_course_list = array();
@ -118,20 +118,21 @@ if (!empty($course_list)) {
'publicated_on ASC',
true
);
$lp_list = $list->get_flat_list();
$lp_list = $list->get_flat_list();
$lp_count = 0;
if(!empty($lp_list)) {
if (!empty($lp_list)) {
foreach ($lp_list as $valLp) {
if($valLp['lp_visibility']) {
if ($valLp['lp_visibility']) {
$lp_count++;
}
}
}
$course_info = api_get_course_info($course_data['code']);
$exercise_count = count(get_all_exercises($course_info, $session_id, true));
$max_mutation_date = '';
$last_date = Tracking::get_last_connection_date_on_the_course(
@ -146,11 +147,11 @@ if (!empty($course_list)) {
if ($item['modified_on'] == '0000-00-00 00:00:00' || empty($item['modified_on'])) {
$lp_date_original = $item['created_on'];
$image = 'new.gif';
$label = get_lang('LearnpathAdded');
$label = get_lang('LearnpathAdded');
} else {
$lp_date_original = $item['modified_on'];
$image = 'moderator_star.png';
$label = get_lang('LearnpathUpdated');
$image = 'moderator_star.png';
$label = get_lang('LearnpathUpdated');
}
$mutation_date = api_strtotime($item['publicated_on']) > api_strtotime($lp_date_original) ? $item['publicated_on'] : $lp_date_original;
@ -161,7 +162,10 @@ if (!empty($course_list)) {
if (strtotime($last_date) < strtotime($lp_date_original)) {
if (empty($icons)) {
$icons .= ' '.Display::return_icon($image, get_lang('TitleNotification').': '.$label.' - '.$lp_date_original).' ';
$icons .= ' '.Display::return_icon(
$image,
get_lang('TitleNotification').': '.$label.' - '.$lp_date_original
).' ';
}
}
}
@ -205,9 +209,9 @@ if (count($session_select) > 1) {
}
if (empty($session_id)) {
$user_list = UserManager::get_user_list();
$user_list = UserManager::get_user_list();
} else {
$user_list = SessionManager::get_users_by_session($session_id);
$user_list = SessionManager::get_users_by_session($session_id);
}
//Final data to be show
@ -230,7 +234,7 @@ foreach ($final_array as $session_data) {
$best_score = '';
if (!empty($best_score_data)) {
$best_score = show_score($best_score_data['exe_result'], $best_score_data['exe_weighting']);
$best_score = show_score($best_score_data['exe_result'], $best_score_data['exe_weighting']);
}
// Exercise results
$counter = 1;
@ -250,12 +254,22 @@ foreach ($final_array as $session_data) {
if(!empty($exercise_result['exe_weighting']) && intval($exercise_result['exe_weighting']) != 0) {
$my_score = $exercise_result['exe_result']/$exercise_result['exe_weighting'];
}
$position = get_exercise_result_ranking($my_score, $exercise_result['exe_id'], $my_exercise_id, $my_course_code, $session_id, $user_list);
//$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/exercice.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id&show=result", array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link'));
$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1", array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link'));
$position = get_exercise_result_ranking(
$my_score,
$exercise_result['exe_id'],
$my_exercise_id,
$my_course_code,
$session_id,
$user_list
);
$exercise_info->exercise = Display::url(
$exercise_info->exercise,
api_get_path(WEB_CODE_PATH)."exercice/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1",
array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link')
);
$my_real_array[]= array(
//'date' => api_get_local_time($exercise_result['exe_date']),
'status' => Display::return_icon('quiz.gif', get_lang('Attempted'),'', ICON_SIZE_SMALL),
'date' => $start_date,
'course' => $course_data['name'],
@ -268,16 +282,20 @@ foreach ($final_array as $session_data) {
$counter++;
}
} else {
//We check the date validation of the exercise if the user can make it
// We check the date validation of the exercise if the user can make it
if ($exercise_info->start_time != '0000-00-00 00:00:00') {
$allowed_time = api_strtotime($exercise_info->start_time, 'UTC');
if ($now < $allowed_time) {
continue;
}
}
$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id", array('target'=>SESSION_LINK_TARGET));
$exercise_info->exercise = Display::url(
$exercise_info->exercise,
api_get_path(WEB_CODE_PATH)."exercice/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id",
array('target'=>SESSION_LINK_TARGET)
);
$new_exercises[]= array(
//'date' => api_get_local_time($exercise_result['exe_date']),
'status' => Display::return_icon('star.png', get_lang('New'), array('width'=>ICON_SIZE_SMALL)),
'date' => $start_date,
'course' => $course_data['name'],
@ -321,7 +339,7 @@ if (!empty($start) && !empty($end)) {
echo Display::tag('h1', $session_info['name']);
echo $dates.'<br />';
//All Learnpaths grid settings (First tab, first subtab)
// All Learnpaths grid settings (First tab, first subtab)
$columns_courses = array(
get_lang('Title'), get_lang('NumberOfPublishedExercises'), get_lang('NumberOfPublishedLps')
@ -348,12 +366,21 @@ $extra_params_courses['pgbuttons'] = false;*/
//$extra_params_courses['width'] = '50%';
//$extra_params_courses['autowidth'] = 'true';
$url = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_default&session_id='.$session_id.'&course_id='.$course_id;
$columns = array(get_lang('PublicationDate'),get_lang('Course'), get_lang('LearningPaths'));
$column_model = array(array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'true'),
array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true'));
$url = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_default&session_id='.$session_id.'&course_id='.$course_id;
$columns = array(
get_lang('PublicationDate'),
get_lang('Course'),
get_lang('LearningPaths')
);
$column_model = array(
array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'true'),
array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true')
);
$extra_params = array();
/*
$extra_params['sortname'] = 'date';
$extra_params['sortorder'] = 'asc';
@ -386,11 +413,15 @@ $extra_params_course['autowidth'] = 'true'; //use the width of the parent
$extra_params_course['height'] = "100%";
//Per Week grid
$url_week = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_by_week&session_id='.$session_id.'&course_id='.$course_id;
$column_week = array(
get_lang('PeriodWeek'), get_lang('PublicationDate'), get_lang('Course'), get_lang('LearningPaths')
$url_week = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_by_week&session_id='.$session_id.'&course_id='.$course_id;
$column_week = array(
get_lang('PeriodWeek'),
get_lang('PublicationDate'),
get_lang('Course'),
get_lang('LearningPaths')
);
$column_week_model = array (
$column_week_model = array(
array('name'=>'week', 'index'=>'week', 'width'=>'40', 'align'=>'left', 'sortable'=>'false'),
array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'false'),
array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
@ -401,12 +432,12 @@ $extra_params_week = array();
$extra_params_week['grouping'] = 'true';
//For more details see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:grouping
$extra_params_week['groupingView'] = array(
'groupCollapse' => false,
'groupDataSorted' => false,
'groupField' => array('week'),
'groupOrder' => array('desc'),
'groupColumnShow' => 'false',
'groupText' => array('<b>'.get_lang('PeriodWeek').' {0}</b>')
'groupCollapse' => false,
'groupDataSorted' => false,
'groupField' => array('week'),
'groupOrder' => array('desc'),
'groupColumnShow' => 'false',
'groupText' => array('<b>' . get_lang('PeriodWeek') . ' {0}</b>')
);
$extra_params_week['autowidth'] = 'true'; //use the width of the parent
$extra_params_week['height'] = '100%';
@ -458,6 +489,7 @@ $(function() {
width:550,
modal: true
});
$(".opener").click(function() {
var my_id = $(this).attr('id');
var big_image = '#main_graph_' + my_id;
@ -477,7 +509,7 @@ $(function() {
echo Display::grid_js('list_week', $url_week, $column_week, $column_week_model, $extra_params_week,array(),'');
echo Display::grid_js('exercises', '', $column_exercise, $column_exercise_model, $extra_params_exercise, $my_real_array);
?>
//Generate tabs with jquery-ui
// Generate tabs with jquery-ui
$('#tabs').tabs();
$( "#sub_tab" ).tabs();
});
@ -493,14 +525,40 @@ if (empty($my_reporting)) {
}
// Main headers
$headers = array(get_lang('Courses'), get_lang('LearningPaths'), get_lang('MyQCM'), get_lang('MyStatistics'));
// Subheaders
$sub_header = array(get_lang('AllLearningPaths'), get_lang('PerWeek'), get_lang('ByCourse'));
$headers = array(
get_lang('Courses'),
get_lang('LearningPaths'),
get_lang('MyQCM'),
get_lang('MyStatistics')
);
// Sub headers
$sub_header = array(
get_lang('AllLearningPaths'),
get_lang('PerWeek'),
get_lang('ByCourse')
);
// Sub headers data
$lp_tabs = Display::tabs($sub_header, array(Display::grid_html('list_default'), Display::grid_html('list_week'), Display::grid_html('list_course')), 'sub_tab');
$courses_tab = Display::grid_html('courses');
$lp_tabs = Display::tabs(
$sub_header,
array(
Display::grid_html('list_default'),
Display::grid_html('list_week'),
Display::grid_html('list_course')
),
'sub_tab'
);
$courses_tab = Display::grid_html('courses');
// Main headers data
echo Display::tabs($headers, array($courses_tab, $lp_tabs, Display::grid_html('exercises'), $my_reporting));
echo Display::tabs(
$headers,
array(
$courses_tab,
$lp_tabs,
Display::grid_html('exercises'),
$my_reporting
)
);
Display::display_footer();

@ -265,7 +265,6 @@ $(document).ready(function() {
{% if type != 'admin' %}
$('#visible_to_read_only').show();
console.log(calEvent.sent_to);
$("#visible_to_read_only_users").html(calEvent.sent_to);
{% endif %}

@ -222,7 +222,6 @@ $(document).ready(function() {
function(stream) {
if (window.IsChrome) stream = new window.MediaStream(stream.getAudioTracks());
preview.src = myURL.createObjectURL(stream);
console.log(preview.src);
preview.play();
recordAudio = RecordRTC(stream, {

@ -76,7 +76,7 @@ function WSHelperVerifyKey($params) {
// Create the server instance
$server = new soap_server();
//$server->soap_defencoding = 'UTF-8';
$server->soap_defencoding = 'UTF-8';
// Initialize WSDL support
$server->configureWSDL('WSRegistration', 'urn:WSRegistration');
@ -5370,4 +5370,14 @@ function WSUserSubscribedInCourse ($params)
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
// If you send your data in utf8 then this value must be false.
if (isset($_configuration['registration.soap.php.decode_utf8'])) {
if ($_configuration['registration.soap.php.decode_utf8']) {
$server->decode_utf8 = true;
} else {
$server->decode_utf8 = false;
}
}
$server->service($HTTP_RAW_POST_DATA);

@ -142,7 +142,7 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=".intval($_GET['id']));
exit;
} else {
SocialManager::display_individual_user($_GET['id']);
$social_right_content .= SocialManager::display_individual_user($_GET['id']);
}
}
} else {
@ -164,4 +164,4 @@ if (api_get_setting('allow_social_tool') == 'true' && !api_is_anonymous()) {
$tpl->assign('header', get_lang('UsersOnLineList'));
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}
}

Loading…
Cancel
Save