skala
Juan Carlos Raña 14 years ago
commit f1505adffc
  1. 38
      main/admin/configure_plugin.php
  2. 2
      main/admin/resume_session.php
  3. 23
      main/admin/settings.lib.php
  4. 18
      main/admin/user_add.php
  5. 21
      main/admin/user_edit.php
  6. 56
      main/auth/cas/authcas.php
  7. 11
      main/auth/cas/cas_var.inc.php
  8. 1
      main/auth/cas/logincas.php
  9. 13
      main/course_info/delete_course.php
  10. 2
      main/course_info/maintenance.php
  11. 21
      main/coursecopy/classes/CourseRestorer.class.php
  12. 59
      main/coursecopy/copy_course.php
  13. 29
      main/coursecopy/create_backup.php
  14. 25
      main/coursecopy/recycle_course.php
  15. 65
      main/css/base.css
  16. 18
      main/css/base_chamilo.css
  17. 22
      main/document/document.php
  18. 25
      main/exercice/exercise.class.php
  19. 4
      main/exercice/exercise.lib.php
  20. 2
      main/exercice/exercise_reminder.php
  21. 3
      main/exercice/exercise_result.php
  22. 2
      main/exercice/exercise_show.php
  23. 14
      main/exercice/multiple_answer_combination.class.php
  24. 23
      main/exercice/overview.php
  25. 3
      main/gradebook/gradebook_showlog_eval.php
  26. 49
      main/inc/lib/banner.lib.php
  27. 36
      main/inc/lib/display.lib.php
  28. 15
      main/inc/lib/events.lib.inc.php
  29. 15
      main/inc/lib/fckeditor/editor/dialog/fck_template.html
  30. 20
      main/inc/lib/main_api.lib.php
  31. 69
      main/inc/lib/plugin.lib.php
  32. 4
      main/inc/lib/social.lib.php
  33. 2
      main/inc/lib/system_announcements.lib.php
  34. 69
      main/inc/lib/template.lib.php
  35. 2
      main/inc/lib/text.lib.php
  36. 9
      main/inc/lib/tracking.lib.php
  37. 26
      main/inc/lib/userportal.lib.php
  38. 2
      main/inc/local.inc.php
  39. 5
      main/install/configuration.dist.php
  40. 25
      main/messages/new_message.php
  41. 2
      main/mySpace/course.php
  42. 12
      main/mySpace/lp_tracking.php
  43. 65
      main/mySpace/myStudents.php
  44. 2
      main/mySpace/session.php
  45. 2
      main/newscorm/aicc_api.php
  46. 49
      main/newscorm/learnpath.class.php
  47. 2
      main/newscorm/lp_add.php
  48. 157
      main/newscorm/lp_add_item.php
  49. 25
      main/newscorm/lp_controller.php
  50. 187
      main/newscorm/lp_stats.php
  51. 89
      main/newscorm/lp_view.php
  52. 13
      main/newscorm/scorm_api.php
  53. 8
      main/template/default/layout/main_header.tpl
  54. 38
      main/work/work.php
  55. 12
      plugin/add_cas_login_button/css.css
  56. 21
      plugin/add_cas_login_button/index.php
  57. 41
      plugin/add_cas_login_button/plugin.php
  58. 7
      plugin/add_cas_login_button/readme.txt
  59. 44
      plugin/add_cas_login_button/template.tpl

