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

1.9.x
Yannick Warnier 11 years ago
commit eab9d76382
  1. 20
      main/admin/settings.lib.php
  2. 93
      main/admin/settings.php
  3. 36
      main/attendance/attendance_controller.php
  4. 4
      main/attendance/attendance_list.php
  5. 30
      main/attendance/index.php
  6. 13
      main/chat/chat_message.php
  7. 160
      main/inc/lib/attendance.lib.php
  8. 44
      main/inc/lib/course.lib.php
  9. 30
      main/inc/lib/dashboard.lib.php
  10. 2
      main/inc/lib/database.lib.php
  11. 64
      main/inc/lib/link.lib.php
  12. 31
      main/inc/lib/pdf.lib.php
  13. 87
      main/link/link.php
  14. 2
      main/newscorm/learnpath.class.php
  15. 8
      main/template/default/export/table_pdf.tpl
  16. 43
      main/tracking/courseLog.php
  17. 54
      main/work/work.lib.php
  18. 9
      main/work/work_list_all.php

@ -219,7 +219,6 @@ function handle_stylesheets()
}
$form = new FormValidator('stylesheet_upload', 'post', 'settings.php?category=Stylesheets#tabs-2');
//$form->addElement('header', get_lang('UploadNewStylesheet'));
$form->addElement('text', 'name_stylesheet', get_lang('NameStylesheet'), array('size' => '40', 'maxlength' => '40'));
$form->addRule('name_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('file', 'new_stylesheet', get_lang('UploadNewStylesheet'));
@ -256,7 +255,13 @@ function handle_stylesheets()
// Add event to the system log.
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
event_system(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,
api_get_utc_datetime(),
$user_id
);
if ($result) {
Display::display_confirmation_message(get_lang('StylesheetAdded'));
@ -537,9 +542,14 @@ function store_plugins()
function store_stylesheets()
{
// Insert the stylesheet.
$style = Database::escape_string($_POST['style']);
if (is_style($style)) {
api_set_setting('stylesheets', $style, null, 'stylesheets', api_get_current_access_url_id());
if (is_style($_POST['style'])) {
api_set_setting(
'stylesheets',
$_POST['style'],
null,
'stylesheets',
api_get_current_access_url_id()
);
}
return true;
}

@ -10,8 +10,6 @@
* @package chamilo.admin
*/
/* INIT SECTION */
// Language files that need to be included.
if (isset($_GET['category']) && $_GET['category'] == 'Templates') {
$language_file = array('admin', 'document');
@ -45,7 +43,12 @@ $settings_to_avoid = array(
'example_material_course_creation' => 'true' // ON by default - now we have this option when we create a course
);
$convert_byte_to_mega_list = array('dropbox_max_filesize', 'message_max_upload_filesize', 'default_document_quotum', 'default_group_quotum');
$convert_byte_to_mega_list = array(
'dropbox_max_filesize',
'message_max_upload_filesize',
'default_document_quotum',
'default_group_quotum'
);
if (isset($_POST['style'])) {
Display::$preview_style = $_POST['style'];
@ -119,11 +122,16 @@ function get_settings($category = null) {
$settings = search_setting($_REQUEST['search_field']);
}
}
return array('settings' => $settings, 'settings_by_access_list' => $settings_by_access_list);
return array(
'settings' => $settings,
'settings_by_access_list' => $settings_by_access_list
);
}
// Build the form.
if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))) {
if (!empty($_GET['category']) &&
!in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))
) {
$my_category = isset($_GET['category']) ? $_GET['category'] : null;
$settings_array = get_settings($my_category);
$settings = $settings_array['settings'];
@ -139,11 +147,15 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
$un_mark_all = false;
if (api_is_multiple_url_enabled()) {
if (isset($values['buttons_in_action_right']) && isset($values['buttons_in_action_right']['mark_all'])) {
if (isset($values['buttons_in_action_right']) &&
isset($values['buttons_in_action_right']['mark_all'])
) {
$mark_all = true;
}
if (isset($values['buttons_in_action_right']) && isset($values['buttons_in_action_right']['unmark_all'])) {
if (isset($values['buttons_in_action_right']) &&
isset($values['buttons_in_action_right']['unmark_all'])
) {
$un_mark_all = true;
}
}
@ -174,7 +186,10 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
$settings_array = get_settings($my_category);
$settings = $settings_array['settings'];
$settings_by_access_list = $settings_array['settings_by_access_list'];
$form = generate_settings_form($settings, $settings_by_access_list);
$form = generate_settings_form(
$settings,
$settings_by_access_list
);
}
}
if (!empty($_FILES['pdf_export_watermark_path'])) {
@ -182,7 +197,10 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
}
if (isset($pdf_export_watermark_path) && !empty($pdf_export_watermark_path['name'])) {
$pdf_export_watermark_path_result = PDF::upload_watermark($pdf_export_watermark_path['name'], $pdf_export_watermark_path['tmp_name']);
$pdf_export_watermark_path_result = PDF::upload_watermark(
$pdf_export_watermark_path['name'],
$pdf_export_watermark_path['tmp_name']
);
if ($pdf_export_watermark_path_result) {
$message['confirmation'][] = get_lang('UplUploadSucceeded');
} else {
@ -202,7 +220,6 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
$values['allow_message_tool'] = 'true';
}
// The first step is to set all the variables that have type=checkbox of the category
// to false as the checkbox that is unchecked is not in the $_POST data and can
// therefore not be set to false.
@ -225,25 +242,33 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
foreach ($settings as $item) {
$key = $item['variable'];
if (in_array($key, $settings_to_avoid)) { continue; }
if ($key == 'search_field' or $key == 'submit_fixed_in_bottom') { continue; }
if (in_array($key, $settings_to_avoid)) {
continue;
}
if ($key == 'search_field' or $key == 'submit_fixed_in_bottom') {
continue;
}
$key = Database::escape_string($key);
$sql = "UPDATE $table_settings_current SET selected_value = 'false' WHERE variable = '".$key."' AND access_url = ".intval($url_id)." AND type IN ('checkbox', 'radio') ";
$sql = "UPDATE $table_settings_current
SET selected_value = 'false'
WHERE variable = '".$key."' AND access_url = ".intval($url_id)." AND type IN ('checkbox', 'radio') ";
$res = Database::query($sql);
}
/*foreach($settings_to_avoid as $key => $value) {
api_set_setting($key, $value, null, null, $_configuration['access_url']);
}*/
// Save the settings.
$keys = array();
foreach ($values as $key => $value) {
if (strcmp($key,'MAX_FILE_SIZE')===0) { continue; }
if (in_array($key, $settings_to_avoid)) { continue; }
if (strcmp($key, 'MAX_FILE_SIZE') === 0) {
continue;
}
if (in_array($key, $settings_to_avoid)) {
continue;
}
// Avoid form elements which have nothing to do with settings
if ($key == 'search_field' or $key == 'submit_fixed_in_bottom') { continue; }
if ($key == 'search_field' or $key == 'submit_fixed_in_bottom') {
continue;
}
// Treat gradebook values in separate function.
//if (strpos($key, 'gradebook_score_display_custom_values') === false) {
@ -301,20 +326,31 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
foreach ($value as $subkey => $subvalue) {
$result = api_set_setting($key, 'true', $subkey, null, $url_id);
}
}
}
// Add event configuration settings category to the system log.
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
event_system(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,
api_get_utc_datetime(),
$user_id
);
// Add event configuration settings variable to the system log.
if (is_array($keys) && count($keys) > 0) {
foreach ($keys as $variable) {
if (in_array($key, $settings_to_avoid)) { continue; }
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_VARIABLE, $variable, api_get_utc_datetime(), $user_id);
event_system(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_VARIABLE,
$variable,
api_get_utc_datetime(),
$user_id
);
}
}
}
@ -401,7 +437,6 @@ $resultcategories[] = array('category' => 'CAS');
$resultcategories[] = array('category' => 'Shibboleth');
$resultcategories[] = array('category' => 'Facebook');
foreach ($resultcategories as $row) {
$url = array();
$url['url'] = api_get_self()."?category=".$row['category'];
@ -413,9 +448,7 @@ foreach ($resultcategories as $row) {
}
echo Display::actions($action_array);
echo '<br />';
echo $form_search_html;
if ($watermark_deleted) {
@ -451,7 +484,13 @@ if (!empty($_GET['category'])) {
// add event to system log
$user_id = api_get_user_id();
$category = $_GET['category'];
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
event_system(
LOG_CONFIGURATION_SETTINGS_CHANGE,
LOG_CONFIGURATION_SETTINGS_CATEGORY,
$category,
api_get_utc_datetime(),
$user_id
);
Display :: display_confirmation_message(get_lang('DashboardPluginsHaveBeenUpdatedSucesslly'));
}
}

@ -544,33 +544,55 @@ class AttendanceController
}
/**
* Gets attendace base in the table:
* Gets attendance base in the table:
* TABLE_STATISTIC_TRACK_E_COURSE_ACCESS
* @param bool $showForm
* @throws ViewException
*/
public function calendarLogins()
public function getAttendanceBaseInLogin($showForm = false, $exportToPdf = true)
{
$table = null;
$formToDisplay = null;
$startDate = null;
$endDate = null;
$sessionId = api_get_session_id();
if ($showForm) {
$form = new FormValidator(
'search',
'post',
api_get_self().'?'.api_get_cidreq().'&action=calendar_logins'
api_get_self() . '?' . api_get_cidreq(
) . '&action=calendar_logins'
);
$form->addDateRangePicker('range', get_lang('Range'));
$form->add_button('submit', get_lang('submit'));
$table = null;
if ($form->validate()) {
$values = $form->getSubmitValues();
$startDate = api_get_utc_datetime($values['range_start']);
$endDate = api_get_utc_datetime($values['range_end']);
}
$formToDisplay = $form->return_form();
} else {
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
$startDate = $sessionInfo['date_start'];
$endDate = $sessionInfo['date_end'];
}
}
$attendance = new Attendance();
$table = $attendance->getAttendanceLogins($startDate, $endDate);
}
if ($exportToPdf) {
$result = $attendance->exportAttendanceLogin($startDate, $endDate);
if (empty($result)) {
api_not_allowed(true, get_lang('NoDataAvailable'));
}
}
$table = $attendance->getAttendanceLoginTable($startDate, $endDate);
$data = array(
'form' => $form->return_form(),
'form' => $formToDisplay,
'table' => $table
);
$this->view->set_data($data);

