1.10.x
aragonc 10 years ago
commit 4a3aa7bf7a
  1. 7
      custompages/registration-dist.php
  2. 22
      main/admin/course_list.php
  3. 2
      main/admin/settings.php
  4. 51
      main/admin/user_information.php
  5. 2
      main/announcements/announcements.php
  6. 13
      main/calendar/agenda_js.php
  7. 35
      main/chat/chat_chat.php
  8. 25
      main/course_info/maintenance.php
  9. 82
      main/course_info/postpone.php
  10. 5
      main/course_info/tools.php
  11. 25
      main/course_progress/thematic_advance.php
  12. 3
      main/course_progress/thematic_controller.php
  13. 52
      main/coursecopy/backup.php
  14. 116
      main/coursecopy/classes/CourseBuilder.class.php
  15. 1
      main/create_course/add_course.php
  16. 90
      main/dashboard/dashboard.php
  17. 2
      main/document/document.php
  18. 54
      main/exercice/question.class.php
  19. 70
      main/gradebook/gradebook.php
  20. 5
      main/gradebook/lib/fe/displaygradebook.php
  21. 20
      main/gradebook/lib/fe/gradebooktable.class.php
  22. 2
      main/inc/introductionSection.inc.php
  23. 11
      main/inc/lib/api.lib.php
  24. 19
      main/inc/lib/course.lib.php
  25. 23
      main/inc/lib/dashboard.lib.php
  26. 8
      main/inc/lib/document.lib.php
  27. 14
      main/inc/lib/groupmanager.lib.php
  28. 2
      main/inc/lib/internationalization.lib.php
  29. 122
      main/inc/lib/tracking.lib.php
  30. 100
      main/inc/lib/urlmanager.lib.php
  31. 53
      main/inc/lib/userportal.lib.php
  32. 20
      main/mySpace/admin.php
  33. 117
      main/mySpace/reussite.php
  34. 10
      main/mySpace/session.php
  35. 1
      main/mySpace/student.php
  36. 112
      main/mySpace/user_import.php
  37. 17
      main/search/index.php
  38. 7
      main/search/search_suggestions.php
  39. 5
      main/social/friends.php
  40. 4
      main/social/group_add.php
  41. 3
      main/social/group_edit.php
  42. 6
      main/social/group_invitation.php
  43. 1
      main/social/group_members.php
  44. 7
      main/social/group_topics.php
  45. 6
      main/social/group_view.php
  46. 2
      main/social/invitations.php
  47. 10
      main/social/my_skills_report.php
  48. 5
      main/social/profile.php
  49. 4
      main/social/search.php
  50. 4
      main/survey/copy_survey.php
  51. 10
      main/survey/create_new_survey.php
  52. 17
      main/template/default/agenda/month.tpl
  53. 18
      main/tracking/courseLog.php
  54. 27
      main/tracking/courseLogCSV.php
  55. 70
      main/tracking/course_access_details.php
  56. 1
      main/tracking/course_log_groups.php
  57. 2
      main/tracking/course_log_resources.php
  58. 4
      main/tracking/course_session_report.php
  59. 10
      main/tracking/logins_details.php
  60. 245
      main/tracking/personnalLog.php
  61. 9
      main/user/class.php
  62. 13
      main/user/resume_session.php
  63. 25
      main/user/session_list.php
  64. 3
      main/user/subscribe_class.php
  65. 102
      main/user/subscribe_user.php
  66. 42
      main/user/user.php
  67. 3
      main/user/user_import.php
  68. 2
      main/wiki/wiki.inc.php
  69. 44
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  70. 2
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php
  71. 4
      tests/main/inc/lib/tracking.lib.test.php
  72. 10
      whoisonline.php

@ -7,14 +7,9 @@
* Copyright: CBlue SPRL, 20XX (GNU/GPLv3)
* @package chamilo.custompages
**/
/**
* Initialization
*/
require_once('language.php');
require_once('../inc/global.inc.php');
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
/**
* Removes some unwanted elementend of the form object
*/