@ -10,6 +10,9 @@ $language_file = array ('registration','admin');
$cidReset = true;
require_once '../inc/global.inc.php';
// Access restrictions
api_protect_admin_script();
$plugin_name = $_GET['name'];
$plugin_obj = new AppPlugin();
@ -21,36 +24,41 @@ if (empty($plugin_info)) {
$installed_plugins = $plugin_obj->get_installed_plugins();
if (!in_array($plugin_name, $installed_plugins)) {
api_not_allowed();
}
global $_configuration;
$content = '';
$content = null;
if (isset($plugin_info['settings_form'])) {
$form = $plugin_info['settings_form'];
$form = $plugin_info['settings_form'];
if (isset($form)) {
//We override the form attributes
$attributes = array('action'=>api_get_self().'?name='.$plugin_name, 'method'=>'POST');
$form->updateAttributes($attributes);
$content = $form->toHtml();
$form->updateAttributes($attributes);
$content = Display::page_header($plugin_info['title']);
$content .= $form->toHtml();
}
} else {
$message = Display::return_message(get_lang('NoConfigurationSettingsForThisPlugin'), 'warning');
}
if (isset($form) && $form->validate()) {
$values = $form->exportValues();
//api_delete_category_settings_by_subkey($plugin_name);
$access_url_id = api_get_current_access_url_id();
api_delete_settings_params(array('category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' =>
array('Plugins', $access_url_id, $plugin_name, 'setting', "status")));
foreach ($values as $key => $value) {
$key = Database::escape_string($plugin_name.'_'.$key);
api_add_setting($value, $key, $plugin_name, 'setting', 'Plugins', $plugin_name, null, null, null, $_configuration['access_url'], 1);
if (isset($form)) {
if ($form->validate()) {
$values = $form->exportValues();
//api_delete_category_settings_by_subkey($plugin_name);
$access_url_id = api_get_current_access_url_id();
api_delete_settings_params(array('category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' =>
array('Plugins', $access_url_id, $plugin_name, 'setting', "status")));
foreach ($values as $key => $value) {
$key = Database::escape_string($plugin_name.'_'.$key);
api_add_setting($value, $key, $plugin_name, 'setting', 'Plugins', $plugin_name, null, null, null, $_configuration['access_url'], 1);
}
$message = Display::return_message(get_lang('Updated'), 'success');
}
} else {
$content = Display::return_message(get_lang('NoConfigurationSettingsForThisPlugin'), 'warning');
}
$tpl = new Template($tool_name);

@ -122,7 +122,7 @@ if (!empty($message)) {
echo $message;
}
echo Display::page_subheader(Display::return_icon('session.png', get_lang('Session')).' '.$session['name']);
echo Display::page_header(Display::return_icon('session.png', get_lang('Session')).' '.$session['name']);
?>
<!-- General properties -->
<table class="data_table" width="100%">

@ -49,7 +49,7 @@ function handle_regions() {
/* We display all the possible plugins and the checkboxes */
$plugin_list = array();
$my_plugin_list = $plugin_obj->get_plugin_blocks();
$my_plugin_list = $plugin_obj->get_plugin_regions();
foreach($my_plugin_list as $plugin_item) {
$plugin_list[$plugin_item] = $plugin_item;
}
@ -60,15 +60,17 @@ function handle_regions() {
if (file_exists($plugin_info_file)) {
$plugin_info = array();
require $plugin_info_file;
echo '<tr>';
if (isset($_GET['name']) && $_GET['name'] == $plugin) {
echo '<tr class="row_selected">';
} else {
echo '<tr>';
}
echo '<td>';
echo '<h4>'.$plugin_info['title'].' <small>v'.$plugin_info['version'].'</small></h4>';
echo '<p>'.$plugin_info['comment'].'</p>';
echo '</td><td>';
$selected_plugins = $plugin_obj->get_areas_by_plugin($plugin);
echo Display::select('plugin_'.$plugin.'[]', $plugin_list, $selected_plugins, array('multiple' => 'multiple', 'style' => 'width:500px'));
echo Display::select('plugin_'.$plugin.'[]', $plugin_list, $selected_plugins, array('multiple' => 'multiple', 'style' => 'width:500px'));
echo '</td></tr>';
}
}
@ -117,10 +119,9 @@ function handle_plugins() {
echo get_lang('Description');
echo '</th>';
echo '</tr>';
$plugin_list = array();
$my_plugin_list = $plugin_obj->get_plugin_blocks();
$my_plugin_list = $plugin_obj->get_plugin_regions();
foreach($my_plugin_list as $plugin_item) {
$plugin_list[$plugin_item] = $plugin_item;
}
@ -131,7 +132,12 @@ function handle_plugins() {
if (file_exists($plugin_info_file)) {
$plugin_info = array();
require $plugin_info_file;
echo '<tr>';
if (in_array($plugin, $installed_plugins)) {
echo '<tr class="row_selected">';
} else {
echo '<tr>';
}
//echo '<tr>';
echo '<td>';
//Checkbox
if (in_array($plugin, $installed_plugins)) {
@ -149,6 +155,7 @@ function handle_plugins() {
echo '<div class="btn-group">';
if (in_array($plugin, $installed_plugins)) {
echo Display::url(get_lang('Configure'), 'configure_plugin.php?name='.$plugin, array('class' => 'btn'));
echo Display::url(get_lang('Regions'), 'settings.php?category=Regions&name='.$plugin, array('class' => 'btn'));
}
if (file_exists(api_get_path(SYS_PLUGIN_PATH).$plugin.'/readme.txt')) {

@ -128,14 +128,24 @@ if (api_get_setting('login_is_email') != 'true') {
// Password
$group = array();
$auth_sources = 0; //make available wider as we need it in case of form reset (see below)
$nb_ext_auth_source_added = 0;
if (count($extAuthSource) > 0) {
$group[] =& HTML_QuickForm::createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2);
$auth_sources = array();
foreach($extAuthSource as $key => $info) {
$auth_sources[$key] = $key;
// @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
// same action for file user_edit.php
if (($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true') || ($key != CAS_AUTH_SOURCE)) {
$auth_sources[$key] = $key;
$nb_ext_auth_source_added++;
}
}
$group[] =& HTML_QuickForm::createElement('select', 'auth_source', null, $auth_sources);
$group[] =& HTML_QuickForm::createElement('static', '', '', '<br />');
if ($nb_ext_auth_source_added > 0) {
$group[] =& HTML_QuickForm::createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2);
$group[] =& HTML_QuickForm::createElement('select', 'auth_source', null, $auth_sources);
$group[] =& HTML_QuickForm::createElement('static', '', '', '<br />');
}
}
$group[] =& HTML_QuickForm::createElement('radio', 'password_auto', get_lang('Password'), get_lang('AutoGeneratePassword').'<br />', 1);
$group[] =& HTML_QuickForm::createElement('radio', 'password_auto', 'id="radio_user_password"', null, 0);

@ -158,15 +158,26 @@ if (api_get_setting('login_is_email') != 'true') {
// Password
$form->addElement('radio', 'reset_password', get_lang('Password'), get_lang('DontResetPassword'), 0);
$nb_ext_auth_source_added = 0;
if (count($extAuthSource) > 0) {
$group[] =& HTML_QuickForm::createElement('radio', 'reset_password', null, get_lang('ExternalAuthentication').' ', 3);
$auth_sources = array();
foreach($extAuthSource as $key => $info) {
$auth_sources[$key] = $key;
// @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
// same action for file user_add.php
if (($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true') || ($key != CAS_AUTH_SOURCE)) {
$auth_sources[$key] = $key;
$nb_ext_auth_source_added++;
}
}
if ($nb_ext_auth_source_added > 0) {
// @todo check the radio button for external authentification and select the external authentification in the menu
$group[] =& HTML_QuickForm::createElement('radio', 'reset_password', null, get_lang('ExternalAuthentication').' ', 3);
$group[] =& HTML_QuickForm::createElement('select', 'auth_source', null, $auth_sources);
$group[] =& HTML_QuickForm::createElement('static', '', '', '<br />');
$form->addGroup($group, 'password', null, '', false);
}
$group[] =& HTML_QuickForm::createElement('select', 'auth_source', null, $auth_sources);
$group[] =& HTML_QuickForm::createElement('static', '', '', '<br />');
$form->addGroup($group, 'password', null, '', false);
}
$form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1);
$group = array();

@ -62,27 +62,41 @@ function cas_is_authenticated()
default:
$status=5; // Student
}*/
//If the user is in the dokeos database and we are ,not in a logout request, we upgrade his infomration by ldap
if (! $logout){
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT user_id, username, password, auth_source, active, expiration_date ".
"FROM $user_table ".
"WHERE username = '$login' ";
$result = api_sql_query($sql,__FILE__,__LINE__);
if(mysql_num_rows($result) == 0) {
require_once(api_get_path(SYS_PATH).'main/inc/lib/usermanager.lib.php');
$rnumber=rand(0,256000);
UserManager::create_user($firstName, $lastName, $status, $email, $login, md5('casplaceholder'.$rnumber), $official_code='',$language='',$phone='',$picture_uri='',$auth_source = PLATFORM_AUTH_SOURCE);
}
else {
$user = mysql_fetch_assoc($result);
$user_id = intval($user['user_id']);
//echo "deb : $status";
UserManager::update_user ($user_id, $firstname, $lastname, $login, null, null, $email, $status, '', '', '', '', 1, null, 0, null,'') ;
}
}
if (!$logout){
// get user info from username
$tab_user_info = UserManager::get_user_info($login);
// user found in the chamilo database
if (is_array($tab_user_info)) {
// if option is on we can update user automatically from ldap server
return $login;
}
// user not found
else {
// if option is on we can add user automatically from ldap server
return false;
}
}
// //If the user is in the dokeos database and we are ,not in a logout request, we upgrade his infomration by ldap
// if (! $logout){
// $user_table = Database::get_main_table(TABLE_MAIN_USER);
// $sql = "SELECT user_id, username, password, auth_source, active, expiration_date ".
// "FROM $user_table ".
// "WHERE username = '$login' ";
//
// $result = api_sql_query($sql,__FILE__,__LINE__);
// if(mysql_num_rows($result) == 0) {
// require_once(api_get_path(SYS_PATH).'main/inc/lib/usermanager.lib.php');
// $rnumber=rand(0,256000);
// UserManager::create_user($firstName, $lastName, $status, $email, $login, md5('casplaceholder'.$rnumber), $official_code='',$language='',$phone='',$picture_uri='',$auth_source = PLATFORM_AUTH_SOURCE);
// }
// else {
// $user = mysql_fetch_assoc($result);
// $user_id = intval($user['user_id']);
// //echo "deb : $status";
// UserManager::update_user ($user_id, $firstname, $lastname, $login, null, null, $email, $status, '', '', '', '', 1, null, 0, null,'') ;
//
// }
// }
return($login);
}
else

@ -3,18 +3,19 @@
* In the future, these will be in the database
*/
require_once('lib/CAS.php');
define("CAS_VERSION_2_0",'2.0');
define("SAML_VERSION_1_1", 'S1');
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
$cas_auth_server = api_get_setting('cas_server');
$cas_auth_uri = api_get_setting('cas_server_uri');
$cas_auth_port = intval(api_get_setting('cas_port'));
switch (api_get_setting('cas_protocol')) {
case 'CAS1': $cas_auth_ver = CAS_VERSION_1_0; break;
case 'CAS2': $cas_auth_ver = CAS_VERSION_2_0; break;
case 'SAML': $cas_auth_ver = SAML_VERSION_1_1; break;
default : $cas_auth_ver = CAS_VERSION_2_0; break;
}
$cas_auth_uri = api_get_setting('cas_server_uri');
if ( ! is_string($cas_auth_uri)) $cas_auth_uri = '';
$cas_auth_ver = '2.0';
//$cas_auth_ver = SAML_VERSION_1_1;
?>

@ -21,5 +21,4 @@ if (!is_object($PHPCAS_CLIENT) ) {
phpCAS::setNoCasServerValidation();
}
phpCAS::forceAuthentication();
//echo 'ici';
header('Location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login'));

@ -15,7 +15,6 @@
$language_file = array('admin', 'course_info');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once '../gradebook/lib/be/gradebookitem.class.php';
require_once '../gradebook/lib/be/category.class.php';
$this_section = SECTION_COURSES;
@ -29,9 +28,7 @@ if (!api_is_allowed_to_edit()) {
$tool_name = get_lang('DelCourse');
if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
CourseManager :: delete_course($_course['sysCode']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_course['sysCode']);
@ -39,15 +36,17 @@ if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
unset($_course);
unset($_cid);
$noPHP_SELF = true;
$message = get_lang('Course').' &quot;'.$current_course_name.'&quot; ('.$current_course_code.') '.get_lang('HasDel');
$message = '<h2>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h2>';
$message .=get_lang('HasDel');
$message .= '<br /><br /><a href="../../index.php">'.get_lang('BackHome').' '.api_get_setting('siteName').'</a>';
} else {
$message = '&quot;'.$current_course_name.'&quot; ('.$current_course_code.') <p>'.get_lang('ByDel').'</p><p><a href="maintenance.php">'.get_lang('No').'</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="'.api_get_self().'?delete=yes">'.get_lang('Yes').'</a></p>';
} else {
$message = '<h3>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h3>';
$message .= '<p>'.get_lang('ByDel').'</p><p><a class="btn btn-primary" href="maintenance.php">'.get_lang('No').'</a>&nbsp;<a class="btn" href="'.api_get_self().'?delete=yes">'.get_lang('Yes').'</a></p>';
$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
}
Display :: display_header($tool_name, 'Settings');
api_display_tool_title($tool_name);
echo Display::page_header($tool_name);
Display::display_warning_message($message, false);
/* FOOTER */

@ -16,7 +16,7 @@ $this_section = SECTION_COURSES;
$nameTools = get_lang('Maintenance');
api_block_anonymous_users();
Display :: display_header($nameTools);
api_display_tool_title($nameTools);
echo Display::page_header($nameTools);
?>

@ -1135,7 +1135,7 @@ class CourseRestorer
$new_id=0;
if(is_object($question)) {
if (is_object($question)) {
if ($question->is_restored()) {
return $question->destination_id;
}
@ -1158,8 +1158,7 @@ class CourseRestorer
extra='".self::DBUTF8escapestring($question->extra)."'";
Database::query($sql);
$new_id = Database::insert_id();
if ($question->quiz_type == MATCHING) { // for answer type matching
$answerid = 0;
$t = array();
@ -1167,8 +1166,7 @@ class CourseRestorer
$t[$answer['position']] = $answer;
}
foreach ($t as $index => $answer) {
$sql = "INSERT INTO ".$table_ans." SET c_id = ".$this->destination_course_id." , id= '".$index."',question_id = '".$new_id."', answer = '".self::DBUTF8escapestring($answer['answer'])."', correct = '".$answer['correct']."', comment = '".self::DBUTF8escapestring($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'";
$sql = "INSERT INTO ".$table_ans." SET c_id = ".$this->destination_course_id." , id= '".$index."',question_id = '".$new_id."', answer = '".self::DBUTF8escapestring($answer['answer'])."', correct = '".$answer['correct']."', comment = '".self::DBUTF8escapestring($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'";
Database::query($sql);
}
} else {
@ -1193,13 +1191,14 @@ class CourseRestorer
$old_id = $item['id'];
unset($item['id']);
$item['question_id'] = $new_id;
$item['c_id'] = $this->destination_course_id;
$question_option_id = Database::insert($table_options, $item);
$old_option_ids[$old_id] = $question_option_id;
}
$new_answers = Database::select('id, correct', $table_ans, array('WHERE' => array('question_id = ? AND c_id = ? '=>array($new_id, $this->destination_course_id))));
}
$new_answers = Database::select('id, correct', $table_ans, array('WHERE' => array('question_id = ? AND c_id = ? '=>array($new_id, $this->destination_course_id))));
foreach ($new_answers as $answer_item) {
$params['correct'] = $old_option_ids[$answer_item['correct']];
$question_option_id = Database::update($table_ans, $params, array('id = ?'=>$answer_item['id']));
$question_option_id = Database::update($table_ans, $params, array('id = ? AND c_id = ? '=> array($answer_item['id'], $this->destination_course_id)));
}
}
$this->course->resources[RESOURCE_QUIZQUESTION][$id]->destination_id = $new_id;
@ -1291,11 +1290,9 @@ class CourseRestorer
$this->course->resources[RESOURCE_SURVEY][$id]->destination_id = $new_id;
foreach ($survey->question_ids as $index => $question_id) {
$qid = $this->restore_survey_question($question_id, $new_id);
$sql = "UPDATE ".$table_que." " .
"SET survey_id = ".$new_id." WHERE c_id = ".$this->destination_course_id." AND question_id = $qid";
$sql = "UPDATE ".$table_que." SET survey_id = ".$new_id." WHERE c_id = ".$this->destination_course_id." AND question_id = $qid";
Database::query($sql);
$sql = "UPDATE ".$table_ans." ".
"SET survey_id = ".$new_id." WHERE c_id = ".$this->destination_course_id." AND question_id = $qid";
$sql = "UPDATE ".$table_ans." SET survey_id = ".$new_id." WHERE c_id = ".$this->destination_course_id." AND question_id = $qid";
Database::query($sql);
}

@ -77,40 +77,31 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (is
if (Database::num_rows($res) == 0) {
Display::display_normal_message(get_lang('NoDestinationCoursesAvailable'));
} else {
?>
<form method="post" action="copy_course.php">
<?php
echo get_lang('SelectDestinationCourse');
echo ' <select name="destination_course"/>';
while ($obj = Database::fetch_object($res)) {
echo '<option value="'.$obj->code.'">'.$obj->title.'</option>';
}
echo '</select>';
?>
<br/>
<br/>
<input type="radio" class="checkbox" id="copy_option_1" name="copy_option" value="full_copy"/>
<label for="copy_option_1"><?php echo get_lang('FullCopy'); ?></label>
<br/>
<input type="radio" class="checkbox" id="copy_option_2" name="copy_option" value="select_items" checked="checked"/>
<label for="copy_option_2"><?php echo get_lang('LetMeSelectItems'); ?></label>
<br/>
<br/>
<?php echo get_lang('SameFilename'); ?>
<blockquote>
<input type="radio" class="checkbox" id="same_file_name_option_1" name="same_file_name_option" value="<?php echo FILE_SKIP; ?>"/>
<label for="same_file_name_option_1"><?php echo get_lang('SameFilenameSkip'); ?></label>
<br/>
<input type="radio" class="checkbox" id="same_file_name_option_2" name="same_file_name_option" value="<?php echo FILE_RENAME; ?>"/>
<label for="same_file_name_option_2"><?php echo get_lang('SameFilenameRename'); ?></label>
<br/>
<input type="radio" class="checkbox" id="same_file_name_option_3" name="same_file_name_option" value="<?php echo FILE_OVERWRITE; ?>" checked="checked"/>
<label for="same_file_name_option_3"><?php echo get_lang('SameFilenameOverwrite'); ?></label>
</blockquote>
<br/>
<button class="save" type="submit"><?php echo get_lang('CopyCourse'); ?></button>
</form>
<?php
$options = array();
while ($obj = Database::fetch_object($res)) {
$options[$obj->code] = $obj->title;
}
$form = new FormValidator('copy_course', 'post', 'copy_course.php');
$form->addElement('header','' );
$form->addElement('select','destination_course', get_lang('SelectDestinationCourse'), $options);
$group = array();
$group[] = $form->createElement('radio', 'copy_option', null, get_lang('FullCopy'), 'full_copy');
$group[] = $form->createElement('radio', 'copy_option', null, get_lang('LetMeSelectItems'), 'select_items');
$form->addGroup($group, '', get_lang('SelectOptionForBackup'));
$group = array();
$group[] = $form->createElement('radio', 'same_file_name_option', null, get_lang('SameFilenameSkip'), FILE_SKIP);
$group[] = $form->createElement('radio', 'same_file_name_option', null, get_lang('SameFilenameRename'), FILE_RENAME);
$group[] = $form->createElement('radio', 'same_file_name_option', null, get_lang('SameFilenameOverwrite'), FILE_OVERWRITE);
$form->addGroup($group, '', get_lang('SameFilename'));
$form->addElement('style_submit_button', 'submit', get_lang('CopyCourse'),'class="save"');
$form->setDefaults(array('copy_option' =>'select_items','same_file_name_option' => FILE_OVERWRITE));
$form->display();
}
}

@ -44,7 +44,7 @@ require_once 'classes/CourseRestorer.class.php';
require_once 'classes/CourseSelectForm.class.php';
// Display the tool title
api_display_tool_title($nameTools);
echo Display::page_header($nameTools);
/* MAIN CODE */
@ -57,38 +57,25 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (is
}
$zip_file = CourseArchiver :: write_course($course);
Display::display_confirmation_message(get_lang('BackupCreated'));
echo '<br /><a class="a_button orange medium" href="../course_info/download.php?archive='.$zip_file.'">'.get_lang('Download').'</a>';
?>
<!-- Manual download <script language="JavaScript">
setTimeout('download_backup()',2000);
function download_backup()
{
window.location="../course_info/download.php?archive=<?php echo $zip_file; ?>";
}
</script> //-->
<?php
echo '<br /><a class="btn btn-primary btn-large" href="../course_info/download.php?archive='.$zip_file.'">'.get_lang('Download').'</a>';
} elseif (isset($_POST['backup_option']) && $_POST['backup_option'] == 'select_items') {
$cb = new CourseBuilder('partial');
$course = $cb->build();
$course = $cb->build();
CourseSelectForm :: display_form($course);
} else {
$cb = new CourseBuilder();
$course = $cb->build();
if (!$course->has_resources()) {
echo get_lang('NoResourcesToBackup');
} else {
echo '<span id="page_title">'.get_lang('SelectOptionForBackup').'</span><br /><br />';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
} else {
$form = new FormValidator('create_backup_form', 'post');
$renderer = $form->defaultRenderer();
$renderer->setElementTemplate('<div>{element}</div> ');
$form->addElement('header',get_lang('SelectOptionForBackup'));
$form->addElement('radio', 'backup_option', '', get_lang('CreateFullBackup'), 'full_backup');
$form->addElement('radio', 'backup_option', '', get_lang('LetMeSelectItems'), 'select_items');
$form->addElement('html', '<br />');
$form->addElement('style_submit_button', null, get_lang('CreateBackup'), 'class="save"');
$form->add_progress_bar();

@ -37,7 +37,7 @@ require_once 'classes/CourseRecycler.class.php';
require_once 'classes/CourseSelectForm.class.php';
// Display the tool title
api_display_tool_title($nameTools);
echo Display::page_header($nameTools);
/* MAIN CODE */
@ -62,18 +62,17 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (is
echo get_lang('NoResourcesToRecycle');
} else {
Display::display_warning_message(get_lang('RecycleWarning'), false);
?>
<form method="post" action="recycle_course.php">
<input type="radio" class="checkbox" id="recycle_option_1" name="recycle_option" value="full_backup" checked="checked"/>
<label for="recycle_option_1"><?php echo get_lang('FullRecycle'); ?></label>
<br/>
<input type="radio" class="checkbox" id="recycle_option_2" name="recycle_option" value="select_items"/>
<label for="recycle_option_2"><?php echo get_lang('LetMeSelectItems'); ?></label>
<br/>
<br/>
<button class="save" type="submit"><?php echo get_lang('RecycleCourse'); ?></button>
</form>
<?php
$form = new FormValidator('recycle_course', 'post', 'recycle_course.php');
$form->addElement('header',get_lang('SelectOptionForBackup'));
$form->addElement('radio', 'recycle_option', null, get_lang('FullRecycle'), 'full_backup');
$form->addElement('radio', 'recycle_option', null, get_lang('LetMeSelectItems'), 'select_items');
$form->addElement('style_submit_button', 'submit', get_lang('RecycleCourse'), 'class="save"');
$form->setDefaults(array('recycle_option' => 'select_items'));
$form->display();
}
}

@ -19,7 +19,7 @@ select {
visibility: visible;
}
.label {
form .label {
padding: 1px 3px 2px;
font-size: 100%;
font-weight: normal;
@ -71,12 +71,12 @@ label, input, button, select, textarea, p {
form .label {
color: #404040;
float: left;
font-size: 13px;
float: left;
line-height: 18px;
padding-top: 6px;
text-align: right;
width: 150px;
text-shadow:none;
}
form .formw {
margin-left: 170px;
@ -98,7 +98,7 @@ form .formw input {
/* New changes Chamilo 1.9 */
.sidebar-nav {
padding: 20px 0px 0px 20px;
padding: 20px 20px 10px 20px
}
.well_border {
@ -115,10 +115,13 @@ form .formw input {
height:26px;
}
#lp_navigation_elem .buttons,
#lp_navigation_elem #progress_bar {
width:130px;
margin:0px 0px 10px 15px;
#lp_navigation_elem .buttons{
margin-bottom: 5px;
}
#lp_navigation_elem {
padding-left: 15px;
width: 110px;
}
* {
@ -793,10 +796,7 @@ button {
-opera-shadow: 2px 2px 1px rgba(0, 0, 0, 0.5);
-webkit-shadow: 2px 2px 1px rgba(0, 0, 0, 0.5);
box-shadow: 2px 2px 1px rgba(0, 0, 0, 0.5);
font-weight:bold;
font-size: 105%;
box-shadow: 2px 2px 1px rgba(0, 0, 0, 0.5);
}
button:hover {
@ -2165,23 +2165,6 @@ div.lp_resource {
padding:5px;
}
/*LP changes
.lp_resource_element img {
float: left;
margin-bottom: 0;
margin-left: 43px;
margin-right: 43px;
margin-top: 7px;
}
.lp_resource_element a {
float: left;
margin-bottom: 12px;
margin-left: 33px;
margin-right: auto;
margin-top: 15px;
width: 100%;
}*/
.doc_resource {
margin:6px;
}
@ -2190,7 +2173,6 @@ div.lp_tree {
height: 100%;
overflow: auto;
padding: 3px 10px 3px 0;
width: 230px;
}
table.lp_build td.tree {
@ -3209,9 +3191,7 @@ a:active{
}
.homepage_notice {
width:90%;
margin-left: 14px;
margin-bottom: 10px;
}
.welcome_course li {
@ -3573,3 +3553,22 @@ a.forum_group_link {
#online_grid_container .thumbnail .caption {
height: 30px;
}
#hide_bar_template {
width: 10px;
display: inline;
float:left;
height: 100%;
padding-bottom: 90em;
margin-bottom: -90em;
cursor:pointer;
background-color:#eee;
margin-left: 0px !important;
background-image: url("../img/hide0.png");
background-repeat: no-repeat;
background-position: center center;
}
#hide_bar_template:hover {
background-color:#aaa;
}

@ -67,7 +67,7 @@ ul#navigation {
position: fixed;
margin: 0px;
padding: 0px;
top: 78px;
top: 200px;
right: -10px;
list-style: none;
z-index:9999;
@ -365,9 +365,6 @@ footer a:link, footer a:visited {
font-weight: bold;
padding-left: 12px;
}
.menusection {
width:100%;
}
.menusectioncaption {
background-color: #8A8A8A;
color: #FFFFFF;
@ -379,7 +376,7 @@ footer a:link, footer a:visited {
display:block;
}
.menulist {
margin: 0 20px;
margin: 0px;
list-style: none;
padding: 0;
list-style-image:none;
@ -882,8 +879,7 @@ div.admin_section h4 {
.sectioncomment {
color: #000000;
margin: 5px 5px 5px 0px;
padding: 5px;
font-size: 11px;
padding: 5px;
}
.sectionvalue {
list-style-type: none;
@ -1694,16 +1690,12 @@ span.radio {
* BUTTONS *
*****************************************************/
button {
margin:2px 5px 3px 3px !important;
/* margin:2px 5px 3px 3px; */
background-color: #F5F5F5;
border-width: 0px;
border-color:#EEEEEE #DEDEDE #DEDEDE #EEEEEE;
border-style:solid;
border-width:1px;
font-family: bold arial, verdana, helvetica, sans-serif;
font-size: 100%;
border-width:1px;
line-height :130%;
text-decoration: none;
color: black;

@ -145,18 +145,7 @@ switch ($action) {
$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
// Check whether the document is in the database
if (empty($document_data)) {
// File not found!
header('HTTP/1.0 404 Not Found');
$error404 = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">';
$error404 .= '<html><head>';
$error404 .= '<title>404 Not Found</title>';
$error404 .= '</head><body>';
$error404 .= '<h1>Not Found</h1>';
$error404 .= '<p>The requested URL was not found on this server.</p>';
$error404 .= '<hr>';
$error404 .= '</body></html>';
echo $error404;
exit;
api_not_allowed();
}
// Launch event
event_download($document_data['url']);
@ -233,11 +222,9 @@ switch ($action) {
if (!copy($file, $copyfile)) {
$message = Display::return_message(get_lang('CopyFailed'), 'error');
} else {
$message = Display::return_message(get_lang('CopyMade').' '.$file_link, 'confirmation', false);
$message = Display::return_message(get_lang('CopyMade').' '.$file_link, 'confirmation', false);
/*$doc_id = add_document($_course, $copyfile , 'file', filesize($copyfile), $document_info['title']);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], null, null, null, null, $session_id);*/
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], null, null, null, null, $session_id);*/
}
}
}
@ -480,7 +467,6 @@ $htmlHeadXtra[] = '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skins
$htmlHeadXtra[] = '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jquery.jplayer.min.js"></script>';
//$htmlHeadXtra[] = '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jquery.jplayer.inspector.js"></script>';
$mediaplayer_path = api_get_path(WEB_LIBRARY_PATH).'mediaplayer/player.swf';
//automatic loading the course language for yoxview
@ -518,7 +504,7 @@ foreach ($docs_and_folders as $file) {
//errorAlerts: true,
//warningAlerts: true,
swfPath: "'.$js_path.'jquery-jplayer",
supplied: "m4a, oga, mp3, ogg, wav",
//supplied: "m4a, oga, mp3, ogg, wav",
wmode: "window",
//solution: "flash, html", // Do not change this setting otherwise
cssSelectorAncestor: "#jp_container_'.$count.'",

@ -1587,7 +1587,7 @@ class Exercise {
if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) {
$html .='<a href="exercise_submit_modal.php?learnpath_id='.$safe_lp_id.'&learnpath_item_id='.$safe_lp_item_id.'&learnpath_item_view_id='.$safe_lp_item_view_id.'&origin='.$origin.'&hotspot='.$hotspot_get.'&nbrQuestions='.$nbrQuestions.'&questionnum='.$questionNum.'&exerciseType='.$this->type.'&exerciseId='.$this->id.'&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=480&width=640&modal=true" title="" class="thickbox button" id="validationButton">';
$html .= get_lang('ValidateAnswer').'</a>';
$html .= get_lang('EndTest').'</a>';
$html .='<br />';
} else {
//User
@ -1597,8 +1597,8 @@ class Exercise {
$label = get_lang('ReviewQuestions');
$class = 'btn btn-primary';
} else {
$label = get_lang('ValidateAnswers');
$class = 'btn btn-sucess';
$label = get_lang('EndTest');
$class = 'btn btn-success';
}
} else {
$label = get_lang('NextQuestion');
@ -1620,8 +1620,8 @@ class Exercise {
$all_label = get_lang('ReviewQuestions');
$class = 'btn btn-primary';
} else {
$all_label = get_lang('ValidateAnswers');
$class = 'btn btn-sucess';
$all_label = get_lang('EndTest');
$class = 'btn btn-success';
}
$all_button = '&nbsp;<a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
$all_button .= '&nbsp;<span id="save_all_reponse"></span>';
@ -2274,7 +2274,7 @@ class Exercise {
// for matching
case MATCHING :
if ($from_database) {
$sql_answer = 'SELECT id, answer FROM '.$table_ans.' WHERE question_id="'.$questionId.'" AND correct=0';
$sql_answer = 'SELECT id, answer FROM '.$table_ans.' WHERE c_id = '.$course_id.' AND question_id="'.$questionId.'" AND correct=0';
$res_answer = Database::query($sql_answer);
// getting the real answer
$real_list =array();
@ -2282,7 +2282,7 @@ class Exercise {
$real_list[$real_answer['id']]= $real_answer['answer'];
}
$sql_select_answer = 'SELECT id, answer, correct, id_auto FROM '.$table_ans.'
WHERE question_id="'.$questionId.'" AND correct <> 0 ORDER BY id_auto';
WHERE c_id = '.$course_id.' AND question_id="'.$questionId.'" AND correct <> 0 ORDER BY id_auto';
$res_answers = Database::query($sql_select_answer);
$questionScore = 0;
@ -2980,8 +2980,7 @@ class Exercise {
if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER) {
// We made an extra table for the answers
if ($show_result) {
if ($show_result) {
if ($origin != 'learnpath') {
echo '</table></td></tr>';
echo '<tr>
@ -2992,24 +2991,20 @@ class Exercise {
<param name="movie" value="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.Security::remove_XSS($questionId).'&exe_id='.$exeId.'&from_db=1" />
</object>';
echo '</td>
</tr>';
</tr>';
}
}
}
if ($origin != 'learnpath') {
if ($show_result) {
echo '</table>';
//if ($this->type == ALL_ON_ONE_PAGE) {
echo '</table>';
echo '<div id="question_score">';
if ($propagate_neg == 0 && $questionScore < 0) {
$questionScore = 0;
}
echo get_lang('Score').": ".show_score($questionScore, $questionWeighting, false, false);
echo '</div>';
//}
echo '<br />';
}
}
}

@ -1130,9 +1130,9 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
}
if ($revised) {
$revised = Display::span(get_lang('Validated'), array('class'=>'label_tag success'));
$revised = Display::label(get_lang('Validated'), 'success');
} else {
$revised = Display::span(get_lang('NotValidated'), array('class'=>'label_tag notice'));
$revised = Display::label(get_lang('NotValidated'), 'info');
}
if ($is_allowedToEdit || $is_tutor) {

@ -232,7 +232,7 @@ foreach ($question_list as $questionId) {
echo Display::div($table, array('class'=>'span10'));
$exercise_actions = Display::url(get_lang('ValidateAnswers'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-success'));
$exercise_actions = Display::url(get_lang('EndTest'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-success'));
$exercise_actions .= '&nbsp;'.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();','class'=>'btn'));
echo Display::div('', array('class'=>'clear'));

@ -204,8 +204,7 @@ if ($origin != 'learnpath') {
}
echo show_score($total_score, $total_weight, false, true, true, $objExercise->selectPassPercentage());
echo '</div>';
}
/* <button type="submit" class="save"><?php echo get_lang('Finish');?></button> */
}
}
// Tracking of results

@ -607,7 +607,7 @@ if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type'])))
if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) {
$my_total_score_temp = 0;
}
echo show_score($my_total_score_temp, $totalWeighting, false);
echo show_score($my_total_score_temp, $totalWeighting, false);
echo '</div>';
}
}

@ -134,14 +134,10 @@ class MultipleAnswerCombination extends Question {
$form -> add_multiple_required_rule ($boxes_names , get_lang('ChooseAtLeastOneCheckbox') , 'multiple_required');
$html_total_score ='<div style="margin-bottom:2px;">'.get_lang('Score').'</div>';
$form -> addElement ('html', $html_total_score);
//only 1 answer the all deal ...
$form->addElement('text', 'weighting[1]',null, array('class' => "span1", 'value' => '10'));
$form -> addElement ('html', '<br />');
$form->addElement('text', 'weighting[1]', get_lang('Score'), array('class' => "span1", 'value' => '10'));
$navigator_info = api_get_navigator();
global $text, $class, $show_quiz_edition;
//ie6 fix
@ -150,12 +146,12 @@ class MultipleAnswerCombination extends Question {
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('submit', 'submitQuestion', $text, 'class="'.$class.'"');
} else {
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('style_submit_button', 'submitQuestion',$text, 'class="'.$class.'"');
// setting the save button here and not in the question class.php

@ -80,18 +80,19 @@ if (isset($_GET['preview'])) {
$extra_params = '&preview=1';
}
$exercise_stat_info = $objExercise->get_stat_track_exercise_info($learnpath_id, $learnpath_item_id, 0);
$attempt_list = null;
if (isset($exercise_stat_info['exe_id'])) {
$attempt_list = get_all_exercise_event_by_exe_id($exercise_stat_info['exe_id']);
}
//Exercise button
//Notice we not add there the lp_item_view__id because is not already generated
$exercise_url = api_get_path(WEB_CODE_PATH).'exercice/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&origin='.$origin.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.$extra_params;
$label = get_lang('StartTest');
if ($time_control && !empty($clock_expired_time)) {
if ($time_control && !empty($clock_expired_time) || !empty($attempt_list)) {
$label = get_lang('ContinueTest');
}
$exercise_stat_info = $objExercise->get_stat_track_exercise_info($learnpath_id, $learnpath_item_id, 0);
$attempt_list = null;
if (isset($exercise_stat_info['exe_id'])) {
$attempt_list = get_all_exercise_event_by_exe_id($exercise_stat_info['exe_id']);
}
$exercise_url_button = Display::url($label, $exercise_url, array('class'=>'btn btn-primary btn-large'));
@ -102,7 +103,6 @@ if ($visible_return['value'] == false) {
$exercise_url_button = $visible_return['message'];
}
//Message "you already try this exercise"
$message = '';
@ -126,17 +126,17 @@ $table_content = '';
if (!empty($attempts)) {
$i = $counter;
foreach ($attempts as $attempt_result) {
foreach ($attempts as $attempt_result) {
$score = show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']);
$attempt_url = api_get_path(WEB_CODE_PATH).'exercice/result.php?'.api_get_cidreq().'&id='.$attempt_result['exe_id'].'&id_session='.api_get_session_id().'&height=500&width=750';
$attempt_link = Display::url(get_lang('Show'), $attempt_url, array('class'=>'ajax btn'));
$teacher_revised = Display::span(get_lang('Validated'), array('class'=>'label_tag success'));
$teacher_revised = Display::label(get_lang('Validated'), 'success');
//$attempt_link = get_lang('NoResult');
//$attempt_link = Display::return_icon('quiz_na.png', get_lang('NoResult'), array(), ICON_SIZE_SMALL);
if ($attempt_result['attempt_revised'] == 0) {
$teacher_revised = Display::span(get_lang('NotValidated'), array('class'=>'label_tag notice'));
$teacher_revised = Display::label(get_lang('NotValidated'), 'info');
}
$row = array('count' => $i,
'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG)
@ -167,8 +167,7 @@ if (!empty($attempts)) {
case EXERCISE_FEEDBACK_TYPE_EXAM:
$header_names = array(get_lang('Attempt'), get_lang('Date'), get_lang('Score'));
break;
}
}
$row = 0;
$column = 0;
foreach ($header_names as $item) {

@ -32,8 +32,7 @@ $interbreadcrumb[] = array (
$this_section = SECTION_COURSES;
Display :: display_header('');
echo Display::page_subheader(get_lang('GradebookQualifyLog'));
echo Display::page_header(get_lang('GradebookQualifyLog'));
$t_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$t_user= Database :: get_main_table(TABLE_MAIN_USER);

@ -79,7 +79,7 @@ function get_tabs() {
$group_pending_invitations = count($group_pending_invitations);
}
$total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message);
$total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':'');
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) :'');
$navigation['social']['title'] = get_lang('SocialNetwork'). $total_invitations;
}
@ -111,9 +111,8 @@ function get_tabs() {
return $navigation;
}
function show_header_1($language_file, $nameTools, $theme) {
global $noPHP_SELF;
$_course = api_get_course_info();
function return_logo($theme) {
$_course = api_get_course_info();
$html = '';
$logo = api_get_path(SYS_CODE_PATH).'css/'.$theme.'/images/header-logo.png';
@ -146,21 +145,21 @@ function show_header_1($language_file, $nameTools, $theme) {
}
}
/* Course title section */
/* // Course title section
if (!empty($_cid) and $_cid != -1 and isset($_course)) {
//Put the name of the course in the header
$html .= '<div id="my_courses">';
$html .= '</div>';
} elseif (isset($nameTools) && $language_file != 'course_home') {
//Put the name of the user-tools in the header
if (!isset($_user['user_id'])) {
if (!isset($user_id)) {
//echo '<div id="my_courses"></div>';
} elseif (!$noPHP_SELF) {
$html .= '<div id="my_courses"><a href="'.api_get_self().'?'.api_get_cidreq(). '" target="_top">'.$nameTools.'</a></div>';
} else {
$html .= '<div id="my_courses">'.$nameTools.'</div>';
}
}
}*/
return $html;
}
@ -221,7 +220,7 @@ function return_navigation_array() {
$navigation = array();
$menu_navigation = array();
$possible_tabs = get_tabs();
$possible_tabs = get_tabs();
// Campus Homepage
if (api_get_setting('show_tabs', 'campus_homepage') == 'true') {
@ -326,7 +325,7 @@ function return_navigation_array() {
}
function return_menu() {
$navigation = return_navigation_array();
$navigation = return_navigation_array();
$navigation = $navigation['navigation'];
// Displaying the tabs
@ -407,11 +406,11 @@ function return_menu() {
$show_bar = true;
}
$menu = '';
$menu = null;
// Logout
if ($show_bar) {
if (api_get_user_id()) {
if (api_get_user_id() && !api_is_anonymous()) {
$login = '';
if (api_is_anonymous()) {
$login = get_lang('Anonymous');
@ -421,6 +420,7 @@ function return_menu() {
$logout_link = api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id();
$message_link = null;
if (api_get_setting('allow_message_tool') == 'true') {
$message_link = '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.get_lang('Inbox').'</a>';
}
@ -446,7 +446,7 @@ function return_menu() {
$menu .= $lis;
$menu .= '</ul>';
}
}
}
return $menu;
}
@ -465,11 +465,14 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
$navigation = array();
// part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage
// hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
$session_name = cut($session_name, MAX_LENGTH_BREADCRUMB);
$my_session_name = is_null($session_name) ? '' : '&nbsp;('.$session_name.')';
if (!empty($_course) && !isset($_GET['hide_course_breadcrumb'])) {
$navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
$course_title = cut($_course['name'], MAX_LENGTH_BREADCRUMB);
switch (api_get_setting('breadcrumbs_course_homepage')) {
case 'get_lang':
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', get_lang('CourseHomepageLink')).' '.get_lang('CourseHomepageLink');
@ -478,13 +481,13 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['official_code']).' '.$_course['official_code'];
break;
case 'session_name_and_course_title':
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$_course['name'].$my_session_name;
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
break;
default:
if (api_get_setting('use_session_mode') == 'true' && api_get_session_id() != -1 ) {
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$_course['name'].$my_session_name;
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
} else {
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name']).' '.$_course['name'];
$navigation_item['title'] = Display::img(api_get_path(WEB_CSS_PATH).'home.png', $_course['name']).' '.$course_title;
}
break;
}
@ -497,6 +500,7 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
*/
$navigation[] = $navigation_item;
}
// part 2: Interbreadcrumbs. If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb (which is the tool itself)
if (isset($interbreadcrumb) && is_array($interbreadcrumb)) {
foreach ($interbreadcrumb as $breadcrumb_step) {
@ -529,9 +533,8 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
$navigation_item['title'] = get_lang('Gallery');
}
//Fixes breadcrumb title now we applied the Security::remove_XSS and we cut the string depending of the MAX_LENGTH_BREADCRUMB value
if (api_strlen($navigation_item['title']) > MAX_LENGTH_BREADCRUMB) {
$navigation_item['title'] = api_substr($navigation_item['title'], 0, MAX_LENGTH_BREADCRUMB).' ...';
}
$navigation_item['title'] = cut($navigation_item['title'], MAX_LENGTH_BREADCRUMB);
$navigation_item['title'] = Security::remove_XSS($navigation_item['title']);
$navigation[] = $navigation_item;
}
@ -551,11 +554,9 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
foreach ($navigation as $index => $navigation_info) {
if (!empty($navigation_info['title'])) {
if ($navigation_info['url'] == '#') {
$final_navigation[$index] = '<span>'.$navigation_info['title'].'</span>';
$final_navigation[$index] = '<span>'.$navigation_info['title'].'</span>';
} else {
$final_navigation[$index] = '<a href="'.$navigation_info['url'].'" class="" target="_top"><span>'.$navigation_info['title'].'</span></a>';
}
@ -592,7 +593,7 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools) {
} else {
$lis.= Display::tag('li', $home_link);
}
$html .= Display::tag('ul',$lis, array('class'=>'breadcrumb'));
$html .= Display::tag('ul', $lis, array('class'=>'breadcrumb'));
}
return $html ;
}

@ -1371,4 +1371,40 @@ class Display {
return $div;
}
function badge($count) {
$count = intval($count);
if (!empty($count)) {
return ' <span class="badge badge-warning">'.$count.'</span>';
}
return '';
}
function label($content, $type = 'default') {
$class = '';
switch ($type) {
case 'success':
$class = 'label-success';
break;
case 'warning':
$class = 'label-warning';
break;
case 'important':
$class = 'label-important';
break;
case 'info':
$class = 'label-info';
break;
case 'inverse':
$class = 'label-inverse';
break;
}
$html = '';
if (!empty($content)) {
$html = '<span class="label '.$class.'">';
$html .= $content;
$html .='</span>';
}
return $html;
}
} //end class Display

@ -833,15 +833,18 @@ function delete_student_lp_events($user_id, $lp_id, $course, $session_id) {
$session_id = intval($session_id);
//make sure we have the exact lp_view_id
$sqlview = "SELECT id FROM $lp_view_table WHERE c_id = $course_id AND user_id = $user_id AND lp_id = $lp_id AND session_id = $session_id ";
$sqlview = "SELECT id FROM $lp_view_table WHERE c_id = $course_id AND user_id = $user_id AND lp_id = $lp_id AND session_id = $session_id ";
$resultview = Database::query($sqlview);
$view = Database::fetch_array($resultview, 'ASSOC');
$lp_view_id = $view['id'];
$sql_delete = "DELETE FROM $lp_item_view_table WHERE c_id = $course_id AND lp_view_id = $view_id ";
$result = Database::query($sql_delete);
if (Database::num_rows($sqlview)) {
$view = Database::fetch_array($resultview, 'ASSOC');
$lp_view_id = $view['id'];
$sql_delete = "DELETE FROM $lp_item_view_table WHERE c_id = $course_id AND lp_view_id = $lp_view_id ";
$result = Database::query($sql_delete);
}
$sql_delete = "DELETE FROM $lp_view_table WHERE c_id = $course_id AND user_id = $user_id AND lp_id= $lp_id AND session_id= $session_id ";
$sql_delete = "DELETE FROM $lp_view_table WHERE c_id = $course_id AND user_id = $user_id AND lp_id= $lp_id AND session_id= $session_id ";
$result = Database::query($sql_delete);
$select_all_attempts = "SELECT exe_id FROM $track_e_exercises WHERE exe_user_id = $user_id AND session_id= $session_id AND exe_cours_id = '{$course['code']}' AND orig_lp_id = $lp_id";

@ -194,21 +194,18 @@ function ItemDiv_OnMouseOut()
function ItemDiv_OnClick()
{
SelectTemplate( this.TplIndex ) ;
SelectTemplate( this.TplIndex ) ;
if (window.top.hide_bar) {
window.top.hide_bar();
}
}
function SelectTemplate( index )
{
oEditor.FCKUndo.SaveUndoStep() ;
FCK.SetHTML( FCK._Templates[index].Html ) ;
FCK.SetHTML( FCK._Templates[index].Html ) ;
}
</script>
<style type="text/css">
body, td, input, textarea, select, label { font-family: Arial, Verdana, Geneva, helvetica, sans-serif; font-size: 11px; }
</style>
</script>
</head>
<body scroll="no" style="overflow: hidden; background-color: #ffffff;">
<table width="100%" style="height: 100%;" valign="top">

@ -118,6 +118,8 @@ define('SECTION_GLOBAL', 'global');
// CONSTANT name for local authentication source
define('PLATFORM_AUTH_SOURCE', 'platform');
define('CAS_AUTH_SOURCE', 'cas');
define('LDAP_AUTH_SOURCE', 'extldap');
// CONSTANT defining the default HotPotatoes files directory
define('DIR_HOTPOTATOES','/HotPotatoes_files');
@ -2563,6 +2565,22 @@ function api_is_anonymous($user_id = null, $db_check = false) {
return isset($_user['is_anonymous']) && $_user['is_anonymous'] === true;
}
/*
* Returns a not found page
* @todo use smarty to customize the not found page
*/
function api_not_found($print_headers = false) {
$origin = isset($_GET['origin']) ? $_GET['origin'] : '';
$show_headers = 0;
if ((!headers_sent() || $print_headers) && $origin != 'learnpath') {
$show_headers = 1;
}
$tpl = new Template(null, $show_headers, $show_headers);
$msg = get_lang('NotFound');
$tpl->assign('content', $msg);
$tpl->display_one_col_template();
}
/**
* Displays message "You are not allowed here..." and exits the entire script.
* @param bool Whether or not to print headers (default = false -> does not print them)
@ -3402,7 +3420,7 @@ function api_number_of_plugins($location) {
/**
* Including the necessary plugins.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @deprecated use AppPlugin::get_all_plugin_contents_by_block function
* @deprecated use AppPlugin::get_all_plugin_contents_by_region function
*/
function api_plugin($location) {
global $_plugins;

@ -1,7 +1,8 @@
<?php
/* See license terms in /license.txt */
class AppPlugin {
var $plugin_blocks = array (
var $plugin_regions = array (
// 'loginpage_main',
'login_top',
'login_bottom',
@ -24,8 +25,7 @@ class AppPlugin {
'course_tool_plugin'
);
function __construct() {
function __construct() {
}
/* For each of the possible plugin directories we check whether a file named "plugin.php" exists
@ -37,6 +37,7 @@ class AppPlugin {
$plugin_info['version'] = '0.1 alpha'; // The version number of the plugin.
$plugin_info['author'] = 'Patrick Cool'; // The author of the plugin.
*/
function read_plugins_from_path() {
/* We scan the plugin directory. Each folder is a potential plugin. */
$pluginpath = api_get_path(SYS_PLUGIN_PATH);
@ -52,14 +53,14 @@ class AppPlugin {
return $possible_plugins;
}
function get_installed_plugins_by_block(){
$usedplugins = array();
function get_installed_plugins_by_region(){
$used_plugins = array();
/* We retrieve all the active plugins. */
$result = api_get_settings('Plugins');
foreach ($result as $row) {
$usedplugins[$row['variable']][] = $row['selected_value'];
$used_plugins[$row['variable']][] = $row['selected_value'];
}
return $usedplugins;
return $used_plugins;
}
function get_installed_plugins() {
@ -132,17 +133,17 @@ class AppPlugin {
return false;
}
function get_plugin_blocks() {
sort($this->plugin_blocks);
return $this->plugin_blocks;
function get_plugin_regions() {
sort($this->plugin_regions);
return $this->plugin_regions;
}
function load_block($block, $main_template) {
function load_region($region, $main_template) {
ob_start();
$this->get_all_plugin_contents_by_block($block, $main_template);
$block_content = ob_get_contents();
$this->get_all_plugin_contents_by_region($region, $main_template);
$content = ob_get_contents();
ob_end_clean();
return $block_content;
return $content;
}
/**
@ -152,35 +153,31 @@ class AppPlugin {
* @param smarty obj
* @todo improve this function
*/
function get_all_plugin_contents_by_block($block, $template) {
function get_all_plugin_contents_by_region($region, $template) {
global $_plugins;
if (isset($_plugins[$block]) && is_array($_plugins[$block])) {
if (isset($_plugins[$region]) && is_array($_plugins[$region])) {
//if (1) {
foreach ($_plugins[$block] as $plugin_name) {
foreach ($_plugins[$region] as $plugin_name) {
//Load the plugin information
//The plugin_info variable is available inside the plugin index
$plugin_info = $this->get_plugin_info($plugin_name);
$plugin_info = $this->get_plugin_info($plugin_name);
//We also where the plugin is
$plugin_info['current_region'] = $block;
$plugin_info['current_region'] = $region;
// Loading the plugin/XXX/index.php file
$plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/index.php";
$plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/index.php";
if (file_exists($plugin_file)) {
require $plugin_file;
//We set the $template variable in order to use smarty
if (isset($_template) && !empty($_template)) {
/*
foreach ($_template as $key =>$value) {
$template->assign($plugin_name[$key], $value);
}
*/
//We set the $template variable in order to use Smarty
if (isset($_template) && !empty($_template)) {
$template->assign($plugin_name, $_template);
}
//Loading the smarty template files if exists
//Loading the Smarty template plugin files if exists
$template_list = array();
if (isset($plugin_info) && isset($plugin_info['templates'])) {
$template_list = $plugin_info['templates'];
@ -204,31 +201,31 @@ class AppPlugin {
*
* Loads plugin info
* @staticvar array $plugin_data
* @param type $plugin_name
* @param type bool
* @param string plugin name
* @param bool load from DB or from the static array
* @todo filter setting_form
* @return array
*/
function get_plugin_info($plugin_name, $forced = false) {
static $plugin_data = array();
if (isset($plugin_data[$plugin_name]) && $forced == false) {
if (isset($plugin_data[$plugin_name]) && $forced == false) {
return $plugin_data[$plugin_name];
} else {
$plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/plugin.php";
$plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/plugin.php";
$plugin_info = array();
if (file_exists($plugin_file)) {
require $plugin_file;
}
$plugin_data[$plugin_name] = $plugin_info;
}
//extra options
$plugin_settings = api_get_settings_params(array("subkey = ? AND category = ? AND type = ? " =>
array($plugin_name, 'Plugins','setting')));
array($plugin_name, 'Plugins','setting')));
$settings_filtered = array();
foreach ($plugin_settings as $item) {
$settings_filtered[$item['variable']] = $item['selected_value'];
}
$plugin_info['settings'] = $settings_filtered;
$plugin_info['settings'] = $settings_filtered;
$plugin_data[$plugin_name] = $plugin_info;
return $plugin_info;
}
}

@ -556,13 +556,13 @@ class SocialManager extends UserManager {
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = (!empty($count_unread_message)?' ('.$count_unread_message.')':'');
$count_unread_message = (!empty($count_unread_message)? Display::badge($count_unread_message) :'');
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION,false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':'');
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) :'');
$html = '<div class="social-menu">';

@ -607,7 +607,7 @@ class SystemAnnouncementManager {
$announcements = Database::query($sql);
$html = '';
if (Database::num_rows($announcements) > 0) {
$html .= '<div class="span12">';
$html .= '<div class="span9">';
$html .= '<h3>'.get_lang('SystemAnnouncements').'</h3>';
$html .= '<div id="container-slider" class="span6"><ul id="slider">';
while ($announcement = Database::fetch_object($announcements)) {

@ -2,12 +2,11 @@
/* For licensing terms, see /license.txt */
/*
* @author Julio Montoya <gugli100@gmail.com>
* @todo better organization of the class, methods and variables
*
**/
/* @todo better organization of the class methods and variables */
// Load Smarty library
// Load Smarty library
require_once api_get_path(LIBRARY_PATH).'smarty/Smarty.class.php';
require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
@ -22,7 +21,7 @@ class Template extends Smarty {
var $show_header;
var $show_footer;
var $help;
var $menu_navigation = array();
//var $menu_navigation = array();
var $show_learnpath = false; // This is a learnpath section or not?
var $plugin = null;
var $course_id = null;
@ -53,10 +52,9 @@ class Template extends Smarty {
//Setting user variables
$this->set_user_parameters();
//Setting course id
$course_id = api_get_course_int_id();
$this->course_id = $course_id;
//Setting course variables
$this->set_course_parameters();
//header and footer are showed by default
$this->set_footer($show_footer);
@ -82,9 +80,9 @@ class Template extends Smarty {
//Chamilo plugins
$this->plugin = new AppPlugin();
$plugin_blocks = $this->plugin->get_plugin_blocks();
foreach ($plugin_blocks as $block) {
$this->set_plugin_block($block);
$plugin_regions = $this->plugin->get_plugin_regions();
foreach ($plugin_regions as $region) {
$this->set_plugin_region($region);
}
}
@ -213,8 +211,16 @@ class Template extends Smarty {
function get_template($name) {
return $this->style.'/'.$name;
}
}
/* Set course parameters */
private function set_course_parameters() {
//Setting course id
$course_id = api_get_course_int_id();
$this->course_id = $course_id;
}
/* Set user parameters */
private function set_user_parameters() {
$user_info = array();
$user_info['logged'] = 0;
@ -235,6 +241,7 @@ class Template extends Smarty {
$this->assign('_u', $user_info);
}
/* Set system parameters */
private function set_system_parameters() {
global $_configuration;
@ -243,7 +250,8 @@ class Template extends Smarty {
'web_course' => api_get_path(WEB_COURSE_PATH),
'web_main' => api_get_path(WEB_CODE_PATH),
'web_ajax' => api_get_path(WEB_AJAX_PATH),
'web_img' => api_get_path(WEB_IMG_PATH)
'web_img' => api_get_path(WEB_IMG_PATH),
'web_plugin' => api_get_path(WEB_PLUGIN_PATH)
);
$this->assign('_p', $_p);
@ -285,23 +293,24 @@ class Template extends Smarty {
$this->assign('css_style', $style_html);
$style_print = '@import "'.api_get_path(WEB_CSS_PATH).$this->theme.'/print.css";'."\n";
$this->assign('css_style_print', $style_print);
$this->assign('style_print', $style_print);
// Header 1
$header1 = show_header_1($language_file, $nameTools, $this->theme);
$this->assign('header1', $header1);
$this->assign('css_style_print', $style_print);
// Logo
$logo = return_logo($this->theme);
$this->assign('logo', $logo);
}
private function set_header_parameters() {
$help = $this->help;
$nameTools = $this->title;
global $lp_theme_css, $mycoursetheme, $user_theme;
global $httpHeadXtra, $htmlHeadXtra, $_course, $_user, $text_dir, $_user,
$_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;
global $httpHeadXtra, $htmlHeadXtra, $_course, $text_dir,
$interbreadcrumb, $charset, $language_file, $noPHP_SELF;
$navigation = return_navigation_array();
$this->menu_navigation = $navigation['menu_navigation'];
//$navigation = return_navigation_array();
//$this->menu_navigation = $navigation['menu_navigation'];
global $_configuration;
@ -325,6 +334,7 @@ class Template extends Smarty {
$title_list[] = api_get_setting('Institution');
$title_list[] = api_get_setting('siteName');
if (!empty($course_title)) {
$title_list[] = $course_title;
}
@ -403,6 +413,7 @@ class Template extends Smarty {
$css_file_to_string .= api_get_css($css_file);
}
// @todo move this somewhere else
if (SHOW_TEXT_NEAR_ICONS == true) {
//hack in order to fix the actions buttons
$css_file_to_string .= '<style>
@ -457,7 +468,7 @@ class Template extends Smarty {
$this->set_help();
$bug_notification_link = '';
if (api_get_setting('show_link_bug_notification') == 'true') {
if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
$bug_notification_link = '<li class="report">
<a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank">
<img src="'.api_get_path(WEB_IMG_PATH).'bug.large.png" style="vertical-align: middle;" alt="'.get_lang('ReportABug').'" title="'.get_lang('ReportABug').'"/></a>
@ -467,7 +478,7 @@ class Template extends Smarty {
$this->assign('bug_notification_link', $bug_notification_link);
$notification = return_notification_menu();
$menu = return_menu();
$menu = return_menu();
$breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools);
$this->assign('notification_menu', $notification);
@ -578,12 +589,12 @@ class Template extends Smarty {
}
/* Sets the plugin content in a Smarty variable */
function set_plugin_block($plugin_block) {
if (!empty($plugin_block)) {
$block_content = $this->plugin->load_block($plugin_block, $this);
if (!empty($block_content)) {
function set_plugin_region($plugin_region) {
if (!empty($plugin_region)) {
$content = $this->plugin->load_region($plugin_region, $this);
if (!empty($content)) {
//Assigning the plugin with the smarty template
$this->assign('plugin_'.$plugin_block, $block_content);
$this->assign('plugin_'.$plugin_region, $content);
}
}
return null;

@ -563,7 +563,7 @@ function cut($text, $maxchar, $embed = false) {
if ($embed) {
return '<span title="'.$text.'">'.api_substr($text, 0, $maxchar).'...</span>';
}
return api_substr($text, 0, $maxchar).'...';
return api_substr($text, 0, $maxchar).' ...';
}
return $text;
}

@ -167,12 +167,9 @@ class Tracking {
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
if ($currentTimestamp - $timestamp > 604800)
{
if ($currentTimestamp - $timestamp > 604800) {
return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
}
else
{
} else {
return api_format_date($last_login_date, DATE_FORMAT_SHORT);
}
}
@ -2652,7 +2649,7 @@ class Tracking {
}
}
echo Display::div($normal_graph, array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') );
$html .= Display::div($normal_graph, array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') );
if (empty($graph)) {
$graph = '-';

@ -786,6 +786,7 @@ class IndexManager {
function return_profile_block() {
$html = '';
$user_id = api_get_user_id();
if (empty($user_id)) {
return;
}
@ -802,12 +803,11 @@ class IndexManager {
if (api_get_setting('allow_social_tool') == 'true') {
if (!$no_image) {
$profile_content .='<li><a class="thumbnail" href="'.api_get_path(WEB_PATH).'main/social/home.php"><img src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a></li>';
$profile_content .='<li><a class="thumbnail" href="'.api_get_path(WEB_PATH).'main/social/home.php"><img src="'.$img_array['file'].'" '.$img_array['style'].' ></a></li>';
} else {
$profile_content .='<li><a class="thumbnail" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a></li>';
$profile_content .='<li><a class="thumbnail" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].'></a></li>';
}
}
}
// @todo Add a platform setting to add the user image.
if (api_get_setting('allow_message_tool') == 'true') {
@ -823,10 +823,7 @@ class IndexManager {
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$cant_msg = '';
if ($number_of_new_messages > 0) {
$cant_msg = ' ('.$number_of_new_messages.')';
}
$cant_msg = Display::badge($number_of_new_messages);
$link = '';
if (api_get_setting('allow_social_tool') == 'true') {
@ -835,13 +832,9 @@ class IndexManager {
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.get_lang('Inbox').$cant_msg.' </a></li>';
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.get_lang('Compose').' </a></li>';
if (api_get_setting('allow_social_tool') == 'true') {
if ($total_invitations == 0) {
$total_invitations = '';
} else {
$total_invitations = ' ('.$total_invitations.')';
}
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').' '.$total_invitations.' </a></li>';
if (api_get_setting('allow_social_tool') == 'true') {
$total_invitations = Display::badge($total_invitations);
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').$total_invitations.'</a></li>';
}
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></li>';
}
@ -861,8 +854,7 @@ class IndexManager {
// Main navigation section.
// Tabs that are deactivated are added here.
if (!empty($this->tpl->menu_navigation)) {
$main_navigation_content .= '<ul class="menulist">';
$main_navigation_content .= '<ul class="menulist">';
foreach ($this->tpl->menu_navigation as $section => $navigation_info) {
$current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';

@ -258,7 +258,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
if (Database::num_rows($result) > 0) {
$uData = Database::fetch_array($result);
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE || $uData['auth_source'] == CAS_AUTH_SOURCE) {
//the authentification of this user is managed by Chamilo itself
$password = trim(stripslashes($password));

@ -87,6 +87,11 @@ $_configuration['db_admin_path'] = '';
// $extAuthSource["ldap"]["login"] = $_configuration['root_sys'].$_configuration['code_append']."auth/ldap/login.php";
// $extAuthSource["ldap"]["newUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/ldap/newUser.php";
//
// Go to Chamilo > Administration > CAS to activate CAS
// You can leave these lines uncommented even if you don't use CAS
$extAuthSource["cas"]["login"] = $_configuration['root_sys'].$_configuration['code_append']."auth/cas/login.php";
$extAuthSource["cas"]["newUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/cas/newUser.php";
//
// To fetch external login information, uncomment those 2 lines and modify files auth/external_login/newUser.php and auth/external_login/updateUser.php files
// $extAuthSource["external_login"]["newUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/external_login/newUser.php";
// $extAuthSource["external_login"]["updateUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/external_login/updateUser.php";

@ -109,7 +109,7 @@ function add_image_form() {
filepaths.appendChild(elem1);
id_elem1 = "filepath_"+counter_image;
id_elem1 = "\'"+id_elem1+"\'";
document.getElementById("filepath_"+counter_image).innerHTML = "<input type=\"file\" name=\"attach_"+counter_image+"\" class=\"span5\" />&nbsp;<input type=\"text\" name=\"legend[]\" size=\"20\" />";
document.getElementById("filepath_"+counter_image).innerHTML = "<input type=\"file\" name=\"attach_"+counter_image+"\" class=\"span4\" />&nbsp;<input type=\"text\" name=\"legend[]\" size=\"20\" />";
if (filepaths.childNodes.length == 6) {
var link_attach = document.getElementById("link-more-attach");
if (link_attach) {
@ -142,9 +142,9 @@ function show_compose_reply_to_message($message_id, $receiver_id) {
$html = get_lang('InvalidMessageId');
return $html;
}
$pre_html = '<div class="row">
<div class="label">'.get_lang('SendMessageTo').': </div>
<div class="formw">';
$pre_html = '<div class="control-group">
<label class="control-label">'.get_lang('SendMessageTo').': </label>
<div class="controls">';
$post = '</div></div>';
$sent_to = $pre_html.'<strong>'.GetFullUserName($row['user_sender_id']).'</strong>'.$post;
$default['users'] = array($row['user_sender_id']);
@ -161,19 +161,18 @@ function show_compose_to_user ($receiver_id) {
return $html;
}
function manage_form($default, $select_from_user_list = null, $sent_to = null) {
function manage_form($default, $select_from_user_list = null, $sent_to = null) {
$group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
$message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null;
$param_f = isset($_GET['f']) ? Security::remove_XSS($_GET['f']):'';
$form = new FormValidator('compose_message',null,api_get_self().'?f='.$param_f,null,array('enctype'=>'multipart/form-data'));
$form = new FormValidator('compose_message',null,api_get_self().'?f='.$param_f, null, array('enctype'=>'multipart/form-data'));
if (empty($group_id)) {
if (isset($select_from_user_list)) {
$form->add_textfield('id_text_name', get_lang('SendMessageTo'),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px'));
$form->add_textfield('id_text_name', get_lang('SendMessageTo'), true,array('class' => 'span4','id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off'));
$form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>');
$form->addElement('hidden','user_list',0,array('id'=>'user_list'));
$form->addElement('hidden','user_list', 0, array('id'=>'user_list'));
} else {
if (!empty($sent_to)) {
$form->addElement('html',$sent_to);
@ -188,12 +187,12 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null) {
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
$form->addElement('html','<div class="row"><div class="label">'.get_lang('ToGroup').'</div><div class="formw">'.api_xml_http_response_encode($group_info['name']).'</div></div>');
$form->addElement('label', get_lang('ToGroup'), api_xml_http_response_encode($group_info['name']));
$form->addElement('hidden','group_id',$group_id);
$form->addElement('hidden','parent_id',$message_id);
}
$form->add_textfield('title', get_lang('Subject'),true , array('size' => 54));
$form->add_textfield('title', get_lang('Subject'),true , array('class' => 'span4'));
$form->add_html_editor('content', get_lang('Message'), false, false, array('ToolbarSet' => 'Messages', 'Width' => '95%', 'Height' => '250'));
@ -209,9 +208,9 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null) {
if (empty($group_id)) {
$form->addElement('advanced_settings',get_lang('FilesAttachment').'<span id="filepaths">
$form->addElement('advanced_settings', get_lang('FilesAttachment').'<span id="filepaths">
<div id="filepath_1">
<input type="file" name="attach_1" class="span5"/>
<input type="file" name="attach_1" class="span4"/>
<input type="text" name="legend[]" size="20" /></div></span>');
$form->addElement('advanced_settings','<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
}

@ -97,7 +97,7 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
echo '</span>';
}
echo '</div>';
echo Display::page_subheader($title);
echo Display::page_header($title);
}
// Database Table Definitions

@ -15,7 +15,6 @@ if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
} else {
$this_section = SECTION_COURSES;
}
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php';
@ -37,12 +36,9 @@ if (isset($_GET['course'])) {
$user_infos = UserManager :: get_user_info_by_id($user_id);
$name = api_get_person_name($user_infos['firstname'], $user_infos['lastname']);
if (!api_is_platform_admin(true) && !CourseManager :: is_course_teacher($_user['user_id'], $cidReq) && !Tracking :: is_allowed_to_coach_student($_user['user_id'],$_GET['student_id']) && !api_is_drh() && !api_is_course_tutor()) {
Display::display_header('');
api_not_allowed();
Display::display_footer();
if (!api_is_platform_admin(true) && !CourseManager :: is_course_teacher($_user['user_id'], $cidReq) && !Tracking :: is_allowed_to_coach_student($_user['user_id'],$_GET['student_id']) && !api_is_drh() && !api_is_course_tutor()) {
api_not_allowed();
}
$course_exits = CourseManager::course_exists($cidReq);
if (!empty($course_exits)) {
@ -87,8 +83,8 @@ $session_name = api_get_session_name($session_id);
$table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':' ').
Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_info['name'].' '.
Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name;
echo Display::page_subheader($table_title);
echo '<h3>'.Display::return_icon('learnpath.png', get_lang('ToolLearnpath'), array(), ICON_SIZE_SMALL).' '.$lp_title.'</h3>';
echo Display::page_header($table_title);
echo Display::page_subheader('<h3>'.Display::return_icon('learnpath.png', get_lang('ToolLearnpath'), array(), ICON_SIZE_SMALL).' '.$lp_title.'</h3>');
$list = learnpath :: get_flat_ordered_items_list($lp_id, 0, $course_info['real_id']);
$origin = 'tracking';

@ -8,8 +8,6 @@
// name of the language file that needs to be included
$language_file = array('registration', 'index', 'tracking', 'exercice', 'admin', 'gradebook', 'survey');
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
@ -120,7 +118,7 @@ if (isset($_GET['details'])) {
}
}
$nameTools = get_lang("DetailsStudentInCourse");
} else {
} else {
if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
$interbreadcrumb[] = array (
'url' => '../admin/index.php',
@ -186,26 +184,25 @@ $check= Security::check_token('get');
if ($check) {
switch ($_GET['action']) {
case 'reset_lp' :
$course = isset($_GET['course']) ?$_GET['course']:"";
$lp_id = isset($_GET['lp_id']) ?intval($_GET['lp_id']):"";
$course = isset($_GET['course']) ? $_GET['course']:"";
$lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']):"";
if (api_is_course_admin() && !empty($course) && !empty($lp_id) && !empty($student_id)) {
if (api_is_allowed_to_edit() && !empty($course) && !empty($lp_id) && !empty($student_id)) {
$course_info = api_get_course_info($course);
delete_student_lp_events($student_id, $lp_id, $course_info, $session_id);
//@todo delete the stats.track_e_exercices records. First implement this http://support.chamilo.org/issues/1334
Display::display_confirmation_message(get_lang('LPWasReset'));
$message = Display::return_message(get_lang('LPWasReset'),'success');
}
break;
break;
default:
break;
break;
}
Security::clear_token();
}
// infos about user
$user_info = UserManager::get_user_info_by_id($student_id);
$user_info = api_get_user_info($student_id);
$courses_in_session = array();
$courses = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
@ -268,6 +265,10 @@ if (empty($courses_in_session)) {
Display :: display_header($nameTools);
if (isset($message )) {
echo $message;
}
if (!empty($student_id)) {
if (api_is_drh() && !UserManager::is_user_followed_by_drh($student_id, api_get_user_id())) {
@ -299,13 +300,12 @@ if (!empty($student_id)) {
}
// get average of score and average of progress by student
$avg_student_progress = $avg_student_score = $nb_courses = 0;
$avg_student_progress = $avg_student_score = 0;
$course_code = Security :: remove_XSS($_GET['course']);
if (!CourseManager :: is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
unset($courses[$key]);
} else {
$nb_courses++;
} else {
$avg_student_progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, array(), $session_id);
//the score inside the Reporting table
$avg_student_score = Tracking::get_avg_student_score($user_info['user_id'], $course_code, array(), $session_id);
@ -314,8 +314,9 @@ if (!empty($student_id)) {
$avg_student_progress = round($avg_student_progress, 2);
// time spent on the course
$time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $course_code, $session_id));
// get information about connections on the platform by student
$first_connection_date = Tracking :: get_first_connection_date($user_info['user_id']);
if ($first_connection_date == '') {
@ -390,15 +391,14 @@ if (!empty($student_id)) {
$session_name = $session_info['name'];
} // end
$info_course = CourseManager :: get_course_information($get_course_code);
$info_course = CourseManager :: get_course_information($get_course_code);
$table_title = Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).$user_info['complete_name'];
echo Display::page_subheader($table_title);
?>
<table width="100%" border="0">
<tr>
<?php
echo '<table width="100%" border="0">';
echo '<tr>';
$image_array = UserManager :: get_user_picture_path_by_id($user_info['user_id'], 'web', false, true);
echo '<td class="borderRight" width="10%" valign="top">';
@ -438,19 +438,17 @@ if (!empty($student_id)) {
</td>
</tr>
<tr>
<td> <?php echo get_lang('Tel') . ' : ';
<td> <?php echo get_lang('Tel') . ' : ';
if (!empty ($user_info['phone'])) {
echo $user_info['phone'];
} else {
echo get_lang('NoTel');
}
?>
?>
</td>
</tr>
<tr>
<td> <?php echo get_lang('OfficialCode') . ' : ';
<td> <?php echo get_lang('OfficialCode') . ' : ';
if (!empty ($user_info['official_code'])) {
echo $user_info['official_code'];
} else {
@ -550,7 +548,7 @@ if (empty($_GET['details'])) {
$attendance = new Attendance();
foreach ($courses_in_session as $key => $courses) {
foreach ($courses_in_session as $key => $courses) {
$session_id = $key;
$session_info = api_get_session_info($session_id);
$session_name = $session_info['name'];
@ -666,13 +664,6 @@ if (empty($_GET['details'])) {
} else {
$csv_content[] = array ();
$csv_content[] = array (str_replace('&nbsp;', '', $table_title));
$headerLearnpath = array (
get_lang('Learnpath'),
get_lang('Time'),
get_lang('Progress'),
get_lang('LastConnexion')
);
$t_lp = Database :: get_course_table(TABLE_LP_MAIN);
@ -709,7 +700,7 @@ if (empty($_GET['details'])) {
<th><?php echo get_lang('LastConnexion').' '; Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
<?php
echo '<th>'.get_lang('Details').'</th>';
if (api_is_course_admin()) {
if (api_is_allowed_to_edit()) {
echo '<th>'.get_lang('ResetLP').'</th>';
}
?>
@ -808,9 +799,9 @@ if (empty($_GET['details'])) {
echo Display::tag('td', $link, array('align'=>'center'));
}
if (api_is_course_admin()) {
if (api_is_allowed_to_edit()) {
echo '<td align="center">';
if($any_result === true) {
if ($any_result === true) {
echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student='.$user_info['user_id'].'&details=true&id_session='.Security::remove_XSS($_GET['id_session']).'">';
echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
echo '</a>';

@ -89,7 +89,7 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
}
echo '</div>';
echo Display::page_subheader(get_lang('YourSessionsList'));
echo Display::page_header(get_lang('YourSessionsList'));
} else {
/*if (api_is_platform_admin()) {

@ -543,7 +543,7 @@ function update_progress_bar(nbr_complete, nbr_total, mode)
percentage = Math.round(percentage);
var progress_bar = $("#progress_bar_value");
progress_bar.css('width', percentage);
progress_bar.css('width', percentage +"%");
/*
var pr_text = myframe.document.getElementById('progress_text');

@ -197,7 +197,7 @@ class learnpath {
// Now get the latest attempt from this user on this LP, if available, otherwise create a new one.
$lp_table = Database::get_course_table(TABLE_LP_VIEW);
// Selecting by view_count descending allows to get the highest view_count first.
$sql = "SELECT * FROM $lp_table WHERE c_id = '.$course_id.' AND lp_id = '$lp_id' AND user_id = '$user_id' $session ORDER BY view_count DESC";
$sql = "SELECT * FROM $lp_table WHERE c_id = $course_id AND lp_id = '$lp_id' AND user_id = '$user_id' $session ORDER BY view_count DESC";
if ($this->debug > 2) { error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0); }
$res = Database::query($sql);
$view_id = 0; // Used later to query lp_item_view.
@ -302,10 +302,9 @@ class learnpath {
// Get last viewing vars.
$lp_item_view_table = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
// This query should only return one or zero result.
$sql = "SELECT * " .
"FROM $lp_item_view_table " .
"WHERE c_id = ".$course_id." AND lp_view_id = " . $this->lp_view_id . " " .
"AND lp_item_id = " . $row['id'] . " ORDER BY view_count DESC ";
$sql = "SELECT * FROM $lp_item_view_table
WHERE c_id = $course_id AND lp_view_id = ".$this->lp_view_id." AND lp_item_id = ".$row['id']."
ORDER BY view_count DESC ";
if ($this->debug > 2) {
error_log('New LP - learnpath::__construct() - Selecting item_views: ' . $sql, 0);
}
@ -393,8 +392,8 @@ class learnpath {
$title = $this->escape_string($title);
$description = $this->escape_string($description);
$sql_count = " SELECT COUNT(id) AS num
FROM " . $tbl_lp_item . "
WHERE c_id = ".$course_id." AND lp_id = " . $this->get_id() . " AND parent_item_id = " . $parent;
FROM $tbl_lp_item
WHERE c_id = $course_id AND lp_id = " . $this->get_id() . " AND parent_item_id = " . $parent;
$res_count = Database::query($sql_count);
$row = Database :: fetch_array($res_count);
@ -404,7 +403,7 @@ class learnpath {
if ($previous == 0) {
$sql = "SELECT id, next_item_id, display_order
FROM " . $tbl_lp_item . "
WHERE c_id = ".$course_id." AND
WHERE c_id = $course_id AND
lp_id = " . $this->get_id() . " AND
parent_item_id = " . $parent . " AND
previous_item_id = 0 OR previous_item_id=" . $parent;
@ -417,8 +416,8 @@ class learnpath {
} else {
$previous = (int) $previous;
$sql = "SELECT id, previous_item_id, next_item_id, display_order
FROM " . $tbl_lp_item . "
WHERE c_id = ".$course_id." AND lp_id = " . $this->get_id() . " AND id = " . $previous;
FROM $tbl_lp_item
WHERE c_id = $course_id AND lp_id = " . $this->get_id() . " AND id = " . $previous;
$result = Database::query($sql);
$row = Database :: fetch_array($result);
@ -611,7 +610,7 @@ class learnpath {
// Session id.
$session_id = api_get_session_id();
$check_name = "SELECT * FROM $tbl_lp WHERE c_id = ".$course_id." AND name = '$name'";
$check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
//if ($this->debug > 2) { error_log('New LP - Checking the name for new LP: '.$check_name, 0); }
$res_name = Database::query($check_name);
@ -639,7 +638,7 @@ class learnpath {
// There is already one such name, update the current one a bit.
$i++;
$name = $name . ' - ' . $i;
$check_name = "SELECT * FROM $tbl_lp WHERE c_id = ".$course_id." AND name = '$name'";
$check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
//if ($this->debug > 2) { error_log('New LP - Checking the name for new LP: '.$check_name, 0); }
$res_name = Database::query($check_name);
}
@ -663,7 +662,7 @@ class learnpath {
break;
case 'manual':
default:
$get_max = "SELECT MAX(display_order) FROM $tbl_lp WHERE c_id = ".$course_id." ";
$get_max = "SELECT MAX(display_order) FROM $tbl_lp WHERE c_id = $course_id";
$res_max = Database::query($get_max);
if (Database :: num_rows($res_max) < 1) {
$dsp = 1;
@ -1943,8 +1942,6 @@ class learnpath {
global $_course;
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
$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 " .
@ -2507,7 +2504,7 @@ class learnpath {
$course_id = api_get_course_int_id();
$list = array();
$table = Database :: get_course_table(TABLE_LP_IV_OBJECTIVE);
$sql = "SELECT * FROM $table WHERE c_id = ".$course_id." AND lp_iv_id = $lp_iv_id ORDER BY order_id ASC";
$sql = "SELECT * FROM $table WHERE c_id = $course_id AND lp_iv_id = $lp_iv_id ORDER BY order_id ASC";
$res = Database::query($sql);
$num = Database :: num_rows($res);
if ($num > 0) {
@ -2620,7 +2617,7 @@ class learnpath {
public function get_type_static($lp_id = 0) {
$course_id = api_get_course_int_id();
$tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
$sql = "SELECT lp_type FROM $tbl_lp WHERE c_id = ".$course_id." AND id = '" . $lp_id . "'";
$sql = "SELECT lp_type FROM $tbl_lp WHERE c_id = $course_id AND id = '" . $lp_id . "'";
$res = Database::query($sql);
if ($res === false) {
return null;
@ -3367,7 +3364,6 @@ class learnpath {
}
$display = $display +1;
}
break;
default :
return false;
@ -5623,7 +5619,7 @@ class learnpath {
if ($action != 'move') {
$return .= '<tr>';
$return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
$return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" class="learnpath_item_form" value="' . $item_title . '" /></td>';
$return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
$return .= '</tr>';
}
@ -5632,7 +5628,7 @@ class learnpath {
$return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
$return .= '<td class="input">';
$return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
$return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
$return .= '<option class="top" value="0">' . $this->name . '</option>';
@ -6681,9 +6677,8 @@ class learnpath {
if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
$return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
}
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
$form = new FormValidator('form', 'POST', api_get_self() . '?' . $_SERVER['QUERY_STRING'], '', 'enctype="multipart/form-data"');
}
$form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
$defaults['title'] = Security :: remove_XSS($item_title);
if (empty($item_title)) {
$defaults['title'] = Security::remove_XSS($item_title);
@ -6691,7 +6686,7 @@ class learnpath {
$defaults['description'] = $item_description;
$form->addElement('html', $return);
if ($action != 'move') {
$form->addElement('text', 'title', get_lang('Title'), 'id="idTitle" class="learnpath_item_form" size=44%');
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'idTitle', 'class' => 'span4'));
$form->applyFilter('title', 'html_filter');
}
@ -6881,8 +6876,7 @@ class learnpath {
if (is_numeric($extra_info)) {
$form->addElement('style_submit_button', 'submit_button', get_lang('SaveDocument'), 'value="submit_button", class="save"');
$form->addElement('hidden', 'path', $extra_info);
}
elseif (is_array($extra_info)) {
} elseif (is_array($extra_info)) {
$form->addElement('style_submit_button', 'submit_button', get_lang('SaveDocument'), 'class="save"');
$form->addElement('hidden', 'path', $extra_info['path']);
}
@ -7463,8 +7457,7 @@ class learnpath {
if (is_numeric($item_id)) {
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
$sql = "SELECT *
FROM " . $tbl_lp_item . "
$sql = "SELECT * FROM " . $tbl_lp_item . "
WHERE c_id = ".$course_id." AND id = " . $item_id;
$res = Database::query($sql);

@ -139,7 +139,7 @@ $form = new FormValidator('lp_add', 'post', 'lp_controller.php');
$form->addElement('header', null, get_lang('AddLpToStart'));
// Title
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LPName')), array('size' => 43));
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LPName')), array('class' => 'span6'));
$form->applyFilter('lp_name', 'html_filter');
$form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');

@ -23,70 +23,79 @@ include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
$language_file = 'learnpath';
$htmlHeadXtra[] = '
<script type="text/javascript">
var temp=false;
var temp2=false;
var temp = false;
var use_document_title='.api_get_setting('use_document_title').';
var load_default_template = '. ((isset($_POST['submit']) || empty($_SERVER['QUERY_STRING'])) ? 'false' : 'true' ) .';
function FCKeditor_OnComplete( editorInstance ) {
editorInstance.Events.AttachEvent( \'OnSelectionChange\', check_for_title ) ;
document.getElementById(\'frmModel\').innerHTML = "<iframe height=890px width=230px; frameborder=0 src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";
editorInstance.Events.AttachEvent( \'OnSelectionChange\', check_for_title) ;
document.getElementById(\'frmModel\').innerHTML = "<iframe id=\'frame_template\' name=\'my_frame_template\' height=890px width=220px; frameborder=0 src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";
loaded = true;
}
var hide_bar = function() {
$("#main_content .span3").hide();
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
}
function check_for_title() {
if (temp) {
// This functions shows that you can interact directly with the editor area
// DOM. In this way you have the freedom to do anything you want with it.
function check_for_title() {
if (temp) {
// This functions shows that you can interact directly with the editor area
// DOM. In this way you have the freedom to do anything you want with it.
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance(\'content_lp\') ;
// Get the Editor Area DOM (Document object).
var oDOM = oEditor.EditorDocument ;
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance(\'content_lp\') ;
var iLength ;
var contentText ;
var contentTextArray;
var bestandsnaamNieuw = "";
var bestandsnaamOud = "";
// Get the Editor Area DOM (Document object).
var oDOM = oEditor.EditorDocument ;
// The are two diffent ways to get the text (without HTML markups).
// It is browser specific.
var iLength ;
var contentText ;
var contentTextArray;
var bestandsnaamNieuw = "";
var bestandsnaamOud = "";
if( document.all ) // If Internet Explorer.
{
contentText = oDOM.body.innerText ;
}
else // If Gecko.
{
var r = oDOM.createRange() ;
r.selectNodeContents( oDOM.body ) ;
contentText = r.toString() ;
}
// The are two diffent ways to get the text (without HTML markups).
// It is browser specific.
var index=contentText.indexOf("/*<![CDATA");
contentText=contentText.substr(0,index);
if( document.all ) // If Internet Explorer.
// Compose title if there is none
contentTextArray = contentText.split(\' \') ;
var x=0;
for(x=0; (x<5 && x<contentTextArray.length); x++) {
if(x < 4)
{
contentText = oDOM.body.innerText ;
bestandsnaamNieuw += contentTextArray[x] + \' \';
}
else // If Gecko.
else
{
var r = oDOM.createRange() ;
r.selectNodeContents( oDOM.body ) ;
contentText = r.toString() ;
}
var index=contentText.indexOf("/*<![CDATA");
contentText=contentText.substr(0,index);
// Compose title if there is none
contentTextArray = contentText.split(\' \') ;
var x=0;
for(x=0; (x<5 && x<contentTextArray.length); x++) {
if(x < 4)
{
bestandsnaamNieuw += contentTextArray[x] + \' \';
}
else
{
bestandsnaamNieuw += contentTextArray[x];
}
bestandsnaamNieuw += contentTextArray[x];
}
}
temp=true;
}
temp=true;
}
function InnerDialogLoaded() {
if (document.all) {
@ -118,7 +127,6 @@ $_SESSION['oLP']->get_js_dropdown_array() .
'}
$(function() {
if ($(\'#previous\')) {
if(\'parent is\'+$(\'#idParent\').val()) {
load_cbo($(\'#idParent\').val());
@ -137,14 +145,14 @@ $(function() {
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
$isStudentView = (int) $_REQUEST['isStudentView'];
$learnpath_id = (int) $_REQUEST['lp_id'];
$submit = $_POST['submit_button'];
$type = isset($_GET['type']) ? $_GET['type'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
@ -180,10 +188,11 @@ if (!empty($gradebook) && $gradebook == 'view') {
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
switch($_GET['type']) {
switch ($type) {
case 'chapter':
$interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewChapter'));
break;
@ -226,6 +235,20 @@ function confirmation(name) {
return false;
}
}
$(document).ready(function() {
$("#hide_bar_template").toggle(
function() {
$("#main_content .span3").hide();
$(this).css({'background-image' : 'url("../img/hide2.png")'})
},
function() {
$("#main_content .span3").show();
$(this).css('background-image', 'url("../img/hide0.png")');
}
);
});
</script>
<?php
@ -233,11 +256,11 @@ function confirmation(name) {
echo $_SESSION['oLP']->build_action_menu();
echo '<div class="row-fluid">';
echo '<div class="row-fluid" style="overflow:hidden">';
echo '<div class="span3">';
// Show the template list.
if (isset($_GET['type']) && $_GET['type'] == 'document' && !isset($_GET['file'])) {
if ($type == 'document' && !isset($_GET['file'])) {
$count_items = count($_SESSION['oLP']->ordered_items);
$style = ($count_items > 12) ? ' style="height:250px;width:230px;overflow-x : auto; overflow-y : scroll;" ' : ' class="lp_tree" ';
echo '<div '.$style.'>';
@ -245,7 +268,7 @@ if (isset($_GET['type']) && $_GET['type'] == 'document' && !isset($_GET['file'])
echo $_SESSION['oLP']->build_tree();
echo '</div>';
// Show the template list.
echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"></p>';
echo '<p style="border-bottom:1px solid #ddd; margin:0; padding:2px;"></p>';
echo '<br />';
echo '<div id="frmModel" style="display:block; height:890px;width:100px; position:relative;"></div>';
} else {
@ -254,31 +277,35 @@ if (isset($_GET['type']) && $_GET['type'] == 'document' && !isset($_GET['file'])
echo $_SESSION['oLP']->build_tree();
echo '</div>';
}
echo '</div>';
echo '<div class="span9">';
//hide bar div
if ($action == 'add_item' && $type == 'document' && !isset($_GET['file'])) {
echo '<div id="hide_bar_template" class="span1"></div>';
}
echo '<div class="span8">';
if (isset($new_item_id) && is_numeric($new_item_id)) {
switch($_GET['type']) {
switch ($type) {
case 'chapter':
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_POST['type']);
Display::display_confirmation_message(get_lang('NewChapterCreated'));
break;
case TOOL_LINK:
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewLinksCreated'));
break;
case TOOL_STUDENTPUBLICATION:
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewStudentPublicationCreated'));
break;
case 'module':
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewModuleCreated'));
break;
case TOOL_QUIZ:
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewExerciseCreated'));
break;
case TOOL_DOCUMENT:
@ -286,21 +313,21 @@ echo '<div class="span9">';
echo $_SESSION['oLP']->display_item($new_item_id, true);
break;
case TOOL_FORUM:
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewForumCreated'));
break;
case 'thread':
echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewThreadCreated'));
break;
}
} else {
switch($_GET['type']) {
switch ($type) {
case 'chapter':
echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang('EnterDataNewChapter'));
echo $_SESSION['oLP']->display_item_form($type, get_lang('EnterDataNewChapter'));
break;
case 'module':
echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang('EnterDataNewModule'));
echo $_SESSION['oLP']->display_item_form($type, get_lang('EnterDataNewModule'));
break;
case 'document':
if (isset($_GET['file']) && is_numeric($_GET['file'])) {

@ -882,27 +882,24 @@ switch ($action) {
}
require 'lp_message.php';
break;
case 'return_to_course_homepage':
if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
else {
$_SESSION['oLP']->save_current();
$_SESSION['oLP']->save_last();
// Declare variables to be used in lp_stats.php.
$lp_id = $_SESSION['oLP']->get_id();
$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
$user_id = api_get_user_id();
header('location: '.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/?id_session='.api_get_session_id());
}
break;
if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
else {
$_SESSION['oLP']->save_current();
$_SESSION['oLP']->save_last();
// Declare variables to be used in lp_stats.php.
$lp_id = $_SESSION['oLP']->get_id();
$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
$user_id = api_get_user_id();
header('location: '.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/?id_session='.api_get_session_id());
}
break;
case 'search':
/* Include the search script, it's smart enough to know when we are
* searching or not.
*/
require 'lp_list_search.php';
break;
default:
if ($debug > 0) error_log('New LP - default action triggered', 0);
//$_SESSION['refresh'] = 1;

@ -13,10 +13,12 @@
*/
require_once 'learnpath.class.php';
require_once 'resourcelinker.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once '../exercice/exercise.lib.php';
$course_code = api_get_course_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if (isset($_GET['course'])) {
$course_code = Security::remove_XSS($_GET['course']);
}
@ -35,12 +37,6 @@ if (!isset($origin))
$origin = '';
//Origin = tracking means that teachers see that info in the Reporting tool
if ($origin != 'tracking') {
//$w = $tablewidth -20;
$htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "../css/public_admin/scorm.css";
/*]]>*/
</style>';
Display::display_reduced_header();
echo '<body dir="'.api_get_text_direction().'">';
}
@ -61,7 +57,7 @@ if ($origin == 'tracking') {
} else {
$url_suffix = '&lp_id=' . $lp_id;
}
if (!empty ($_GET['extend_all'])) {
if (!empty($_GET['extend_all'])) {
$extend_all_link = '<a href="' . api_get_self() . '?action=stats' . $url_suffix . '"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.get_lang('HideAllAttempts').'"></a>';
$extend_all = 1;
} else {
@ -91,6 +87,9 @@ $TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST);
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_stats_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
//It cames from myspace/lp_tracking.php
$lp_id = intval($lp_id);
$sql = "SELECT max(view_count) FROM $TBL_LP_VIEW WHERE c_id = $course_id AND lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition";
$res = Database::query($sql);
$view = '';
@ -101,9 +100,7 @@ if (Database :: num_rows($res) > 0) {
}
$counter = 0;
//error_log('New LP - Querying views for latest attempt: '.$sql, 0);
$total_score = 0;
$total_max_score = 0;
$total_time = 0;
$h = get_lang('h');
@ -117,8 +114,8 @@ if (!empty($export_csv)) {
}
// Get attempts of a exercise.
if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) {
$clean_lp_item_id = Database::escape_string($_GET['my_lp_id']);
if (isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) {
$clean_lp_item_id = Database::escape_string($_GET['lp_item_id']);
$clean_lp_id = Database::escape_string($_GET['lp_id']);
$clean_course_code = Database :: escape_string($course_code);
$sql_path = "SELECT path FROM $TBL_LP_ITEM WHERE c_id = $course_id AND id = '$clean_lp_item_id' AND lp_id = '$clean_lp_id'";
@ -134,40 +131,36 @@ if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) {
WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND status <> "incomplete" AND exe_user_id="' . $student_id . '" AND orig_lp_id = "'.(int)$clean_lp_id.'" AND orig_lp_item_id = "'.(int)$clean_lp_item_id.'" AND exe_cours_id="' . $clean_course_code. '" AND session_id = '.$session_id.' ORDER BY exe_date';
}
}
//var_dump($sql_attempts);
}
//Show lp items
if (is_array($list) && count($list) > 0) {
if (is_array($list) && count($list) > 0) {
foreach ($list as $my_item_id) {
$extend_this = 0;
$qry_order = 'DESC';
if ((!empty ($_GET['extend_id']) && $_GET['extend_id'] == $my_item_id) || $extend_all) {
$extend_this = 1;
$qry_order = 'ASC';
}
}
// Prepare statement to go through each attempt.
if (!empty ($view)) {
$sql = "SELECT iv.status as mystatus, v.view_count as mycount, " .
" iv.score as myscore, iv.total_time as mytime, i.id as myid, i.lp_id as mylpid, iv.lp_view_id as mylpviewid, " .
" i.title as mytitle, i.max_score as mymaxscore, " .
" iv.max_score as myviewmaxscore, " .
" i.item_type as item_type, iv.view_count as iv_view_count, " .
" iv.id as iv_id, path as path" .
" FROM $TBL_LP_ITEM as i, $TBL_LP_ITEM_VIEW as iv, $TBL_LP_VIEW as v" .
" WHERE
if (!empty($view)) {
$sql = "SELECT iv.status as mystatus, v.view_count as mycount, iv.score as myscore, iv.total_time as mytime, i.id as myid,
i.lp_id as mylpid, iv.lp_view_id as mylpviewid, i.title as mytitle, i.max_score as mymaxscore,
iv.max_score as myviewmaxscore, i.item_type as item_type, iv.view_count as iv_view_count, iv.id as iv_id, path as path
FROM $TBL_LP_ITEM as i INNER JOIN $TBL_LP_ITEM_VIEW as iv ON (i.id = iv.lp_item_id )
INNER JOIN $TBL_LP_VIEW as v ON (iv.lp_view_id = v.id)
WHERE
i.c_id = $course_id AND
iv.c_id = $course_id AND
v.c_id = $course_id AND
i.id = iv.lp_item_id " .
" AND i.id = $my_item_id " .
" AND iv.lp_view_id = v.id " .
" AND i.lp_id = $lp_id " .
" AND v.user_id = " . $user_id . " " .
" AND v.view_count = $view " .
" AND v.session_id = $session_id " .
" ORDER BY iv.view_count $qry_order ";
v.c_id = $course_id AND i.id = $my_item_id AND
i.lp_id = $lp_id AND
v.user_id = " . $user_id . " AND
v.view_count = $view AND v.session_id = $session_id
ORDER BY iv.view_count $qry_order ";
//var_dump($sql);
} else {
$sql = "SELECT iv.status as mystatus, v.view_count as mycount, " .
" iv.score as myscore, iv.total_time as mytime, i.id as myid, i.lp_id as mylpid, iv.lp_view_id as mylpviewid, " .
@ -187,28 +180,28 @@ if (is_array($list) && count($list) > 0) {
" AND v.session_id = $session_id " .
" ORDER BY iv.view_count $qry_order ";
}
//echo $sql.'<br />';
$result = Database::query($sql);
$num = Database :: num_rows($result);
$time_for_total = 'NaN';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
//Extend all + extend scorm?
if (($extend_this || $extend_all) && $num > 0) {
//var_dump('go');
$row = Database :: fetch_array($result);
$result_disabled_ext_all = false;
if ($row['item_type'] == 'quiz') {
// Check results_disabled in quiz table.
$my_path = Database::escape_string($row['path']);
$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE c_id = $course_id AND id ='".(int)$my_path."'";
$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE c_id = $course_id AND id ='".$my_path."'";
$res_result_disabled = Database::query($sql);
$row_result_disabled = Database::fetch_row($res_result_disabled);
if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0] === 1) {
$result_disabled_ext_all = true;
}
}
}
//echo '<br /><pre>'; print_r($row); echo '</pre><br />';
// If there are several attempts, and the link to extend has been clicked, show each attempt...
@ -232,10 +225,10 @@ if (is_array($list) && count($list) > 0) {
$title = Security::remove_XSS($title);
$output .= "<tr class='$oddclass'>" . "<td>$extend_link</td>" . '<td colspan="4" class="content"><div class="mystatus">' . $title . "</div></td>" . '<td colspan="2" class="content"></td>'.'<td colspan="2" class="content"></td>'.'<td colspan="2" class="content"></td><td class="content"></td>' . "</tr>";
}
$counter++;
do {
$row['iv_view_count'];
do {
// Check if there are interactions below.
$extend_attempt_link = '';
$extend_this_attempt = 0;
@ -249,18 +242,19 @@ if (is_array($list) && count($list) > 0) {
$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'" border="0"></a>' . "\n";
}
}
if (($counter % 2) == 0) {
$oddclass = 'row_odd';
} else {
$oddclass = 'row_even';
}
$lesson_status = $row['mystatus'];
$score = $row['myscore'];
$time_for_total = $row['mytime'];
$time = learnpathItem :: get_scorm_time('js', $row['mytime']);
$type;
$time = learnpathItem :: get_scorm_time('js', $row['mytime']);
$scoIdentifier = $row['myid'];
if ($score == 0) {
$maxscore = $row['mymaxscore'];
@ -277,12 +271,13 @@ if (is_array($list) && count($list) > 0) {
$maxscore = $row['mymaxscore'];
}
}
// Remove "NaN" if any (@todo: locate the source of these NaN)
$time = str_replace('NaN', '00' . $h . '00\'00"', $time);
if (($lesson_status == 'completed') || ($lesson_status == 'passed')) {
$color = 'green';
} else {
$color = 'black';
if (($lesson_status == 'completed') || ($lesson_status == 'passed')) {
$class_status = 'success';
} else {
$class_status = 'default';
}
$mylanglist = array (
'completed' => 'ScormCompstatus',
@ -305,14 +300,13 @@ if (is_array($list) && count($list) > 0) {
$view_score = $score;
} else {
$view_score = show_score($score, $maxscore, false);
}
}
} else {
$view_score = show_score($score, $maxscore, false);
}
}
$output .= "<tr class='$oddclass'>" . "<td></td>" . "<td>$extend_attempt_link</td>" . '<td colspan="3">' . get_lang('Attempt') . ' ' . $row['iv_view_count'] . "</td>"
. '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . "</div></font></td>\n" . '<td colspan="2"><div class="mystatus" align="center">' . $view_score . "</div></td>" . '<td colspan="2"><div class="mystatus">'.$time.'</div></td><td></td></tr>';
. '<td colspan="2">' . Display::label($my_lesson_status, $class_status) . "</td>\n" . '<td colspan="2"><div class="mystatus" align="center">' . $view_score . "</div></td>" . '<td colspan="2"><div class="mystatus">'.$time.'</div></td><td></td></tr>';
if (!empty($export_csv)) {
$temp = array ();
@ -375,7 +369,9 @@ if (is_array($list) && count($list) > 0) {
} while ($row = Database :: fetch_array($result));
} elseif ($num > 0) {
$row = Database :: fetch_array($result);
//Not extended
$row = Database :: fetch_array($result,'ASSOC');
$my_id = $row['myid'];
$my_lp_id = $row['mylpid'];
$my_lp_view_id = $row['mylpviewid'];
@ -394,15 +390,16 @@ if (is_array($list) && count($list) > 0) {
if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0] === 1) {
$result_disabled_ext_all = true;
}
}
}
// Check if there are interactions below.
$extend_attempt_link = '';
// Check if there are interactions below
$extend_this_attempt = 0;
$inter_num = learnpath::get_interactions_count_from_db($row['iv_id'], $course_id);
$objec_num = learnpath::get_objectives_count_from_db($row['iv_id'], $course_id);
if (($inter_num > 0 || $objec_num > 0) && !$extend_all) {
$extend_attempt_link = '';
if (($inter_num > 0 || $objec_num > 0)) {
if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
// The extend button for this attempt has been clicked.
$extend_this_attempt = 1;
@ -412,20 +409,22 @@ if (is_array($list) && count($list) > 0) {
$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'" border="0"></a>' . "\n";
}
}
if (($counter % 2) == 0) {
$oddclass = 'row_odd';
} else {
$oddclass = 'row_even';
}
//$extend_link = '<img src="../img/invisible.gif" alt="extend_disabled">';
$extend_link = '';
if ($inter_num > 1) {
$extend_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'" border="0"></a>';
}
$lesson_status = $row['mystatus'];
$score = $row['myscore'];
$subtotal_time = $row['mytime'];
$lesson_status = $row['mystatus'];
$score = $row['myscore'];
$subtotal_time = $row['mytime'];
//if ($row['mytime'] == 0) {
while ($tmp_row = Database :: fetch_array($result)) {
$subtotal_time += $tmp_row['mytime'];
@ -441,8 +440,8 @@ if (is_array($list) && count($list) > 0) {
$sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date DESC limit 1';
} else {
$sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . $student_id . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date DESC limit 1';
}
}
$resultLastAttempt = Database::query($sql_last_attempt);
$num = Database :: num_rows($resultLastAttempt);
if ($num > 0) {
@ -450,7 +449,8 @@ if (is_array($list) && count($list) > 0) {
$id_last_attempt = $rowLA['exe_id'];
}
}
//var_dump($row['path'] .' '.$score);
if ($score == 0) {
$maxscore = $row['mymaxscore'];
} else {
@ -500,6 +500,7 @@ if (is_array($list) && count($list) > 0) {
}
}
}
$time_for_total = $subtotal_time;
$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
if (empty ($title)) {
@ -508,26 +509,28 @@ if (is_array($list) && count($list) > 0) {
// Remove "NaN" if any (@todo: locate the source of these NaN)
//$time = str_replace('NaN', '00'.$h.'00\'00"', $time);
if (($lesson_status == 'completed') or ($lesson_status == 'passed')) {
$color = 'green';
if (($lesson_status == 'completed') or ($lesson_status == 'passed')) {
$class_status = 'success';
} else {
$color = 'black';
$class_status = 'default';
}
$mylanglist = array (
'completed' => 'ScormCompstatus',
'incomplete' => 'ScormIncomplete',
'failed' => 'ScormFailed',
'passed' => 'ScormPassed',
'browsed' => 'ScormBrowsed',
'not attempted' => 'ScormNotAttempted',
'completed' => 'ScormCompstatus',
'incomplete' => 'ScormIncomplete',
'failed' => 'ScormFailed',
'passed' => 'ScormPassed',
'browsed' => 'ScormBrowsed',
'not attempted' => 'ScormNotAttempted'
);
$my_lesson_status = get_lang($mylanglist[$lesson_status]);
if ($row['item_type'] != 'dokeos_chapter') {
if ($row['item_type'] == 'quiz') {
$correct_test_link = '';
$my_url_suffix ='';
if ($origin != 'tracking' && $origin != 'tracking_course') {
$my_url_suffix = '&course=' . api_get_course_id() . '&student_id=' . api_get_user_id() . '&lp_id=' . Security::remove_XSS($row['mylpid']);
$sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date DESC ';
@ -535,37 +538,38 @@ if (is_array($list) && count($list) > 0) {
$my_url_suffix = '&course=' . Security::remove_XSS($_GET['course']) . '&student_id=' . $student_id . '&lp_id=' . Security::remove_XSS($row['mylpid']).'&origin=' . Security::remove_XSS($_GET['origin'].$from_link);
$sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . $student_id . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . Database :: escape_string($_GET['course']) . '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date DESC ';
}
$resultLastAttempt = Database::query($sql_last_attempt);
$num = Database :: num_rows($resultLastAttempt);
$num = Database :: num_rows($resultLastAttempt);
if ($num > 0) {
if (isset($_GET['extend_attempt']) && $_GET['extend_attempt'] == 1 && (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id) ) {
$correct_test_link = '<a href="' . api_get_self() . '?action=stats' . $my_url_suffix . '&session_id='.api_get_session_id().'&my_ext_lp_id='.$my_id.'"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.get_lang('HideAllAttempts').'"></a>';
if (isset($_GET['extend_attempt']) && $_GET['extend_attempt'] == 1 && (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['lp_item_id']) && $_GET['lp_item_id'] == $my_id) ) {
$correct_test_link = '<a href="' . api_get_self() . '?action=stats' . $my_url_suffix . '&session_id='.api_get_session_id().'&lp_item_id='.$my_id.'"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.get_lang('HideAllAttempts').'"></a>';
$extend_attempt = 1;
} else {
$correct_test_link = '<a href="' . api_get_self() . '?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.api_get_session_id().'&my_lp_id='.$my_id.'"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.get_lang('ShowAllAttemptsByExercise').'"></a>';
$correct_test_link = '<a href="' . api_get_self() . '?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.api_get_session_id().'&lp_item_id='.$my_id.'"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.get_lang('ShowAllAttemptsByExercise').'"></a>';
}
} else {
$correct_test_link = '-';
}
} else {
$correct_test_link = '-';
}
}
$title = Security::remove_XSS($title);
if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)) {
$output .= "<tr class='$oddclass' >" . "<td>$extend_link</td>" . '<td colspan="4"><div class="mystatus">' .$title. '</div></td>';
if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id && false) ) {
$output .= '<tr class='.$oddclass.'><td>'.$extend_link.'</td><td colspan="4"><div class="mystatus">'.$title.'</div></td>';
$output .= '<td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td>'.$correct_test_link.'</td></tr>';
$output .= "</tr>";
} else {
if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['my_ext_lp_id']) && $_GET['my_ext_lp_id'] == $my_id)) {
if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['lp_item_id']) && $_GET['lp_item_id'] == $my_id)) {
$output .= "<tr class='$oddclass'>";
} else {
$output .= "<tr class='$oddclass'>";
}
$output .= "<td>$extend_link</td>\n" . '<td colspan="4"><div class="mystatus">' .$title. '</div></td>';
$output .= '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . "</div></font></td>" . '<td colspan="2"><div class="mystatus" align="center">';
if ($row['item_type'] == 'quiz') {
$output .= '<td>'.$extend_link.'</td><td colspan="4"><div class="mystatus">'.$title.'</div></td>';
$output .= '<td colspan="2">' . Display::label($my_lesson_status, $class_status). "</td>" . '<td colspan="2"><div class="mystatus" align="center">';
if ($row['item_type'] == 'quiz') {
if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$output .= Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
} else {
@ -599,8 +603,10 @@ if (is_array($list) && count($list) > 0) {
}
$counter++;
//var_dump($extend_this_attempt, $extend_all);
if ($extend_this_attempt OR $extend_all) {
$list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
foreach ($list1 as $id => $interaction) {
if (($counter % 2) == 0) {
$oddclass = 'row_odd';
@ -627,7 +633,7 @@ if (is_array($list) && count($list) > 0) {
}
// Attempts listing by exercise.
if ((isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)) {
if ((isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['lp_item_id']) && $_GET['lp_item_id'] == $my_id) && isset($_GET['extend_attempt'])) {
$res_attempts = Database::query($sql_attempts);
$num_attempts = Database :: num_rows($res_attempts);
@ -678,7 +684,8 @@ if (is_array($list) && count($list) > 0) {
}
$output .= '<tr class="'.$oddclass.'" ><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . get_lang('Attempt') . ' ' . $n . '</td>'
. '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . '</div></font></td><td colspan="2"><div class="mystatus" align="center">' . $view_score . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>';
. '<td colspan="2">' . Display::label($my_lesson_status, $class_status).'</td><td colspan="2">
<div class="mystatus" align="center">' . $view_score . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>';
if ($origin != 'tracking') {
if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"></td>';
@ -746,8 +753,8 @@ if (!empty($a_my_id)) {
$total_time = learnpathItem :: get_scorm_time('js', $total_time);
//$total_time = str_replace('NaN', '00:00:00' ,$total_time);
$total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
$lp_type = learnpath :: get_type_static($lp_id);
$total_percent = 0;
//$lp_type = learnpath :: get_type_static($lp_id);
//$total_percent = 0;
if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));

@ -21,7 +21,7 @@ $_SESSION['whereami'] = 'lp/view';
$this_section = SECTION_COURSES;
if ($lp_controller_touched != 1) {
header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']);
header('location: lp_controller.php?action=view&item_id='.intval($_REQUEST['item_id']));
exit;
}
@ -36,6 +36,31 @@ $show_learnpath = true;
api_protect_course_script();
$lp_id = intval($_GET['lp_id']);
// Check if the learning path is visible for student - (LP requisites)
if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
api_not_allowed();
}
//Checking visibility (eye icon)
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
api_not_allowed();
}
if (empty($_SESSION['oLP'])) {
api_not_allowed();
}
$debug = 0;
if ($debug) { error_log('------ Entering lp_view.php -------'); }
$_SESSION['oLP']->error = '';
$lp_item_id = $_SESSION['oLP']->get_current_item_id();
$lp_type = $_SESSION['oLP']->get_type();
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();
@ -52,35 +77,19 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setti
</script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
}
$htmlHeadXtra[] = '<script language="javascript" type="text/javascript">
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready(function (){
$("div#log_content_cleaner").bind("click", function() {
$("div#log_content").empty();
});
});
</script>';
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var dokeos_xajax_handler = window.oxajax;
</script>';
$_SESSION['oLP']->error = '';
$lp_item_id = $_SESSION['oLP']->get_current_item_id();
$lp_type = $_SESSION['oLP']->get_type();
$lp_id = intval($_GET['lp_id']);
var dokeos_xajax_handler = window.oxajax;
// Check if the learning path is visible for student - (LP requisites)
if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
api_not_allowed();
}
</script>';
//Checking visibility (eye icon)
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
api_not_allowed();
}
// Prepare variables for the test tool (just in case) - honestly, this should disappear later on.
$_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id();
@ -115,7 +124,7 @@ $htmlHeadXtra[] = '<script type="text/javascript" src="js/storageapi.js"></scrip
if (!isset($src)) {
$src = '';
switch($lp_type) {
switch ($lp_type) {
case 1:
$_SESSION['oLP']->stop_previous_item();
$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
@ -173,26 +182,32 @@ foreach($list as $toc) {
}
}
$debug = 0;
$autostart = 'true';
// Update status, total_time from lp_item_view table when you finish the exercises in learning path.
if ($debug) {
error_log('$type_quiz: '.$type_quiz);
error_log('$_REQUEST[exeId]: '.$_REQUEST['exeId']);
error_log('$lp_id: '.$lp_id);
error_log('$_GET[lp_item_id]: '.$_GET['lp_item_id']);
}
if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp_item_id'])) {
global $src;
$_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db();
$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
//$TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
$TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$safe_item_id = Database::escape_string($_GET['lp_item_id']);
$safe_item_id = intval($_GET['lp_item_id']);
$safe_id = $lp_id;
$safe_exe_id = intval($_REQUEST['exeId']);
if ($safe_id == strval(intval($safe_id)) && $safe_item_id == strval(intval($safe_item_id))) {
$sql = 'SELECT start_date, exe_date, exe_result, exe_weighting FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = '.$safe_exe_id;
if ($debug) error_log($sql);
$res = Database::query($sql);
$row_dates = Database::fetch_array($res);
@ -203,12 +218,13 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp
$score = (float)$row_dates['exe_result'];
$max_score = (float)$row_dates['exe_weighting'];
$sql_upd_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '$max_score' WHERE c_id = $course_id AND id = '".(int)$safe_item_id."'";
$sql_upd_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '$max_score' WHERE c_id = $course_id AND id = '".$safe_item_id."'";
if ($debug) error_log($sql_upd_max_score);
Database::query($sql_upd_max_score);
$sql_last_attempt = "SELECT id FROM $TBL_LP_ITEM_VIEW WHERE c_id = $course_id AND lp_item_id = '$safe_item_id' AND lp_view_id = '".$_SESSION['oLP']->lp_view_id."' order by id desc limit 1";
$res_last_attempt = Database::query($sql_last_attempt);
if ($debug) error_log($sql_last_attempt);
if (Database::num_rows($res_last_attempt)) {
$row_last_attempt = Database::fetch_row($res_last_attempt);
@ -227,7 +243,7 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp
$src = 'blank.php?msg=exerciseFinished';
} else {
$src = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?id='.$safe_exe_id.'&origin=learnpath&learnpath_id='.$lp_id.'&learnpath_item_id='.$lp_id.'&fb_type='.Security::remove_XSS($_GET['fb_type']);
if ($debug) error_log('Calling URL'.$src);
if ($debug) error_log('Calling URL: '.$src);
}
$autostart = 'false';
}
@ -322,11 +338,11 @@ if (Database::num_rows($res_media) > 0) {
<!-- hub 26-50-2010 for lp toc height
<div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px;">
-->
<div id="author_image" name="author_image" class="row-fluid">
<div class="span12">
<div id="author_image" name="author_image" class="row">
<div class="span3">
<div class="well_border">
<div class="row-fluid">
<div class="span5">
<div class="row">
<div class="span1">
<?php
if ($_SESSION['oLP']->get_preview_image()!='') {
$picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
@ -339,15 +355,12 @@ if (Database::num_rows($res_media) > 0) {
}
?>
</div>
<div id="lp_navigation_elem" class="span7">
<div class="row">
<div class="span5">
<div id="lp_navigation_elem" class="span2">
<?php echo $navigation_bar; ?>
<div id="progress_bar">
<?php echo $progress_bar; ?>
</div>
</div>
</div>
</div>
</div>
</div>

@ -1246,20 +1246,21 @@ function update_stats_page()
* @param integer Number of items in total
* @param string Display mode (absolute 'abs' or percentage '%').Defaults to %
*/
function update_progress_bar(nbr_complete, nbr_total, mode)
{
function update_progress_bar(nbr_complete, nbr_total, mode) {
logit_lms('update_progress_bar('+nbr_complete+','+nbr_total+','+mode+')',2);
logit_lms('could update with data: '+olms.lms_lp_id+','+olms.lms_view_id+','+olms.lms_user_id,2);
if(mode == ''){mode='%';}
if(nbr_total == 0){nbr_total=1;}
if (mode == ''){mode='%';}
if (nbr_total == 0){nbr_total=1;}
var percentage = (nbr_complete/nbr_total)*100;
percentage = Math.round(percentage);
var pr_text = $("#progress_text");
var progress_bar = $("#progress_bar_value");
progress_bar.css('width', percentage);
progress_bar.css('width', percentage + "%");
/*
var pr_full = $("#progress_img_full");
var pr_empty = $("#progress_img_empty");

@ -29,10 +29,11 @@
<div id="main" class="container">
<header>
<div class="row">
{* header1 - logo *}
<div class="row">
<div id="header_left" class="span4">
{$header1}
{* logo *}
{$logo}
{* plugin_header *}
{if !empty($plugin_header_left)}
<div id="plugin_header_left">
@ -76,6 +77,7 @@
</div>
{/if}
</header>
{* menu *}
{if $menu}
<div class="subnav">

@ -112,7 +112,6 @@ $currentUserFirstName = $_user['firstName'];
$currentUserLastName = $_user['lastName'];
$currentUserEmail = $_user['mail'];
$delete = isset($_REQUEST['delete']) ? Database::escape_string($_REQUEST['delete']) : '';
$description = isset($_REQUEST['description']) ? Database::escape_string($_REQUEST['description']) : '';
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
@ -1026,29 +1025,29 @@ switch ($action) {
/* Delete dir command */
if ($is_allowed_to_edit && !empty($_REQUEST['delete_dir'])) {
del_dir($_REQUEST['delete_dir']);
$delete_2 = intval($_REQUEST['delete_dir']);
$delete_dir_id = intval($_REQUEST['delete_dir']);
$work_to_delete = get_work_data_by_id($delete_dir_id);
del_dir($delete_dir_id);
// gets calendar_id from student_publication_assigment
$sql = "SELECT add_to_calendar FROM $TSTDPUBASG WHERE c_id = $course_id AND publication_id ='$delete_2'";
$sql = "SELECT add_to_calendar FROM $TSTDPUBASG WHERE c_id = $course_id AND publication_id ='$delete_dir_id'";
$res = Database::query($sql);
$calendar_id = Database::fetch_row($res);
// delete from agenda if it exists
if (!empty($calendar_id[0])) {
$t_agenda = Database::get_course_table(TABLE_AGENDA);
$sql = "DELETE FROM $t_agenda WHERE c_id = $course_id AND id ='".$calendar_id[0]."'";
Database::query($sql);
}
$sql2 = "DELETE FROM $TSTDPUBASG WHERE c_id = $course_id AND publication_id ='$delete_2'";
$result2 = Database::query($sql2);
$sql = "DELETE FROM $TSTDPUBASG WHERE c_id = $course_id AND publication_id ='$delete_dir_id'";
Database::query($sql);
$link_id = is_resource_in_course_gradebook(api_get_course_id(), 3 , $delete_2, api_get_session_id());
$link_id = is_resource_in_course_gradebook(api_get_course_id(), 3 , $delete_dir_id, api_get_session_id());
if ($link_id !== false) {
remove_resource_from_course_gradebook($link_id);
}
Display :: display_confirmation_message(get_lang('DirDeleted') . ': '.$delete_directory);
}
Display :: display_confirmation_message(get_lang('DirDeleted') . ': '.$work_to_delete['title']);
}
/* DELETE WORK COMMAND */
@ -1056,9 +1055,10 @@ switch ($action) {
if ($action == 'delete' && $item_id) {
$file_deleted = false;
$is_author = user_is_author($item_id);
$is_author = user_is_author($item_id);
$work_data = get_work_data_by_id($item_id);
if (($is_author AND api_get_course_setting('student_delete_own_publication') == 1)) {
if ($is_allowed_to_edit || ($is_author && api_get_course_setting('student_delete_own_publication') == 1 && $work_data['qualificator_id'] == 0)) {
//we found the current user is the author
$queryString1 = "SELECT url, contains_file FROM " . $work_table . " WHERE c_id = $course_id AND id = $item_id";
$result1 = Database::query($queryString1);
@ -1067,8 +1067,8 @@ switch ($action) {
if (Database::num_rows($result1) > 0) {
$queryString2 = "UPDATE " . $work_table . " SET active = 2 WHERE c_id = $course_id AND id = $item_id";
$queryString3 = "DELETE FROM " . $TSTDPUBASG . " WHERE c_id = $course_id AND publication_id = $item_id";
$result2 = Database::query($queryString2);
$result3 = Database::query($queryString3);
Database::query($queryString2);
Database::query($queryString3);
api_item_property_update($_course, 'work', $item_id, 'DocumentDeleted', $user_id);
$work = $row['url'];
@ -1078,10 +1078,8 @@ switch ($action) {
my_delete($currentCourseRepositorySys.'/'.$work);
Display::display_confirmation_message(get_lang('TheDocumentHasBeenDeleted'));
$file_deleted = true;
} else {
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
$extension = pathinfo($work, PATHINFO_EXTENSION);
//$basename_file = basename($work, '.'.$extension);
} else {
$extension = pathinfo($work, PATHINFO_EXTENSION);
$new_dir = $work.'_DELETED_'.$item_id.'.'.$extension;
if (file_exists($currentCourseRepositorySys.'/'.$work)) {

@ -0,0 +1,12 @@
.cas_plugin_image {
float:left;
height:50px;
margin: 0px 5px 5px 0px;
}
.cas_plugin_comm {
font-style:italic;
}
.cas_plugin_clear {
clear:both;
height:1px;
}

@ -0,0 +1,21 @@
<?php
// Show the CAS button to login using CAS
$_template['show_message'] = false;
if (api_is_anonymous() && api_get_setting('cas_activate') == 'true') {
$_template['show_message'] = true;
// the default title
$button_label = "Connexion via CAS";
if (!empty($plugin_info['settings']['add_cas_login_button_cas_button_label'])) {
$button_label = api_htmlentities($plugin_info['settings']['add_cas_login_button_cas_button_label']);
}
// the comm
$comm_label = api_htmlentities($plugin_info['settings']['add_cas_login_button_cas_button_comment']);;
// URL of the image
$url_label = $plugin_info['settings']['add_cas_login_button_cas_image_url'];
$_template['button_label'] = $button_label;
$_template['comm_label'] = $comm_label;
$_template['url_label'] = $url_label;
}

@ -0,0 +1,41 @@
<?php
/**
* This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)
* @package chamilo.plugin
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Plugin details (must be present)
*/
//the plugin title
$plugin_info['title'] = 'Add a button to login using CAS';
//the comments that go with the plugin
$plugin_info['comment'] = "If CAS is activated, this plugin add a text and a button on the login page to login with CAS. Configure plugin to add title, comment and logo.";
//the plugin version
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration
$form = new FormValidator('add_cas_button_form');
$form->addElement('text', 'cas_button_label', 'CAS connexion title', '');
$form->addElement('text', 'cas_button_comment', 'CAS connexion description', '');
$form->addElement('text', 'cas_image_url', 'Logo URL if any (image, 50px height)');
$form->addElement('style_submit_button', 'submit_button', get_lang('Save'));
//get default value for form
$tab_default_add_cas_login_button_cas_button_label = api_get_setting('add_cas_login_button_cas_button_label');
$tab_default_add_cas_login_button_cas_button_comment = api_get_setting('add_cas_login_button_cas_button_comment');
$tab_default_add_cas_login_button_cas_image_url = api_get_setting('add_cas_login_button_cas_image_url');
$defaults['cas_button_label'] = $tab_default_add_cas_login_button_cas_button_label['add_cas_login_button'];
$defaults['cas_button_comment'] = $tab_default_add_cas_login_button_cas_button_comment['add_cas_login_button'];
$defaults['cas_image_url'] = $tab_default_add_cas_login_button_cas_image_url['add_cas_login_button'];
$form->setDefaults($defaults);
//display form
$plugin_info['settings_form'] = $form;
//set the smarty templates that are going to be used
$plugin_info['templates'] = array('template.tpl');

@ -0,0 +1,7 @@
README
<br/><br/>
This plugin add a button to allow user to login to Chamilo with CAS authentification.<br/><br/>
You have to activate your CAS connection to display this button.<br/>
You have to configure your CAS connection to have the button works.<br/>
To activate and configure CAS, for your Chamilo platform, go to Administration > Configuration settings > CAS<br/>
This plugin has been done to be added in the login_top region, but you can put it where you want.<br/>

@ -0,0 +1,44 @@
{*
This is a Chamilo plugin using Smarty you can use handy shorcuts like:
1. Shortcuts
$_p = url chamilo paths
$_u = user information of the current user
2. i18n
You can use i18n variables just use this syntax:
{"HelloWorld"|get_lang}
Now you can add your variables in the main/lang/english/ or main/lang/spanish/ for example in spanish:
$HelloWorld = "Hola Mundo";
3. Portal settings
You can access the portal settings using:
{"siteName"|api_get_setting}
For more settings check the settings_current database
4. Read more
You can also see more examples in the the main/template/default/layout files
5. {$_p|var_dump} pour les path {$_u|var_dump} pour info de l'utilisateur loggé
*}
{if $add_cas_login_button.show_message}
<link href="{$_p.web_plugin}/add_cas_login_button/css.css" rel="stylesheet" type="text/css">
<div class="well">
{if $add_cas_login_button.url_label}
<img src="{$add_cas_login_button.url_label}" class='cas_plugin_image'/>
{/if}
<h4>{$add_cas_login_button.button_label}</h4>
{if $add_cas_login_button.url_label}
<div class='cas_plugin_clear'>&nbsp;</div>
{/if}
<div class='cas_plugin_comm'>{$add_cas_login_button.comm_label}</div>
<button type="submit" name="submitAuth" class="btn" onclick="javascript:self.location.href='main/auth/cas/logincas.php'">{"LoginEnter"|get_lang}</button>
</div>
{/if}
Loading…
Cancel
Save