@ -19,8 +19,8 @@ if (api_is_allowed_to_edit(null, true)) {
echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=attendance_add">'.
Display::return_icon('new_attendance_list.png',get_lang('CreateANewAttendance'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=calendar_logins">'.
Display::return_icon('attendance_list.png',get_lang('Logins'),'',ICON_SIZE_MEDIUM).'</a>';
/*echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=calendar_logins">'.
Display::return_icon('attendance_list.png',get_lang('Logins'),'',ICON_SIZE_MEDIUM).'</a>';*/
echo '</div>';
}

@ -92,7 +92,7 @@ if (isset($_GET['calendar_id'])) {
$attendance = new Attendance();
// attendance controller object
$attendance_controller = new AttendanceController();
$attendanceController = new AttendanceController();
$attendance_data = array();
// get attendance data
if (!empty($attendance_id)) {
@ -235,53 +235,53 @@ if ($action == 'calendar_add') {
// delete selected attendance
if (isset($_POST['action']) && $_POST['action'] == 'attendance_delete_select') {
$attendance_controller->attendance_delete($_POST['id']);
$attendanceController->attendance_delete($_POST['id']);
}
// distpacher actions to controller
switch ($action) {
case 'attendance_list':
$attendance_controller->attendance_list();
$attendanceController->attendance_list();
break;
case 'attendance_add':
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_add();
$attendanceController->attendance_add();
} else {
api_not_allowed();
}
break;
case 'attendance_edit' :
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_edit($attendance_id);
$attendanceController->attendance_edit($attendance_id);
} else {
api_not_allowed();
}
break;
case 'attendance_delete' :
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_delete($attendance_id);
$attendanceController->attendance_delete($attendance_id);
} else {
api_not_allowed();
}
break;
case 'attendance_restore':
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_restore($attendance_id);
$attendanceController->attendance_restore($attendance_id);
} else {
api_not_allowed();
}
break;
case 'attendance_sheet_list':
$attendance_controller->attendance_sheet($action, $attendance_id, $student_id, true);
$attendanceController->attendance_sheet($action, $attendance_id, $student_id, true);
break;
case 'attendance_sheet_list_no_edit':
$attendance_controller->attendance_sheet($action, $attendance_id, $student_id, false);
$attendanceController->attendance_sheet($action, $attendance_id, $student_id, false);
break;
case 'attendance_sheet_export_to_pdf':
$attendance_controller->attendance_sheet_export_to_pdf($action, $attendance_id, $student_id, $course_id);
$attendanceController->attendance_sheet_export_to_pdf($action, $attendance_id, $student_id, $course_id);
break;
case 'attendance_sheet_add' :
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_sheet($action, $attendance_id);
$attendanceController->attendance_sheet($action, $attendance_id);
} else {
api_not_allowed();
}
@ -289,7 +289,7 @@ switch ($action) {
case 'lock_attendance' :
case 'unlock_attendance' :
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->lock_attendance($action, $attendance_id);
$attendanceController->lock_attendance($action, $attendance_id);
} else {
api_not_allowed();
}
@ -302,13 +302,13 @@ switch ($action) {
api_not_allowed();
}
case 'calendar_list' :
$attendance_controller->attendance_calendar($action, $attendance_id, $calendar_id);
$attendanceController->attendance_calendar($action, $attendance_id, $calendar_id);
break;
case 'calendar_logins':
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->calendarLogins();
$attendanceController->getAttendanceBaseInLogin(false, true);
}
break;
default :
$attendance_controller->attendance_list();
$attendanceController->attendance_list();
}