@ -231,14 +231,22 @@ function get_course_data_by_session($from, $number_of_items, $column, $direction
function modify_filter($code)
{
$icourse = api_get_course_info($code);
return
'<a href="course_information.php?code='.$code.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;'.
//'<a href="../course_home/course_home.php?cidReq='.$code.'">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'. // This is not the preferable way to go to the homepage.
'<a href="'.api_get_path(WEB_COURSE_PATH).$icourse['path'].'/index.php">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'.
'<a href="../tracking/courseLog.php?cidReq='.$code.'">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;'.
'<a href="course_edit.php?id='.$icourse['real_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;'.
'<a href="../coursecopy/backup.php?cidReq='.$code.'">'.Display::return_icon('backup.gif', get_lang('CreateBackup')).'</a>&nbsp;'.
'<a href="course_list.php?delete_course='.$code.'" onclick="javascript: if (!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
'<a href="course_information.php?code='.$code.'">'.
Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;'.
//'<a href="../course_home/course_home.php?cidReq='.$code.'">'.
//Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'. // This is not the preferable way to go to the homepage.
'<a href="'.api_get_path(WEB_COURSE_PATH).$icourse['path'].'/index.php">'.
Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'.
'<a href="../tracking/courseLog.php?cidReq='.$code.'">'.
Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;'.
'<a href="course_edit.php?id='.$icourse['real_id'].'">'.
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;'.
'<a href="../coursecopy/create_backup.php?cidReq='.$code.'">'.
Display::return_icon('backup.gif', get_lang('CreateBackup')).'</a>&nbsp;'.
'<a href="course_list.php?delete_course='.$code.'" onclick="javascript: if (!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
}
/**

@ -484,7 +484,7 @@ if (!empty($_GET['category'])) {
api_get_utc_datetime(),
$user_id
);
Display :: display_confirmation_message(get_lang('DashboardPluginsHaveBeenUpdatedSucesslly'));
Display :: display_confirmation_message(get_lang('DashboardPluginsUpdatedSuccessfully'));
}
}
echo '<script>

@ -69,10 +69,19 @@ $data = array(
get_lang('Phone') => $user['phone'],
get_lang('OfficialCode') => $user['official_code'],
get_lang('Online') => $user['user_is_online'] ?
Display::return_icon('online.png') : Display::return_icon('offline.png'),
get_lang('Status') => $user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'),
null => sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id='
.$creatorId, $creatorInfo['username'], api_get_utc_datetime($registrationDate))
Display::return_icon('online.png') : Display::return_icon(
'offline.png'
),
get_lang('Status') => $user['status'] == 1 ? get_lang('Teacher') : get_lang(
'Student'
),
null => sprintf(
get_lang('CreatedByXYOnZ'),
'user_information.php?user_id='
.$creatorId,
$creatorInfo['username'],
api_get_utc_datetime($registrationDate)
),
);
$row = 1;
@ -251,12 +260,12 @@ $sql = 'SELECT * FROM '.$table_course_user.' cu, '.$table_course.' c
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$header = array(
array(get_lang('Code'), true),
array(get_lang('Title'), true),
array(get_lang('Status'), true),
array(get_lang('TimeSpentInTheCourse'), true),
array(get_lang('TotalPostsInAllForums'), true),
array('', false)
array(get_lang('Code')),
array(get_lang('Title')),
array(get_lang('Status')),
array(get_lang('TimeSpentInTheCourse')),
array(get_lang('TotalPostsInAllForums')),
array('')
);
$headerList = array();
@ -278,7 +287,7 @@ if (Database::num_rows($res) > 0) {
Display::return_icon('synthese_view.gif', get_lang('Overview')).'</a>'.
'<a href="'.$courseInfo['course_public_url'].'">'.
Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>' .
'<a href="course_edit.php?course_code='.$courseCode.'">'.
'<a href="course_edit.php?id='.$course->c_id.'">'.
Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
if ($course->status == STUDENT) {
$tools .= '<a href="user_information.php?action=unsubscribe&course_code='.$courseCode.'&user_id='.$user['user_id'].'">'.
@ -328,8 +337,7 @@ if (Database::num_rows($res) > 0) {
array(),
array('user_id' => intval($_GET['user_id']))
);
$courseInformation .= $courseToolInformationTotal;
$courseInformation .= $courseToolInformationTotal;
} else {
$courseInformation = '<p>'.get_lang('NoCoursesForThisUser').'</p>';
}
@ -339,7 +347,7 @@ if (Database::num_rows($res) > 0) {
*/
$urlInformation = null;
if (api_is_multiple_url_enabled()) {
$urlList= UrlManager::get_access_url_from_user($user['user_id']);
$urlList = UrlManager::get_access_url_from_user($user['user_id']);
if (count($urlList) > 0) {
$header = array();
$header[] = array('URL', true);
@ -399,13 +407,13 @@ if (isset($_GET['action'])) {
Display::display_header($tool_name);
echo '<div class="actions">
<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.intval($_GET['user_id']).'" title="'.get_lang('Reporting').'">'.
Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'
</a>
'.$login_as_icon.'
'.$editUser.'
'.$exportLink.'
</div>';
<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.intval($_GET['user_id']).'" title="'.get_lang('Reporting').'">'.
Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'
</a>
'.$login_as_icon.'
'.$editUser.'
'.$exportLink.'
</div>';
echo Display::page_header($tool_name);
@ -420,7 +428,6 @@ $fullUrl = UserManager::getUserPicture(
USER_IMAGE_SIZE_ORIGINAL
);
echo '<div class="row">';
echo '<div class="col-md-2">';
echo '<a class="expand-image" href="'.$fullUrlBig.'">'

@ -237,7 +237,7 @@ switch ($action) {
// determines which users have to be warned (i.e the users who have been inactive for x days or more
$since = isset($_GET['since']) ? intval($_GET['since']) : 6;
// getting the users who have to be reminded
$to = Tracking:: get_inactives_students_in_course(
$to = Tracking:: getInactiveStudentsInCourse(
api_get_course_int_id(),
$since,
api_get_session_id()

@ -224,13 +224,22 @@ $agenda->showToForm($form, $sendTo, array(), $addOnlyItemsInSendTo);
$form->addElement('html', '</div>');
$form->addElement('html', '<div id="visible_to_read_only" style="display: none">');
$form->addElement('label', get_lang('To'),'<div id="visible_to_read_only_users"></div>');
$form->addElement('label', get_lang('To'), '<div id="visible_to_read_only_users"></div>');
$form->addElement('html', '</div>');
$form->addElement('label', get_lang('Agenda'), '<div id ="color_calendar"></div>');
$form->addElement('label', get_lang('Date'), '<span id="start_date"></span><span id="end_date"></span>');
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'title'));
$form->addElement('textarea', 'content', get_lang('Description'), array('id' => 'content'));
$form->addHtmlEditor(
'content',
get_lang('Description'),
false,
false,
[
'ToolbarSet' => 'TestProposedAnswer',
'Height' => '120'
]
);
if ($agenda->type == 'course') {
$form->addElement('html', '<div id="add_as_announcement_div" style="display: none">');

@ -130,11 +130,36 @@ if (!empty($course)) {
@fclose(fopen($chat_path.$basename_chat.'.log.html', 'w'));
$doc_id = add_document($_course, $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html', 'file', filesize($chat_path.$basename_chat.'-'.$i.'.log.html'), $basename_chat.'-'.$i.'.log.html');
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $userId, $group_id, null, null, null, $session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, $group_id, null, null, null, $session_id);
item_property_update_on_folder($_course, $basepath_chat, $userId);
$doc_id = DocumentManager::get_document_id($_course, $basepath_chat.'/'.$basename_chat.'.log.html');
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'DocumentAdded',
$userId,
$group_id,
null,
null,
null,
$session_id
);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'invisible',
$userId,
$group_id,
null,
null,
null,
$session_id
);
item_property_update_on_folder($_course, $basepath_chat, $userId);
$doc_id = DocumentManager::get_document_id(
$_course,
$basepath_chat.'/'.$basename_chat.'.log.html'
);
update_existing_document($_course, $doc_id, 0);
}

@ -4,9 +4,7 @@
* @author Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com
* @package chamilo.course_info
*/
/**
* Code
*/
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;
$this_section = SECTION_COURSES;
@ -20,16 +18,19 @@ echo Display::page_header($nameTools);
?>
<div class="sectiontitle"><?php Display::display_icon('save_import.gif', get_lang('Backup')); ?>&nbsp;&nbsp;<a href="../coursecopy/backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('Backup'); ?></a></div>
<div class="sectiontitle">
<?php Display::display_icon('save_import.gif', get_lang('Backup')); ?>&nbsp;&nbsp;
<?php echo get_lang('Backup'); ?>
</div>
<div class="sectioncomment">
<ul>
<li><a href="../coursecopy/create_backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CreateBackup'); ?></a><br/>
<?php echo get_lang('CreateBackupInfo'); ?>
</li>
<li><a href="../coursecopy/import_backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('ImportBackup'); ?></a><br/>
<?php echo get_lang('ImportBackupInfo'); ?>
</li>
</ul>
<ul>
<li><a href="../coursecopy/create_backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CreateBackup'); ?></a><br/>
<?php echo get_lang('CreateBackupInfo'); ?>
</li>
<li><a href="../coursecopy/import_backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('ImportBackup'); ?></a><br/>
<?php echo get_lang('ImportBackupInfo'); ?>
</li>
</ul>
</div>
<div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang('CopyCourse')); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CopyCourse'); ?></a></div>

@ -1,82 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
// TODO: Is this file needed anymore?
/**
* MODIFY COURSE INFO
* Modify course settings like:
* 1. Course title
* 2. Department
* 3. Course description URL in the university web
* Course code cannot be modified, because it gives the name for the
* course database and course web directory. Professor cannot be
* changed either as it determines who is allowed to modify the course.
*
* @author Thomas Depraetere
* @author Hugues Peeters
* @author Christophe Gesche
*
* @package chamilo.course_info
*/
/**
* Code
*/
/* INIT SECTION */
// Language file that needs to be included
$language_file = 'postpone';
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Admin'));
$htmlHeadXtra[] = "
<style type=\"text/css\">
<!--
.month {font-weight : bold;color : #FFFFFF;background-color : #4171B5;padding-left : 15px;padding-right : 15px;}
.content {position: relative; left: 25px;}
-->
</style>
<STYLE media=\"print\" type=\"text/css\">
TD {border-bottom: thin dashed Gray;}
</STYLE>";
require '../inc/global.inc.php';
$this_section = SECTION_COURSES;
Display::display_header($nameTools, 'Settings');
//include api_get_path(CONFIGURATION_PATH).'postpone.conf.php';
$nameTools = get_lang('Postpone');
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$is_allowedToEdit = $is_courseAdmin;
$currentCourseID = $_course['sysCode'];
$currentCourseRepository = $_course['path'];
$sqlCourseExtention = "SELECT last_visit, last_edit, creation_date, expiration_date FROM ".$TABLECOURSE." WHERE code = '".$_cid."'";
$resultCourseExtention = Database::query($sqlCourseExtention);
$currentCourseExtentionData = Database::fetch_array($resultCourseExtention);
$currentCourseLastVisit = $currentCourseExtentionData['last_visit'];
$currentCourseLastEdit = $currentCourseExtentionData['last_edit'];
$currentCourseCreationDate = $currentCourseExtentionData['creation_date'];
$currentCourseExpirationDate = $currentCourseExtentionData['expiration_date'];
// HERE YOU CAN EDIT YOUR RULES TO EXTEND THE LIFE OF COURSE
// $newCourseExpirationDate = now() + $extendDelay
?>
<h3>
<?php echo $nameTools ?>
</h3>
This script would be called by
professor,
or administrator,
or other script
to give more time to a course before expiration.
<?php
Display::display_footer();

@ -15,6 +15,8 @@ if (!api_is_allowed_to_edit()) {
$action = isset($_GET['action']) ? $_GET['action'] : '';
$id = isset($_GET['id']) ? intval($_GET['id']) : '';
$toolName = get_lang('CustomizeIcons');
switch ($action) {
case 'delete_icon':
$tool = CourseHome::getTool($id);
@ -89,7 +91,7 @@ switch ($action) {
api_get_session_id()
);
$iconsTools = '<div id="custom-icons">';
$iconsTools .= Display::page_header( get_lang('CustomizeIcons'),null,'h4');
$iconsTools .= Display::page_header(get_lang('CustomizeIcons'), null, 'h4');
$iconsTools .= '<div class="row">';
foreach ($toolList as $tool) {
@ -143,6 +145,7 @@ function getCustomWebIconPath()
{
// Check if directory exists or create it if it doesn't
$dir = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/course_home_icons/';
return $dir;
}
$tpl = new Template($toolName);

@ -37,8 +37,25 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
}
$radios = array();
$radios[] = $form->createElement('radio', 'start_date_type', null, get_lang('StartDateFromAnAttendance'),'1',array('onclick' => 'check_per_attendance(this)', 'id'=>'from_attendance'));
$radios[] = $form->createElement('radio', 'start_date_type', null, get_lang('StartDateCustom'),'2',array('onclick' => 'check_per_custom_date(this)', 'id'=>'custom_date'));
$radios[] = $form->createElement(
'radio',
'start_date_type',
null,
get_lang('StartDateFromAnAttendance'),
'1',
array(
'onclick' => 'check_per_attendance(this)',
'id' => 'from_attendance',
)
);
$radios[] = $form->createElement(
'radio',
'start_date_type',
null,
get_lang('StartDateCustom'),
'2',
array('onclick' => 'check_per_custom_date(this)', 'id' => 'custom_date')
);
$form->addGroup($radios, null, get_lang('StartDateOptions'));
if (isset($thematic_advance_data['attendance_id']) &&
@ -70,7 +87,6 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
$form->addElement('select', 'start_date_by_attendance', get_lang('StartDate'), $calendar_select, array('id'=>'start_date_select_calendar'));
}
$form->addElement('html', '</div>');
$form->addElement('html', '</div>');
$form->addText(
@ -83,6 +99,7 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
'autofocus' => 'autofocus',
)
);
$form->addHtmlEditor(
'content',
get_lang('Content'),
@ -100,7 +117,7 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
} else {
$form->addButtonUpdate(get_lang('Save'));
}
//$form->addElement('html', '<a href="#" id="save_button" onclick="save();">Save</a>');
$attendance_select_item_id = null;
if (count($attendance_select) > 1) {

@ -37,9 +37,6 @@ class ThematicController
{
$thematic = new Thematic();
$data = array();
$error = false;
$msg_add = false;
$check = Security::check_token('request');
$thematic_id = isset($_REQUEST['thematic_id']) ? intval($_REQUEST['thematic_id']) : null;
$displayHeader = (!empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header') ? false : true;

@ -1,52 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Create a backup.
*
* @author Bart Mollet <bart.mollet@hogent.be>
* @package chamilo.backup
*/
/**
* Code
*/
// Including the global initialization file
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
api_block_anonymous_users();
// Check access rights (only teachers allowed)
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
// Section for the tabs
$this_section = SECTION_COURSES;
// Breadcrumbs
$interbreadcrumb[] = array('url' => '../course_info/maintenance.php', 'name' => get_lang('Maintenance'));
// Displaying the header
$nameTools = get_lang('Backup');
Display::display_header($nameTools);
// Display the tool title
echo Display::page_header($nameTools);
/* MAIN CODE */
?>
<ul>
<li><a href="create_backup.php"><?php echo get_lang('CreateBackup') ?></a><br/>
<?php echo get_lang('CreateBackupInfo'); ?>
</li>
<li><a href="import_backup.php"><?php echo get_lang('ImportBackup') ?></a><br/>
<?php echo get_lang('ImportBackupInfo'); ?>
</li>
</ul>
<?php
// Display the footer
Display::display_footer();

@ -26,6 +26,7 @@ require_once 'wiki.class.php';
require_once 'Thematic.class.php';
require_once 'Attendance.class.php';
require_once 'Work.class.php';
require_once 'QuizQuestionOption.class.php';
/**
* Class CourseBuilder
@ -359,12 +360,14 @@ class CourseBuilder
$with_base_content
);
$sql = "SELECT * FROM $table WHERE c_id = $courseId $sessionCondition ORDER BY cat_title";
$sql = "SELECT * FROM $table
WHERE c_id = $courseId $sessionCondition
ORDER BY cat_title";
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$forum_category = new ForumCategory($obj);
$this->course->add_resource($forum_category);
$result = Database::query($sql);
while ($obj = Database::fetch_object($result)) {
$forumCategory = new ForumCategory($obj);
$this->course->add_resource($forumCategory);
}
}
@ -552,7 +555,8 @@ class CourseBuilder
{
$link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY);
$sql = "SELECT * FROM $link_cat_table WHERE c_id = $courseId AND id = $id";
$sql = "SELECT * FROM $link_cat_table
WHERE c_id = $courseId AND id = $id";
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$link_category = new LinkCategory(
@ -600,24 +604,28 @@ class CourseBuilder
true
);
}
$sql = "SELECT * FROM $table_qui WHERE c_id = $courseId AND active >=0 $session_condition";
$sql = "SELECT * FROM $table_qui
WHERE c_id = $courseId AND active >=0 $session_condition";
//select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
} else {
$sql = "SELECT * FROM $table_qui WHERE c_id = $courseId AND active >=0 AND session_id = 0";
$sql = "SELECT * FROM $table_qui
WHERE c_id = $courseId AND active >=0 AND session_id = 0";
//select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
}
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
if (strlen($obj->sound) > 0) {
$sql = "SELECT id FROM $table_doc WHERE c_id = $courseId AND path = '/audio/".$obj->sound."'";
$sql = "SELECT id FROM $table_doc
WHERE c_id = $courseId AND path = '/audio/".$obj->sound."'";
$res = Database::query($sql);
$doc = Database::fetch_object($res);
$obj->sound = $doc->id;
}
$quiz = new Quiz($obj);
$sql = 'SELECT * FROM '.$table_rel.' WHERE c_id = '.$courseId.' AND exercice_id = '.$obj->id;
$sql = 'SELECT * FROM '.$table_rel.'
WHERE c_id = '.$courseId.' AND exercice_id = '.$obj->id;
$db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2)) {
$quiz->add_question($obj2->question_id, $obj2->question_order);
@ -644,7 +652,8 @@ class CourseBuilder
$table_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER);
// Building normal tests.
$sql = "SELECT * FROM $table_que WHERE c_id = $courseId ";
$sql = "SELECT * FROM $table_que
WHERE c_id = $courseId ";
$result = Database::query($sql);
while ($obj = Database::fetch_object($result)) {
@ -689,7 +698,8 @@ class CourseBuilder
$table_options = Database::get_course_table(
TABLE_QUIZ_QUESTION_OPTION
);
$sql = 'SELECT * FROM '.$table_options.' WHERE c_id = '.$courseId.' AND question_id = '.$obj->id;
$sql = 'SELECT * FROM '.$table_options.'
WHERE c_id = '.$courseId.' AND question_id = '.$obj->id;
$db_result3 = Database::query($sql);
while ($obj3 = Database::fetch_object($db_result3)) {
$question_option = new QuizQuestionOption($obj3);
@ -761,7 +771,8 @@ class CourseBuilder
$obj->extra,
$question_category_id
);
$sql = "SELECT * FROM $table_ans WHERE c_id = $courseId AND question_id = ".$obj->id;
$sql = "SELECT * FROM $table_ans
WHERE c_id = $courseId AND question_id = ".$obj->id;
$db_result2 = Database::query($sql);
if (Database::num_rows($db_result2)) {
while ($obj2 = Database::fetch_object($db_result2)) {
@ -818,11 +829,12 @@ class CourseBuilder
ON questions.id=quizz_questions.question_id
LEFT JOIN '.$table_qui.' as exercises
ON quizz_questions.exercice_id = exercises.id
WHERE questions.c_id = quizz_questions.c_id AND
questions.c_id = exercises.c_id AND
exercises.c_id = '.$courseId.' AND
(quizz_questions.exercice_id IS NULL OR
exercises.active = -1)';
WHERE
questions.c_id = quizz_questions.c_id AND
questions.c_id = exercises.c_id AND
exercises.c_id = '.$courseId.' AND
(quizz_questions.exercice_id IS NULL OR
exercises.active = -1)';
$db_result = Database::query($sql);
if (Database::num_rows($db_result) > 0) {
// This is the fictional test for collecting orphan questions.
@ -932,7 +944,8 @@ class CourseBuilder
$obj->creation_date, $obj->invited, $obj->answered,
$obj->invite_mail, $obj->reminder_mail
);
$sql = 'SELECT * FROM '.$table_question.' WHERE c_id = '.$courseId.' AND survey_id = '.$obj->survey_id;
$sql = 'SELECT * FROM '.$table_question.'
WHERE c_id = '.$courseId.' AND survey_id = '.$obj->survey_id;
$db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2)) {
$survey->add_question($obj2->question_id);
@ -964,7 +977,8 @@ class CourseBuilder
$obj->shared_question_id,
$obj->max_value
);
$sql = 'SELECT * FROM '.$table_opt.' WHERE c_id = '.$courseId.' AND question_id = '.$obj->question_id;
$sql = 'SELECT * FROM '.$table_opt.'
WHERE c_id = '.$courseId.' AND question_id = '.$obj->question_id;
$db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2)) {
$question->add_answer($obj2->option_text, $obj2->sort);
@ -994,13 +1008,16 @@ class CourseBuilder
$with_base_content
);
$sql = 'SELECT * FROM '.$table.' WHERE c_id = '.$courseId.' '.$sessionCondition;
$sql = 'SELECT * FROM '.$table.'
WHERE c_id = '.$courseId.' '.$sessionCondition;
$db_result = Database::query($sql);
$table_attachment = Database:: get_course_table(
TABLE_ANNOUNCEMENT_ATTACHMENT
);
while ($obj = Database::fetch_object($db_result)) {
if (empty($obj->id)) {
continue;
}
$sql = 'SELECT path, comment, filename, size
FROM '.$table_attachment.'
WHERE c_id = '.$courseId.' AND announcement_id = '.$obj->id.'';
@ -1052,13 +1069,16 @@ class CourseBuilder
$with_base_content
);
$sql = 'SELECT * FROM '.$table.' WHERE c_id = '.$courseId.' '.$sessionCondition;
$sql = 'SELECT * FROM '.$table.'
WHERE c_id = '.$courseId.' '.$sessionCondition;
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$table_attachment = Database:: get_course_table(
TABLE_AGENDA_ATTACHMENT
);
$sql = 'SELECT path, comment, filename, size FROM '.$table_attachment.' WHERE c_id = '.$courseId.' AND agenda_id = '.$obj->id.'';
$sql = 'SELECT path, comment, filename, size
FROM '.$table_attachment.'
WHERE c_id = '.$courseId.' AND agenda_id = '.$obj->id.'';
$result = Database::query($sql);
$attachment_obj = Database::fetch_object($result);
@ -1114,10 +1134,12 @@ class CourseBuilder
true
);
}
$sql = 'SELECT * FROM '.$table.' WHERE c_id = '.$courseId.' '.$session_condition;
$sql = 'SELECT * FROM '.$table.'
WHERE c_id = '.$courseId.' '.$session_condition;
} else {
$table = Database:: get_course_table(TABLE_COURSE_DESCRIPTION);
$sql = 'SELECT * FROM '.$table.' WHERE c_id = '.$courseId.' AND session_id = 0';
$sql = 'SELECT * FROM '.$table.'
WHERE c_id = '.$courseId.' AND session_id = 0';
}
$db_result = Database::query($sql);
@ -1163,9 +1185,11 @@ class CourseBuilder
true
);
}
$sql = 'SELECT * FROM '.$table_main.' WHERE c_id = '.$courseId.' '.$session_condition;
$sql = 'SELECT * FROM '.$table_main.'
WHERE c_id = '.$courseId.' '.$session_condition;
} else {
$sql = 'SELECT * FROM '.$table_main.' WHERE c_id = '.$courseId.' AND session_id = 0';
$sql = 'SELECT * FROM '.$table_main.'
WHERE c_id = '.$courseId.' AND session_id = 0';
}
if (!empty($id_list)) {
@ -1300,9 +1324,11 @@ class CourseBuilder
$table_glossary = Database:: get_course_table(TABLE_GLOSSARY);
//@todo check this queries are the same ... ayayay
if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = 'SELECT * FROM '.$table_glossary.' g WHERE g.c_id = '.$courseId.' AND session_id = 0';
$sql = 'SELECT * FROM '.$table_glossary.' g
WHERE g.c_id = '.$courseId.' AND session_id = 0';
} else {
$sql = 'SELECT * FROM '.$table_glossary.' g WHERE g.c_id = '.$courseId.' AND session_id = 0';
$sql = 'SELECT * FROM '.$table_glossary.' g
WHERE g.c_id = '.$courseId.' AND session_id = 0';
}
}
$db_result = Database::query($sql);
@ -1332,14 +1358,9 @@ class CourseBuilder
$this->course = new Course();
$this->course->code = $_course['code'];
$this->course->type = 'partial';
$this->course->path = api_get_path(
SYS_COURSE_PATH
).$_course['directory'].'/';
$this->course->backup_path = api_get_path(
SYS_COURSE_PATH
).$_course['directory'];
$this->course->encoding = api_get_system_encoding(
); //current platform encoding
$this->course->path = api_get_path(SYS_COURSE_PATH).$_course['directory'].'/';
$this->course->backup_path = api_get_path(SYS_COURSE_PATH).$_course['directory'];
$this->course->encoding = api_get_system_encoding(); //current platform encoding
$code_course = $_course['code'];
$courseId = $_course['real_id'];
$sql_session = "SELECT s.id, name, c_id
@ -1389,10 +1410,12 @@ class CourseBuilder
true
);
}
$sql = 'SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$courseId.' '.$session_condition;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$courseId.' '.$session_condition;
} else {
$tbl_wiki = Database::get_course_table(TABLE_WIKI);
$sql = 'SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$courseId.' AND session_id = 0';
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$courseId.' AND session_id = 0';
}
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
@ -1425,9 +1448,9 @@ class CourseBuilder
$with_base_content = false,
$id_list = array()
) {
$table_thematic = Database :: get_course_table(TABLE_THEMATIC);
$table_thematic = Database :: get_course_table(TABLE_THEMATIC);
$table_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$table_thematic_plan = Database :: get_course_table(TABLE_THEMATIC_PLAN);
$table_thematic_plan = Database :: get_course_table(TABLE_THEMATIC_PLAN);
$session_id = intval($session_id);
if ($with_base_content) {
@ -1440,11 +1463,13 @@ class CourseBuilder
$session_condition = api_get_session_condition($session_id, true);
}
$sql = "SELECT * FROM $table_thematic WHERE c_id = $courseId $session_condition ";
$sql = "SELECT * FROM $table_thematic
WHERE c_id = $courseId $session_condition ";
$db_result = Database::query($sql);
while ($row = Database::fetch_array($db_result, 'ASSOC')) {
$thematic = new Thematic($row);
$sql = 'SELECT * FROM '.$table_thematic_advance.' WHERE c_id = '.$courseId.' AND thematic_id = '.$row['id'];
$sql = 'SELECT * FROM '.$table_thematic_advance.'
WHERE c_id = '.$courseId.' AND thematic_id = '.$row['id'];
$result = Database::query($sql);
while ($sub_row = Database::fetch_array($result, 'ASSOC')) {
@ -1456,7 +1481,6 @@ class CourseBuilder
api_get_course_id(),
$session_id
);
//$items_from_session = api_get_item_property_by_tool('thematic_plan', api_get_course_id(), api_get_session_id());
$thematic_plan_id_list = array();
if (!empty($items)) {
@ -1500,7 +1524,7 @@ class CourseBuilder
$with_base_content = false,
$id_list = array()
) {
$table_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$table_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$table_attendance_calendar = Database :: get_course_table(TABLE_ATTENDANCE_CALENDAR);
$sessionCondition = api_get_session_condition($session_id, true, $with_base_content);

@ -77,7 +77,6 @@ $form->addElement(
get_lang('Ex')
),
array(
'class' => 'span6',
'id' => 'title'
)
);

@ -39,52 +39,52 @@ echo '</div>';
// block dashboard view
if (isset($dashboard_view) && $dashboard_view == 'blocks') {
if (count($blocks) > 0) {
$columns = array();
// group content html by number of column
if (is_array($blocks)) {
$tmp_columns = array();
foreach ($blocks as $block) {
$tmp_columns[] = $block['column'];
if (in_array($block['column'], $tmp_columns)) {
$columns['column_'.$block['column']][] = $block['content_html'];
}
}
}
if (isset($blocks) && count($blocks) > 0) {
$columns = array();
// group content html by number of column
if (is_array($blocks)) {
$tmp_columns = array();
foreach ($blocks as $block) {
$tmp_columns[] = $block['column'];
if (in_array($block['column'], $tmp_columns)) {
$columns['column_'.$block['column']][] = $block['content_html'];
}
}
}
echo '<div id="columns" class="row">';
if (count($columns) > 0) {
$columns_name = array_keys($columns);
// blocks for column 1
if (in_array('column_1',$columns_name)) {
echo '<div id="column1" class="col-md-6">';
foreach ($columns['column_1'] as $content) {
echo $content;
}
echo '</div>';
} else {
echo '<div id="column1" class="col-md-6">';
echo '&nbsp;';
echo '</div>';
}
// blocks for column 2
if (in_array('column_2',$columns_name)) {
// blocks for column 1
echo '<div id="column2" class="col-md-6">';
foreach ($columns['column_2'] as $content) {
echo $content;
}
echo '</div>';
} else {
echo '<div id="column2" class="col-md-6">';
echo '&nbsp;';
echo '</div>';
}
}
echo '</div>';
} else {
echo '<div style="margin-top:20px;">'.get_lang('YouHaveNotEnabledBlocks').'</div>';
}
echo '<div id="columns" class="row">';
if (count($columns) > 0) {
$columns_name = array_keys($columns);
// blocks for column 1
if (in_array('column_1',$columns_name)) {
echo '<div id="column1" class="col-md-6">';
foreach ($columns['column_1'] as $content) {
echo $content;
}
echo '</div>';
} else {
echo '<div id="column1" class="col-md-6">';
echo '&nbsp;';
echo '</div>';
}
// blocks for column 2
if (in_array('column_2',$columns_name)) {
// blocks for column 1
echo '<div id="column2" class="col-md-6">';
foreach ($columns['column_2'] as $content) {
echo $content;
}
echo '</div>';
} else {
echo '<div id="column2" class="col-md-6">';
echo '&nbsp;';
echo '</div>';
}
}
echo '</div>';
} else {
echo '<div style="margin-top:20px;">'.get_lang('YouHaveNotEnabledBlocks').'</div>';
}
} else {
// block dashboard list

@ -43,7 +43,7 @@ api_protect_course_group(GroupManager::GROUP_TOOL_DOCUMENTS);
DocumentManager::removeGeneratedAudioTempFile();
if(
if (
isset($_SESSION['temp_realpath_image']) &&
!empty($_SESSION['temp_realpath_image']) &&
file_exists($_SESSION['temp_realpath_image'])

@ -101,7 +101,7 @@ abstract class Question
*
* @return Question
*/
static function read($id, $course_id = null)
public static function read($id, $course_id = null)
{
$id = intval($id);
@ -144,13 +144,22 @@ abstract class Question
$objQuestion->course = $course_info;
$objQuestion->category = TestCategory::getCategoryForQuestion($id);
$sql = "SELECT exercice_id FROM $TBL_EXERCISE_QUESTION
WHERE c_id = $course_id AND question_id = $id";
$result_exercise_list = Database::query($sql);
$tblQuiz = Database::get_course_table(TABLE_QUIZ_TEST);
$sql = "SELECT DISTINCT q.exercice_id
FROM $TBL_EXERCISE_QUESTION q
INNER JOIN $tblQuiz e
ON e.c_id = q.c_id AND e.id = q.exercice_id
WHERE
q.c_id = $course_id AND
q.question_id = $id AND
e.active >= 0";
$result = Database::query($sql);
// fills the array with the exercises which this question is in
if ($result_exercise_list) {
while ($obj = Database::fetch_object($result_exercise_list)) {
if ($result) {
while ($obj = Database::fetch_object($result)) {
$objQuestion->exerciseList[] = $obj->exercice_id;
}
}
@ -167,6 +176,7 @@ abstract class Question
* returns the question ID
*
* @author Olivier Brouckaert
*
* @return - integer - question ID
*/
public function selectId()
@ -194,6 +204,7 @@ abstract class Question
public function selectDescription()
{
$this->description = text_filter($this->description);
return $this->description;
}
@ -236,7 +247,7 @@ abstract class Question
* @author Nicolas Raynaud
* @return integer - level of the question, 0 by default.
*/
function selectLevel()
public function selectLevel()
{
return $this->level;
}
@ -260,6 +271,7 @@ abstract class Question
if (!empty($this->picture)) {
return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture;
}
return false;
}
@ -280,7 +292,8 @@ abstract class Question
* @author Olivier Brouckaert
* @return integer - number of exercises
*/
public function selectNbrExercises() {
public function selectNbrExercises()
{
return sizeof($this->exerciseList);
}
@ -288,6 +301,7 @@ abstract class Question
* changes the question title
*
* @author Olivier Brouckaert
*
* @param string $title - question title
*/
public function updateTitle($title)
@ -307,6 +321,7 @@ abstract class Question
* changes the question description
*
* @author Olivier Brouckaert
*
* @param string $description - question description
*/
public function updateDescription($description)
@ -372,11 +387,11 @@ abstract class Question
$category_id = intval($category_id);
$question_id = intval($this->id);
$sql = "SELECT count(*) AS nb
FROM $TBL_QUESTION_REL_CATEGORY
WHERE
category_id = $category_id
AND question_id = $question_id
AND c_id=".api_get_course_int_id();
FROM $TBL_QUESTION_REL_CATEGORY
WHERE
category_id = $category_id
AND question_id = $question_id
AND c_id=".api_get_course_int_id();
$res = Database::query($sql);
$row = Database::fetch_array($res);
if ($row['nb'] > 0) {
@ -483,7 +498,7 @@ abstract class Question
) {
// removes old answers
$sql = "DELETE FROM $TBL_REPONSES
WHERE c_id = $course_id AND question_id = " . intval($this->id);
WHERE c_id = $course_id AND question_id = " . intval($this->id);
Database::query($sql);
}
@ -728,7 +743,8 @@ abstract class Question
* @author Olivier Brouckaert
* @return boolean - true if moved, otherwise false
*/
function getTmpPicture() {
function getTmpPicture()
{
global $picturePath;
// if the question has got an ID and if the picture exists
@ -1334,7 +1350,7 @@ abstract class Question
/**
* Returns an instance of the class corresponding to the type
* @param integer $type the type of the question
* @return an instance of a Question subclass (or of Questionc class by default)
* @return $this instance of a Question subclass (or of Questionc class by default)
*/
public static function getInstance($type)
{
@ -1711,6 +1727,7 @@ abstract class Question
array('class' => 'ribbon')
);
$header .= Display::div($this->description, array('id' => 'question_description'));
return $header;
}
@ -1793,6 +1810,7 @@ abstract class Question
$tabQuestionList = Question::get_question_type_list(); // [0]=file to include [1]=type name
require_once $tabQuestionList[$type][0];
$img = $explanation = null;
eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;');
eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);');
@ -1810,8 +1828,7 @@ abstract class Question
$sidx = "question",
$sord = "ASC",
$where_condition = array()
)
{
) {
$table_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
$default_where = array('c_id = ? AND parent_id = 0 AND type = ?' => array($course_id, MEDIA_QUESTION));
$result = Database::select(
@ -1823,6 +1840,7 @@ abstract class Question
'order' => "$sidx $sord"
)
);
return $result;
}

@ -310,24 +310,20 @@ if (isset ($_POST['action'])) {
$filter_confirm_msg = false;
break;
case 'setvisible' :
foreach ($_POST['id'] as $indexstr)
{
if (api_substr($indexstr, 0, 4) == 'CATE')
{
$cats= Category :: load(api_substr($indexstr, 4));
foreach ($_POST['id'] as $indexstr) {
if (api_substr($indexstr, 0, 4) == 'CATE') {
$cats = Category:: load(api_substr($indexstr, 4));
$cats[0]->set_visible(1);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
}
if (api_substr($indexstr, 0, 4) == 'EVAL')
{
$eval= Evaluation :: load(api_substr($indexstr, 4));
if (api_substr($indexstr, 0, 4) == 'EVAL') {
$eval = Evaluation:: load(api_substr($indexstr, 4));
$eval[0]->set_visible(1);
$eval[0]->save();
}
if (api_substr($indexstr, 0, 4) == 'LINK')
{
$link= LinkFactory :: load(api_substr($indexstr, 4));
if (api_substr($indexstr, 0, 4) == 'LINK') {
$link = LinkFactory:: load(api_substr($indexstr, 4));
$link[0]->set_visible(1);
$link[0]->save();
}
@ -336,24 +332,20 @@ if (isset ($_POST['action'])) {
$filter_confirm_msg = false;
break;
case 'setinvisible' :
foreach ($_POST['id'] as $indexstr)
{
if (api_substr($indexstr, 0, 4) == 'CATE')
{
$cats= Category :: load(api_substr($indexstr, 4));
foreach ($_POST['id'] as $indexstr) {
if (api_substr($indexstr, 0, 4) == 'CATE') {
$cats = Category:: load(api_substr($indexstr, 4));
$cats[0]->set_visible(0);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
}
if (api_substr($indexstr, 0, 4) == 'EVAL')
{
$eval= Evaluation :: load(api_substr($indexstr, 4));
if (api_substr($indexstr, 0, 4) == 'EVAL') {
$eval = Evaluation:: load(api_substr($indexstr, 4));
$eval[0]->set_visible(0);
$eval[0]->save();
}
if (api_substr($indexstr, 0, 4) == 'LINK')
{
$link= LinkFactory :: load(api_substr($indexstr, 4));
if (api_substr($indexstr, 0, 4) == 'LINK') {
$link = LinkFactory:: load(api_substr($indexstr, 4));
$link[0]->set_visible(0);
$link[0]->save();
}
@ -446,6 +438,7 @@ if (isset ($move_form)) {
// LOAD DATA & DISPLAY TABLE -
$is_platform_admin= api_is_platform_admin();
$is_course_admin= api_is_allowed_to_edit();
//load data for category, evaluation and links
if (!isset ($_GET['selectcat']) || empty ($_GET['selectcat'])) {
$category= 0;
@ -454,7 +447,13 @@ if (!isset ($_GET['selectcat']) || empty ($_GET['selectcat'])) {
}
// search form
$simple_search_form= new UserForm(UserForm :: TYPE_SIMPLE_SEARCH, null, 'simple_search_form', null, api_get_self() . '?selectcat=' . $selectcat);
$simple_search_form = new UserForm(
UserForm :: TYPE_SIMPLE_SEARCH,
null,
'simple_search_form',
null,
api_get_self().'?selectcat='.$selectcat
);
$values= $simple_search_form->exportValues();
$keyword = '';
if (isset($_GET['search']) && !empty($_GET['search'])) {
@ -463,8 +462,8 @@ if (isset($_GET['search']) && !empty($_GET['search'])) {
if ($simple_search_form->validate() && (empty($keyword))) {
$keyword = $values['keyword'];
}
if (!empty($keyword)) {
if (!empty($keyword)) {
$cats= Category :: load($category);
$allcat= array ();
if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
@ -486,7 +485,13 @@ if (!empty($keyword)) {
$alllink= $cats[0]->get_links($stud_id, true);
if (isset ($_GET['exportpdf'])) {
$datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
$header_names = array(get_lang('Name'),get_lang('Description'),get_lang('Weight'),get_lang('Date'),get_lang('Results'));
$header_names = array(
get_lang('Name'),
get_lang('Description'),
get_lang('Weight'),
get_lang('Date'),
get_lang('Results'),
);
$data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
$newarray = array();
foreach ($data_array as $data) {
@ -500,7 +505,18 @@ if (!empty($keyword)) {
$pdf->line(50,790,550,790);
$pdf->line(50,40,550,40);
$pdf->ezSetY(750);
$pdf->ezTable($newarray,$header_names,'',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1,'rowGap'=>3,'width'=> 500));
$pdf->ezTable(
$newarray,
$header_names,
'',
array(
'showHeadings' => 1,
'shaded' => 1,
'showLines' => 1,
'rowGap' => 3,
'width' => 500,
)
);
$pdf->ezStream();
exit;
}
@ -565,7 +581,7 @@ if (isset($_GET['search'])) {
if (isset ($_GET['studentoverview'])) {
$addparams['studentoverview'] = '';
}
if (count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
if (isset($allcat_info) && count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
$allcat=$allcat_info;
} else {
$allcat=$allcat;

@ -516,7 +516,10 @@ class DisplayGradebook
} else {
$header .= '<td></td>';
}
if ($is_course_admin && $message_resource === false && $_GET['selectcat'] != 0) {
if ($is_course_admin &&
$message_resource === false &&
isset($_GET['selectcat']) && $_GET['selectcat'] != 0
) {
/* $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
if ($is_course_admin && $message_resource===false) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() .'"><img src="../img/acces_tool.gif" alt="' . get_lang('ScoreEdit') . '" /> ' . get_lang('ScoreEdit') . '</a>';

@ -883,11 +883,11 @@ class GradebookTable extends SortableTable
switch ($item->get_item_type()) {
// category
case 'C' :
$prms_uri='?selectcat=' . $item->get_id() . '&amp;view='.$view;
$prms_uri='?selectcat=' . $item->get_id() . '&view='.$view;
if (isset($_GET['isStudentView'])) {
if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) {
$prms_uri=$prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']);
$prms_uri=$prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']);
}
}
@ -897,22 +897,28 @@ class GradebookTable extends SortableTable
. $item->get_name()
. '</a>'
. ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']'.$show_message : '');
// evaluation
// evaluation
case 'E' :
$cat = new Category();
$course_id = CourseManager::get_course_by_category($_GET['selectcat']);
$show_message = $cat->show_message_resource_delete($course_id);
$show_message = false;
$course_id = 0;
if (isset($_GET['selectcat'])) {
$course_id = CourseManager::get_course_by_category(
$_GET['selectcat']
);
$show_message = $cat->show_message_resource_delete($course_id);
}
// course/platform admin can go to the view_results page
if (api_is_allowed_to_edit() && $show_message===false) {
if ($item->get_type() == 'presence') {
return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>';
} else {
return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>&nbsp;'.Display::label(get_lang('Evaluation'));
}

@ -364,7 +364,7 @@ if ($intro_dispCommand) {
}
}
$introduction_section .= '<div class="col-md-12">';
$introduction_section .= '<div class="col-md-12">';
if ($intro_dispDefault) {
if (!empty($intro_content)) {

@ -3954,7 +3954,7 @@ function api_get_item_property_list_by_tool_by_user(
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$session_condition = ' AND session_id = '.$session_id;
if (empty($session_id)) {
$session_condition = " (session_id = 0 OR session_id IS NULL) ";
$session_condition = " AND (session_id = 0 OR session_id IS NULL) ";
}
$sql = "SELECT * FROM $item_property_table
WHERE
@ -3970,6 +3970,7 @@ function api_get_item_property_list_by_tool_by_user(
$list[] = $row;
}
}
return $list;
}
@ -3992,10 +3993,14 @@ function api_get_item_property_id($course_code, $tool, $ref, $sessionId = 0)
$course_id = $course_info['real_id'];
$sessionCondition = " AND session_id = $sessionId ";
if (empty($sessionId)) {
$sessionCondition = " (session_id = 0 OR session_id IS NULL) ";
$sessionCondition = " AND (session_id = 0 OR session_id IS NULL) ";
}
$sql = "SELECT id FROM $tableItemProperty
WHERE c_id = $course_id AND tool = '$tool' AND ref = $ref $sessionCondition";
WHERE
c_id = $course_id AND
tool = '$tool' AND
ref = $ref
$sessionCondition";
$rs = Database::query($sql);
$item_property_id = '';
if (Database::num_rows($rs) > 0) {

@ -2088,7 +2088,6 @@ class CourseManager
return;
}
$sql = "SELECT * FROM $table_course WHERE code = '" . $codeFiltered . "'";
$res = Database::query($sql);
$course = Database::fetch_array($res);
@ -2101,7 +2100,7 @@ class CourseManager
$url_id = api_get_current_access_url_id();
}
UrlManager::delete_url_rel_course($courseId, $url_id);
$count = UrlManager::getcountUrlRelCourse($courseId);
$count = UrlManager::getCountUrlRelCourse($courseId);
}
if ($count == 0) {
@ -2109,6 +2108,22 @@ class CourseManager
$course_tables = AddCourse::get_course_tables();
// Cleaning group categories
$groupCategories = GroupManager::get_categories($course['code']);
if (!empty($groupCategories)) {
foreach ($groupCategories as $category) {
GroupManager::delete_category($category['id'], $course['code']);
}
}
// Cleaning groups
$groups = GroupManager::get_groups();
if (!empty($groups)) {
$groupList = array_column($groups, 'id');
GroupManager::delete_groups($groupList);
}
// Cleaning c_x tables
if (!empty($courseId)) {

@ -1,20 +1,15 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains a class used like library, provides functions for dashboard.
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.dashboard
*/
/**
* DashboardManager can be used to manage dashboard
* author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.dashboard
*/
class DashboardManager
{
/**
* contructor
* Constructor
*/
public function __construct()
{
@ -68,10 +63,14 @@ class DashboardManager
}
echo '</tr>';
} else {
echo Display::tag(
'tr',
Display::tag('td', get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file) , array('colspan'=>'3'))
);
if ($testplugin != 'css') {
echo Display::tag(
'tr',
Display::tag('td',
get_lang('CheckFilePermissions') . ' ' . Security::remove_XSS($plugin_info_file),
array('colspan' => '3'))
);
}
}
}
@ -165,7 +164,7 @@ class DashboardManager
foreach ($extra_user_data as $key => $user_data) {
$user_id = $key;
$user_block_data = self::get_user_block_data($user_id);
$user_block_id = array_keys($user_block_data);
$user_block_id = array_keys($user_block_data);
// clean disabled block data
foreach ($user_block_id as $block_id) {

@ -3807,7 +3807,13 @@ class DocumentManager
if (!$visible) {
return false;
} else {
return self::check_visibility_tree($document_data['parent_id'], $course_code, $session_id, $user_id, $groupId);
return self::check_visibility_tree(
$document_data['parent_id'],
$course_code,
$session_id,
$user_id,
$groupId
);
}
}
} else {

@ -432,20 +432,20 @@ class GroupManager
$sql = "DELETE FROM ".$forum_table."
WHERE c_id = $course_id AND forum_of_group IN ('".implode("' , '", $group_ids)."')";
$result = Database::query($sql);
Database::query($sql);
// Delete item properties of this group.
$itemPropertyTable = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql = "DELETE FROM ".$itemPropertyTable."
WHERE c_id = $course_id AND to_group_id IN ('".implode("' , '", $group_ids)."')";
$result = Database::query($sql);
Database::query($sql);
// delete the groups
$sql = "DELETE FROM ".$group_table."
WHERE c_id = $course_id AND id IN ('".implode("' , '", $group_ids)."')";
Database::query($sql);
return Database::affected_rows($result);
return true;
}
/**
@ -657,7 +657,8 @@ class GroupManager
$course_id = $course_info['real_id'];
$table_group_cat = Database :: get_course_table(TABLE_GROUP_CATEGORY);
$sql = "SELECT * FROM $table_group_cat
WHERE c_id = $course_id ORDER BY display_order";
WHERE c_id = $course_id
ORDER BY display_order";
$res = Database::query($sql);
$cats = array ();
while ($cat = Database::fetch_array($res)) {
@ -759,7 +760,7 @@ class GroupManager
public static function delete_category($cat_id, $course_code = null)
{
$course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id'];
$course_id = $course_info['real_id'];
$table_group = Database:: get_course_table(TABLE_GROUP);
$table_group_cat = Database:: get_course_table(TABLE_GROUP_CATEGORY);
@ -774,7 +775,8 @@ class GroupManager
}
self :: delete_groups($groups_to_delete);
}
$sql = "DELETE FROM $table_group_cat WHERE c_id = $course_id AND id='".$cat_id."'";
$sql = "DELETE FROM $table_group_cat
WHERE c_id = $course_id AND id='".$cat_id."'";
Database::query($sql);
}

@ -995,7 +995,7 @@ function api_sort_by_first_name($language = null) {
* This function is aimed at replacing the function mb_convert_encoding() for human-language strings.
* @link http://php.net/manual/en/function.mb-convert-encoding
*/
function api_convert_encoding($string, $to_encoding, $from_encoding = null)
function api_convert_encoding($string, $to_encoding, $from_encoding = 'UTF-8')
{
return mb_convert_encoding($string, $to_encoding, $from_encoding);
}

@ -3674,11 +3674,11 @@ class Tracking
/**
* Get inactive students in course
* @param int $courseId
* @param string Since login course date (optional, default = 'never')
* @param int Session id (optional)
* @return array Inactives users
* @param string $since Since login course date (optional, default = 'never')
* @param int $session_id (optional)
* @return array Inactive users
*/
public static function get_inactives_students_in_course($course_code, $since = 'never', $session_id=0)
public static function getInactiveStudentsInCourse($courseId, $since = 'never', $session_id = 0)
{
$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -3686,9 +3686,11 @@ class Tracking
$tableCourse = Database :: get_main_table(TABLE_MAIN_COURSE);
$inner = '';
$now = api_get_utc_datetime();
$courseId = intval($courseId);
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
if (empty($courseId)) {
return false;
}
if ($session_id != 0) {
$inner = ' INNER JOIN '.$tbl_session_course_user.' session_course_user
@ -3721,6 +3723,7 @@ class Tracking
while($user = Database::fetch_array($rs)) {
$inactive_users[] = $user['user_id'];
}
return $inactive_users;
}
@ -3794,7 +3797,6 @@ class Tracking
$sql_type = "SELECT id, lp_type FROM $lp_table WHERE c_id = $course_id";
$rs_type=Database::query($sql_type);
$average_data=0;
$count_loop=0;
$average_data_sum = 0;
$lp_list = array();
@ -3803,7 +3805,8 @@ class Tracking
if ($row_type['lp_type']==1) {
//lp chamilo
$sql = "SELECT id FROM $lp_view_table WHERE c_id = $course_id AND user_id = '".intval($user_id)."' and lp_id='".$row_type['id']."'";
$sql = "SELECT id FROM $lp_view_table
WHERE c_id = $course_id AND user_id = '".intval($user_id)."' and lp_id='".$row_type['id']."'";
$rs_last_lp_view_id = Database::query($sql);
$lp_view_id = intval(Database::result($rs_last_lp_view_id,0,'id'));
@ -4006,7 +4009,6 @@ class Tracking
),
);
$error_sql = '';
foreach ($tables as $tableName => $fields) {
//If session is defined, add it to query
$where = '';
@ -4052,6 +4054,7 @@ class Tracking
}
}
}
return $data;
}
@ -4105,9 +4108,7 @@ class Tracking
{
$course_code = Database::escape_string($course_code);
$course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id'];
$data = array();
$TABLETRACK_LINKS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
@ -4121,10 +4122,11 @@ class Tracking
$sql = "SELECT cl.title, cl.url,count(DISTINCT sl.links_user_id), count(cl.title) as count_visits
FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
WHERE cl.c_id = $course_id AND
sl.links_link_id = cl.id
AND sl.c_id = $course_id
$condition_session
WHERE
cl.c_id = $course_id AND
sl.links_link_id = cl.id AND
sl.c_id = $course_id
$condition_session
GROUP BY cl.title, cl.url
ORDER BY count_visits DESC
LIMIT 0, 3";
@ -4465,11 +4467,11 @@ class Tracking
$html .= '<table class="data_table" width="100%">';
$html .= '<tr>
'.Display::tag('th', get_lang('Session'), array('width'=>'300px')).'
'.Display::tag('th', get_lang('PublishedExercises'), array('width'=>'300px')).'
'.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).'
'.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Session'), array('width'=>'300px')).'
'.Display::tag('th', get_lang('PublishedExercises'), array('width'=>'300px')).'
'.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).'
'.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).'
'.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
</tr>';
foreach ($course_in_session as $my_session_id => $session_data) {
@ -4520,7 +4522,7 @@ class Tracking
$average = ExerciseLib::get_average_score_by_course($courseInfo['real_id'], $my_session_id);
$all_exercises += $count_exercises;
$all_unanswered_exercises_by_user += $count_exercises - $answered_exercises;
$all_average += $average;
$all_average += $average;
}
$all_average = $all_average / count($course_list);
@ -5589,7 +5591,6 @@ class Tracking
foreach ($courses as $courseIdx => $courseData) {
$where = '';
$whereParams = array();
$whereCourseCode = $courseData['code'];
$whereSessionParams = '';
if (count($sessions > 0)) {
foreach ($sessions as $sessionIdx => $sessionData) {
@ -6426,10 +6427,26 @@ class TrackingCourseLog
$user['student_score'] = $avg_student_score;
}
$user['count_assignments'] = Tracking::count_student_assignments($user['user_id'], $course_code, $session_id);
$user['count_messages'] = Tracking::count_student_messages($user['user_id'], $course_code, $session_id);
$user['first_connection'] = Tracking::get_first_connection_date_on_the_course($user['user_id'], $courseId, $session_id);
$user['last_connection'] = Tracking::get_last_connection_date_on_the_course($user['user_id'], $courseInfo, $session_id);
$user['count_assignments'] = Tracking::count_student_assignments(
$user['user_id'],
$course_code,
$session_id
);
$user['count_messages'] = Tracking::count_student_messages(
$user['user_id'],
$course_code,
$session_id
);
$user['first_connection'] = Tracking::get_first_connection_date_on_the_course(
$user['user_id'],
$courseId,
$session_id
);
$user['last_connection'] = Tracking::get_last_connection_date_on_the_course(
$user['user_id'],
$courseInfo,
$session_id
);
// we need to display an additional profile field
$user['additional'] = '';
@ -6547,7 +6564,6 @@ class TrackingUserLog
ORDER BY YEAR(access_date),MONTH(access_date) ASC";
echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
//$results = getManyResults2Col($sql);
$results = getManyResults3Col($sql);
echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
@ -6710,9 +6726,9 @@ class TrackingUserLog
if (substr($view,2,1) == '1') {
$new_view = substr_replace($view,'0',2,1);
echo "<tr>
<td valign='top'>
<font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('WorkUploads')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>]
</td>
<td valign='top'>
<font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('WorkUploads')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>]
</td>
</tr>";
echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>";
$sql = "SELECT u.upload_date, w.title, w.author,w.url
@ -6758,9 +6774,9 @@ class TrackingUserLog
$new_view = substr_replace($view,'1',2,1);
echo "
<tr>
<td valign='top'>
+<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a>
</td>
<td valign='top'>
+<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a>
</td>
</tr>
";
}
@ -6785,11 +6801,11 @@ class TrackingUserLog
";
echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>";
$sql = "SELECT cl.title, cl.url
FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
WHERE sl.links_link_id = cl.id
AND sl.c_id = $courseId
AND sl.links_user_id = ".intval($user_id)."
GROUP BY cl.title, cl.url";
FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
WHERE sl.links_link_id = cl.id
AND sl.c_id = $courseId
AND sl.links_user_id = ".intval($user_id)."
GROUP BY cl.title, cl.url";
echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
$results = StatsUtils::getManyResults2Col($sql);
echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
@ -6815,9 +6831,9 @@ class TrackingUserLog
$new_view = substr_replace($view,'1',3,1);
echo "
<tr>
<td valign='top'>
+<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a>
</td>
<td valign='top'>
+<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a>
</td>
</tr>
";
}
@ -6834,7 +6850,7 @@ class TrackingUserLog
public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0)
{
// protect data
$user_id = intval($user_id);
$user_id = intval($user_id);
$courseId = api_get_course_int_id($course_code);
$session_id = intval($session_id);
@ -6843,19 +6859,19 @@ class TrackingUserLog
$new_view = substr_replace($view,'0',4,1);
echo "
<tr>
<td valign='top'>
<font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('DocumentsAccess')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>]
</td>
<td valign='top'>
<font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('DocumentsAccess')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>]
</td>
</tr>
";
echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>";
$sql = "SELECT down_doc_path
FROM $downloads_table
WHERE c_id = $courseId
AND down_user_id = $user_id
AND down_session_id = $session_id
GROUP BY down_doc_path";
FROM $downloads_table
WHERE c_id = $courseId
AND down_user_id = $user_id
AND down_session_id = $session_id
GROUP BY down_doc_path";
echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
$results = StatsUtils::getManyResults1Col($sql);
@ -6882,9 +6898,9 @@ class TrackingUserLog
$new_view = substr_replace($view,'1',4,1);
echo "
<tr>
<td valign='top'>
+<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a>
</td>
<td valign='top'>
+<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a>
</td>
</tr>
";
}

@ -15,9 +15,9 @@ class UrlManager
*
* @author Julio Montoya <gugli100@gmail.com>,
*
* @param string The URL of the site
* @param string The description of the site
* @param int is active or not
* @param string $url The URL of the site
* @param string $description The description of the site
* @param int $active is active or not
* @return boolean if success
*/
public static function add($url, $description, $active)
@ -31,6 +31,7 @@ class UrlManager
created_by = '".api_get_user_id()."',
tms = FROM_UNIXTIME(".$tms.")";
$result = Database::query($sql);
return $result;
}
@ -38,9 +39,10 @@ class UrlManager
* Updates an URL access
* @author Julio Montoya <gugli100@gmail.com>,
*
* @param int The url id
* @param string The description of the site
* @param int is active or not
* @param int $url_id The url id
* @param string $url
* @param string $description The description of the site
* @param int $active is active or not
* @return boolean if success
*/
public static function update($url_id, $url, $description, $active)
@ -55,6 +57,7 @@ class UrlManager
created_by = '".api_get_user_id()."',
tms = FROM_UNIXTIME(".$tms.")
WHERE id = '$url_id'";
$result = Database::query($sql);
return $result;
@ -63,7 +66,8 @@ class UrlManager
/**
* Deletes an url
* @author Julio Montoya
* @param int url id
* @param int $id url id
*
* @return boolean true if success
* */
public static function delete($id)
@ -78,12 +82,14 @@ class UrlManager
/**
* @param string $url
*
* @return int
*/
public static function url_exist($url)
{
$table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id FROM $table WHERE url = '".Database::escape_string($url)."' ";
$sql = "SELECT id FROM $table
WHERE url = '".Database::escape_string($url)."' ";
$res = Database::query($sql);
$num = Database::num_rows($res);
@ -92,11 +98,14 @@ class UrlManager
/**
* @param string $url
*
* @return int
*/
public static function url_id_exist($url)
{
if (empty($url)) { return false; }
if (empty($url)) {
return false;
}
$table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id FROM $table WHERE id = ".intval($url)."";
$res = Database::query($sql);
@ -129,7 +138,9 @@ class UrlManager
public static function get_url_data()
{
$table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id, url, description, active FROM $table ORDER BY id";
$sql = "SELECT id, url, description, active
FROM $table
ORDER BY id";
$res = Database::query($sql);
$urls = array ();
while ($url = Database::fetch_array($res)) {
@ -148,7 +159,9 @@ class UrlManager
public static function get_url_data_from_id($url_id)
{
$table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id, url, description, active FROM $table WHERE id = ".intval($url_id);
$sql = "SELECT id, url, description, active
FROM $table
WHERE id = ".intval($url_id);
$res = Database::query($sql);
$row = Database::fetch_array($res);
return $row;
@ -220,6 +233,7 @@ class UrlManager
* Gets the number of rows with a specific course_code in access_url_rel_course table
* @author Yoselyn Castillo
* @param int $courseId
*
* @return int Database::num_rows($res);
**/
public static function getCountUrlRelCourse($courseId)
@ -237,7 +251,8 @@ class UrlManager
/**
* Gets the inner join of access_url and the session table
* @author Julio Montoya
* @param int access url id
* @param int $access_url_id access url id
*
* @return array Database::store_result of the result
*
**/
@ -257,8 +272,9 @@ class UrlManager
$where
ORDER BY name, id";
$result=Database::query($sql);
$sessions=Database::store_result($result);
$result = Database::query($sql);
$sessions = Database::store_result($result);
return $sessions;
}
@ -266,7 +282,8 @@ class UrlManager
* Gets the inner join of access_url and the usergroup table
*
* @author Julio Montoya
* @param int access url id
* @param int $access_url_id
*
* @return array Database::store_result of the result
**/
public static function get_url_rel_usergroup_data($access_url_id = null)
@ -296,10 +313,9 @@ class UrlManager
* Gets the inner join of access_url and the usergroup table
*
* @author Julio Montoya
* @param int access url id
* @param int $access_url_id
* @return array Database::store_result of the result
**/
public static function getUrlRelCourseCategory($access_url_id = null)
{
$table_url_rel = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
@ -398,6 +414,7 @@ class UrlManager
usergroup_id = ".intval($userGroupId);
$result = Database::query($sql);
$num = Database::num_rows($result);
return $num;
}
@ -413,9 +430,13 @@ class UrlManager
$table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$session_id = intval($session_id);
$url_id = intval($url_id);
$sql= "SELECT session_id FROM $table_url_rel_session WHERE access_url_id = ".intval($url_id)." AND session_id = ".Database::escape_string($session_id);
$result = Database::query($sql);
$num = Database::num_rows($result);
$sql = "SELECT session_id FROM $table_url_rel_session
WHERE
access_url_id = ".intval($url_id)." AND
session_id = ".Database::escape_string($session_id);
$result = Database::query($sql);
$num = Database::num_rows($result);
return $num;
}
@ -476,10 +497,11 @@ class UrlManager
$sql = "INSERT INTO $table_url_rel_course
SET c_id = '".$courseId."', access_url_id = ".intval($url_id);
$result = Database::query($sql);
if($result)
$result_array[$url_id][$course_code]=1;
else
$result_array[$url_id][$course_code]=0;
if ($result) {
$result_array[$url_id][$course_code] = 1;
} else {
$result_array[$url_id][$course_code] = 0;
}
}
}
}
@ -491,8 +513,8 @@ class UrlManager
/**
* Add a group of user group into a group of URLs
* @author Julio Montoya
* @param array of course ids
* @param array of url_ids
* @param array $userGroupList of course ids
* @param array $urlList of url_ids
* @return array
**/
public static function addUserGroupListToUrl($userGroupList, $urlList)
@ -642,8 +664,9 @@ class UrlManager
/**
* Add a user into a url
* @author Julio Montoya
* @param user_id
* @param url_id
* @param $user_id
* @param $url_id
*
* @return boolean true if success
* */
public static function add_user_to_url($user_id, $url_id = 1)
@ -655,7 +678,8 @@ class UrlManager
$count = UrlManager::relation_url_user_exist($user_id, $url_id);
$result = true;
if (empty($count)) {
$sql = "INSERT INTO $table_url_rel_user (user_id, access_url_id) VALUES ('".intval($user_id)."', '".intval($url_id)."') ";
$sql = "INSERT INTO $table_url_rel_user (user_id, access_url_id)
VALUES ('".intval($user_id)."', '".intval($url_id)."') ";
$result = Database::query($sql);
}
@ -665,6 +689,7 @@ class UrlManager
/**
* @param int $courseId
* @param int $url_id
*
* @return resource
*/
public static function add_course_to_url($courseId, $url_id = 1)
@ -687,6 +712,7 @@ class UrlManager
* Inserts a session to a URL (access_url_rel_session table)
* @param int Session ID
* @param int URL ID
*
* @return bool True on success, false session already exists or insert failed
*/
public static function add_session_to_url($session_id, $url_id = 1)
@ -713,6 +739,7 @@ class UrlManager
* @author Julio Montoya
* @param int user id
* @param int url id
*
* @return boolean true if success
* */
public static function delete_url_rel_user($user_id, $url_id)
@ -731,15 +758,16 @@ class UrlManager
/**
* Deletes an url and course relationship
* @author Julio Montoya
* @param id $courseId
* @param int $urlId
* @param int $courseId
* @param int $urlId
*
* @return boolean true if success
* */
public static function delete_url_rel_course($courseId, $urlId)
{
$table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql= "DELETE FROM $table_url_rel_course
WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($url_id)." ";
WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)." ";
$result = Database::query($sql);
return $result;
@ -750,6 +778,7 @@ class UrlManager
* @author Julio Montoya
* @param int $userGroupId
* @param int $urlId
*
* @return boolean true if success
* */
public static function delete_url_rel_usergroup($userGroupId, $urlId)
@ -759,6 +788,7 @@ class UrlManager
WHERE usergroup_id = '".intval($userGroupId)."' AND
access_url_id=".intval($urlId)." ";
$result = Database::query($sql);
return $result;
}
@ -767,6 +797,7 @@ class UrlManager
* @author Julio Montoya
* @param int $userGroupId
* @param int $urlId
*
* @return boolean true if success
* */
public static function deleteUrlRelCourseCategory($userGroupId, $urlId)
@ -776,16 +807,16 @@ class UrlManager
WHERE course_category_id = '".intval($userGroupId)."' AND
access_url_id=".intval($urlId)." ";
$result = Database::query($sql);
return $result;
}
/**
* Deletes an url and session relationship
* @author Julio Montoya
* @param char course code
* @param int url id
*
* @return boolean true if success
* */
public static function delete_url_rel_session($session_id, $url_id)
@ -794,6 +825,7 @@ class UrlManager
$sql= "DELETE FROM $table_url_rel_session
WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)." ";
$result = Database::query($sql,'ASSOC');
return $result;
}

@ -148,25 +148,6 @@ class IndexManager
return false;
}
/**
* Displays the right-hand menu for anonymous users:
* login form, useful links, help section
* Warning: function defines globals
* @version 1.0.1
* @todo does $_plugins need to be global?
*/
function display_anonymous_right_menu()
{
global $loginFailed, $_user;
$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview');
$current_user_id = api_get_user_id();
echo self::set_login_form(false);
echo self::return_teacher_link();
echo self::return_notice();
}
function return_teacher_link()
{
$html = '';
@ -279,7 +260,7 @@ class IndexManager
function return_notice()
{
$sys_path = api_get_path(SYS_PATH);
$sys_path = api_get_path(SYS_PATH);
$user_selected_language = api_get_interface_language();
$html = '';
@ -493,8 +474,11 @@ class IndexManager
LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses)
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = t3.id)
WHERE url_rel_course.access_url_id = $url_access_id AND t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")."
GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name";
WHERE
url_rel_course.access_url_id = $url_access_id AND
t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")."
GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count
ORDER BY t1.tree_pos, t1.name";
}
}
@ -587,7 +571,7 @@ class IndexManager
// 3. the user is logged in and the user is subscribed to the course and the course visibility is not COURSE_VISIBILITY_CLOSED;
// 4. the user is logged in and the user is course admin of te course (regardless of the course visibility setting);
// 5. the user is the platform admin api_is_platform_admin().
//
$courses_shown++;
$courses_list_string .= "<li>";
if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
@ -629,13 +613,7 @@ class IndexManager
// 2.
if ($user_identified && !array_key_exists($course['code'], $courses_of_user)) {
if ($course['subscribe'] == '1') {
/*$courses_list_string .= '<form action="main/auth/courses.php?action=subscribe&category='.Security::remove_XSS($_GET['category']).'" method="post">';
$courses_list_string .= '<input type="hidden" name="sec_token" value="'.$stok.'">';
$courses_list_string .= '<input type="hidden" name="subscribe" value="'.$course['code'].'" />';
$courses_list_string .= '<input type="image" name="unsub" src="main/img/enroll.gif" alt="'.get_lang('Subscribe').'" />'.get_lang('Subscribe').'</form>';
*/
$courses_list_string .= '&nbsp;<a class="btn btn-primary" href="main/auth/courses.php?action=subscribe_course&amp;sec_token='.$stok.'&amp;subscribe_course='.$course['code'].'&amp;category_code='.Security::remove_XSS($_GET['category']).'">'.get_lang('Subscribe').'</a><br />';
$courses_list_string .= '&nbsp;<a class="btn btn-primary" href="main/auth/courses.php?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&category_code='.Security::remove_XSS($_GET['category']).'">'.get_lang('Subscribe').'</a><br />';
} else {
$courses_list_string .= '<br />'.get_lang('SubscribingNotAllowed');
}
@ -651,7 +629,9 @@ class IndexManager
$result .= $courses_list_string;
}
if ($category != '') {
$result .= '<p><a href="'.api_get_self().'"> ' . Display :: return_icon('back.png', get_lang('BackToHomePage')) . get_lang('BackToHomePage') . '</a></p>';
$result .= '<p><a href="'.api_get_self().'"> ' .
Display :: return_icon('back.png', get_lang('BackToHomePage')).
get_lang('BackToHomePage') . '</a></p>';
}
return $result;
}
@ -666,7 +646,8 @@ class IndexManager
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
// Secondly we select the courses that are in a category (user_course_cat <> 0) and sort these according to the sort of the category
// Secondly we select the courses that are in a category (user_course_cat <> 0)
// and sort these according to the sort of the category
$user_id = intval($user_id);
$sql_select_courses = "SELECT
course.code k,
@ -710,7 +691,8 @@ class IndexManager
/**
* @todo use the template system
*/
function show_right_block($title, $content, $id = null, $params = null, $idAccordion = null, $idCollpase = null) {
function show_right_block($title, $content, $id = null, $params = null, $idAccordion = null, $idCollpase = null)
{
if (!empty($idAccordion)) {
$html = null;
$html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL;
@ -889,6 +871,7 @@ class IndexManager
'profile',
'profileCollapse'
);
return $html;
}
@ -1561,7 +1544,7 @@ class IndexManager
}
/**
* Return HTML code for personnal user course category
* Return HTML code for personal user course category
* @param $id
* @param $title
* @return string
@ -1577,6 +1560,7 @@ class IndexManager
array('class' => 'sessionView'),
ICON_SIZE_LARGE
);
return "<div class='session-view-user-category'>$icon<span>$title</span></div>";
}
@ -1757,5 +1741,4 @@ class IndexManager
{
setcookie('defaultMyCourseView'.$userId, $view);
}
}

@ -4,9 +4,7 @@
* Special reporting page for admins
* @package chamilo.reporting
*/
/**
* Code
*/
ob_start();
$cidReset = true;
@ -30,23 +28,15 @@ $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
/**
* MAIN PART
*/
/*
* liste nominative avec coordonnies et lien vers les cours et les stagiaires dont il est le responsable.
*/
if (isset($_POST['export'])) {
$order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
} else {
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
}
$sql_admins = "SELECT user.user_id,lastname,firstname,email
FROM $tbl_user as user, $tbl_admin as admin
WHERE admin.user_id=user.user_id" . $order_clause;
$result_admins = Database::query($sql_admins);
$sql = "SELECT user.user_id,lastname,firstname,email
FROM $tbl_user as user, $tbl_admin as admin
WHERE admin.user_id=user.user_id" . $order_clause;
$result_admins = Database::query($sql);
if (api_is_western_name_order()) {
echo '<table class="data_table"><tr><th>' . get_lang('FirstName') . '</th><th>' . get_lang('LastName') . '</th><th>' . get_lang('Email') . '</th></tr>';

@ -1,117 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Old reporting file - probably not used anymore
* @package chamilo.reporting
*/
/**
* Code
*/
// TODO: Is this file used?
$nameTools = 'Reussite';
$cidReset = true;
require '../inc/global.inc.php';
$this_section = "session_my_space";
api_block_anonymous_users();
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
Display :: display_header($nameTools);
// Database Table Definitions
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_track_exercice = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
/*
===============================================================================
MAIN CODE
===============================================================================
*/
if (!empty($_GET['session'])) {
$sql_session = "SELECT name,id
FROM $tbl_session
ORDER BY name ASC";
$result_session = Database::query($sql_session);
echo "<a href='".api_get_self()."'>".get_lang('MoyCourse')."</a>";
echo "<br /><br />";
if (Database::num_rows($result_session) > 0) {
echo '<table class="data_table"><tr><th>'.get_lang('Session').'</th><th>'.get_lang('MoyenneTest').'</th><th>'.get_lang('MoyenneExamen').'</th></tr>';
while ($session = Database::fetch_array($result_session)) {
$sql_course = "SELECT title, code, course.id
FROM $tbl_course as course
INNER JOIN $tbl_session_course AS rel_course
ON course.id = rel_course.c_id
AND rel_course.session_id = ".$session['id']."
ORDER BY title ASC";
$result_course = Database::query($sql_course);
$total_result = 0;
$total_weighting = 0;
while ($course = Database::fetch_array($result_course)) {
$sql_moy_test = "SELECT exe_result,exe_weighting
FROM $tbl_track_exercice
WHERE c_id = ".$course['id'];
$result_moy_test = Database::query($sql_moy_test);
$result = 0;
$weighting = 0;
while ($moy_test = Database::fetch_array($result_moy_test)) {
$result = $result + $moy_test['exe_result'];
$weighting = $weighting + $moy_test['exe_weighting'];
}
$total_result = $total_result + $result;
$total_weighting = $total_weighting + $weighting;
}
if ($total_weighting != 0) {
$moyenne_test = round(($total_result * 100) / $total_weighting);
} else {
$moyenne_test = null;
}
echo '<tr><td>'.$session['name'].'</td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td><td> </td></tr>';
}
echo '</table>';
} else {
echo get_lang('NoSession');
}
} else {
$sql_course = "SELECT title, code, id
FROM $tbl_course as course
ORDER BY title ASC";
$result_course = Database::query($sql_course);
echo "<a href='".api_get_self()."?session=true'>".get_lang('MoySession')."</a>";
echo "<br /><br />";
if (Database::num_rows($result_course) > 0) {
echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('MoyenneTest').'</th><th>'.get_lang('MoyenneExamen').'</th></tr>';
while ($course= Database::fetch_array($result_course)) {
$sql_moy_test = "SELECT exe_result,exe_weighting
FROM $tbl_track_exercice
WHERE c_id = ".$course['id'];
$result_moy_test = Database::query($sql_moy_test);
$result = 0;
$weighting = 0;
while ($moy_test = Database::fetch_array($result_moy_test)) {
$result = $result + $moy_test['exe_result'];
$weighting = $weighting + $moy_test['exe_weighting'];
}
if ($weighting != 0) {
$moyenne_test = round(($result * 100) / $weighting);
} else {
$moyenne_test = null;
}
echo '<tr><td>'.$course['title'].'</td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td><td> </td></tr>';
}
echo '</table>';
} else {
echo get_lang('NoCourse');
}
}
Display :: display_footer();

@ -67,24 +67,22 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
$actionsLeft .= $item;
}
}
if (count($a_sessions) > 0) {
$actionsRight = Display::url(
Display::return_icon('printer.png', get_lang('Print'), array(), 32),
'javascript: void(0);',
array('onclick'=>'javascript: window.print();')
);
$actionsRight .= Display::url(
$actionsRight .= Display::url(
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32),
api_get_self().'?export=csv'
);
}
$toolbar = Display::toolbarAction('toolbar-session', $content = array( 0 => $actionsLeft, 1 => $actionsRight ));
echo $toolbar;
echo Display::page_header(get_lang('YourSessionsList'));
} else {

@ -47,6 +47,7 @@ function get_count_users()
null,
api_is_student_boss() ? null : STUDENT
);
return $count;
}

@ -6,9 +6,7 @@
* @package chamilo.reporting
* Created on 26 julio 2008 by Julio Montoya gugli100@gmail.com
*/
/**
* Main script
*/
$cidReset = true;
require_once '../inc/global.inc.php';
@ -28,27 +26,21 @@ if (isset($_GET['id_session']) && $_GET['id_session'] != '') {
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
/*
// Checking whether the current coach is the admin coach.
if (!api_is_coach()) {
api_not_allowed(true);
}
*/
// Checking whether the current coach is the admin coach.
if (api_get_setting('add_users_by_coach') == 'true') {
if (!api_is_platform_admin()) {
if (isset($_REQUEST['id_session'])) {
$id_session = intval($_REQUEST['id_session']);
$sql = 'SELECT id_coach FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
$rs = Database::query($sql);
if (Database::result($rs, 0, 0) != $_user['user_id']) {
api_not_allowed(true);
}
} else {
api_not_allowed(true);
}
}
if (!api_is_platform_admin()) {
if (isset($_REQUEST['id_session'])) {
$id_session = intval($_REQUEST['id_session']);
$sql = 'SELECT id_coach FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).'
WHERE id='.$id_session;
$rs = Database::query($sql);
if (Database::result($rs, 0, 0) != $_user['user_id']) {
api_not_allowed(true);
}
} else {
api_not_allowed(true);
}
}
} else {
api_not_allowed(true);
}
@ -56,40 +48,40 @@ if (api_get_setting('add_users_by_coach') == 'true') {
set_time_limit(0);
if ($_POST['formSent'] && $_FILES['import_file']['size'] !== 0) {
$file_type = $_POST['file_type'];
$id_session = intval($_POST['id_session']);
if ($file_type == 'csv') {
$users = MySpace::parse_csv_data($_FILES['import_file']['tmp_name']);
} else {
$users = MySpace::parse_xml_data($_FILES['import_file']['tmp_name']);
}
if (count($users) > 0) {
$results = MySpace::validate_data($users);
$errors = $results['errors'];
$users = $results['users'];
if (count($errors) == 0) {
if (!empty($id_session)) {
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
// Selecting all the courses from the session id requested.
$sql = "SELECT c_id FROM $tbl_session_rel_course WHERE session_id ='$id_session'";
$result = Database::query($sql);
$course_list = array();
while ($row = Database::fetch_array($result)) {
$course_list[] = $row['c_id'];
}
$errors = MySpace::get_user_creator($users);
$users = MySpace::check_all_usernames($users, $course_list, $id_session);
if (count($errors) == 0) {
MySpace::save_data($users, $course_list, $id_session);
}
} else {
header('Location: course.php?id_session='.$id_session.'&action=error_message&message='.urlencode(get_lang('NoSessionId')));
}
}
} else {
header('Location: course.php?id_session='.$id_session.'&action=error_message&message='.urlencode(get_lang('NoUsersRead')));
}
$file_type = $_POST['file_type'];
$id_session = intval($_POST['id_session']);
if ($file_type == 'csv') {
$users = MySpace::parse_csv_data($_FILES['import_file']['tmp_name']);
} else {
$users = MySpace::parse_xml_data($_FILES['import_file']['tmp_name']);
}
if (count($users) > 0) {
$results = MySpace::validate_data($users);
$errors = $results['errors'];
$users = $results['users'];
if (count($errors) == 0) {
if (!empty($id_session)) {
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
// Selecting all the courses from the session id requested.
$sql = "SELECT c_id FROM $tbl_session_rel_course WHERE session_id ='$id_session'";
$result = Database::query($sql);
$course_list = array();
while ($row = Database::fetch_array($result)) {
$course_list[] = $row['c_id'];
}
$errors = MySpace::get_user_creator($users);
$users = MySpace::check_all_usernames($users, $course_list, $id_session);
if (count($errors) == 0) {
MySpace::save_data($users, $course_list, $id_session);
}
} else {
header('Location: course.php?id_session='.$id_session.'&action=error_message&message='.urlencode(get_lang('NoSessionId')));
}
}
} else {
header('Location: course.php?id_session='.$id_session.'&action=error_message&message='.urlencode(get_lang('NoUsersRead')));
}
}
Display :: display_header($tool_name);
@ -126,11 +118,6 @@ $defaults['sendMail'] = 0;
$defaults['file_type'] = 'xml';
$form->setDefaults($defaults);
$form->display();
/*
<?php echo implode('/',$defined_auth_sources); ?>
&lt;AuthSource&gt;<?php echo implode('/',$defined_auth_sources); ?>&lt;/AuthSource&gt;
*/
?>
<p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
@ -160,7 +147,4 @@ $form->display();
</pre>
</blockquote>
<?php
/*
FOOTER
*/
Display :: display_footer();

@ -5,20 +5,15 @@
* bootstraps chamilo api enough to make lp_list_search work.
* @package chamilo.search
*/
/**
* Code
*/
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
if (extension_loaded('xapian')) {
require_once api_get_path(LIBRARY_PATH).'system_announcements.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
//api_block_anonymous_users(); // only users who are logged in can proceed
if (extension_loaded('xapian')) {
require '../newscorm/lp_list_search.php';
} else {
Display::display_header(get_lang('Search'));
Display::display_error_message(get_lang('SearchXapianModuleNotInstalled'));
Display::display_footer();
exit;
Display::display_header(get_lang('Search'));
Display::display_error_message(get_lang('SearchXapianModuleNotInstalled'));
Display::display_footer();
exit;
}

@ -18,7 +18,8 @@ function get_suggestions_from_search_engine($q) {
if ($cid != -1) {
$sql_add = " AND course_code = '".$cid."' ";
}
$sql = "SELECT * FROM $table_sfv where value LIKE '%$q%'".$sql_add." ORDER BY course_code, tool_id, ref_id, field_id";
$sql = "SELECT * FROM $table_sfv where value LIKE '%$q%'".$sql_add."
ORDER BY course_code, tool_id, ref_id, field_id";
$sql_result = Database::query($sql);
$data = array();
$i = 0;
@ -39,7 +40,9 @@ function get_suggestions_from_search_engine($q) {
//natsort($item_ref_id);
$output = array();
$field_val = array();
$sql2 = "SELECT * FROM $table_sfv where course_code = '$cc' AND tool_id = '$ti' AND ref_id = '$ri' ORDER BY field_id";
$sql2 = "SELECT * FROM $table_sfv
WHERE course_code = '$cc' AND tool_id = '$ti' AND ref_id = '$ri'
ORDER BY field_id";
$res2 = Database::query($sql2);
// TODO this code doesn't manage multiple terms in one same field just yet (should duplicate results in this case)
$field_id = 0;

@ -36,7 +36,6 @@ function delete_friend (element_div) {
}
}
function search_image_social() {
var name_search = $("#id_search_image").attr("value");
$.ajax({
@ -59,7 +58,6 @@ function show_icon_delete(element_html) {
$(ident).attr("title","'.get_lang('Delete', '').'");
}
function hide_icon_delete(element_html) {
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
@ -82,9 +80,6 @@ $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends'));
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('friends');
$user_id = api_get_user_id();
$user_id = api_get_user_id();
$name_search = isset($_POST['search_name_q']) ? $_POST['search_name_q'] : null;
$number_friends = 0;

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com>
@ -43,13 +44,10 @@ $interbreadcrumb[]= array ('url' =>'#','name' => $nameTools);
$social_avatar_block = SocialManager::show_social_avatar_block('group_add');
$social_menu_block = SocialManager::show_social_menu('group_add');
$social_right_content = $form->returnForm();
$tpl = new Template(null);
SocialManager::setSocialUserBlock($tpl, $user_id, null, null);
$tpl->setHelp('Groups');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);

@ -31,8 +31,7 @@ if (empty($group_data)) {
$interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => 'group_view.php?id='.$group_id, 'name' => $group_data['name']);
//only group admins can edit the group
// only group admins can edit the group
if (!$usergroup->is_group_admin($group_id)) {
api_not_allowed();
}

@ -48,7 +48,6 @@ $form_sent = 0;
$errorMsg = $firstLetterUser = $firstLetterSession = '';
$UserList = $SessionList = array();
$users = $sessions = array();
$content = null;
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@ -135,7 +134,10 @@ if (!$friends) {
if (is_array($Users) && count($Users) > 0 ) {
foreach ($Users as $user) {
if ($user['group_id'] != $group_id) {
$nosessionUsersList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
$nosessionUsersList[$user['user_id']] = api_get_person_name(
$user['firstname'],
$user['lastname']
);
}
}
}

@ -18,6 +18,7 @@ if (api_get_setting('allow_social_tool') != 'true') {
$this_section = SECTION_SOCIAL;
$group_id = intval($_GET['id']);
$userGroup = new UserGroup();
$user_role = '';
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {

@ -14,8 +14,8 @@ if (api_get_setting('allow_social_tool') !='true') {
api_not_allowed();
}
$group_id = intval($_GET['id']);
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : null;
$group_id = intval($_GET['id']);
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : null;
$message_id = isset($_GET['msg_id']) ? intval($_GET['msg_id']) : null;
$usergroup = new UserGroup();
@ -105,7 +105,6 @@ if (isset($_POST['action'])) {
$message_id = $res;
}
$htmlHeadXtra[] = '<script>
var counter_image = 1;
@ -164,7 +163,7 @@ function validate_text_empty(str,msg) {
}
$(document).ready(function() {
if ( $("#msg_'.$message_id.'").length) {
if ($("#msg_'.$message_id.'").length) {
$("html,body").animate({
scrollTop: $("#msg_'.$message_id.'").offset().top
})

@ -138,7 +138,11 @@ if ($group_id != 0) {
Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'confirmation', false)
);
} else {
$usergroup->add_user_to_group($user_join, $group_id, GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER);
$usergroup->add_user_to_group(
$user_join,
$group_id,
GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER
);
Display::addFlash(
Display::return_message(get_lang('InvitationSent'), 'confirmation', false)
);

@ -23,7 +23,7 @@ $userGroup = new UserGroup();
$htmlHeadXtra[] = '
<script>
function denied_friend (element_input) {
function denied_friend(element_input) {
name_button=$(element_input).attr("id");
name_div_id="id_"+name_button.substring(13);
user_id=name_div_id.split("_");

@ -8,10 +8,10 @@
require_once '../inc/global.inc.php';
$isStudent = api_is_student();
$isStudentBosss = api_is_student_boss();
$isStudentBoss = api_is_student_boss();
$isDRH = api_is_drh();
if (!$isStudent && !$isStudentBosss && !$isDRH) {
if (!$isStudent && !$isStudentBoss && !$isDRH) {
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php');
exit;
}
@ -58,19 +58,15 @@ if ($isStudent) {
$courseImageThumb->resize(32, 32, 0);
$courseImageThumb->send_image($thumbSysPath);
}
$tableRow['courseImage'] = $thumbWebPath;
}
$tableRows[] = $tableRow;
}
$tplPath = 'skill/student_report.tpl';
} else if ($isStudentBosss) {
} else if ($isStudentBoss) {
$selectedStudent = isset($_REQUEST['student']) ? intval($_REQUEST['student']) : 0;
$tableRows = array();
$followedStudents = UserManager::getUsersFollowedByStudentBoss($userId);
foreach ($followedStudents as &$student) {

@ -170,7 +170,7 @@ function timeAgo() {
}
function register_friend(element_input) {
if(confirm("'.get_lang('AddToFriends').'")) {
if (confirm("'.get_lang('AddToFriends').'")) {
name_button=$(element_input).attr("id");
name_div_id="id_"+name_button.substring(13);
user_id=name_div_id.split("_");
@ -494,8 +494,7 @@ if ($show_full_profile) {
//$social_course_block = Display::panel($my_courses, get_lang('MyCourses'));
}
//Block Social Sessions
// Block Social Sessions
if (count($sessionList) > 0) {
//$social_session_block = $htmlSessionList;
$social_session_block = $sessionList;

@ -16,8 +16,8 @@ if (api_get_setting('allow_social_tool') != 'true') {
api_not_allowed();
}
$this_section = SECTION_SOCIAL;
$tool_name = get_lang('Search');
$this_section = SECTION_SOCIAL;
$tool_name = get_lang('Search');
$interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork'));
$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null;

@ -3,9 +3,7 @@
/**
* @package chamilo.backup
*/
/**
* Code
*/
// Setting the global file that gets the general configuration, the databases, the languages, ...
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;

@ -12,7 +12,7 @@
* @todo only the available platform languages should be used => need an
* api get_languages and and api_get_available_languages (or a parameter)
*/
// Including the global initialization file
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
@ -104,7 +104,12 @@ if ($_GET['action'] == 'edit' && isset($survey_id) && is_numeric($survey_id)) {
$form->addElement('hidden', 'survey_id');
}
$survey_code = $form->addElement('text', 'survey_code', get_lang('SurveyCode'), array('size' => '20', 'maxlength' => '20', 'autofocus' => 'autofocus'));
$survey_code = $form->addElement(
'text',
'survey_code',
get_lang('SurveyCode'),
array('size' => '20', 'maxlength' => '20', 'autofocus' => 'autofocus')
);
if ($_GET['action'] == 'edit') {
//$survey_code->freeze();
@ -149,7 +154,6 @@ $surveytypes[1] = get_lang('Conditional');
if ($_GET['action'] == 'add') {
$form->addElement('hidden', 'survey_type', 0);
require_once api_get_path(LIBRARY_PATH).'surveymanager.lib.php';
$survey_tree = new SurveyTree();
$list_surveys = $survey_tree->createList($survey_tree->surveylist);
$list_surveys[0] = '';

@ -126,7 +126,7 @@ $(document).ready(function() {
var end_date_value = end.format('{{ js_format_date }}');
$('#start_date').html(start_date_value);
if (start_date_value == end_date_value) {
$('#end_date').html(' - ' + end_date_value);
} else {
@ -138,6 +138,13 @@ $(document).ready(function() {
$('#color_calendar').removeClass('group_event');
$('#color_calendar').addClass('label_tag');
$('#color_calendar').addClass('{{ type_event_class }}');
//It shows the CKEDITOR while Adding an Event
$('#cke_content').show();
//It Fixing a minor bug with textarea ckeditor.remplace
$('#content').css('display','none');
//Reset the CKEditor content that persist in memory
CKEDITOR.instances['content'].setData('');
allFields.removeClass("ui-state-error");
$("#dialog-form").dialog("open");
@ -146,6 +153,11 @@ $(document).ready(function() {
'{{ "Add" | get_lang }}' : function() {
var bValid = true;
bValid = bValid && checkLength(title, "title", 1, 255);
//This For make the CKEDITOR SERIALIZABLE
for ( instance in CKEDITOR.instances ) {
CKEDITOR.instances[instance].updateElement();
}
var params = $("#add_event_form").serialize();
@ -264,6 +276,9 @@ $(document).ready(function() {
$('#color_calendar').removeClass('personal_event');
$('#color_calendar').removeClass('group_event');
$('#color_calendar').addClass(calEvent.type+'_event');
//It hides the CKEDITOR while clicking an existing Event
$('#cke_content').hide();
$('#start_date').html(calEvent.start.format("YY-MM-DD"));
if (calEvent.end) {

@ -157,10 +157,10 @@ $TABLETRACK_LINKS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS
$TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$TABLETRACK_ACCESS_2 = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$TABLEQUIZ = Database::get_course_table(TABLE_QUIZ_TEST);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$TABLEQUIZ = Database::get_course_table(TABLE_QUIZ_TEST);
$sessionId = api_get_session_id();
@ -342,12 +342,7 @@ if (count($a_students) > 0) {
$form = new FormValidator(
'reminder_form',
'get',
api_get_path(REL_CODE_PATH).'announcements/announcements.php'
);
$renderer = $form->defaultRenderer();
$renderer->setElementTemplate(
'<span>{label} {element}</span>&nbsp;<button class="save" type="submit">'.get_lang('SendNotification').'</button>',
'since'
api_get_path(REL_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq()
);
$options = array (
2 => '2 '.get_lang('Days'),
@ -372,6 +367,9 @@ if (count($a_students) > 0) {
$form->addElement('hidden', 'action', 'add');
$form->addElement('hidden', 'remindallinactives', 'true');
$form->addElement('hidden', 'cidReq', $courseInfo['code']);
$form->addElement('hidden', 'id_session', api_get_session_id());
$form->addButtonSend(get_lang('SendNotification'));
$extra_field_select = TrackingCourseLog::display_additional_profile_fields();

@ -11,12 +11,8 @@
*
* @package chamilo.tracking
*/
/**
* Code
*/
// TODO: Is this file deprecated?
/* INIT SECTION */
// TODO: Is this file deprecated?
$pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
require_once '../inc/global.inc.php';
@ -225,12 +221,9 @@ if ($is_allowedToTrack) {
/* Tools */
$tempView = $view;
if ($view[2] == '1') {
$tempView[2] = '0';
$title[1] = $nameTools;
$line = '';
$title_line = get_lang('ToolTitleToolnameColumn') . ";" . get_lang('ToolTitleUsersColumn') . ";" . get_lang('ToolTitleCountColumn') . "\n";
$sql = "SELECT access_tool, COUNT(DISTINCT access_user_id),count( access_tool )
@ -239,7 +232,7 @@ if ($is_allowedToTrack) {
AND c_id = $courseId
GROUP BY access_tool";
$results = getManyResults3Col($sql);
$results = StatsUtils::getManyResults3Col($sql);
if (is_array($results)) {
for ($j = 0; $j < count($results); $j++) {
@ -250,9 +243,7 @@ if ($is_allowedToTrack) {
}
}
/* Links */
$tempView = $view;
if ($view[3] == '1') {
@ -281,20 +272,18 @@ if ($is_allowedToTrack) {
}
}
/* Documents */
$tempView = $view;
if ($view[4] == '1') {
$tempView[4] = '0';
$sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path)
FROM $TABLETRACK_DOWNLOADS
WHERE c_id = $courseId
GROUP BY down_doc_path";
FROM $TABLETRACK_DOWNLOADS
WHERE c_id = $courseId
GROUP BY down_doc_path";
$results = getManyResults3Col($sql);
$results = StatsUtils::getManyResults3Col($sql);
$title[1] = $nameTools;
$line = '';
@ -312,9 +301,7 @@ if ($is_allowedToTrack) {
/* Scorm contents and Learning Path */
$tempView = $view;
if ($view[5] == '1') {
$tempView[5] = '0';
$sql = "SELECT id, name FROM $tbl_learnpath_main WHERE c_id = $course_id ";
$result = Database::query($sql);
@ -354,7 +341,6 @@ if ($is_allowedToTrack) {
$line .= $ar['id'] . " " . $ar2['user_id'] . " " . api_get_person_name($ar2['firstname'], $ar2['lastname']);
}
if ($ar2['user_id'] == $scormstudentopen) { //have to list the student's results
$studentId = $ar2['user_id'];
$sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time " .
@ -378,7 +364,6 @@ if ($is_allowedToTrack) {
$line .= "\n";
$ar2 = Database::fetch_array($result2);
}
$title_line .= "\n";
}
}

@ -10,9 +10,6 @@
*/
// TODO: Is this file deprecated?
/*
INIT SECTION
*/
$reqdate = $_REQUEST['reqdate'];
$period = $_REQUEST['period'];
$displayType = $_REQUEST['displayType'];
@ -20,7 +17,10 @@ require_once '../inc/global.inc.php';
$courseId = api_get_course_int_id();
$interbreadcrumb[]= array ("url"=>"courseLog.php", "name"=> get_lang('ToolName'));
$interbreadcrumb[] = array(
"url" => "courseLog.php",
"name" => get_lang('ToolName'),
);
$nameTools = get_lang('TrafficDetails');
@ -38,7 +38,7 @@ td {border-bottom: thin dashed gray;}
</style>";
//@todo use Database library
$TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
Display::display_header($nameTools,"Tracking");
Display::display_header($nameTools, "Tracking");
// the variables for the days and the months
// Defining the shorts for the days
@ -56,14 +56,12 @@ $is_allowedToTrack = $is_courseAdmin;
</h3>
<table width="100%" cellpadding="2" cellspacing="3" border="0">
<?php
if ($is_allowedToTrack)
{
if( !isset($reqdate) || $reqdate < 0 || $reqdate > 2149372861 )
$reqdate = time();
//** dislayed period
echo "<tr><td><b>";
switch($period)
{
if ($is_allowedToTrack) {
if (!isset($reqdate) || $reqdate < 0 || $reqdate > 2149372861)
$reqdate = time();
//** dislayed period
echo "<tr><td><b>";
switch($period) {
case "year" :
echo date(" Y", $reqdate);
break;
@ -80,32 +78,30 @@ $is_allowedToTrack = $is_courseAdmin;
echo "</b></tr></td>";
//** menu
echo "<tr>
<td>
";
<td>";
echo " ".get_lang('PeriodToDisplay')." : [<a href='".api_get_self()."?period=year&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodYear')."</a>]
[<a href='".api_get_self()."?period=month&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodMonth')."</a>]
[<a href='".api_get_self()."?period=day&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodDay')."</a>]
&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
".get_lang('DetailView')." :
";
switch($period)
{
switch($period) {
case "year" :
//-- if period is "year" display can be by month, day or hour
echo " [<a href='".api_get_self()."?period=$period&reqdate=$reqdate&displayType=month' class='specialLink'>".get_lang('PeriodMonth')."</a>]";
//-- if period is "year" display can be by month, day or hour
echo " [<a href='".api_get_self()."?period=$period&reqdate=$reqdate&displayType=month' class='specialLink'>".get_lang('PeriodMonth')."</a>]";
case "month" :
//-- if period is "month" display can be by day or hour
echo " [<a href='".api_get_self()."?period=$period&reqdate=$reqdate&displayType=day' class='specialLink'>".get_lang('PeriodDay')."</a>]";
//-- if period is "month" display can be by day or hour
echo " [<a href='".api_get_self()."?period=$period&reqdate=$reqdate&displayType=day' class='specialLink'>".get_lang('PeriodDay')."</a>]";
case "day" :
//-- if period is "day" display can only be by hour
echo " [<a href='".api_get_self()."?period=$period&reqdate=$reqdate&displayType=hour' class='specialLink'>".get_lang('PeriodHour')."</a>]";
break;
//-- if period is "day" display can only be by hour
echo " [<a href='".api_get_self()."?period=$period&reqdate=$reqdate&displayType=hour' class='specialLink'>".get_lang('PeriodHour')."</a>]";
break;
}
echo "&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;";
switch($period)
{
switch ($period) {
case "year" :
// previous and next date must be evaluated
// 30 days should be a good approximation
@ -136,12 +132,9 @@ $is_allowedToTrack = $is_courseAdmin;
";
break;
}
echo "
</td>
</tr>
";
echo "</td></tr>";
// display information about this period
switch($period) {
switch ($period) {
// all days
case "year" :
$sql = "SELECT UNIX_TIMESTAMP( access_date )
@ -172,14 +165,12 @@ $is_allowedToTrack = $is_courseAdmin;
AND YEAR( access_date ) = YEAR( FROM_UNIXTIME( '$reqdate' ) )
AND c_id = $courseId
AND access_tool IS NULL ";
if($displayType == "day")
{
if ($displayType == "day") {
$sql .= "ORDER BY DAYOFYEAR( access_date)";
$days_array = StatsUtils::daysTab($sql);
StatsUtils::makeHitsTable($days_array,get_lang('PeriodDay'));
}
else // by hours by default
{
} else {
// by hours by default
$sql .= "ORDER BY HOUR( access_date)";
$hours_array = StatsUtils::hoursTab($sql);
StatsUtils:: makeHitsTable($hours_array,get_lang('PeriodHour'));
@ -199,10 +190,9 @@ $is_allowedToTrack = $is_courseAdmin;
StatsUtils::makeHitsTable($hours_array,get_lang('PeriodHour'));
break;
}
}
else // not allowed to track
{
api_not_allowed();
} else {
// not allowed to track
api_not_allowed();
}
?>
</table>

@ -105,7 +105,6 @@ function action_formatter(cellvalue, options, rowObject) {
// Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = '
<script>
$(function() {

@ -5,8 +5,6 @@
* @package chamilo.tracking
*/
/* INIT SECTION */
$pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
// Including the global initialization file
require_once '../inc/global.inc.php';

@ -47,9 +47,8 @@ if (count($session_list) == 0) {
$form->addElement('select', 'session_id', get_lang('Sessions'), $my_session_list);
$form->addButtonFilter(get_lang('Filter'));
if (!empty($_REQUEST['score'])) $filter_score = intval($_REQUEST['score']); else $filter_score = 70;
if (!empty($_REQUEST['session_id'])) $session_id = intval($_REQUEST['session_id']); else $session_id = 0;
if (!empty($_REQUEST['session_id'])) $session_id = intval($_REQUEST['session_id']); else $session_id = 0;
if (empty($session_id)) {
$session_id = key($my_session_list);
@ -169,7 +168,6 @@ if (!empty($users) && is_array($users)) {
}
$html_result .= $result;
$html_result .= "</td>";
}
if (empty($counter)) {

@ -16,15 +16,17 @@
/* INIT SECTION */
$uInfo = $_REQUEST['uInfo'];
if (!isset($_REQUEST['reqdate']))
if (!isset($_REQUEST['reqdate'])) {
$reqdate = time();
else
} else {
$reqdate = $_REQUEST['reqdate'];
}
$period = $_REQUEST['period'];
if (!isset($_REQUEST['view']))
if (!isset($_REQUEST['view'])) {
$view = "0000000";
else
} else {
$view = $_REQUEST['view'];
}
include('../inc/global.inc.php');
$interbreadcrumb[] = array("url" => "../user/user.php", "name" => get_lang('Users'));

@ -1,245 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Thomas Depraetere
* @author Hugues Peeters
* @author Christophe Gesche
* @author Sebastien Piraux
*
* @package chamilo.tracking
*/
/**
* Code
*/
// TODO: Is this file deprecated?
/*
* INIT SECTION
*/
include '../inc/global.inc.php';
$interbreadcrumb[]= array ("url"=>"../auth/profile.php", "name"=> get_lang('ModifyProfile'));
$nameTools = get_lang('ToolName');
$htmlHeadXtra[] = "<style type=\"text/css\">
/*<![CDATA[*/
.secLine {background-color : #E6E6E6;}
.content {padding-left : 15px; padding-right : 15px;}
.specialLink{color : #0000FF;}
/*]]>*/
</style>
<style media='print' type='text/css'>
/*<![CDATA[*/
td {border-bottom: thin dashed gray;}
/*]]>*/
</style>";
//Remove all characters different than 0 and 1 from $view parameter
$view = preg_replace('/[^01]/','',$_REQUEST['view']);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_LINKS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$TABLETRACK_LOGIN = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$limitOfDisplayedLogins = 25; // number of logins to display
Display::display_header($nameTools,"Tracking");
api_display_tool_title($nameTools);
// MAIN SECTION
// show all : view must be equal to the sum of all view values (1024+512+...+64)
// show none : 0
echo "
<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\">
<tr>
<td class='minilink'>
[<a href='".api_get_self()."?view=1111111'>".get_lang('ShowAll')."</a>]
[<a href='".api_get_self()."?view=0000000'>".get_lang('ShowNone')."</a>]
</td>
</tr>
";
if (empty($view)) {
$view ="0000000";
}
/***************************************************************************
*
* Logins
*
***************************************************************************/
$tempView = $view;
if ($tempView[0] == '1') {
$tempView[0] = '0';
echo "
<tr>
<td valign='top'>
<font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font>
<b>".get_lang('Logins')."</b>
&nbsp;&nbsp;&nbsp;
[<a href='".api_get_self()."?view=".$tempView."'>".get_lang('Close')."</a>]
</td>
</tr>";
$sql = "SELECT login_date
FROM ".$TABLETRACK_LOGIN."
WHERE login_user_id = '".$_user['user_id']."'
ORDER BY login_date DESC
LIMIT ".$limitOfDisplayedLogins."";
echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsExplaination')."<br/>";
$results = StatsUtils::getManyResults1Col($sql);
echo "
<table width='100%' cellpadding='2' cellspacing='1' border='0' align='center'>";
if (is_array($results)) {
while (list($key, $value) = each($results)) {
$beautifulDate = api_convert_and_format_date($value, null, date_default_timezone_get());
echo "
<tr>
<td class='secLine'>
".$beautifulDate."
</td>
</tr>";
if (!isset($previousDate)) {
$previousDate = api_get_utc_datetime();
}
$sql = "SELECT access_tool, count(access_tool), c_id
FROM $TABLETRACK_ACCESS
WHERE
access_user_id = " . $_user['user_id'] . " AND
access_date > '".$value."' AND
access_date < '".$previousDate."'
GROUP BY access_tool, c_id
ORDER BY c_id ASC";
$results2 = StatsUtils::getManyResults3Col($sql);
if (is_array($results2)) {
echo "
<tr>
<td colspan='2'>
<table width='50%' cellpadding='0' cellspacing='0' border='0' >";
$previousCourse = "???";
for ($j = 0; $j < count($results2); $j++) {
// if course is different, write the name of the course
if ($results2[$j][2] != $previousCourse) {
echo "<tr>
<td colspan='2' width='100%' style='padding-left : 40px;'>
".$results2[$j][2]."
</td>
</tr>";
}
// if count != de 0 then display toolname et number of visits, else its a course visit
if ($results2[$j][1] != 0) {
echo "<tr>";
echo "<td width='70%' style='padding-left : 60px;'>".get_lang(ucfirst($results2[$j][0]))."</td>";
echo "<td width='30%' align='right'>".$results2[$j][1]." ".get_lang('Visits')."</td>";
echo "</tr>";
}
$previousCourse = $results2[$j][2];
}
echo "</table>";
echo "</td></tr>";
}
$previousDate = $value;
}
} else {
echo "<tr>";
echo "<td colspan='2' bgcolor='#eeeeee' align='center' >".get_lang('NoResult')."</td>";
echo"</tr>";
}
echo "</table>";
echo "</td></tr>";
} else {
$tempView[0] = '1';
echo "
<tr>
<td valign='top'>
+<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?view=".$tempView."' class='specialLink'>".get_lang('Logins')."</a>
</td>
</tr>
";
}
/***************************************************************************
*
* Exercices
*
***************************************************************************/
/*
$tempView = $view;
if($view[1] == '1')
{
$tempView[1] = '0';
echo "
<tr>
<td valign='top'>
<font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('ExercicesResults')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?view=".$tempView."'>".get_lang('Close')."</a>]
</td>
</tr>
";
echo " Ceci est amen etre dplac vers la page de garde des exercices ";
$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, te.exe_date
FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te
WHERE te.exe_user_id = '".$_user['user_id']."'
AND te.exe_exo_id = ce.id
ORDER BY te.c_id ASC, ce.title ASC, te.exe_date ASC";
echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
$results = getManyResultsXCol($sql,4);
echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>";
echo "<tr>
<td class='secLine' width='60%'>
".get_lang('ExercicesTitleExerciceColumn')."
</td>
<td class='secLine' width='20%'>
".get_lang('Date')."
</td>
<td class='secLine' width='20%'>
".get_lang('ExercicesTitleScoreColumn')."
</td>
</tr>";
if (is_array($results)) {
for ($i = 0; $i < sizeof($results); $i++) {
if ( $results[$i][1] < ($results[$i][2]/2) )
$scoreColor = "red";
elseif( $results[$i][1] > ($results[$i][2]/100*60) )
$scoreColor = "green";
else
$scoreColor = "#FF8C00";
echo "<tr>";
echo "<td class='content'>".$results[$i][0]."</td>";
echo "<td class='content'>".$results[$i][3]."</td>";
echo "<td valign='top' align='right' class='content'><font color=$scoreColor>".$results[$i][1]." / ".$results[$i][2]."</font></td>";
echo"</tr>";
}
} else {
echo "<tr>";
echo "<td colspan='2' align='center'>".get_lang('NoResult')."</td>";
echo"</tr>";
}
echo "</table>";
echo "</td></tr>";
} else {
$tempView[1] = '1';
echo "
<tr>
<td valign='top'>
<font color='#0000FF'>+&nbsp;&nbsp;</font><a href='".api_get_self()."?view=".$tempView."' class='specialLink'>".get_lang('ExercicesResults')."</a>
</td>
</tr>
";
}
*/
echo "</table>";
Display::display_footer();

@ -20,21 +20,22 @@ $tool_name = get_lang("Classes");
$htmlHeadXtra[] = api_get_jqgrid_js();
// Extra entries in breadcrumb
$interbreadcrumb[] = array ("url" => "user.php?".api_get_cidreq(), "name" => get_lang("ToolUser"));
$interbreadcrumb[] = array(
"url" => "user.php?".api_get_cidreq(),
"name" => get_lang("ToolUser"),
);
$type = isset($_GET['type']) ? Security::remove_XSS($_GET['type']) : 'registered';
$groupFilter = isset($_GET['group_filter']) ? intval($_GET['group_filter']) : 0;
$htmlHeadXtra[] = '
<script>
$(document).ready( function() {
$("#group_filter").change(function() {
window.location = "class.php?'.api_get_cidreq().'&type='.$type.'" +"&group_filter=" + $(this).val();
});
});
</script>
';
</script>';
Display :: display_header($tool_name, "User");
$usergroup = new UserGroup();

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Bart Mollet, Julio Montoya lot of fixes
* @package chamilo.admin
@ -16,7 +17,7 @@ SessionManager::protect_teacher_session_edit($id_session);
$tool_name = get_lang('SessionOverview');
$allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
if($allowTutors == 'true') {
if ($allowTutors == 'true') {
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS);
@ -221,7 +222,7 @@ if($allowTutors == 'true') {
<?php
if ($session['nbr_courses'] == 0) {
echo '<tr>
<td colspan="4">'.get_lang('NoCoursesForThisSession').'</td>
<td colspan="4">'.get_lang('NoCoursesForThisSession').'</td>
</tr>';
} else {
// select the courses
@ -276,7 +277,8 @@ if($allowTutors == 'true') {
}
$orig_param = '&origin=resume_session';
//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
//hide_course_breadcrumb the parameter has been added to hide the
// name of the course, that appeared in the default $interbreadcrumb
echo '
<tr>
<td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session),'</td>
@ -292,7 +294,6 @@ if($allowTutors == 'true') {
<?php
echo Display::page_subheader(get_lang('UserList').$url);
?>
<!--List of users -->
<table class="data_table">
<tr>
@ -330,7 +331,8 @@ if($allowTutors == 'true') {
$result = Database::query($sql);
$users = Database::store_result($result);
$orig_param = '&origin=resume_session&id_session='.$id_session; // change breadcrumb in destination page
// change breadcrumb in destination page
$orig_param = '&origin=resume_session&id_session='.$id_session;
foreach ($users as $user) {
$user_link = '';
if (!empty($user['user_id'])) {
@ -347,6 +349,7 @@ if($allowTutors == 'true') {
$link_to_add_user_in_url = '<a href="resume_session.php?action=add_user_to_url&id_session='.$id_session.'&user_id='.$user['user_id'].'">'.$add.'</a>';
}
}
echo '<tr>
<td width="90%">
'.$user_link.'

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* List sessions in an efficient and usable way
* @package chamilo.admin
@ -22,7 +23,7 @@ $tool_name = get_lang('SessionList');
Display::display_header($tool_name);
$allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
if($allowTutors == 'true') {
if ($allowTutors == 'true') {
$error_message = ''; // Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php.
if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
@ -41,10 +42,19 @@ if($allowTutors == 'true') {
}
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(get_lang('Name'), get_lang('NumberOfCourses'), get_lang('NumberOfUsers'), get_lang('SessionCategoryName'),
get_lang('StartDate'), get_lang('EndDate'), get_lang('Coach'), get_lang('Status'), get_lang('Visibility'), get_lang('Actions'));
$columns = array(
get_lang('Name'),
get_lang('NumberOfCourses'),
get_lang('NumberOfUsers'),
get_lang('SessionCategoryName'),
get_lang('StartDate'),
get_lang('EndDate'),
get_lang('Coach'),
get_lang('Status'),
get_lang('Visibility'),
get_lang('Actions'),
);
//$activeurl = '?sidx=session_active';
//Column config
$column_model = array(
array('name'=>'name', 'index'=>'name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
@ -56,9 +66,10 @@ if($allowTutors == 'true') {
array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'80', 'align'=>'left', 'search' => 'false'),
array('name'=>'status', 'index'=>'session_active','width'=>'40', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
//for the bottom bar
'searchoptions' => array(
'defaultValue' => '1',
'value' => '1:'.get_lang('Active').';0:'.get_lang('Inactive')),
'searchoptions' => array(
'defaultValue' => '1',
'value' => '1:'.get_lang('Active').';0:'.get_lang('Inactive')
),
//for the top bar
'editoptions' => array('value' => ':'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive'))),
array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),

@ -74,7 +74,8 @@ function get_number_of_classes()
/**
* Get the classes to display on the current page.
*/
function get_class_data($from, $number_of_items, $column, $direction) {
function get_class_data($from, $number_of_items, $column, $direction)
{
$class_table = Database :: get_main_table(TABLE_MAIN_CLASS);
$course_class_table = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
$class_user_table = Database :: get_main_table(TABLE_MAIN_CLASS_USER);

@ -50,50 +50,49 @@ if ($keyword) {
$tool_name = get_lang('SearchResults');
}
$current_session_id = api_get_session_id();
$list_register_user='';
$list_not_register_user='';
if (isset($_REQUEST['register'])) {
if ($type == COURSEMANAGER) {
if (!empty($current_session_id)) {
$result_simple_sub = SessionManager::set_coach_to_course_session(
$_REQUEST['user_id'],
$current_session_id,
$courseInfo['code']
);
} else {
$result_simple_sub = CourseManager:: subscribe_user(
$_REQUEST['user_id'],
$courseInfo['code'],
COURSEMANAGER
);
}
} else {
if ($type == COURSEMANAGER) {
if (!empty($current_session_id)) {
$result_simple_sub = SessionManager::set_coach_to_course_session(
$_REQUEST['user_id'],
$current_session_id,
$courseInfo['code']
);
} else {
$result_simple_sub = CourseManager:: subscribe_user(
$_REQUEST['user_id'],
$courseInfo['code'],
COURSEMANAGER
);
}
} else {
$result_simple_sub = CourseManager:: subscribe_user(
$_REQUEST['user_id'],
$courseInfo['code']
);
}
}
$user_id_temp = $_SESSION['session_user_id'];
if (is_array($user_id_temp)) {
$counter = count($user_id_temp);
for ($j=0; $j<$counter;$j++) {
if ($user_id_temp[$j]==$_GET['user_id']) {
if ($result_simple_sub) {
if (is_array($user_id_temp)) {
$counter = count($user_id_temp);
for ($j=0; $j<$counter;$j++) {
if ($user_id_temp[$j]==$_GET['user_id']) {
if ($result_simple_sub) {
Display::addFlash(Display::return_message($_SESSION['session_user_name'][$j].' '.get_lang('AddedToCourse')));
} else {
} else {
Display::addFlash(Display::return_message($_SESSION['session_user_name'][$j].' '.get_lang('NotAddedToCourse'), 'error'));
}
}
}
unset($_SESSION['session_user_id']);
unset($_SESSION['session_user_name']);
}
}
}
}
unset($_SESSION['session_user_id']);
unset($_SESSION['session_user_name']);
}
header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type);
exit;
@ -132,12 +131,12 @@ if (isset($_POST['action'])) {
$user_id_temp = $_SESSION['session_user_id'];
$user_name_temp = $_SESSION['session_user_name'];
unset($_SESSION['session_user_id']);
unset($_SESSION['session_user_name']);
$counter = 0;
$is_suscribe_counter = count($is_suscribe_user_id);
unset($_SESSION['session_user_id']);
unset($_SESSION['session_user_name']);
$counter = 0;
$is_suscribe_counter = count($is_suscribe_user_id);
$list_register_user='';
$list_register_user='';
for ($i = 0; $i < $is_suscribe_counter; $i++) {
for ($j = 0; $j < count($user_id_temp); $j++) {
@ -153,20 +152,20 @@ if (isset($_POST['action'])) {
}
}
if (!empty($list_register_user)) {
if (!empty($list_register_user)) {
if ($is_suscribe_counter == 1) {
$register_user_message = $temp_unique_user.' '.get_lang('AddedToCourse');
Display::addFlash(Display::return_message($register_user_message));
} else {
$register_user_message = get_lang('UsersRegistered').'<br/><br />'.$list_register_user;
$register_user_message = $temp_unique_user.' '.get_lang('AddedToCourse');
Display::addFlash(Display::return_message($register_user_message));
} else {
$register_user_message = get_lang('UsersRegistered').'<br/><br />'.$list_register_user;
Display::addFlash(Display::return_message($register_user_message, 'normal', false));
}
}
}
}
if (!empty($list_not_register_user)) {
$not_register_user_message = get_lang('UsersNotRegistered').'<br/><br /><br />'.$list_not_register_user;
if (!empty($list_not_register_user)) {
$not_register_user_message = get_lang('UsersNotRegistered').'<br/><br /><br />'.$list_not_register_user;
Display::addFlash(Display::return_message($not_register_user_message, 'error', false));
}
}
header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type);
exit;
@ -210,7 +209,7 @@ if (api_get_setting('show_email_addresses') == 'true') {
$table->set_header($col ++, get_lang('Email'));
$table->set_column_filter($col -1, 'email_filter');
}
$table->set_header($col ++, get_lang('Active'),false);
$table->set_header($col++, get_lang('Active'), false);
$table->set_column_filter($col -1, 'active_filter');
$table->set_header($col ++, get_lang('Actions'), false);
$table->set_column_filter($col -1, 'reg_filter');
@ -308,7 +307,9 @@ function get_number_of_users()
$sql = "SELECT COUNT(u.user_id)
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu
ON u.user_id = cu.user_id and cu.c_id = '".api_get_course_int_id()."' AND session_id ='".api_get_session_id()."'
ON
u.user_id = cu.user_id and cu.c_id = '".api_get_course_int_id()."' AND
session_id ='".api_get_session_id()."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id)
WHERE
@ -341,7 +342,6 @@ function get_number_of_users()
}
}
}
} else {
// students
if (api_get_session_id() != 0) {
@ -423,7 +423,13 @@ function get_number_of_users()
// when there is a keyword then we are searching and we have to change the SQL statement
if (isset($_GET['keyword']) AND !empty($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_REQUEST['keyword']));
$sql .= " AND (firstname LIKE '%".$keyword."%' OR lastname LIKE '%".$keyword."%' OR email LIKE '%".$keyword."%' OR username LIKE '%".$keyword."%' OR official_code LIKE '%".$keyword."%')";
$sql .= " AND (
firstname LIKE '%".$keyword."%' OR
lastname LIKE '%".$keyword."%' OR
email LIKE '%".$keyword."%' OR
username LIKE '%".$keyword."%' OR
official_code LIKE '%".$keyword."%'
)";
// we also want to search for users who have something in their profile fields that matches the keyword
if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {

@ -202,14 +202,14 @@ if (api_is_allowed_to_edit(null, true)) {
if (api_get_session_id()) {
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql = "SELECT DISTINCT
user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").",
user.username,
$select_email_condition
phone,
user.official_code,
active
$legal
FROM $table_session_course_user as session_course_user, $table_users as user ";
user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").",
user.username,
$select_email_condition
phone,
user.official_code,
active
$legal
FROM $table_session_course_user as session_course_user, $table_users as user ";
if (api_is_multiple_url_enabled()) {
$sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
}
@ -280,7 +280,6 @@ if (api_is_allowed_to_edit(null, true)) {
}
if ($sessionId == 0) {
// users directly subscribed to the course
$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT DISTINCT
@ -446,7 +445,6 @@ if (!$is_allowed_in_course) {
// Statistics
Event::event_access_tool(TOOL_USER);
/**
* Get the users to display on the current page.
*/
@ -609,13 +607,13 @@ function get_user_data($from, $number_of_items, $column, $direction)
foreach ($a_course_users as $user_id => $o_course_user) {
if ((
isset($_GET['keyword']) &&
searchUserKeyword(
$o_course_user['firstname'],
$o_course_user['lastname'],
$o_course_user['username'],
$o_course_user['official_code'],
$_GET['keyword'])
isset($_GET['keyword']) &&
searchUserKeyword(
$o_course_user['firstname'],
$o_course_user['lastname'],
$o_course_user['username'],
$o_course_user['official_code'],
$_GET['keyword'])
) || !isset($_GET['keyword']) || empty($_GET['keyword'])
) {
@ -942,7 +940,7 @@ if (api_is_allowed_to_edit(null, true)) {
$url = api_get_path(WEB_CODE_PATH).'user/subscribe_user.php?'.api_get_cidreq().'&type='.COURSEMANAGER;
break;
}
echo '<div class="row">';
echo '<div class="col-md-6">';
echo Display::url(
@ -964,7 +962,7 @@ if (api_is_allowed_to_edit(null, true)) {
$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&type=pdf">'.
Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a> ';
echo $actions;
echo '</div>';
echo '<div class="col-md-6">';
echo '<div class="pull-right">';
@ -973,17 +971,17 @@ if (api_is_allowed_to_edit(null, true)) {
$form->addText('keyword', '', false);
$form->addButtonSearch(get_lang('SearchButton'));
$form->display();
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
$allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
if (api_is_allowed_to_edit() && $allowTutors == 'true') {
$actions .= ' <a class="btn btn-default" href="session_list.php?'.api_get_cidreq().'">'.
get_lang('Sessions').'</a>';
}
echo '</div>';
}

@ -40,11 +40,9 @@ $type = '';
if ($form->validate()) {
if (isset($_FILES['import_file']['size']) && $_FILES['import_file']['size'] !== 0) {
$unsubscribe_users = isset($_POST['unsubscribe_users']) ? true : false;
//@todo : csvToArray deprecated
$users = Import::csvToArray($_FILES['import_file']['tmp_name']);
$invalid_users = array();
$clean_users = array();
@ -134,7 +132,6 @@ if (!empty($message)) {
} else {
$empty_line_msg = ($empty_line == 0) ? get_lang('ErrorsWhenImportingFile'): get_lang('ErrorsWhenImportingFile').': '.get_lang('EmptyHeaderLine');
Display::display_error_message($empty_line_msg);
}
}

@ -419,7 +419,7 @@ class Wiki
Database::update(
$tbl_wiki_conf,
$params,
['page_id => ? AND c_id = ?' => [$pageId, $course_id]]
['page_id = ? AND c_id = ?' => [$pageId, $course_id]]
);
}

@ -83,28 +83,28 @@ class BlockEvaluationGraph extends Block
</a></div>
</div>
<div class="panel-body">';
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
}
}
if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
$html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
} else {
// display evaluations base courses graph
if (!empty($evaluations_base_courses_graph)) {
foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
// display evaluations base courses graph
if (!empty($evaluations_courses_in_sessions_graph)) {
foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
$session_name = api_get_session_name($session_id);
$html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
foreach ($courses as $course_code => $img_html) {
$html .= '<div><strong>'.$course_code.'</strong></div>';
$html .= $img_html;
}
}
}
}
$html .= '</div>
</div>';

@ -195,7 +195,7 @@ class BlockTeacherGraph extends Block
}
$graph = '<img src="' . $imgPath . '" >';
} else {
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8').'</p>';
}
return $graph;

@ -210,12 +210,12 @@ class TestTracking extends UnitTestCase {
//var_dump($res);
}
function testget_inactives_students_in_course() {
function testGetInactiveStudentsInCourse() {
global $_course;
$course_code = $_course;
$since='2010-10-02';
$session_id='';
$res=Tracking::get_inactives_students_in_course($course_code, $since, $session_id);
$res=Tracking::getInactiveStudentsInCourse($course_code, $since, $session_id);
if(!is_null($res))$this->assertTrue(is_array($res));
//var_dump($res);
}

@ -16,19 +16,13 @@ if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
}
$_SESSION['who_is_online_counter'] = 2;
//$htmlHeadXtra[] = api_get_js('jquery.endless-scroll.js');
//social tab
$this_section = SECTION_SOCIAL;
// table definitions
$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
$htmlHeadXtra[] = '<script>
</script>';
$social_right_content = null;
$whoisonline_list = null;
$social_search = '';
/* if (isset($_GET['chatid'])) {
//send out call request
@ -68,7 +62,7 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
if (api_get_setting('allow_social_tool') == 'true') {
if (!api_is_anonymous()) {
$query = isset($_GET['q']) ? $_GET['q']: null;
$social_search .= UserManager::get_search_form($query);
$social_search = UserManager::get_search_form($query);
}
}
//$social_right_content .= SocialManager::display_user_list($user_list);

Loading…
Cancel
Save