@ -77,13 +77,19 @@ if ($sent) {
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab1" data-toggle="tab"><?php echo get_lang('Write'); ?></a>
<a href="#tab1" data-toggle="tab">
<?php echo get_lang('Write'); ?>
</a>
</li>
<li>
<a href="#tab2" id="preview" data-toggle="tab"><?php echo get_lang('Preview'); ?></a>
<a href="#tab2" id="preview" data-toggle="tab">
<?php echo get_lang('Preview'); ?>
</a>
</li>
<li>
<a href="#tab3" id="emojis" data-toggle="tab"><?php echo get_lang('Emojis'); ?></a>
<a href="#tab3" id="emojis" data-toggle="tab">
<?php echo Emojione\Emojione::toImage(':smile:'); ?>
</a>
</li>
</ul>
<div class="tab-content">
@ -93,7 +99,6 @@ if ($sent) {
<td width="320" valign="middle">
<?php
$talkboxsize = (api_get_course_setting('allow_open_chat_window')) ? 'width: 350px; height: 80px' : 'width: 450px; height: 35px';
//onkeydown="send_message(event);"
?>
<textarea id="message" class="message-text" name="message" style=" <?php echo $talkboxsize; ?>"></textarea>
</td>

@ -383,7 +383,8 @@ class Attendance
if (is_array($attendance_id)) {
foreach ($attendance_id as $id) {
$id = intval($id);
$sql = "UPDATE $tbl_attendance SET active = 1 WHERE c_id = $course_id AND id = '$id'";
$sql = "UPDATE $tbl_attendance SET active = 1
WHERE c_id = $course_id AND id = '$id'";
Database::query($sql);
$affected_rows = Database::affected_rows();
if (!empty($affected_rows)) {
@ -393,7 +394,8 @@ class Attendance
}
} else {
$attendance_id = intval($attendance_id);
$sql = "UPDATE $tbl_attendance SET active = 1 WHERE c_id = $course_id AND id = '$attendance_id'";
$sql = "UPDATE $tbl_attendance SET active = 1
WHERE c_id = $course_id AND id = '$attendance_id'";
Database::query($sql);
$affected_rows = Database::affected_rows();
if (!empty($affected_rows)) {
@ -419,7 +421,8 @@ class Attendance
if (is_array($attendance_id)) {
foreach ($attendance_id as $id) {
$id = intval($id);
$sql = "UPDATE $tbl_attendance SET active = 0 WHERE c_id = $course_id AND id = '$id'";
$sql = "UPDATE $tbl_attendance SET active = 0
WHERE c_id = $course_id AND id = '$id'";
Database::query($sql);
$affected_rows = Database::affected_rows();
if (!empty($affected_rows)) {
@ -429,7 +432,8 @@ class Attendance
}
} else {
$attendance_id = intval($attendance_id);
$sql = "UPDATE $tbl_attendance SET active = 0 WHERE c_id = $course_id AND id = '$attendance_id'";
$sql = "UPDATE $tbl_attendance SET active = 0
WHERE c_id = $course_id AND id = '$attendance_id'";
Database::query($sql);
$affected_rows = Database::affected_rows();
if (!empty($affected_rows)) {
@ -685,13 +689,18 @@ class Attendance
if (count($calendar_ids) > 0) {
$sql = "SELECT count(presence) as count_presences
FROM $tbl_attendance_sheet
WHERE c_id = $course_id AND user_id = '$uid' AND attendance_calendar_id IN(".implode(',',$calendar_ids).") AND presence = 1";
WHERE
c_id = $course_id AND
user_id = '$uid' AND
attendance_calendar_id IN(".implode(',',$calendar_ids).") AND
presence = 1";
$rs_count = Database::query($sql);
$row_count = Database::fetch_array($rs_count);
$count_presences = $row_count['count_presences'];
}
// save results
$sql = "SELECT id FROM $tbl_attendance_result WHERE c_id = $course_id AND user_id='$uid' AND attendance_id='$attendance_id'";
$sql = "SELECT id FROM $tbl_attendance_result
WHERE c_id = $course_id AND user_id='$uid' AND attendance_id='$attendance_id'";
$rs_check_result = Database::query($sql);
if (Database::num_rows($rs_check_result) > 0) {
// update result
@ -839,8 +848,12 @@ class Attendance
foreach ($attendances_by_course as $attendance) {
// get total faults and total weight
$total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result
WHERE c_id = $course_id AND user_id = $user_id AND attendance_id = ".$attendance['id'];
$sql = "SELECT score
FROM $tbl_attendance_result
WHERE
c_id = $course_id AND
user_id = $user_id AND
attendance_id = ".$attendance['id'];
$rs = Database::query($sql);
$score = 0;
if (Database::num_rows($rs) > 0) {
@ -884,7 +897,10 @@ class Attendance
// Get total faults and total weight
$total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result
WHERE c_id = {$course_info['real_id']} AND user_id=$user_id AND attendance_id=".$attendance['id'];
WHERE
c_id = {$course_info['real_id']} AND
user_id = $user_id AND
attendance_id=".$attendance['id'];
$rs = Database::query($sql);
$score = 0;
if (Database::num_rows($rs) > 0) {
@ -1014,7 +1030,7 @@ class Attendance
attendance_id = '$attendance_id' AND
done_attendance = 0
ORDER BY date_time
limit 1";
LIMIT 1";
$rs = Database::query($sql);
$next_calendar_datetime = 0;
if (Database::num_rows($rs) > 0) {
@ -1331,10 +1347,14 @@ class Attendance
$course_id = api_get_course_int_id();
// check if datetime already exists inside the table
$sql = "SELECT id FROM $tbl_attendance_calendar
WHERE c_id = $course_id AND date_time = '".Database::escape_string($this->date_time)."' AND attendance_id = '$attendance_id'";
WHERE
c_id = $course_id AND
date_time = '".Database::escape_string($this->date_time)."' AND
attendance_id = '$attendance_id'";
$rs = Database::query($sql);
if (Database::num_rows($rs) == 0) {
$sql = "UPDATE $tbl_attendance_calendar SET date_time='".Database::escape_string($this->date_time)."'
$sql = "UPDATE $tbl_attendance_calendar
SET date_time='".Database::escape_string($this->date_time)."'
WHERE c_id = $course_id AND id = '".intval($calendar_id)."'";
Database::query($sql);
$affected_rows = Database::affected_rows();
@ -1361,7 +1381,7 @@ class Attendance
{
$tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
$tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET);
$session_id = api_get_session_id();
$attendance_id = intval($attendance_id);
// get all registered users inside current course
$users = $this->get_users_rel_course();
@ -1464,22 +1484,22 @@ class Attendance
return $this->date_time;
}
public function get_name($name)
public function get_name()
{
return $this->name;
}
public function get_description($description)
public function get_description()
{
return $this->description;
}
public function get_attendance_qualify_title($attendance_qualify_title)
public function get_attendance_qualify_title()
{
return $this->attendance_qualify_title;
}
public function get_attendance_weight($attendance_weight)
public function get_attendance_weight()
{
return $this->attendance_weight;
}
@ -1488,10 +1508,16 @@ class Attendance
* @param string $startDate in UTC time
* @param string $endDate in UTC time
*
* @return string
* @return array
*/
public function getAttendanceLogins($startDate, $endDate)
public function getAttendanceLogin($startDate, $endDate)
{
if (empty($startDate) || $startDate == '0000-00-00' ||
empty($endDate) || $endDate == '0000-00-00'
) {
return false;
}
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
if (!empty($sessionId)) {
@ -1499,14 +1525,16 @@ class Attendance
$courseCode,
$sessionId,
'',
'lastname'
'lastname',
0
);
} else {
$users = CourseManager:: get_user_list_from_course_code(
$courseCode,
0,
'',
'lastname'
'lastname',
STUDENT
);
}
@ -1544,6 +1572,33 @@ class Attendance
}
}
return array(
'users' => $users,
'dateList' => $dateList,
'headers' => $headers,
'results' => $results
);
}
/**
* @param string $startDate in UTC time
* @param string $endDate in UTC time
*
* @return string
*/
public function getAttendanceLoginTable($startDate, $endDate)
{
$data = $this->getAttendanceLogin($startDate, $endDate);
if (!$data) {
return null;
}
$headers = $data['headers'];
$dateList = $data['dateList'];
$users = $data['users'];
$results = $data['results'];
$table = new HTML_Table(array('class' => 'data_table'));
$row = 0;
$column = 0;
@ -1580,4 +1635,67 @@ class Attendance
return $table->toHtml();
}
/**
* @param string $startDate in UTC time
* @param string $endDate in UTC time
*
* @return string
*/
public function exportAttendanceLogin($startDate, $endDate)
{
$data = $this->getAttendanceLogin($startDate, $endDate);
if (!$data) {
return null;
}
$users = $data['users'];
$results = $data['results'];
$table = new HTML_Table(array('class' => 'data_table'));
$table->setHeaderContents(0, 0, get_lang('User'));
$table->setHeaderContents(0, 1, get_lang('Date'));
$row = 1;
foreach ($users as $user) {
$table->setCellContents(
$row,
0,
$user['lastname'].' '.$user['firstname'].' ('.$user['username'].')'
);
$row++;
}
$table->setColAttributes(0, array('style' => 'width:28%'));
$row = 1;
foreach ($users as $user) {
if (isset($results[$user['user_id']]) &&
!empty($results[$user['user_id']])
) {
$dates = implode(', ', array_keys($results[$user['user_id']]));
$table->setCellContents($row, 1, $dates);
}
$row++;
}
//$tableToString = null;
//$sessionInfo = api_get_session_info(api_get_session_id());
//if (!empty($sessionInfo)) {
/*$tableToString .= '<strong>'.get_lang('PeriodToDisplay').'</strong>: '.
sprintf(get_lang('FromDateXToDateY'), $startDate, $endDate);*/
//}
$tableToString = $table->toHtml();
$params = array(
'filename' => get_lang('Attendance') . '_' . api_get_utc_datetime(),
'pdf_title' => get_lang('Attendance'),
'course_code' => api_get_course_id(),
'show_real_course_teachers' => true
);
$pdf = new PDF('A4', null, $params);
$pdf->html_to_pdf_with_template($tableToString);
}
}

@ -3920,7 +3920,8 @@ class CourseManager
* @param string Original field name
* @return int Course id
*/
public static function get_course_id_from_original_id($original_course_id_value, $original_course_id_name) {
public static function get_course_id_from_original_id($original_course_id_value, $original_course_id_name)
{
$t_cfv = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
$table_field = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
$sql_course = "SELECT course_code FROM $table_field cf INNER JOIN $t_cfv cfv ON cfv.field_id=cf.id WHERE field_variable='$original_course_id_name' AND field_value='$original_course_id_value'";
@ -4149,7 +4150,14 @@ class CourseManager
if (isset($course_info['user_course_cat'])) {
$user_course_category = $course_info['user_course_cat'];
}
$output = array ($user_course_category, $html, $course_info['id_session'], $session, 'active' => $active, 'session_category_id' => $session_category_id);
$output = array(
$user_course_category,
$html,
$course_info['id_session'],
$session,
'active' => $active,
'session_category_id' => $session_category_id
);
} else {
$output = array($course_info['user_course_cat'], $html);
}
@ -4164,7 +4172,8 @@ class CourseManager
* @param int destination session id
* @return bool
*/
public static function copy_course($source_course_code, $source_session_id, $destination_course_code, $destination_session_id, $params = array()) {
public static function copy_course($source_course_code, $source_session_id, $destination_course_code, $destination_session_id, $params = array())
{
require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseBuilder.class.php';
require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseRestorer.class.php';
require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseSelectForm.class.php';
@ -4182,7 +4191,6 @@ class CourseManager
return false;
}
/**
* A simpler version of the copy_course, the function creates an empty course with an autogenerated course code
*
@ -4292,8 +4300,6 @@ class CourseManager
}
return false;
}
return false;
}
/**
@ -4536,10 +4542,15 @@ class CourseManager
$action_done = 'nothing';
$result = Database::select('id, vote', $table_user_course_vote, array('where' => array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params)), 'first');
$result = Database::select(
'id, vote',
$table_user_course_vote,
array('where' => array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params)),
'first'
);
if (empty($result)) {
$result = Database::insert($table_user_course_vote, $params);
Database::insert($table_user_course_vote, $params);
$points_to_add = $vote;
$add_user = true;
$action_done = 'added';
@ -4548,13 +4559,24 @@ class CourseManager
$points_to_add = $vote - $result['vote'];
$add_user = false;
$result = Database::update($table_user_course_vote, $my_params, array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params));
Database::update(
$table_user_course_vote,
$my_params,
array('user_id = ? AND c_id = ? AND session_id = ? AND url_id = ?' => $params)
);
$action_done = 'updated';
}
// Current points
if (!empty($points_to_add)) {
self::update_course_ranking($course_id, $session_id, $url_id, $points_to_add, false, $add_user);
self::update_course_ranking(
$course_id,
$session_id,
$url_id,
$points_to_add,
false,
$add_user
);
}
return $action_done;
}
@ -5157,7 +5179,7 @@ class CourseManager
$sql = "SELECT * FROM $table
WHERE
course_code = $courseCode AND
course_code = '$courseCode' AND
session_id = $sessionId AND
login_course_date BETWEEN '$startDate' AND '$endDate'
";

@ -51,7 +51,6 @@ class DashboardManager
// We display all the possible enabled or disabled plugins
foreach ($possibleplugins as $testplugin) {
$plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info";
$plugin_info = array();
if (file_exists($plugin_info_file) && is_readable($plugin_info_file)) {
$plugin_info = parse_info_file($plugin_info_file);
@ -71,7 +70,10 @@ class DashboardManager
}
echo '</tr>';
} else {
echo Display::tag('tr', Display::tag('td', get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file) , array('colspan'=>'3')));
echo Display::tag(
'tr',
Display::tag('td', get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file) , array('colspan'=>'3'))
);
}
}
@ -113,9 +115,9 @@ class DashboardManager
public static function display_dashboard_plugin_checkboxes($plugin_path) {
$tbl_block = Database::get_main_table(TABLE_MAIN_BLOCK);
$plugin_path = Database::escape_string($plugin_path);
$sql = "SELECT * FROM $tbl_block WHERE path = '$plugin_path' AND active = 1";
$sql = "SELECT * FROM $tbl_block
WHERE path = '".Database::escape_string($plugin_path)."' AND active = 1";
$rs = Database::query($sql);
$checked = '';
@ -129,13 +131,13 @@ class DashboardManager
}
/**
* This function allows easy activating and inactivating of plugins and save them inside db
* @param array dashboard plugin paths
* This function allows easy activating and inactivating
* of plugins and save them inside db
* @param array $plugin_paths dashboard plugin paths
* return int affected rows
*/
public static function store_dashboard_plugins($plugin_paths)
{
$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
$affected_rows = 0;
@ -183,7 +185,6 @@ class DashboardManager
// update extra user blocks data
$upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
}
// clean from block data
@ -196,7 +197,6 @@ class DashboardManager
}
}
// store selected plugins
foreach ($selected_plugins as $testplugin) {
$selected_path = Database::escape_string($testplugin);
@ -254,18 +254,16 @@ class DashboardManager
// get all plugins path inside plugin directory
/* We scan the plugin directory. Each folder is a potential plugin. */
$possibleplugins = array();
$possiblePlugins = array();
$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
$handle = @opendir($dashboard_pluginpath);
while (false !== ($file = readdir($handle)))
{
if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file))
{
$possibleplugins[] = $file;
while (false !== ($file = readdir($handle))) {
if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
$possiblePlugins[] = $file;
}
}
@closedir($handle);
return $possibleplugins;
return $possiblePlugins;
}
/**

@ -474,7 +474,7 @@ class Database
// See #7440 for more info
/*
if ($addFix) {
$string = "__@$string@__";
//$string = "__@$string@__";
}
*/
return get_magic_quotes_gpc()

@ -800,7 +800,8 @@ function makedefaultviewcode($locatie)
*/
function change_visibility_link($id, $scope)
{
global $_course, $_user;
$_course = api_get_course_info();
$_user = api_get_user_info();
if ($scope == TOOL_LINK) {
api_item_property_update(
$_course,
@ -837,43 +838,58 @@ function getLinkCategories($courseId, $sessionId)
// Condition for the session.
$sessionCondition = api_get_session_condition($sessionId, true, true);
// Getting links
$sql = "SELECT *, linkcat.id
FROM $tblLinkCategory linkcat
INNER JOIN $tblItemProperty itemproperties
ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id)
WHERE
itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND
(itemproperties.visibility = '0' OR itemproperties.visibility = '1')
$sessionCondition AND
linkcat.c_id = " . $courseId . " AND
itemproperties.c_id = " . $courseId . "
linkcat.c_id = " . $courseId."
$sessionCondition
ORDER BY linkcat.display_order DESC";
$result = Database::query($sql);
$categories = Database::store_result($result);
$sql = "SELECT *, linkcat.id
FROM $tblLinkCategory linkcat
INNER JOIN $tblItemProperty itemproperties
ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id)
WHERE
itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND
(itemproperties.visibility = '0' OR itemproperties.visibility = '1')
$sessionCondition AND
linkcat.c_id = " . $courseId . "
$sessionCondition
ORDER BY linkcat.display_order DESC";
return Database::query($sql);
}
$result = Database::query($sql);
/**
* Get links categories in the current course and
* session
* @param int $courseId
* @param int $sessionId
* @return array
*/
function getLinkCategoriesResult($courseId, $sessionId)
{
$result = getLinkCategories($courseId, $sessionId);
$list = array();
$categoryInItemProperty = array();
if (Database::num_rows($result)) {
$list = Database::store_result($result, 'ASSOC');
while ($row = Database::fetch_array($result, 'ASSOC')) {
$categoryInItemProperty[$row['id']] = $row;
}
}
return $list;
foreach ($categories as & $category) {
if (!isset($categoryInItemProperty[$category['id']])) {
api_set_default_visibility($category['id'], TOOL_LINK_CATEGORY);
}
}
$sql = "SELECT DISTINCT linkcat.*, visibility
FROM $tblLinkCategory linkcat
INNER JOIN $tblItemProperty itemproperties
ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id)
WHERE
itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND
(itemproperties.visibility = '0' OR itemproperties.visibility = '1')
$sessionCondition AND
linkcat.c_id = " . $courseId . "
GROUP BY c_id, id
ORDER BY linkcat.display_order DESC
";
$result = Database::query($sql);
return Database::store_result($result, 'ASSOC');
}
/**

@ -53,6 +53,7 @@ class PDF
$this->params['session_info'] = isset($params['session_info']) ? $params['session_info'] : api_get_session_info(api_get_session_id());
$this->params['course_code'] = isset($params['course_code']) ? $params['course_code'] : api_get_course_id();
$this->params['add_signatures'] = isset($params['add_signatures']) ? $params['add_signatures'] : false;
$this->params['show_real_course_teachers'] = isset($params['show_real_course_teachers']) ? $params['show_real_course_teachers'] : false;
$this->pdf = new mPDF(
'UTF-8',
@ -111,10 +112,27 @@ class PDF
Display::$global_template->assign('organization', $organization);
//Showing only the current teacher/admin instead the all teacher list name see BT#4080
//$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_code);
if (isset($this->params['show_real_course_teachers']) &&
$this->params['show_real_course_teachers']
) {
if (isset($this->params['session_info']) &&
!empty($this->params['session_info'])
) {
$teacher_list = SessionManager::getCoachesByCourseSessionToString(
$this->params['session_info']['id'],
$this->params['course_code']
);
} else {
$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string(
$this->params['course_code']
);
}
} else {
$user_info = api_get_user_info();
$teacher_list = $user_info['complete_name'];
}
Display::$global_template->assign('pdf_course', $this->params['course_code']);
Display::$global_template->assign('pdf_course_info', $this->params['course_info']);
@ -334,7 +352,8 @@ class PDF
* @param string $document_html valid html
* @param string $css CSS content of a CSS file
* @param string $pdf_name pdf name
* @param string $course_code course code (if you are using html that are located in the document tool you must provide this)
* @param string $course_code course code
* (if you are using html that are located in the document tool you must provide this)
* @return string Web path
*/
public function content_to_pdf(
@ -592,13 +611,15 @@ class PDF
public function set_header($course_data)
{
$this->pdf->defaultheaderfontsize = 10; // in pts
$this->pdf->defaultheaderfontstyle = BI; // blank, B, I, or BI
$this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI
$this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer
if (!empty($course_data['code'])) {
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']);
$teachers = '';
if (!empty($teacher_list)) {
foreach ($teacher_list as $teacher) {
$teachers[]= $teacher['firstname'].' '.$teacher['lastname'];
}
@ -690,8 +711,8 @@ class PDF
/**
* Pre-formats a PDF to the right size and, if not stated otherwise, with
* header, footer and watermark (if any)
* @param array General course information (to fill headers)
* @param bool Whether we want headers, footers and watermark or not
* @param array $course_data General course information (to fill headers)
* @param bool $complete Whether we want headers, footers and watermark or not
*/
public function format_pdf($course_data, $complete = true)
{

@ -117,7 +117,6 @@ function MM_popupMsg(msg) { //v1.0
<?php
/* Action Handling */
$nameTools = get_lang('Links');
if (isset($_GET['action'])) {
@ -126,14 +125,16 @@ if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'addlink':
if ($link_submitted) {
if (!addlinkcategory("link")) { // Here we add a link
// Here we add a link
if (!addlinkcategory("link")) {
unset($submit_link);
}
}
break;
case 'addcategory':
if ($category_submitted) {
if (!addlinkcategory('category')) { // Here we add a category
// Here we add a category
if (!addlinkcategory('category')) {
unset($submit_category);
}
}
@ -144,22 +145,28 @@ if (isset($_GET['action'])) {
}
break;
case 'deletelink':
deletelinkcategory($_GET['id'], 'link'); // Here we delete a link
// Here we delete a link
deletelinkcategory($_GET['id'], 'link');
break;
case 'deletecategory':
deletelinkcategory($_GET['id'], 'category'); // Here we delete a category
// Here we delete a category
deletelinkcategory($_GET['id'], 'category');
break;
case 'editlink':
editlinkcategory('link'); // Here we edit a link
// Here we edit a link
editlinkcategory('link');
break;
case 'editcategory':
editlinkcategory('category'); // Here we edit a category
// Here we edit a category
editlinkcategory('category');
break;
case 'visible':
change_visibility_link($_GET['id'], $_GET['scope']); // Here we edit a category
// Here we edit a category
change_visibility_link($_GET['id'], $_GET['scope']);
break;
case 'invisible':
change_visibility_link($_GET['id'], $_GET['scope']); // Here we edit a category
// Here we edit a category
change_visibility_link($_GET['id'], $_GET['scope']);
break;
}
Security::clear_token();
@ -255,7 +262,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
$resultcategories = getLinkCategories($course_id, $session_id);
if (Database::num_rows($resultcategories)) {
if (!empty($resultcategories)) {
echo ' <div class="control-group category">
<label class="control-label">
'.get_lang('Category').'
@ -263,7 +270,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
<div class="controls">';
echo ' <select name="selectcategory">';
echo ' <option value="0">--</option>';
while ($myrow = Database::fetch_array($resultcategories)) {
foreach ($resultcategories as $myrow) {
echo ' <option value="'.$myrow['id'].'"';
if ($myrow['id'] == $category) {
echo ' selected';
@ -403,23 +410,27 @@ if (!empty($up)) {
movecatlink($up);
}
if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action'] != 'addcategory' && $_GET['action'] != 'addlink') || $link_submitted || $category_submitted) {
if (empty($_GET['action']) ||
($_GET['action'] != 'editlink' && $_GET['action'] != 'addcategory' && $_GET['action'] != 'addlink') ||
$link_submitted ||
$category_submitted
) {
/* Action Links */
echo '<div class="actions">';
if (api_is_allowed_to_edit(null, true)) {
$urlview = Security::remove_XSS($urlview);
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addlink&amp;category='.(!empty($category) ? $category : '').'&amp;urlview='.$urlview.'">'.Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addcategory&amp;urlview='.$urlview.'">'.Display::return_icon('new_folder.png', get_lang('CategoryAdd'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addlink&amp;category='.(!empty($category) ? $category : '').'&amp;urlview='.$urlview.'">'.
Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addcategory&amp;urlview='.$urlview.'">'.
Display::return_icon('new_folder.png', get_lang('CategoryAdd'),'',ICON_SIZE_MEDIUM).'</a>';
/* "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=importcsv&amp;urlview=".$urlview."\">".get_lang('CsvImport')."</a>\n", // RH*/
}
// Making the show none / show all links. Show none means urlview=0000 (number of zeros depending on the
// number of categories). Show all means urlview=1111 (number of 1 depending on teh number of categories).
$resultcategories = getLinkCategories($course_id, $session_id);
$aantalcategories = Database::num_rows($resultcategories);
if ($aantalcategories > 0) {
$aantalcategories = count($resultcategories);
if (!empty($resultcategories)) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&urlview=';
for ($j = 1; $j <= $aantalcategories; $j++) {
echo '0';
@ -449,8 +460,8 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
$catcounter = 1;
$view = '0';
while ($myrow = Database::fetch_array($resultcategories)) {
// Validacion when belongs to a session
foreach ($resultcategories as $myrow) {
// Validation when belongs to a session
$session_img = api_get_session_image($myrow['session_id'], $_user['status']);
//if (!isset($urlview)) {
@ -465,9 +476,6 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
// - instead of a +, the category is no longer clickable and all the links of this category are displayed
$myrow['description'] = text_filter($myrow['description']);
// Link categories are always visible.
$myrow['visibility'] = 1;
$strVisibility = '';
if ($myrow['visibility'] == '1') {
$strVisibility = '<a href="link.php?' . api_get_cidreq() . '&amp;sec_token='.$token.'&amp;action=invisible&amp;id=' . $myrow['id'] . '&amp;scope=' . TOOL_LINK_CATEGORY . '" title="' . get_lang('Hide') . '">' .
@ -478,7 +486,6 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
}
if ($myrow['visibility'] == '1') {
if (isset($urlview[$i]) && $urlview[$i] == '1') {
$newurlview = $urlview;
$newurlview[$i] = '0';
@ -491,7 +498,10 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
echo '</th>';
if (api_is_allowed_to_edit(null, true)) {
if ($session_id == $myrow['session_id']) {
echo '<th>'; echo $strVisibility; showcategoryadmintools($myrow['id']); echo '</th>';
echo '<th>';
echo $strVisibility;
showcategoryadmintools($myrow['id']);
echo '</th>';
} else {
echo '<th>'.get_lang('EditionNotAvailableFromSession');
}
@ -504,21 +514,29 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
echo '<tr>';
echo '<table class="data_table">';
echo '<tr>';
echo '<th width="81%" style="font-weight: bold; text-align:left;padding-left: 5px;"><a href="'.api_get_self().'?'.api_get_cidreq().'&amp;urlview=';
echo '<th width="81%" style="font-weight: bold; text-align:left;padding-left: 5px;">
<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;urlview=';
echo is_array($view) ? implode('', $view) : $view;
echo '"><img src="../img/icons/22/view_tree.png" />&nbsp;&nbsp;'.Security::remove_XSS($myrow['category_title']).$session_img;
echo '"><img src="../img/icons/22/view_tree.png" />&nbsp;&nbsp;'.
Security::remove_XSS($myrow['category_title']).$session_img;
echo'</a><br />&nbsp;&nbsp;&nbsp;';
echo $myrow['description'];
if (api_is_allowed_to_edit(null, true)) {
echo '<th style="text-align:center;">'; echo $strVisibility; showcategoryadmintools($myrow['id']); echo '</th>';
if ($session_id == $myrow['session_id']) {
echo '<th style="text-align:center;">';
echo $strVisibility;
showcategoryadmintools($myrow['id']);
echo '</th>';
}
}
echo '</th>';
echo '</tr>';
echo '</table>';
echo '</tr>';
}
} else { // NO VISIBLES
} else {
// NO VISIBLE
if (api_is_allowed_to_edit(null, true)) {
if (isset($urlview[$i]) && $urlview[$i] == '1') {
$newurlview = $urlview;
@ -550,9 +568,16 @@ if (empty($_GET['action']) || ($_GET['action'] != 'editlink' && $_GET['action']
echo '"><img src="../img/icons/22/view_tree_na.png" />&nbsp;&nbsp;'.Security::remove_XSS($myrow['category_title']).$session_img;
echo'</a><br />&nbsp;&nbsp;&nbsp;';
echo $myrow['description'];
if (api_is_allowed_to_edit(null, true)) {
echo '<th style="text-align:center;">'; echo $strVisibility; showcategoryadmintools($myrow['id']); echo '</th>';
if ($session_id == $myrow['session_id']) {
echo '<th style="text-align:center;">';
echo $strVisibility;
showcategoryadmintools($myrow['id']);
echo '</th>';
}
}
echo '</th>';
echo '</tr>';
echo '</table>';

@ -8499,7 +8499,7 @@ class learnpath
$return .= '</li>';
$course_info = api_get_course_info();
$linkCategories = getLinkCategoriesResult($course_id, $session_id);
$linkCategories = getLinkCategories($course_id, $session_id);
$categoryIdList = array();
if (!empty($linkCategories)) {
foreach ($linkCategories as $categoryInfo) {

@ -26,6 +26,14 @@
</td>
{% endif %}
</tr>
{% if pdf_session_info.date_start != '0000-00-00' and pdf_session_info.date_end != '0000-00-00' %}
<tr>
<td>
<strong>{{ "PeriodToDisplay" | get_lang }}:</strong> {{ "FromDateXToDateY"| get_lang | format(pdf_session_info.date_start, pdf_session_info.date_end ) }}
</td>
</tr>
{% endif %}
{% endif %}
{% if pdf_course_info %}

@ -155,21 +155,23 @@ $htmlHeadXtra[] .= $js;
// Database table definitions.
//@todo remove this calls
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS);
$TABLETRACK_DOWNLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$TABLETRACK_ACCESS_2 = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$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_EXERCICES);
$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();
// Breadcrumbs.
if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
$interbreadcrumb[] = array('url' => '../admin/index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => '../admin/session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => '../admin/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview'));
$interbreadcrumb[] = array('url' => '../admin/resume_session.php?id_session='.$sessionId, 'name' => get_lang('SessionOverview'));
}
$view = isset($_REQUEST['view']) ? $_REQUEST['view'] : '';
@ -189,7 +191,7 @@ if (empty($session_id)) {
$a_students = CourseManager::get_student_list_from_course_code(
api_get_course_id(),
true,
api_get_session_id()
$sessionId
);
}
@ -220,9 +222,26 @@ if (isset($_GET['additional_profile_field']) &&
echo '<div class="actions">';
echo Display::return_icon('user_na.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM);
echo Display::url(Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM), 'course_log_tools.php?'.api_get_cidreq());
echo Display::url(Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM), 'course_log_resources.php?'.api_get_cidreq());
echo Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'tracking/exams.php?'.api_get_cidreq());
echo Display::url(
Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_tools.php?'.api_get_cidreq()
);
echo Display::url(
Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM),
'course_log_resources.php?'.api_get_cidreq()
);
echo Display::url(
Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'tracking/exams.php?'.api_get_cidreq()
);
if (!empty($sessionId)) {
echo Display::url(
Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH) . 'attendance/index.php?' . api_get_cidreq() . '&action=calendar_logins'
);
}
echo '<span style="float:right; padding-top:0px;">';
echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
@ -256,8 +275,8 @@ $form_search = new FormValidator(
$renderer = $form_search->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span>');
$form_search->addElement('hidden', 'from', Security::remove_XSS($from));
$form_search->addElement('hidden', 'session_id', api_get_session_id());
$form_search->addElement('hidden', 'id_session', api_get_session_id());
$form_search->addElement('hidden', 'session_id', $sessionId);
$form_search->addElement('hidden', 'id_session', $sessionId);
$form_search->addElement('text', 'user_keyword');
$form_search->addElement('style_submit_button', 'submit', get_lang('SearchUsers'), 'class="search"');
$form_search->display();

@ -5019,6 +5019,8 @@ function exportAllStudentWorkFromPublication(
return false;
}
$assignment = get_work_assignment_by_id($workId);
$courseCode = $courseInfo['code'];
$header = get_lang('Course').': '.$courseInfo['title'];
$teachers = CourseManager::get_teacher_list_from_course_code_to_string(
@ -5042,8 +5044,11 @@ function exportAllStudentWorkFromPublication(
$header .= '<br />'.get_lang('StudentPublication').': '.$workData['title'].'<br />';
$content = null;
if (!empty($workData['expires_on'])) {
$content .= '<br /><strong>' . get_lang('ExpiryDate') . '</strong>: ' . api_get_local_time($workData['expires_on']);
$expiresOn = null;
if (!empty($assignment) && isset($assignment['expires_on'])) {
$content .= '<br /><strong>' . get_lang('ExpiryDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
$expiresOn = api_get_local_time($assignment['expires_on']);
}
if (!empty($workData['description'])) {
@ -5057,33 +5062,64 @@ function exportAllStudentWorkFromPublication(
if (!empty($workList)) {
require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
$table = new HTML_Table(array('class' => 'data_table'));
$headers = array(
get_lang('Name'),
get_lang('User'),
get_lang('HandOutDateLimit'),
get_lang('SentDate'),
get_lang('Filename'),
get_lang('Score'),
get_lang('Feedback')
);
$column = 0;
foreach($headers as $header) {
$table->setHeaderContents(0, $column, $header);
$column++;
}
$row = 1;
//$pdf->set_custom_header($header);
foreach ($workList as $work) {
$content .= '<hr />';
// getWorkComments need c_id
$work['c_id'] = $courseInfo['real_id'];
$content .= '<h3>'.strip_tags($work['title']).'</h3>';
$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
//$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
$score = null;
if (!empty($work['qualification_only'])) {
$content .= get_lang('Score').': '.$work['qualification_only'] . '<br />';
$score = $work['qualification_only'];
}
$content .= get_lang('Description').': '.$work['description'].'<br />';
//$content .= get_lang('Description').': '.$work['description'].'<br />';
$comments = getWorkComments($work);
$feedback = null;
if (!empty($comments)) {
$content .= '<h4>'.get_lang('Feedback').': </h4>';
foreach ($comments as $comment) {
$content .= get_lang('User').': '.api_get_person_name(
$feedback .= get_lang('User').': '.api_get_person_name(
$comment['firstname'],
$comment['lastname']
).'<br />';
$content .= $comment['comment'];
$content .= '<hr />';
$feedback .= $comment['comment'].'<br />';
}
}
$table->setCellContents($row, 0, strip_tags($workData['title']));
$table->setCellContents($row, 1, api_get_person_name(strip_tags($work['firstname']), strip_tags($work['lastname'])));
$table->setCellContents($row, 2, $expiresOn);
$table->setCellContents($row, 3, api_get_local_time($work['sent_date_from_db']));
$table->setCellContents($row, 4, strip_tags($work['title']));
$table->setCellContents($row, 5, $score);
$table->setCellContents($row, 6, $feedback);
$row++;
}
$content = $table->toHtml();
if (!empty($content)) {
$params = array(
'filename' => $workData['title'] . '_' . api_get_local_time(),

@ -3,7 +3,14 @@
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
$language_file = array(
'exercice',
'work',
'document',
'admin',
'gradebook',
'tracking'
);
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;

Loading…
Cancel
Save