Feature #1744 - Cleaning logical conditions (3).

skala
Ivan Tcholakov 16 years ago
parent 7515a2354b
commit c7b44cc1e9
  1. 2
      main/inc/course_document.inc.php
  2. 104
      main/inc/lib/attendance.lib.php
  3. 6
      main/inc/lib/course.lib.php
  4. 11
      main/inc/lib/fckeditor/editor/dialog/fck_scayt.html
  5. 4
      main/inc/lib/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js
  6. 6
      main/inc/lib/fckeditor/editor/dialog/fck_template.html
  7. 2
      main/inc/lib/fckeditor/editor/filemanager/browser/default/browser.html
  8. 2
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageEditor.php
  9. 34
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php
  10. 4
      main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/editor.js
  11. 14
      main/inc/lib/fckeditor/editor/plugins/ImageManager/editor.php
  12. 6
      main/inc/lib/fckeditor/editor/plugins/ImageManager/editorFrame.php
  13. 6
      main/inc/lib/fckeditor/editor/plugins/ImageManager/images.php
  14. 4
      main/inc/lib/fckeditor/editor/plugins/ImageManager/manager.php
  15. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php
  16. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php
  17. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php
  18. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.file.php
  19. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php
  20. 2
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.manager.php
  21. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/function.base.php
  22. 18
      main/inc/lib/fckeditor/editor/plugins/flvPlayer/flvPlayer.js
  23. 28
      main/inc/lib/fckeditor/editor/plugins/imgmap/jscripts/imgmap.js
  24. 2
      main/inc/lib/fckeditor/editor/plugins/youtube/youtube.js
  25. 4
      main/inc/lib/fckeditor/fckeditor.php
  26. 8
      main/inc/lib/fileUpload.lib.php
  27. 20
      main/inc/lib/glossary.lib.php
  28. 10
      main/inc/lib/group_portal_manager.lib.php
  29. 30
      main/inc/lib/groupmanager.lib.php
  30. 10
      main/inc/lib/main_api.lib.php
  31. 6
      main/inc/lib/sessionmanager.lib.php
  32. 38
      main/inc/lib/social.lib.php
  33. 2
      main/inc/lib/tablesort.lib.php
  34. 414
      main/inc/lib/thematic.lib.php
  35. 10
      main/inc/lib/tracking.lib.php
  36. 16
      main/inc/lib/usermanager.lib.php
  37. 4
      main/inc/local.inc.php

@ -270,7 +270,7 @@ function OpenFile( fileUrl, type )
if (type=="audio") if (type=="audio")
{ {
ret = confirm('<?php echo api_utf8_encode(get_lang('AutostartMp3')); ?>'); ret = confirm('<?php echo api_utf8_encode(get_lang('AutostartMp3')); ?>');
if (ret==true) if (ret)
{ {
GetE('autostart').checked = true; GetE('autostart').checked = true;
} }

@ -4,7 +4,7 @@
/** /**
* This file contains class used like library, provides functions for attendance tool. It's also used like model to attendance_controller (MVC pattern) * This file contains class used like library, provides functions for attendance tool. It's also used like model to attendance_controller (MVC pattern)
* @author Christian Fasanando <christian1827@gmail.com> * @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> improvements * @author Julio Montoya <gugli100@gmail.com> improvements
* @package chamilo.attendance * @package chamilo.attendance
*/ */
@ -40,18 +40,18 @@ class Attendance
return $obj->total_number_of_items; return $obj->total_number_of_items;
} }
/** /**
* Get attendance list only the id, name and attendance_qualify_max fields * Get attendance list only the id, name and attendance_qualify_max fields
* @param string course db name (optional) * @param string course db name (optional)
* @param int session id (optional) * @param int session id (optional)
* @return array attendances list * @return array attendances list
*/ */
function get_attendances_list($course_db_name = '', $session_id = null) { function get_attendances_list($course_db_name = '', $session_id = null) {
// Initializing database table and variables // Initializing database table and variables
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$data = array(); $data = array();
if (!empty($course_db_name)) { if (!empty($course_db_name)) {
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE, $course_db_name); $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE, $course_db_name);
} }
@ -67,7 +67,7 @@ class Attendance
$data[$row['id']] = $row; $data[$row['id']] = $row;
} }
} }
return $data; return $data;
} }
/** /**
@ -108,9 +108,9 @@ class Attendance
$student_param = ''; $student_param = '';
if (api_is_drh() && ($_GET['student_id'])) { if (api_is_drh() && ($_GET['student_id'])) {
$student_param = '&student_id='.Security::remove_XSS($_GET['student_id']); $student_param = '&student_id='.Security::remove_XSS($_GET['student_id']);
} }
$attendance[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$attendance[0].$param_gradebook.$student_param.'">'.$attendance[1].'</a>'; $attendance[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$attendance[0].$param_gradebook.$student_param.'">'.$attendance[1].'</a>';
$attendance[3] = '<center>'.$attendance[3].'</center>'; $attendance[3] = '<center>'.$attendance[3].'</center>';
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
@ -178,7 +178,7 @@ class Attendance
if ($link_to_gradebook) { if ($link_to_gradebook) {
$description = ''; $description = '';
$link_id=is_resource_in_course_gradebook($course_code,7,$last_id,$session_id); $link_id=is_resource_in_course_gradebook($course_code,7,$last_id,$session_id);
if ($link_id==false) { if (!$link_id) {
add_resource_to_course_gradebook($course_code, 7, $last_id, $title_gradebook,$weight_calification,$value_calification,$description,time(),1,$session_id); add_resource_to_course_gradebook($course_code, 7, $last_id, $title_gradebook,$weight_calification,$value_calification,$description,time(),1,$session_id);
} else { } else {
Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.''); Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');
@ -223,20 +223,20 @@ class Attendance
if ($link_to_gradebook) { if ($link_to_gradebook) {
$description = ''; $description = '';
$link_id=is_resource_in_course_gradebook($course_code,7,$attendance_id,$session_id); $link_id=is_resource_in_course_gradebook($course_code,7,$attendance_id,$session_id);
if ($link_id==false) { if (!$link_id) {
add_resource_to_course_gradebook($course_code, 7, $attendance_id, $title_gradebook,$weight_calification,$value_calification,$description,time(),1,$session_id); add_resource_to_course_gradebook($course_code, 7, $attendance_id, $title_gradebook,$weight_calification,$value_calification,$description,time(),1,$session_id);
} else { } else {
Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.''); Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');
} }
} }
$last_id = $attendance_id; $last_id = $attendance_id;
return $last_id; return $last_id;
} }
/** /**
* delete attendaces * delete attendaces
* @param int|array one or many attendances id * @param int|array one or many attendances id
* @return int affected rows * @return int affected rows
*/ */
public function attendance_delete($attendance_id) { public function attendance_delete($attendance_id) {
@ -281,19 +281,19 @@ class Attendance
$a_course_users = CourseManager :: get_user_list_from_course_code($current_course_id, false, 0, '','lastname'); $a_course_users = CourseManager :: get_user_list_from_course_code($current_course_id, false, 0, '','lastname');
} }
// get registered users inside current course // get registered users inside current course
$a_users = array(); $a_users = array();
foreach ($a_course_users as $key =>$user_data) { foreach ($a_course_users as $key =>$user_data) {
$value = array(); $value = array();
$uid = $user_data['user_id']; $uid = $user_data['user_id'];
$status = $user_data['status']; $status = $user_data['status'];
$user_status_in_course = CourseManager::get_user_in_course_status($uid, $current_course_id); $user_status_in_course = CourseManager::get_user_in_course_status($uid, $current_course_id);
//Not taking into account DRH or COURSEMANAGER //Not taking into account DRH or COURSEMANAGER
if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER) continue; if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER) continue;
if (!empty($attendance_id)) { if (!empty($attendance_id)) {
$user_faults = $this->get_faults_of_user($uid, $attendance_id); $user_faults = $this->get_faults_of_user($uid, $attendance_id);
$value['attendance_result'] = $user_faults['faults'].'/'.$user_faults['total'].' ('.$user_faults['faults_porcent'].'%)'; $value['attendance_result'] = $user_faults['faults'].'/'.$user_faults['total'].' ('.$user_faults['faults_porcent'].'%)';
$value['result_color_bar'] = $user_faults['color_bar']; $value['result_color_bar'] = $user_faults['color_bar'];
} }
@ -301,19 +301,19 @@ class Attendance
// user's picture // user's picture
$image_path = UserManager::get_user_picture_path_by_id($uid, 'web', false); $image_path = UserManager::get_user_picture_path_by_id($uid, 'web', false);
$user_profile = UserManager::get_picture_user($uid, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" '); $user_profile = UserManager::get_picture_user($uid, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!empty($image_path['file'])) { if (!empty($image_path['file'])) {
$photo = '<center><a class="thickbox" href="'.$image_path['dir'].$image_path['file'].'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" title="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" /></a></center>'; $photo = '<center><a class="thickbox" href="'.$image_path['dir'].$image_path['file'].'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" title="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" /></a></center>';
} else { } else {
$photo = '<center><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" title="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" /></center>'; $photo = '<center><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" title="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" /></center>';
} }
$value['photo'] = $photo; $value['photo'] = $photo;
$value['firstname'] = $user_data['firstname']; $value['firstname'] = $user_data['firstname'];
$value['lastname'] = $user_data['lastname']; $value['lastname'] = $user_data['lastname'];
$value['user_id'] = $uid; $value['user_id'] = $uid;
//Sending only 5 items in the array instead of 60 //Sending only 5 items in the array instead of 60
$a_users[$key] = $value; $a_users[$key] = $value;
} }
return $a_users; return $a_users;
@ -455,16 +455,16 @@ class Attendance
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange) * @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/ */
public function get_faults_of_user($user_id, $attendance_id) { public function get_faults_of_user($user_id, $attendance_id) {
// initializing database table and variables // initializing database table and variables
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
$user_id = intval($user_id); $user_id = intval($user_id);
$attendance_id = intval($attendance_id); $attendance_id = intval($attendance_id);
$results = array(); $results = array();
$attendance_data = $this->get_attendance_by_id($attendance_id); $attendance_data = $this->get_attendance_by_id($attendance_id);
$total_done_attendance = $attendance_data['attendance_qualify_max']; $total_done_attendance = $attendance_data['attendance_qualify_max'];
$attendance_user_score = $this->get_user_score($user_id, $attendance_id); $attendance_user_score = $this->get_user_score($user_id, $attendance_id);
// calculate results // calculate results
$faults = $total_done_attendance-$attendance_user_score; $faults = $total_done_attendance-$attendance_user_score;
$faults = $faults > 0 ? $faults:0; $faults = $faults > 0 ? $faults:0;
@ -473,7 +473,7 @@ class Attendance
$results['total'] = $total_done_attendance; $results['total'] = $total_done_attendance;
$results['faults_porcent'] = $faults_porcent; $results['faults_porcent'] = $faults_porcent;
$color_bar = ''; $color_bar = '';
if ($faults_porcent > 25 ) { if ($faults_porcent > 25 ) {
$color_bar = '#F11'; $color_bar = '#F11';
} else if ($faults_porcent > 10) { } else if ($faults_porcent > 10) {
@ -483,30 +483,30 @@ class Attendance
return $results; return $results;
} }
/** /**
* Get results of faults average for all courses by user * Get results of faults average for all courses by user
* @param int user id * @param int user id
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange) * @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/ */
public function get_faults_average_inside_courses($user_id) { public function get_faults_average_inside_courses($user_id) {
// get all courses of current user // get all courses of current user
$courses = CourseManager::get_courses_list_by_user_id($user_id, true); $courses = CourseManager::get_courses_list_by_user_id($user_id, true);
$user_id = intval($user_id); $user_id = intval($user_id);
$results = array(); $results = array();
$total_faults = $total_weight = $porcent = 0; $total_faults = $total_weight = $porcent = 0;
foreach ($courses as $course) { foreach ($courses as $course) {
//$course_code = $course['code']; //$course_code = $course['code'];
//$course_info = api_get_course_info($course_code); //$course_info = api_get_course_info($course_code);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course['db_name']); $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course['db_name']);
$attendances_by_course = $this->get_attendances_list($course['db_name']); $attendances_by_course = $this->get_attendances_list($course['db_name']);
foreach ($attendances_by_course as $attendance) { foreach ($attendances_by_course as $attendance) {
// get total faults and total weight // get total faults and total weight
$total_done_attendance = $attendance['attendance_qualify_max']; $total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result WHERE user_id=$user_id AND attendance_id=".$attendance['id']; $sql = "SELECT score FROM $tbl_attendance_result WHERE user_id=$user_id AND attendance_id=".$attendance['id'];
$rs = Database::query($sql); $rs = Database::query($sql);
$score = 0; $score = 0;
@ -517,7 +517,7 @@ class Attendance
$faults = $total_done_attendance-$score; $faults = $total_done_attendance-$score;
$faults = $faults > 0 ? $faults:0; $faults = $faults > 0 ? $faults:0;
$total_faults += $faults; $total_faults += $faults;
$total_weight += $total_done_attendance; $total_weight += $total_done_attendance;
} }
} }
@ -525,30 +525,30 @@ class Attendance
$results['faults'] = $total_faults; $results['faults'] = $total_faults;
$results['total'] = $total_weight; $results['total'] = $total_weight;
$results['porcent'] = $porcent; $results['porcent'] = $porcent;
return $results; return $results;
} }
/** /**
* Get results of faults average by course * Get results of faults average by course
* @param int user id * @param int user id
* @param int Session id (optional) * @param int Session id (optional)
* @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange) * @return array results containing number of faults, total done attendance, porcent of faults and color depend on result (red, orange)
*/ */
public function get_faults_average_by_course($user_id, $course_code, $session_id = null) { public function get_faults_average_by_course($user_id, $course_code, $session_id = null) {
// Database tables and variables // Database tables and variables
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course_info['dbName']); $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT, $course_info['dbName']);
$user_id = intval($user_id); $user_id = intval($user_id);
$results = array(); $results = array();
$total_faults = $total_weight = $porcent = 0; $total_faults = $total_weight = $porcent = 0;
$attendances_by_course = $this->get_attendances_list($course_info['dbName'], $session_id); $attendances_by_course = $this->get_attendances_list($course_info['dbName'], $session_id);
foreach ($attendances_by_course as $attendance) { foreach ($attendances_by_course as $attendance) {
// Get total faults and total weight // Get total faults and total weight
$total_done_attendance = $attendance['attendance_qualify_max']; $total_done_attendance = $attendance['attendance_qualify_max'];
$sql = "SELECT score FROM $tbl_attendance_result WHERE user_id=$user_id AND attendance_id=".$attendance['id']; $sql = "SELECT score FROM $tbl_attendance_result WHERE user_id=$user_id AND attendance_id=".$attendance['id'];
$rs = Database::query($sql); $rs = Database::query($sql);
$score = 0; $score = 0;
@ -559,9 +559,9 @@ class Attendance
$faults = $total_done_attendance-$score; $faults = $total_done_attendance-$score;
$faults = $faults > 0 ? $faults:0; $faults = $faults > 0 ? $faults:0;
$total_faults += $faults; $total_faults += $faults;
$total_weight += $total_done_attendance; $total_weight += $total_done_attendance;
} }
$porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0; $porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0;
$results['faults'] = $total_faults; $results['faults'] = $total_faults;
$results['total'] = $total_weight; $results['total'] = $total_weight;
@ -580,7 +580,7 @@ class Attendance
global $dateTimeFormatLong; global $dateTimeFormatLong;
$tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET);
$tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); $tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
$attendance_calendar = $this->get_attendance_calendar($attendance_id); $attendance_calendar = $this->get_attendance_calendar($attendance_id);
$calendar_ids = array(); $calendar_ids = array();
// get all dates from calendar by current attendance // get all dates from calendar by current attendance
@ -692,8 +692,8 @@ class Attendance
$rs = Database::query($sql); $rs = Database::query($sql);
$data = array(); $data = array();
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
$row['date_time'] = api_get_local_time($row['date_time']); $row['date_time'] = api_get_local_time($row['date_time']);
$row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT); $row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT);
$row['time'] = api_format_date($row['date_time'], TIME_NO_SEC_FORMAT); $row['time'] = api_format_date($row['date_time'], TIME_NO_SEC_FORMAT);
$data[] = $row; $data[] = $row;
@ -737,11 +737,11 @@ class Attendance
// save repeated dates // save repeated dates
switch($repeat_type) { switch($repeat_type) {
case 'daily': case 'daily':
for ($i = $start_date + 86400; ($i <= $end_date); $i += 86400) { for ($i = $start_date + 86400; ($i <= $end_date); $i += 86400) {
$datetime = date('Y-m-d H:i:s', $i); $datetime = date('Y-m-d H:i:s', $i);
$datetimezone = api_get_utc_datetime($datetime); $datetimezone = api_get_utc_datetime($datetime);
$this->set_date_time($datetimezone); $this->set_date_time($datetimezone);
$res = $this->attendance_calendar_add($attendance_id); $res = $this->attendance_calendar_add($attendance_id);
} }
break; break;

@ -440,7 +440,7 @@ class CourseManager {
$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'"; $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'";
$res = Database::query($sql_course); $res = Database::query($sql_course);
$row = Database::fetch_object($res_course); $row = Database::fetch_object($res_course);
if($row != false) { if ($row) {
return $row->course_code; return $row->course_code;
} else { } else {
return 0; return 0;
@ -458,7 +458,7 @@ class CourseManager {
$sql = "SELECT code FROM course WHERE id = '$id';"; $sql = "SELECT code FROM course WHERE id = '$id';";
$res = Database::query($sql); $res = Database::query($sql);
$row = Database::fetch_object($res); $row = Database::fetch_object($res);
if($row != false) { if ($row) {
return $row->code; return $row->code;
} else { } else {
return null; return null;
@ -2199,7 +2199,7 @@ class CourseManager {
$data = ''; $data = '';
foreach ($descriptions as $id => $description) { foreach ($descriptions as $id => $description) {
$data .= '<div class="sectiontitle">'; $data .= '<div class="sectiontitle">';
if (api_is_allowed_to_edit() && $action_show == true) { if (api_is_allowed_to_edit() && $action_show) {
//delete //delete
$data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=delete&amp;description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'; $data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=delete&amp;description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">';
$data .= Display::return_icon('delete.gif', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;')); $data .= Display::return_icon('delete.gif', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'));

@ -325,13 +325,12 @@
var that = get.wrap(this); var that = get.wrap(this);
var isCheck = that.getAttr("checked"); var isCheck = that.getAttr("checked");
//console.info(isCheck) //console.info(isCheck)
if ( isCheck == false ) { if ( isCheck ) {
//that.setAttr("checked", true);
//that.setAttr("checked",false);
options[ this.name ] = 0;
}else{
//that.setAttr("checked",true);
options[ this.name ] = 1; options[ this.name ] = 1;
} else {
//that.setAttr("checked", false);
options[ this.name ] = 0;
} }
//console.info(options) //console.info(options)
}); });

@ -72,7 +72,7 @@ function clearSuggestions() {
function enableUndo() { function enableUndo() {
if( this.undoButton ) { if( this.undoButton ) {
if( this.undoButton.disabled == true ) { if( this.undoButton.disabled ) {
this.undoButton.disabled = false; this.undoButton.disabled = false;
} }
} }
@ -80,7 +80,7 @@ function enableUndo() {
function disableUndo() { function disableUndo() {
if( this.undoButton ) { if( this.undoButton ) {
if( this.undoButton.disabled == false ) { if( !this.undoButton.disabled ) {
this.undoButton.disabled = true; this.undoButton.disabled = true;
} }
} }

@ -86,9 +86,9 @@ window.onload = function()
//window.parent.SetAutoSize( true ) ; //window.parent.SetAutoSize( true ) ;
LoadTemplatesXml() ; LoadTemplatesXml() ;
// select first by default (Chamilo customization) // Select first by default (Chamilo customization)
if(window.top.load_default_template==true) if ( window.top.load_default_template )
SelectTemplate(0); SelectTemplate( 0 ) ;
} }
function LoadTemplatesXml() function LoadTemplatesXml()

@ -226,7 +226,7 @@ oIcons.GetIcon = function( fileName )
break ; break ;
} }
if ( this.AvailableIcons[ sExtension ] == true ) if ( this.AvailableIcons[ sExtension ] )
return sExtension ; return sExtension ;
else else
return 'default.icon' ; return 'default.icon' ;

@ -237,7 +237,7 @@ class ImageEditor
$newSaveFile = $this->makeRelative($relative, $saveFile); $newSaveFile = $this->makeRelative($relative, $saveFile);
$oldSaveFile = $newSaveFile; $oldSaveFile = $newSaveFile;
if ($this->manager->config['allow_newFileName'] && $this->manager->config['allow_overwrite'] == false) if ($this->manager->config['allow_newFileName'] && !$this->manager->config['allow_overwrite'])
{ {
// check whether a file already exist and if there is, create a variant of the filename // check whether a file already exist and if there is, create a variant of the filename
$newName = $this->getUniqueFilename($newSaveFile); $newName = $this->getUniqueFilename($newSaveFile);

@ -103,7 +103,7 @@ class ImageManager
$base = Files::fixPath($base); $base = Files::fixPath($base);
$dirs = array(); $dirs = array();
if($this->isValidBase() == false) if (!$this->isValidBase())
return $dirs; return $dirs;
$d = @dir($base); $d = @dir($base);
@ -128,7 +128,7 @@ class ImageManager
&& strpos($entry, 'css') === false && strpos($entry, 'css') === false
&& strpos($entry, 'HotPotatoes_files') === false && strpos($entry, 'HotPotatoes_files') === false
&& ($in_group || (!$in_group && strpos($entry, '_groupdocs') === false)) && ($in_group || (!$in_group && strpos($entry, '_groupdocs') === false))
&& $this->isThumbDir($entry) == false) && !$this->isThumbDir($entry))
{ {
$relative = Files::fixPath($path.$entry); $relative = Files::fixPath($path.$entry);
$fullpath = Files::fixPath($base.$entry); $fullpath = Files::fixPath($base.$entry);
@ -186,7 +186,7 @@ class ImageManager
$files = array(); $files = array();
$dirs = array(); $dirs = array();
if($this->isValidBase() == false) if (!$this->isValidBase())
return array($files,$dirs); return array($files,$dirs);
$path = Files::fixPath($path); $path = Files::fixPath($path);
@ -249,7 +249,7 @@ class ImageManager
*/ */
} }
if($is_dir && $this->isThumbDir($entry) == false) { if ($is_dir && !$this->isThumbDir($entry)) {
global $_course; global $_course;
if (isset($_course['dbName']) && $_course<>'-1') { if (isset($_course['dbName']) && $_course<>'-1') {
//checking visibility //checking visibility
@ -270,7 +270,7 @@ class ImageManager
$count = $this->countFiles($full); $count = $this->countFiles($full);
$dirs[$relative] = array('fullpath'=>$full,'entry'=>$entry,'count'=>$count); $dirs[$relative] = array('fullpath'=>$full,'entry'=>$entry,'count'=>$count);
} }
else if(is_file($fullpath.$entry) && $this->isThumb($entry)==false && $this->isTmpFile($entry) == false) else if(is_file($fullpath.$entry) && !$this->isThumb($entry) && !$this->isTmpFile($entry))
{ {
$img = $this->getImageInfo($fullpath.$entry); $img = $this->getImageInfo($fullpath.$entry);
@ -323,11 +323,11 @@ class ImageManager
while (false !== ($entry = $d->read())) while (false !== ($entry = $d->read()))
{ {
//echo $entry."<br>"; //echo $entry."<br />";
if(substr($entry,0,1) != '.' if (substr($entry, 0, 1) != '.'
&& $this->isThumbDir($entry) == false && !$this->isThumbDir($entry)
&& $this->isTmpFile($entry) == false && !$this->isTmpFile($entry)
&& $this->isThumb($entry) == false) && !$this->isThumb($entry))
{ {
$total++; $total++;
} }
@ -369,7 +369,7 @@ class ImageManager
*/ */
function isThumbDir($entry) function isThumbDir($entry)
{ {
if($this->config['thumbnail_dir'] == false if (!$this->config['thumbnail_dir']
|| strlen(trim($this->config['thumbnail_dir'])) == 0) || strlen(trim($this->config['thumbnail_dir'])) == 0)
Return false; Return false;
else else
@ -402,7 +402,7 @@ class ImageManager
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename']; $thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
if($this->config['safe_mode'] == true if ($this->config['safe_mode']
|| strlen(trim($this->config['thumbnail_dir'])) == 0) || strlen(trim($this->config['thumbnail_dir'])) == 0)
{ {
Return Files::makeFile($path_parts['dirname'],$thumbnail); Return Files::makeFile($path_parts['dirname'],$thumbnail);
@ -436,7 +436,7 @@ class ImageManager
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename']; $thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
if($path_parts['dirname']=='\\') $path_parts['dirname']='/'; if($path_parts['dirname']=='\\') $path_parts['dirname']='/';
if($this->config['safe_mode'] == true if ($this->config['safe_mode']
|| strlen(trim($this->config['thumbnail_dir'])) == 0) || strlen(trim($this->config['thumbnail_dir'])) == 0)
{ {
$path = Files::fixPath($path_parts['dirname']); $path = Files::fixPath($path_parts['dirname']);
@ -494,7 +494,7 @@ class ImageManager
*/ */
function processUploads() function processUploads()
{ {
if($this->isValidBase() == false) if (!$this->isValidBase())
return; return;
$relative = null; $relative = null;
@ -571,7 +571,7 @@ class ImageManager
} }
// Checking for a valid image by reading binary file (partially in most cases). // Checking for a valid image by reading binary file (partially in most cases).
if($this->config['validate_images'] == true) if ($this->config['validate_images'])
{ {
$imgInfo = @getImageSize($file['tmp_name']); $imgInfo = @getImageSize($file['tmp_name']);
if(!is_array($imgInfo)) if(!is_array($imgInfo))
@ -756,7 +756,7 @@ class ImageManager
{ {
$fullpath = Files::makeFile($this->getBaseDir(),$relative); $fullpath = Files::makeFile($this->getBaseDir(),$relative);
//check that the file is an image //check that the file is an image
if($this->config['validate_images'] == true) if ($this->config['validate_images'])
{ {
if(!is_array($this->getImageInfo($fullpath))) if(!is_array($this->getImageInfo($fullpath)))
return false; //hmmm not an Image!!??? return false; //hmmm not an Image!!???
@ -821,7 +821,7 @@ class ImageManager
*/ */
function processNewDir() function processNewDir()
{ {
if($this->config['safe_mode'] == true) if ($this->config['safe_mode'])
Return false; Return false;
if(isset($_GET['newDir']) && isset($_GET['dir'])) if(isset($_GET['newDir']) && isset($_GET['dir']))

@ -19,7 +19,7 @@
{ {
editor.window.document.getElementById("imgCanvas").style.display = "block"; editor.window.document.getElementById("imgCanvas").style.display = "block";
editor.window.document.getElementById("background").style.display = "none"; editor.window.document.getElementById("background").style.display = "none";
if (editor.window.watermarkingEnabled == true) if (editor.window.watermarkingEnabled)
{ {
editor.window.dd.elements.floater.hide(); editor.window.dd.elements.floater.hide();
} }
@ -55,7 +55,7 @@
{ {
editor.window.document.getElementById("imgCanvas").style.display = "none"; editor.window.document.getElementById("imgCanvas").style.display = "none";
editor.window.document.getElementById("background").style.display = "block"; editor.window.document.getElementById("background").style.display = "block";
if (editor.window.watermarkingEnabled == true) if (editor.window.watermarkingEnabled)
{ {
editor.window.dd.elements.floater.show(); editor.window.dd.elements.floater.show();
editor.window.dd.elements.floater.moveTo(0, 0); editor.window.dd.elements.floater.moveTo(0, 0);

@ -287,12 +287,12 @@ body {
</div> </div>
<div id="tools_save" style="display:none;"> <div id="tools_save" style="display:none;">
<?php if($IMConfig['demo'] != true) { ?> <?php if (!$IMConfig['demo']) { ?>
<div id="tool_inputs"> <div id="tool_inputs">
<?php if($IMConfig['allow_newFileName'] == true) { ?> <?php if ($IMConfig['allow_newFileName']) { ?>
<label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php if($IMConfig['allow_overwrite'] == false){ echo $editor->getDefaultSaveFile(); }else{ echo basename($clean_img); } ?>" /> <label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php if (!$IMConfig['allow_overwrite']) { echo $editor->getDefaultSaveFile(); }else{ echo basename($clean_img); } ?>" />
<?php }else{ ?> <?php }else{ ?>
<input type="hidden" id="save_filename" value="<?php echo basename($clean_img); ?>" /> <input type="hidden" id="save_filename" value="<?php echo basename($clean_img); ?>" />
<?php } ?> <?php } ?>
@ -301,13 +301,13 @@ body {
$pos = strrpos($clean_img, "."); $pos = strrpos($clean_img, ".");
$ext = substr($clean_img, $pos + 1); $ext = substr($clean_img, $pos + 1);
?> ?>
<select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle; <?php if($IMConfig['allow_newFileName'] != true && $ext != "jpg" && $ext != "jpeg") {echo "display: none;";} ?>" onchange="updateFormat(this)"> <select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle; <?php if (!$IMConfig['allow_newFileName'] && $ext != "jpg" && $ext != "jpeg") {echo "display: none;";} ?>" onchange="updateFormat(this)">
<option value="" selected>Image Format</option> <option value="" selected>Image Format</option>
<option value="">---------------------</option> <option value="">---------------------</option>
<option value="jpeg,85">JPEG High</option> <option value="jpeg,85">JPEG High</option>
<option value="jpeg,60">JPEG Medium</option> <option value="jpeg,60">JPEG Medium</option>
<option value="jpeg,35">JPEG Low</option> <option value="jpeg,35">JPEG Low</option>
<?php if($IMConfig['allow_newFileName'] == true){ ?> <?php if ($IMConfig['allow_newFileName']) { ?>
<option value="png">PNG</option> <option value="png">PNG</option>
<?php if($editor->isGDGIFAble() != -1) { ?> <?php if($editor->isGDGIFAble() != -1) { ?>
<option value="gif">GIF</option> <option value="gif">GIF</option>
@ -344,8 +344,8 @@ body {
<div id="toolbar"> <div id="toolbar">
<div id="buttons"> <div id="buttons">
<a href="javascript:toggle('replace')" id="icon_replace" title="Replace" <?php if($IMConfig['allow_replace'] == false) { echo "style=\"display: none;\""; } ?> ><img src="img/replace.gif" height="20" width="20" alt="Replace" /><span>Replace</span></a> <a href="javascript:toggle('replace')" id="icon_replace" title="Replace" <?php if (!$IMConfig['allow_replace']) { echo "style=\"display: none;\""; } ?> ><img src="img/replace.gif" height="20" width="20" alt="Replace" /><span>Replace</span></a>
<a href="javascript:toggle('watermark')" id="icon_watermark" title="Watermark" <?php if(empty($IMConfig['watermarks'])) { echo "style=\"display: none;\""; } ?> ><img src="img/watermark.gif" height="20" width="20" alt="Watermark" /><span>Watermark</span></a> <a href="javascript:toggle('watermark')" id="icon_watermark" title="Watermark" <?php if (empty($IMConfig['watermarks'])) { echo "style=\"display: none;\""; } ?> ><img src="img/watermark.gif" height="20" width="20" alt="Watermark" /><span>Watermark</span></a>
<a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a> <a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a>
<a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a> <a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a>
<a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a> <a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a>

@ -160,7 +160,7 @@
// save message // save message
var message = i18n('File saved.'); var message = i18n('File saved.');
<?php <?php
if ($editor->forcedNewName != false) if ($editor->forcedNewName)
{ {
?> ?>
message += '\n' + i18n('File name was changed into ') + '<?php echo $editor->forcedNewName; ?>'; message += '\n' + i18n('File name was changed into ') + '<?php echo $editor->forcedNewName; ?>';
@ -273,10 +273,10 @@
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ // <![CDATA[
if (watermarkingEnabled == true) if (watermarkingEnabled)
{ {
SET_DHTML("background"+NO_DRAG, "floater"+CURSOR_MOVE); SET_DHTML("background"+NO_DRAG, "floater"+CURSOR_MOVE);
if (window.firstWatermarkItemUnavailable == true) if (window.firstWatermarkItemUnavailable)
{ {
dd.elements.floater.swapImage(eval("window." + watermarkBox.options[0].value + "Preload.src")); dd.elements.floater.swapImage(eval("window." + watermarkBox.options[0].value + "Preload.src"));
} }

@ -56,10 +56,10 @@ function drawFiles($list, &$manager)
<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block"> <td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
<a href="javascript: void(0);" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php echo $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a> <a href="javascript: void(0);" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php echo $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a>
</td></tr><tr><td class="edit" style="padding-top: 5px;"> </td></tr><tr><td class="edit" style="padding-top: 5px;">
<?php if($IMConfig['allow_delete'] == true) { ?> <?php if ($IMConfig['allow_delete']) { ?>
<a href="images.php?dir=<?php echo $relative; ?>&amp;delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a> <a href="images.php?dir=<?php echo $relative; ?>&amp;delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>
<?php } ?> <?php } ?>
<?php if($IMConfig['allow_edit'] == true) { ?> <?php if ($IMConfig['allow_edit']) { ?>
<a href="javascript: void(0);" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a> <a href="javascript: void(0);" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>
<?php } ?> <?php } ?>
<?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?> <?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?>
@ -209,7 +209,7 @@ function drawErrorBase(&$manager)
</head> </head>
<body dir="<?php echo $IMConfig['text_direction']; ?>"> <body dir="<?php echo $IMConfig['text_direction']; ?>">
<?php if ($manager->isValidBase() == false) { drawErrorBase($manager); } <?php if (!$manager->isValidBase()) { drawErrorBase($manager); }
elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?> elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?>
<table> <table>
<tr> <tr>

@ -153,7 +153,7 @@ body {
<?php } ?> <?php } ?>
</select> </select>
<a href="javascript: void(0);" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" />&nbsp;<span>Directory Up</span></a> <a href="javascript: void(0);" onclick="javascript: goUpDir();" title="Directory Up"><img src="img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" />&nbsp;<span>Directory Up</span></a>
<?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?> <?php if (!$IMConfig['safe_mode'] && $IMConfig['allow_new_dir']) { ?>
<a href="javascript: void(0);" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a> <a href="javascript: void(0);" onclick="newFolder();" title="New Folder"><img src="img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
<?php } ?> <?php } ?>
<div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div> <div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div>
@ -182,7 +182,7 @@ body {
<td><input type="text" id="f_horiz" class="smallWidth" value="" /></td> <td><input type="text" id="f_horiz" class="smallWidth" value="" /></td>
</tr> </tr>
<tr> <tr>
<?php if($IMConfig['allow_upload'] == true) { ?> <?php if ($IMConfig['allow_upload']) { ?>
<td align="right"><label for="upload">Upload</label></td> <td align="right"><label for="upload">Upload</label></td>
<td> <td>
<table cellpadding="0" cellspacing="0" border="0"> <table cellpadding="0" cellspacing="0" border="0">

@ -54,7 +54,7 @@
///Second step: hiding as the case ///Second step: hiding as the case
//Juan Carlos Raña //Juan Carlos Raña
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.') if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group && $file['name'][0]!='.')
{ {
if($file['type'] == 'file') if($file['type'] == 'file')
{ {

@ -37,7 +37,7 @@
///Second step: hiding as the case ///Second step: hiding as the case
//Juan Carlos Ra<EFBFBD>a //Juan Carlos Ra<EFBFBD>a
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group==true && $file['name'][0]!='.') if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) && !ereg($css_folder_dokeos, $file['path']) && !ereg($hotpotatoes_folder_dokeos, $file['path']) && !ereg($chat_files_dokeos, $file['path']) && $show_doc_group && $file['name'][0]!='.')
{ {
?> ?>

@ -115,7 +115,7 @@
} }
if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) || ereg($css_folder_dokeos, $file['path']) || ereg($hotpotatoes_folder_dokeos, $file['path']) || ereg($chat_files_dokeos, $file['path']) || $hide_doc_group==true || $file['name'][0]=='.')//Dokeos fix for hidden items. if((!ereg($deleted_by_dokeos_file, $file['name']) || !ereg($deleted_by_dokeos_folder, $file['path'])) || ereg($css_folder_dokeos, $file['path']) || ereg($hotpotatoes_folder_dokeos, $file['path']) || ereg($chat_files_dokeos, $file['path']) || $hide_doc_group || $file['name'][0]=='.')//Dokeos fix for hidden items.
{ {
$count_hideItem=$count_hideItem+1; $count_hideItem=$count_hideItem+1;

@ -366,7 +366,7 @@
* @param boolean $empty * @param boolean $empty
* @return boolean * @return boolean
*/ */
function __recursive_remove_directory($directory, $empty=FALSE) function __recursive_remove_directory($directory, $empty = FALSE)
{ {
// if the path has a slash at the end we remove it here // if the path has a slash at the end we remove it here
if(substr($directory,-1) == '/') if(substr($directory,-1) == '/')
@ -418,7 +418,7 @@
@closedir($handle); @closedir($handle);
// if the option to empty is not set to true // if the option to empty is not set to true
if($empty == FALSE) if (!$empty)
{ {
// try to delete the now empty directory // try to delete the now empty directory
if(!@rmdir($directory)) if(!@rmdir($directory))

@ -488,7 +488,7 @@
$giftype = ($write) ? ' Create Support' : ' Read Support'; $giftype = ($write) ? ' Create Support' : ' Read Support';
$support = strtoupper($extension) . ($extension == 'gif' ? $giftype : ' Support'); $support = strtoupper($extension) . ($extension == 'gif' ? $giftype : ' Support');
if (!isset($this->gdInfo[$support]) || $this->gdInfo[$support] == false) { if (!isset($this->gdInfo[$support]) || !$this->gdInfo[$support]) {
$request = ($write) ? 'saving' : 'reading'; $request = ($write) ? 'saving' : 'reading';
$this->_debug("Support for $request the file type '$extension' cannot be found."); $this->_debug("Support for $request the file type '$extension' cannot be found.");
return false; return false;

@ -203,7 +203,7 @@ class manager
} }
if(ereg($deleted_by_dokeos_folder, $path)|| ereg($css_folder_dokeos, $path) || ereg($hotpotatoes_folder_dokeos, $path) || ereg($chat_files_dokeos, $path) || $hide_doc_group==true || $file[0]=='.') if(ereg($deleted_by_dokeos_folder, $path)|| ereg($css_folder_dokeos, $path) || ereg($hotpotatoes_folder_dokeos, $path) || ereg($chat_files_dokeos, $path) || $hide_doc_group || $file[0]=='.')
{ {
$this->currentFolderInfo['subdir']=$this->currentFolderInfo['subdir']-1; $this->currentFolderInfo['subdir']=$this->currentFolderInfo['subdir']-1;
} }

@ -864,7 +864,7 @@ function getRootPath() {
} }
} }
if(!ereg($deleted_by_dokeos, $folderName) && !ereg($css_folder_dokeos, $folderName) && !ereg($hotpotatoes_folder_dokeos, $folderName) && !ereg($chat_files_dokeos, $folderName) && !ereg($thumbs_folder, $folderName) && $show_doc_group==true) if(!ereg($deleted_by_dokeos, $folderName) && !ereg($css_folder_dokeos, $folderName) && !ereg($hotpotatoes_folder_dokeos, $folderName) && !ereg($chat_files_dokeos, $folderName) && !ereg($thumbs_folder, $folderName) && $show_doc_group)
{ {
return substr($folderName,strpos($folderName, '-'),strlen($folderName)); //hide the firsts numbers return substr($folderName,strpos($folderName, '-'),strlen($folderName)); //hide the firsts numbers
} }
@ -1169,7 +1169,7 @@ function getRootPath() {
if ( $old_x >= 0 && $old_x < $src_x if ( $old_x >= 0 && $old_x < $src_x
&& $old_y >= 0 && $old_y < $src_y ) { && $old_y >= 0 && $old_y < $src_y ) {
if ($bicubic == true) { if ($bicubic) {
$sY = $old_y + 1; $sY = $old_y + 1;
$siY = $old_y; $siY = $old_y;
$siY2 = $old_y - 1; $siY2 = $old_y - 1;

@ -220,7 +220,7 @@ function LoadSelection()
function Ok() function Ok()
{ {
var rbFileTypeVal = "single" ; var rbFileTypeVal = "single" ;
if ( GetE( 'rbFileType' ).checked == false ) if ( !GetE( 'rbFileType' ).checked )
{ {
rbFileTypeVal = "list" ; rbFileTypeVal = "list" ;
} }
@ -449,7 +449,7 @@ Media.prototype.getInnerHTML = function ( objectId )
var thisHeight = this.height ; var thisHeight = this.height ;
var thisMediaType = "single" ; var thisMediaType = "single" ;
if ( GetE( 'rbFileType' ).checked == false ) if ( !GetE( 'rbFileType' ).checked )
{ {
thisMediaType = "mpl" ; thisMediaType = "mpl" ;
} }
@ -470,10 +470,10 @@ Media.prototype.getInnerHTML = function ( objectId )
cssfloat = 'float: left;' ; cssfloat = 'float: left;' ;
} }
var s = "" ; var s = "" ;
//Replacing the creation of the SWFObject to the use of the object tag in order to avoid HTMLPurifier conflicts see CT#1297
//Replacing the creation of the SWFObject to the use of the object tag in order to avoid HTMLPurifier conflicts see CT#1297
s+= '<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n'; s+= '<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n';
s+= '<div style="border-style: none; height: ' + thisHeight + 'px; width:' + thisWidth + 'px; overflow: hidden; background-color: rgb(220, 220, 220); background-image: url(' + oEditor.FCKConfig.PluginsPath + 'flvPlayer/flvPlayer.gif); background-repeat:no-repeat; background-position:center;' + cssalign + '">'; s+= '<div style="border-style: none; height: ' + thisHeight + 'px; width:' + thisWidth + 'px; overflow: hidden; background-color: rgb(220, 220, 220); background-image: url(' + oEditor.FCKConfig.PluginsPath + 'flvPlayer/flvPlayer.gif); background-repeat:no-repeat; background-position:center;' + cssalign + '">';
s+= '<script src="' + oEditor.FCKConfig.PluginsPath + 'flvPlayer/swfobject.js" type="text/javascript"></script>\n'; s+= '<script src="' + oEditor.FCKConfig.PluginsPath + 'flvPlayer/swfobject.js" type="text/javascript"></script>\n';
@ -500,9 +500,9 @@ Media.prototype.getInnerHTML = function ( objectId )
s+= '<p><a href="http://get.adobe.com/flashplayer">Get Flash</a> to see this player.</p>'; s+= '<p><a href="http://get.adobe.com/flashplayer">Get Flash</a> to see this player.</p>';
// s+= '</object>'; // s+= '</object>';
s+= '</object>'; s+= '</object>';
/* /*
s += '\n' ; s += '\n' ;
s += '<div id="player' + randomnumber + '-parent" style="text-align: center;">\n'; //'<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n'; s += '<div id="player' + randomnumber + '-parent" style="text-align: center;">\n'; //'<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n';
@ -617,7 +617,7 @@ Media.prototype.getInnerHTML = function ( objectId )
} }
s += ' s1.addVariable("shuffle","false");\n' ; s += ' s1.addVariable("shuffle","false");\n' ;
if (this.loop == true) if (this.loop)
{ {
s += ' s1.addVariable("repeat","list");\n' ; s += ' s1.addVariable("repeat","list");\n' ;
} }

@ -772,7 +772,7 @@ this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_SHAPE; this.areas[id].style.borderColor=this.config.CL_NORM_SHAPE;
}else{ }else{
if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){ if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[id].style.borderWidth="1px"; this.areas[id].style.borderWidth="1px";
this.areas[id].style.borderStyle="solid"; this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_BOX; this.areas[id].style.borderColor=this.config.CL_NORM_BOX;
@ -852,7 +852,7 @@ if(!this.areas[id].label){
return; return;
} }
try{ try{
if(this.config.label==""||this.config.label==false){ if(this.config.label=="" || !this.config.label){
this.areas[id].label.innerHTML=""; this.areas[id].label.innerHTML="";
this.areas[id].label.style.display="none"; this.areas[id].label.style.display="none";
}else{ }else{
@ -874,7 +874,7 @@ this.log("Error putting label",1);
}; };
imgmap.prototype._puthint=function(id){ imgmap.prototype._puthint=function(id){
try{ try{
if(this.config.hint==""||this.config.hint==false){ if(this.config.hint=="" || !this.config.hint){
this.areas[id].title=""; this.areas[id].title="";
this.areas[id].alt=""; this.areas[id].alt="";
}else{ }else{
@ -1411,7 +1411,7 @@ this.is_drawing=this.DM_POLYGON_DRAW;
this.statusMessage(this.strings["POLYGON_DRAW"]); this.statusMessage(this.strings["POLYGON_DRAW"]);
this.areas[this.currentid].style.left=x+"px"; this.areas[this.currentid].style.left=x+"px";
this.areas[this.currentid].style.top=y+"px"; this.areas[this.currentid].style.top=y+"px";
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderWidth="1px"; this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted"; this.areas[this.currentid].style.borderStyle="dotted";
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
@ -1439,7 +1439,7 @@ this.is_drawing=this.DM_SQUARE_DRAW;
this.statusMessage(this.strings["SQUARE_DRAW"]); this.statusMessage(this.strings["SQUARE_DRAW"]);
this.areas[this.currentid].style.left=x+"px"; this.areas[this.currentid].style.left=x+"px";
this.areas[this.currentid].style.top=y+"px"; this.areas[this.currentid].style.top=y+"px";
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderWidth="1px"; this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted"; this.areas[this.currentid].style.borderStyle="dotted";
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
@ -1472,7 +1472,7 @@ this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_HIGHLIGHT_SHAPE; this.areas[id].style.borderColor=this.config.CL_HIGHLIGHT_SHAPE;
}else{ }else{
if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){ if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[id].style.borderWidth="1px"; this.areas[id].style.borderWidth="1px";
this.areas[id].style.borderStyle="solid"; this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_HIGHLIGHT_BOX; this.areas[id].style.borderColor=this.config.CL_HIGHLIGHT_BOX;
@ -1503,7 +1503,7 @@ this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_SHAPE; this.areas[id].style.borderColor=this.config.CL_NORM_SHAPE;
}else{ }else{
if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){ if(this.areas[id].shape=="circle"||this.areas[id].shape=="polygon"){
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[id].style.borderWidth="1px"; this.areas[id].style.borderWidth="1px";
this.areas[id].style.borderStyle="solid"; this.areas[id].style.borderStyle="solid";
this.areas[id].style.borderColor=this.config.CL_NORM_BOX; this.areas[id].style.borderColor=this.config.CL_NORM_BOX;
@ -1652,7 +1652,7 @@ if(_9e<6&&_9f>6){
if(this.areas[this.currentid].shape=="circle"){ if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_LEFT; this.is_drawing=this.DM_SQUARE_RESIZE_LEFT;
this.statusMessage(this.strings["SQUARE_RESIZE_LEFT"]); this.statusMessage(this.strings["SQUARE_RESIZE_LEFT"]);
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
} }
}else{ }else{
@ -1667,7 +1667,7 @@ if(_9e>parseInt(this.areas[this.currentid].style.width)-6&&_9f>6){
if(this.areas[this.currentid].shape=="circle"){ if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_RIGHT; this.is_drawing=this.DM_SQUARE_RESIZE_RIGHT;
this.statusMessage(this.strings["SQUARE_RESIZE_RIGHT"]); this.statusMessage(this.strings["SQUARE_RESIZE_RIGHT"]);
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
} }
}else{ }else{
@ -1682,7 +1682,7 @@ if(_9e>6&&_9f<6){
if(this.areas[this.currentid].shape=="circle"){ if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_TOP; this.is_drawing=this.DM_SQUARE_RESIZE_TOP;
this.statusMessage(this.strings["SQUARE_RESIZE_TOP"]); this.statusMessage(this.strings["SQUARE_RESIZE_TOP"]);
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
} }
}else{ }else{
@ -1697,7 +1697,7 @@ if(_9f>parseInt(this.areas[this.currentid].style.height)-6&&_9e>6){
if(this.areas[this.currentid].shape=="circle"){ if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_RESIZE_BOTTOM; this.is_drawing=this.DM_SQUARE_RESIZE_BOTTOM;
this.statusMessage(this.strings["SQUARE_RESIZE_BOTTOM"]); this.statusMessage(this.strings["SQUARE_RESIZE_BOTTOM"]);
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
} }
}else{ }else{
@ -1711,7 +1711,7 @@ this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_SHAPE;
if(this.areas[this.currentid].shape=="circle"){ if(this.areas[this.currentid].shape=="circle"){
this.is_drawing=this.DM_SQUARE_MOVE; this.is_drawing=this.DM_SQUARE_MOVE;
this.statusMessage(this.strings["SQUARE_MOVE"]); this.statusMessage(this.strings["SQUARE_MOVE"]);
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
} }
this.memory[this.currentid].rdownx=_9e; this.memory[this.currentid].rdownx=_9e;
@ -1731,7 +1731,7 @@ this.memory[this.currentid].ypoints[i]=this.areas[this.currentid].ypoints[i];
} }
this.is_drawing=this.DM_POLYGON_MOVE; this.is_drawing=this.DM_POLYGON_MOVE;
this.statusMessage(this.strings["POLYGON_MOVE"]); this.statusMessage(this.strings["POLYGON_MOVE"]);
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX; this.areas[this.currentid].style.borderColor=this.config.CL_DRAW_BOX;
} }
this.memory[this.currentid].rdownx=_9e; this.memory[this.currentid].rdownx=_9e;
@ -1752,7 +1752,7 @@ this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted"; this.areas[this.currentid].style.borderStyle="dotted";
}else{ }else{
if(this.areas[this.currentid].shape=="circle"||this.areas[this.currentid].shape=="polygon"){ if(this.areas[this.currentid].shape=="circle"||this.areas[this.currentid].shape=="polygon"){
if(this.config.bounding_box==true){ if(this.config.bounding_box){
this.areas[this.currentid].style.borderWidth="1px"; this.areas[this.currentid].style.borderWidth="1px";
this.areas[this.currentid].style.borderStyle="dotted"; this.areas[this.currentid].style.borderStyle="dotted";
} }

@ -118,7 +118,7 @@ function Ok()
} }
// Check security // Check security
if ( checkCode( GetE( 'txtUrl' ).value ) == false ) if ( !checkCode( GetE( 'txtUrl' ).value ) )
{ {
alert( oEditor.FCKLang.DlgYouTubeSecurity ) ; alert( oEditor.FCKLang.DlgYouTubeSecurity ) ;
return false ; return false ;

@ -241,7 +241,7 @@ class FCKeditor
foreach ( $this->Config as $sKey => $sValue ) foreach ( $this->Config as $sKey => $sValue )
{ {
if ( $bFirst == false ) { if ( !$bFirst ) {
$sParams .= '&amp;' ; $sParams .= '&amp;' ;
} else { } else {
$bFirst = false ; $bFirst = false ;
@ -494,7 +494,7 @@ class FCKeditor
$current_session_id = api_get_session_id(); $current_session_id = api_get_session_id();
if($current_session_id==0) if($current_session_id==0)
{ {
$config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/'; $config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$config['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/'; $config['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$config['BaseHref'] = $script_path; $config['BaseHref'] = $script_path;

@ -1017,13 +1017,13 @@ function search_img_from_html($html_file) {
*/ */
function create_unexisting_directory($_course, $user_id, $to_group_id, $to_user_id, $base_work_dir, $desired_dir_name, $title = null, $visibility = '') { function create_unexisting_directory($_course, $user_id, $to_group_id, $to_user_id, $base_work_dir, $desired_dir_name, $title = null, $visibility = '') {
$nb = ''; $nb = '';
while (file_exists($base_work_dir.$desired_dir_name.$nb)) { while (file_exists($base_work_dir.$desired_dir_name.$nb)) {
$nb += 1; $nb += 1;
} }
if($title == null) { if($title == null) {
$title = basename($desired_dir_name); $title = basename($desired_dir_name);
} }
if (mkdir($base_work_dir.$desired_dir_name.$nb, api_get_permissions_for_new_directories(), true)) { if (mkdir($base_work_dir.$desired_dir_name.$nb, api_get_permissions_for_new_directories(), true)) {
// Check if pathname already exists inside document table // Check if pathname already exists inside document table
$tbl_document = Database::get_course_table(TABLE_DOCUMENT, $_course['dbName']); $tbl_document = Database::get_course_table(TABLE_DOCUMENT, $_course['dbName']);
@ -1043,7 +1043,7 @@ function create_unexisting_directory($_course, $user_id, $to_group_id, $to_user_
return $desired_dir_name.$nb; return $desired_dir_name.$nb;
} }
} else { } else {
//This means the folder NOT exist in the filesystem (now this was created) but there is a record in the Database //This means the folder NOT exist in the filesystem (now this was created) but there is a record in the Database
return $desired_dir_name.$nb; return $desired_dir_name.$nb;
} }
} else { } else {
@ -1342,7 +1342,7 @@ function api_replace_parameter($upload_path, $buffer, $param_name = 'src') {
//$message .= "In tag $count, <b>" . htmlentities($tag_list[$count]) //$message .= "In tag $count, <b>" . htmlentities($tag_list[$count])
// . "</b>, parameter <b>" . $replace_what[$count] . "</b> replaced by <b>" . $replace_by[$count] . "</b><br>"; //debug // . "</b>, parameter <b>" . $replace_what[$count] . "</b> replaced by <b>" . $replace_by[$count] . "</b><br>"; //debug
} }
//if (isset($message) && $message == true) api_display_debug_info($message); //debug //if ($message) api_display_debug_info($message); //debug
$buffer = str_replace($replace_what, $replace_by, $buffer); $buffer = str_replace($replace_what, $replace_by, $buffer);
return $buffer; return $buffer;
} }

@ -164,7 +164,7 @@ class GlossaryManager {
return 0; return 0;
} }
$row = Database::fetch_array($res_max); $row = Database::fetch_array($res_max);
if (!empty($row[0])) { if (!empty($row[0])) {
return $row[0]; return $row[0];
} }
return 0; return 0;
@ -218,8 +218,8 @@ class GlossaryManager {
FROM $t_glossary g FROM $t_glossary g
WHERE g.glossary_id = '".intval($glossary_id)."' "; WHERE g.glossary_id = '".intval($glossary_id)."' ";
$result = Database::query($sql); $result = Database::query($sql);
if ($result === false || Database::num_rows($result) != 1) { if ($result === false || Database::num_rows($result) != 1) {
return false; return false;
} }
return Database::fetch_array($result); return Database::fetch_array($result);
} }
@ -251,7 +251,7 @@ class GlossaryManager {
} }
/** /**
* This is the main function that displays the list or the table with all * This is the main function that displays the list or the table with all
* the glossary terms * the glossary terms
* @param string View ('table' or 'list'). Optional parameter. Defaults to 'table' and prefers glossary_view from the session by default. * @param string View ('table' or 'list'). Optional parameter. Defaults to 'table' and prefers glossary_view from the session by default.
* @return void * @return void
@ -259,10 +259,10 @@ class GlossaryManager {
* @version januari 2009, dokeos 1.8.6 * @version januari 2009, dokeos 1.8.6
*/ */
function display_glossary($view = 'table') { function display_glossary($view = 'table') {
// This function should always be called with the corresponding // This function should always be called with the corresponding
// parameter for view type. Meanwhile, use this cheap trick. // parameter for view type. Meanwhile, use this cheap trick.
if (empty ($_SESSION['glossary_view'])) { if (empty ($_SESSION['glossary_view'])) {
$_SESSION['glossary_view'] = $view; $_SESSION['glossary_view'] = $view;
} }
// action links // action links
echo '<div class="actions" style="margin-bottom:10px">'; echo '<div class="actions" style="margin-bottom:10px">';
@ -326,7 +326,7 @@ class GlossaryManager {
$t_glossary = Database :: get_course_table(TABLE_GLOSSARY); $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
$session_id = intval($session_id); $session_id = intval($session_id);
$sql_filter = api_get_session_condition($session_id); $sql_filter = api_get_session_condition($session_id);
$sql = "SELECT count(glossary_id) as total FROM $t_glossary ". $sql = "SELECT count(glossary_id) as total FROM $t_glossary ".
" WHERE 1=1 $sql_filter"; " WHERE 1=1 $sql_filter";
$res = Database::query($sql); $res = Database::query($sql);
if ($res === false) { return 0; } if ($res === false) { return 0; }
@ -400,7 +400,7 @@ class GlossaryManager {
if (api_is_allowed_to_edit(null,true)) { if (api_is_allowed_to_edit(null,true)) {
$array[5] = $data[5]; $array[5] = $data[5];
} }
// Date treatment for timezones // Date treatment for timezones
$array[3] = api_get_local_time($array[3], null, date_default_timezone_get()); $array[3] = api_get_local_time($array[3], null, date_default_timezone_get());
$array[4] = api_get_local_time($array[4], null, date_default_timezone_get()); $array[4] = api_get_local_time($array[4], null, date_default_timezone_get());
@ -521,7 +521,7 @@ class GlossaryManager {
$res = Database::query($sql); $res = Database::query($sql);
$found = false; $found = false;
while ($row = Database::fetch_array($res)) { while ($row = Database::fetch_array($res)) {
if ($found == true and empty($next_id)) { if ($found && empty($next_id)) {
$next_id = $row['glossary_id']; $next_id = $row['glossary_id'];
$next_display_order = $row['display_order']; $next_display_order = $row['display_order'];
} }

@ -165,7 +165,7 @@ class GroupPortalManager
} }
} }
if ($show_tag_links == true) { if ($show_tag_links) {
if (is_array($tags) && count($tags)>0) { if (is_array($tags) && count($tags)>0) {
foreach ($tags as $tag) { foreach ($tags as $tag) {
$tag_tmp[] = '<a href="'.api_get_path(WEB_PATH).'main/social/search.php?q='.$tag['tag'].'">'.$tag['tag'].'</a>'; $tag_tmp[] = '<a href="'.api_get_path(WEB_PATH).'main/social/search.php?q='.$tag['tag'].'">'.$tag['tag'].'</a>';
@ -208,7 +208,7 @@ class GroupPortalManager
$array = array(); $array = array();
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) { if ($with_image) {
$picture = self::get_picture_group($row['id'], $row['picture_uri'],80); $picture = self::get_picture_group($row['id'], $row['picture_uri'],80);
$img = '<img src="'.$picture['file'].'" />'; $img = '<img src="'.$picture['file'].'" />';
$row['picture_uri'] = $img; $row['picture_uri'] = $img;
@ -245,7 +245,7 @@ class GroupPortalManager
$result=Database::query($sql); $result=Database::query($sql);
$array = array(); $array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) { if ($with_image) {
$picture = self::get_picture_group($row['id'], $row['picture_uri'],80); $picture = self::get_picture_group($row['id'], $row['picture_uri'],80);
$img = '<img src="'.$picture['file'].'" />'; $img = '<img src="'.$picture['file'].'" />';
$row['picture_uri'] = $img; $row['picture_uri'] = $img;
@ -279,7 +279,7 @@ class GroupPortalManager
$result=Database::query($sql); $result=Database::query($sql);
$array = array(); $array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) { if ($with_image) {
$picture = self::get_picture_group($row['id'], $row['picture_uri'],80); $picture = self::get_picture_group($row['id'], $row['picture_uri'],80);
$img = '<img src="'.$picture['file'].'" />'; $img = '<img src="'.$picture['file'].'" />';
$row['picture_uri'] = $img; $row['picture_uri'] = $img;
@ -339,7 +339,7 @@ class GroupPortalManager
$result=Database::query($sql); $result=Database::query($sql);
$array = array(); $array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) { if ($with_image) {
$image_path = UserManager::get_user_picture_path_by_id($row['user_id'], 'web', false, true); $image_path = UserManager::get_user_picture_path_by_id($row['user_id'], 'web', false, true);
$picture = UserManager::get_picture_user($row['user_id'], $image_path['file'],$image_conf['height'],$image_conf['size']); $picture = UserManager::get_picture_user($row['user_id'], $image_path['file'],$image_conf['height'],$image_conf['size']);
$row['image'] = '<img src="'.$picture['file'].'" '.$picture['style'].' />'; $row['image'] = '<img src="'.$picture['file'].'" '.$picture['style'].' />';

@ -211,12 +211,12 @@ class GroupManager {
$lastId = Database::insert_id(); $lastId = Database::insert_id();
$desired_dir_name= '/'.replace_dangerous_char($name,'strict').'_groupdocs'; $desired_dir_name= '/'.replace_dangerous_char($name,'strict').'_groupdocs';
$my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document'; $my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document';
$unique_name = create_unexisting_directory($_course,$_user['user_id'],$lastId,NULL,$my_path, $desired_dir_name); $unique_name = create_unexisting_directory($_course,$_user['user_id'],$lastId,NULL,$my_path, $desired_dir_name);
/* Stores the directory path into the group table */ /* Stores the directory path into the group table */
$sql = "UPDATE ".$table_group." SET name = '".Database::escape_string($name)."', secret_directory = '".$unique_name."' WHERE id ='".$lastId."'"; $sql = "UPDATE ".$table_group." SET name = '".Database::escape_string($name)."', secret_directory = '".$unique_name."' WHERE id ='".$lastId."'";
Database::query($sql); Database::query($sql);
// create a forum if needed // create a forum if needed
@ -389,9 +389,9 @@ class GroupManager {
// define repository for deleted element // define repository for deleted element
/* Useless code /* Useless code
$group_garbage = api_get_path(SYS_ARCHIVE_PATH).$course['path']."/group"; $group_garbage = api_get_path(SYS_ARCHIVE_PATH).$course['path']."/group";
var_dump($group_garbage); var_dump($group_garbage);
if (!file_exists($group_garbage)) if (!file_exists($group_garbage))
FileManager :: mkdirs($group_garbage, api_get_permissions_for_new_directories()); FileManager :: mkdirs($group_garbage, api_get_permissions_for_new_directories());
@ -401,7 +401,7 @@ class GroupManager {
$sql = 'SELECT id, secret_directory, session_id FROM '.$group_table.' WHERE id IN ('.implode(' , ', $group_ids).')'; $sql = 'SELECT id, secret_directory, session_id FROM '.$group_table.' WHERE id IN ('.implode(' , ', $group_ids).')';
$db_result = Database::query($sql); $db_result = Database::query($sql);
$forum_ids = array (); $forum_ids = array ();
while ($group = Database::fetch_object($db_result)) { while ($group = Database::fetch_object($db_result)) {
// move group-documents to garbage // move group-documents to garbage
//$source_directory = api_get_path(SYS_COURSE_PATH).$course['path']."/group/".$group->secret_directory; //$source_directory = api_get_path(SYS_COURSE_PATH).$course['path']."/group/".$group->secret_directory;
@ -410,22 +410,22 @@ class GroupManager {
$destination_dir = api_get_path(SYS_COURSE_PATH).$course['path']."/document".$group->secret_directory.'_DELETED_'.$group->id; $destination_dir = api_get_path(SYS_COURSE_PATH).$course['path']."/document".$group->secret_directory.'_DELETED_'.$group->id;
if (!empty($group->secret_directory)) { if (!empty($group->secret_directory)) {
//Deleting from document tool //Deleting from document tool
DocumentManager::delete_document($course, $group->secret_directory, $source_directory); DocumentManager::delete_document($course, $group->secret_directory, $source_directory);
if (file_exists($source_directory)) { if (file_exists($source_directory)) {
if (api_get_setting('permanently_remove_deleted_files') == 'true') { if (api_get_setting('permanently_remove_deleted_files') == 'true') {
//Delete //Delete
my_delete($source_directory); my_delete($source_directory);
} else { } else {
//Rename //Rename
rename($source_directory, $destination_dir); rename($source_directory, $destination_dir);
} }
} }
} }
//$forum_ids[] = $group->forum_id; //$forum_ids[] = $group->forum_id;
} }
// delete the groups // delete the groups
$sql = "DELETE FROM ".$group_table." WHERE id IN ('".implode("' , '", $group_ids)."')"; $sql = "DELETE FROM ".$group_table." WHERE id IN ('".implode("' , '", $group_ids)."')";
Database::query($sql); Database::query($sql);
@ -1082,7 +1082,7 @@ class GroupManager {
$users = array (); $users = array ();
while ($user = Database::fetch_object($db_result)) while ($user = Database::fetch_object($db_result))
{ {
if ($id_only==false) if (!$id_only)
{ {
$member['user_id'] = $user->user_id; $member['user_id'] = $user->user_id;
$member['firstname'] = $user->firstname; $member['firstname'] = $user->firstname;
@ -1312,15 +1312,15 @@ class GroupManager {
$user_id = Database::escape_string($user_id); $user_id = Database::escape_string($user_id);
$sql = "SELECT group_id FROM $tbl_group WHERE user_id = '$user_id'"; $sql = "SELECT group_id FROM $tbl_group WHERE user_id = '$user_id'";
$groupres = Database::query($sql); $groupres = Database::query($sql);
// uncommenting causes a bug in Agenda AND announcements because there we check if the return value of this function is an array or not // uncommenting causes a bug in Agenda AND announcements because there we check if the return value of this function is an array or not
//$groups=array(); //$groups=array();
if($groupres) { if($groupres) {
while ($myrow= Database::fetch_array($groupres)) while ($myrow= Database::fetch_array($groupres))
$groups[]=$myrow['group_id']; $groups[]=$myrow['group_id'];
} }
return $groups; return $groups;
} }
/* /*

@ -1590,7 +1590,7 @@ function api_get_session_condition($session_id, $and = true, $with_base_content
$session_id = intval($session_id); $session_id = intval($session_id);
//condition to show resources by session //condition to show resources by session
$condition_session = ''; $condition_session = '';
$condition_add = $and == false ? " WHERE " : " AND "; $condition_add = $and ? " AND " : " WHERE ";
if ($with_base_content) { if ($with_base_content) {
$condition_session = $condition_add." (session_id = $session_id OR session_id = 0) "; $condition_session = $condition_add." (session_id = $session_id OR session_id = 0) ";
@ -1979,12 +1979,12 @@ function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach =
$is_allowed_coach_to_edit = api_is_coach(); $is_allowed_coach_to_edit = api_is_coach();
$session_visibility = api_get_session_visibility($my_session_id); $session_visibility = api_get_session_visibility($my_session_id);
$is_courseAdmin = api_is_course_admin() || api_is_platform_admin(); $is_courseAdmin = api_is_course_admin() || api_is_platform_admin();
if (!$is_courseAdmin && $tutor == true) { // If we also want to check if the user is a tutor... if (!$is_courseAdmin && $tutor) { // If we also want to check if the user is a tutor...
$is_courseAdmin = $is_courseAdmin || api_is_course_tutor(); $is_courseAdmin = $is_courseAdmin || api_is_course_tutor();
} }
if (!$is_courseAdmin && $coach == true) { // If we also want to check if the user is a coach...'; if (!$is_courseAdmin && $coach) { // If we also want to check if the user is a coach...';
// Check if session visibility is read only for coachs // Check if session visibility is read only for coachs
if ($session_visibility==SESSION_VISIBLE_READ_ONLY) { if ($session_visibility == SESSION_VISIBLE_READ_ONLY) {
$is_allowed_coach_to_edit = false; $is_allowed_coach_to_edit = false;
} }
@ -1995,7 +1995,7 @@ function api_is_allowed_to_edit($tutor = false, $coach = false, $session_coach =
} }
} }
if (!$is_courseAdmin && $session_coach == true) { if (!$is_courseAdmin && $session_coach) {
$is_courseAdmin = $is_courseAdmin || api_is_coach(); $is_courseAdmin = $is_courseAdmin || api_is_coach();
} }

@ -360,7 +360,7 @@ class SessionManager {
} }
if ($send_email == true) { if ($send_email) {
global $_configuration; global $_configuration;
//sending emails only //sending emails only
if(is_array($user_list) && count($user_list)>0) { if(is_array($user_list) && count($user_list)>0) {
@ -890,7 +890,7 @@ class SessionManager {
$result = @Database::query($sql); $result = @Database::query($sql);
while ($rows = Database::fetch_array($result)) { while ($rows = Database::fetch_array($result)) {
$session_id = $rows['id']; $session_id = $rows['id'];
if ($delete_session == true){ if ($delete_session) {
if ($from_ws) { if ($from_ws) {
SessionManager::delete_session($session_id,true); SessionManager::delete_session($session_id,true);
} else { } else {
@ -1179,7 +1179,7 @@ class SessionManager {
$sql_session = "SELECT session_id FROM $table_field sf INNER JOIN $t_sfv sfv ON sfv.field_id=sf.id WHERE field_variable='$original_session_id_name' AND field_value='$original_session_id_value'"; $sql_session = "SELECT session_id FROM $table_field sf INNER JOIN $t_sfv sfv ON sfv.field_id=sf.id WHERE field_variable='$original_session_id_name' AND field_value='$original_session_id_value'";
$res_session = Database::query($sql_session); $res_session = Database::query($sql_session);
$row = Database::fetch_object($res_session); $row = Database::fetch_object($res_session);
if ($row != false) { if ($row) {
return $row->session_id; return $row->session_id;
} else { } else {
return 0; return 0;

@ -104,14 +104,14 @@ class SocialManager extends UserManager {
$sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE firstName LIKE "%'.Database::escape_string($search_name).'%" OR lastName LIKE "%'.Database::escape_string($search_name).'%" OR '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%") ) '; $sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE firstName LIKE "%'.Database::escape_string($search_name).'%" OR lastName LIKE "%'.Database::escape_string($search_name).'%" OR '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%") ) ';
} }
$res=Database::query($sql); $res = Database::query($sql);
while ($row=Database::fetch_array($res,'ASSOC')) { while ($row = Database::fetch_array($res, 'ASSOC')) {
if ($load_extra_info == true) { if ($load_extra_info) {
$path = UserManager::get_user_picture_path_by_id($row['friend_user_id'],'web',false,true); $path = UserManager::get_user_picture_path_by_id($row['friend_user_id'],'web',false,true);
$my_user_info=api_get_user_info($row['friend_user_id']); $my_user_info = api_get_user_info($row['friend_user_id']);
$list_ids_friends[]=array('friend_user_id'=>$row['friend_user_id'],'firstName'=>$my_user_info['firstName'] , 'lastName'=>$my_user_info['lastName'], 'username'=>$my_user_info['username'], 'image'=>$path['file']); $list_ids_friends[] = array('friend_user_id'=>$row['friend_user_id'],'firstName'=>$my_user_info['firstName'] , 'lastName'=>$my_user_info['lastName'], 'username'=>$my_user_info['username'], 'image'=>$path['file']);
} else { } else {
$list_ids_friends[]=$row; $list_ids_friends[] = $row;
} }
} }
return $list_ids_friends; return $list_ids_friends;
@ -790,7 +790,7 @@ class SocialManager extends UserManager {
$extra_params['cidReq'] = Security::remove_XSS($_GET['cidReq']); $extra_params['cidReq'] = Security::remove_XSS($_GET['cidReq']);
$course_url = '&amp;cidReq='.Security::remove_XSS($_GET['cidReq']); $course_url = '&amp;cidReq='.Security::remove_XSS($_GET['cidReq']);
} }
foreach ($user_list as $user) { foreach ($user_list as $user) {
$uid = $user[0]; $uid = $user[0];
$user_info = api_get_user_info($uid); $user_info = api_get_user_info($uid);
@ -801,7 +801,7 @@ class SocialManager extends UserManager {
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$uid.$course_url; $url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$uid.$course_url;
} else { } else {
$url = '?id='.$uid.$course_url; $url = '?id='.$uid.$course_url;
} }
} else { } else {
$url = '#'; $url = '#';
} }
@ -826,7 +826,7 @@ class SocialManager extends UserManager {
if (api_get_setting('show_email_addresses') == 'true') { if (api_get_setting('show_email_addresses') == 'true') {
$table_header[] = array(get_lang('Email'), true); $table_header[] = array(get_lang('Email'), true);
} }
Display::display_sortable_table($table_header, $table_data, array(), array('per_page' => 25), $extra_params, array(),'grid'); Display::display_sortable_table($table_header, $table_data, array(), array('per_page' => 25), $extra_params, array(),'grid');
} }
} }
@ -839,7 +839,7 @@ class SocialManager extends UserManager {
$safe_user_id = Database::escape_string($user_id); $safe_user_id = Database::escape_string($user_id);
// to prevent a hacking attempt: http://www.dokeos.com/forum/viewtopic.php?t=5363 // to prevent a hacking attempt: http://www.dokeos.com/forum/viewtopic.php?t=5363
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $user_table WHERE user_id='".intval($safe_user_id)."'"; $sql = "SELECT * FROM $user_table WHERE user_id='".intval($safe_user_id)."'";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) == 1) { if (Database::num_rows($result) == 1) {
@ -853,7 +853,7 @@ class SocialManager extends UserManager {
echo $alt; echo $alt;
echo '</div><br />'; echo '</div><br />';
echo '<div>'; echo '<div>';
echo '<div style="margin:0 auto; width:350px; border:1px;">'; echo '<div style="margin:0 auto; width:350px; border:1px;">';
echo '<div id="whoisonline-user-image" style="float:left; padding:5px;">'; echo '<div id="whoisonline-user-image" style="float:left; padding:5px;">';
if (strlen(trim($user_object->picture_uri)) > 0) { if (strlen(trim($user_object->picture_uri)) > 0) {
@ -881,17 +881,17 @@ class SocialManager extends UserManager {
} }
echo '<div style="text-align:center;padding-top:5px;">'.$status.'</div>'; echo '<div style="text-align:center;padding-top:5px;">'.$status.'</div>';
echo '</div>'; echo '</div>';
echo '<div id="whoisonline-user-info" style="float:left; padding-left:15px;">'; echo '<div id="whoisonline-user-info" style="float:left; padding-left:15px;">';
global $user_anonymous; global $user_anonymous;
if (api_get_setting('allow_social_tool') == 'true' && api_get_user_id() <> $user_anonymous && api_get_user_id() <> 0) { if (api_get_setting('allow_social_tool') == 'true' && api_get_user_id() <> $user_anonymous && api_get_user_id() <> 0) {
echo '<p><a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$safe_user_id.'">'.Display :: return_icon('my_shared_profile.png', get_lang('SocialInvitationToFriends'),array('height'=>'18px')).get_lang('ViewSharedProfile').'</a></p>'; echo '<p><a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$safe_user_id.'">'.Display :: return_icon('my_shared_profile.png', get_lang('SocialInvitationToFriends'),array('height'=>'18px')).get_lang('ViewSharedProfile').'</a></p>';
$user_anonymous = api_get_anonymous_id(); $user_anonymous = api_get_anonymous_id();
if ($safe_user_id != api_get_user_id() && !api_is_anonymous($safe_user_id)) { if ($safe_user_id != api_get_user_id() && !api_is_anonymous($safe_user_id)) {
$user_relation = SocialManager::get_relation_between_contacts(api_get_user_id(), $safe_user_id); $user_relation = SocialManager::get_relation_between_contacts(api_get_user_id(), $safe_user_id);
if ($user_relation == 0 || $user_relation == 6) { if ($user_relation == 0 || $user_relation == 6) {

@ -187,7 +187,7 @@ class TableSort {
$check_date = strtotime(strip_tags($row[$column])); $check_date = strtotime(strip_tags($row[$column]));
// strtotime Returns a timestamp on success, FALSE otherwise. // strtotime Returns a timestamp on success, FALSE otherwise.
// Previous to PHP 5.1.0, this function would return -1 on failure. // Previous to PHP 5.1.0, this function would return -1 on failure.
$is_date &= ($check_date != -1 && $check_date != false); $is_date &= ($check_date != -1 && $check_date);
} else { } else {
$is_date &= false; $is_date &= false;
} }

@ -13,7 +13,7 @@
* @package chamilo.course_progress * @package chamilo.course_progress
*/ */
class Thematic class Thematic
{ {
private $session_id; private $session_id;
private $thematic_id; private $thematic_id;
private $thematic_title; private $thematic_title;
@ -21,7 +21,7 @@ class Thematic
private $thematic_plan_id; private $thematic_plan_id;
private $thematic_plan_title; private $thematic_plan_title;
private $thematic_plan_description; private $thematic_plan_description;
private $thematic_plan_description_type; private $thematic_plan_description_type;
private $thematic_advance_id; private $thematic_advance_id;
private $attendance_id; private $attendance_id;
private $thematic_advance_content; private $thematic_advance_content;
@ -29,24 +29,24 @@ class Thematic
private $duration; private $duration;
public function __construct() {} public function __construct() {}
/** /**
* Get the total number of thematic inside current course and current session * Get the total number of thematic inside current course and current session
* @see SortableTable#get_total_number_of_items() * @see SortableTable#get_total_number_of_items()
*/ */
public function get_number_of_thematics() { public function get_number_of_thematics() {
$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic WHERE active = 1 $condition_session "; $sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic WHERE active = 1 $condition_session ";
$res = Database::query($sql); $res = Database::query($sql);
$res = Database::query($sql); $res = Database::query($sql);
$obj = Database::fetch_object($res); $obj = Database::fetch_object($res);
return $obj->total_number_of_items; return $obj->total_number_of_items;
} }
/** /**
* Get the thematics to display on the current page (fill the sortable-table) * Get the thematics to display on the current page (fill the sortable-table)
* @param int offset of first user to recover * @param int offset of first user to recover
@ -68,7 +68,7 @@ class Thematic
$sql = "SELECT $sql = "SELECT
id AS col0, id AS col0,
title AS col1, title AS col1,
display_order AS col2 display_order AS col2
FROM $tbl_thematic FROM $tbl_thematic
WHERE active = 1 $condition_session WHERE active = 1 $condition_session
ORDER BY col2 LIMIT $from,$number_of_items "; ORDER BY col2 LIMIT $from,$number_of_items ";
@ -80,34 +80,34 @@ class Thematic
$param_gradebook = '&gradebook='.$_SESSION['gradebook']; $param_gradebook = '&gradebook='.$_SESSION['gradebook'];
} }
while ($thematic = Database::fetch_row($res)) { while ($thematic = Database::fetch_row($res)) {
$thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].$param_gradebook.'">'.Security::remove_XSS($thematic[1], STUDENT).'</a>'; $thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].$param_gradebook.'">'.Security::remove_XSS($thematic[1], STUDENT).'</a>';
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$actions = ''; $actions = '';
$actions .= '<center><a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('info.gif',get_lang('ThematicPlan')).'</a>&nbsp;'; $actions .= '<center><a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('info.gif',get_lang('ThematicPlan')).'</a>&nbsp;';
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('porcent.png',get_lang('ThematicAdvance')).'</a>&nbsp;'; $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('porcent.png',get_lang('ThematicAdvance')).'</a>&nbsp;';
if ($thematic[2] > 1) { if ($thematic[2] > 1) {
$actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('up.gif', get_lang('Up')).'</a>'; $actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('up.gif', get_lang('Up')).'</a>';
} else { } else {
$actions .= Display::return_icon('up_na.gif','&nbsp;'); $actions .= Display::return_icon('up_na.gif','&nbsp;');
} }
if ($thematic[2] < self::get_max_thematic_item()) { if ($thematic[2] < self::get_max_thematic_item()) {
$actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('down.gif',get_lang('Down')).'</a>'; $actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('down.gif',get_lang('Down')).'</a>';
} else { } else {
$actions .= Display::return_icon('down_na.gif','&nbsp;'); $actions .= Display::return_icon('down_na.gif','&nbsp;');
} }
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>&nbsp;'; $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>&nbsp;';
$actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a></center>'; $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].$param_gradebook.'">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a></center>';
$thematics[] = array($thematic[0], $thematic[1], $actions); $thematics[] = array($thematic[0], $thematic[1], $actions);
} }
} }
return $thematics; return $thematics;
} }
/** /**
* Get the maximum display order of the thematic item * Get the maximum display order of the thematic item
* @return int Maximum display order * @return int Maximum display order
@ -123,7 +123,7 @@ class Thematic
$row = Database::fetch_array($rs); $row = Database::fetch_array($rs);
return $row[0]; return $row[0];
} }
/** /**
* Move a thematic * Move a thematic
* *
@ -143,17 +143,17 @@ class Thematic
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$sql = "SELECT id, display_order FROM $tbl_thematic WHERE active = 1 $condition_session ORDER BY display_order $sortorder"; $sql = "SELECT id, display_order FROM $tbl_thematic WHERE active = 1 $condition_session ORDER BY display_order $sortorder";
$res = Database::query($sql); $res = Database::query($sql);
$found = false; $found = false;
//Variable definition //Variable definition
$current_id = 0; $current_id = 0;
$next_id = 0; $next_id = 0;
while ($row = Database::fetch_array($res)) { while ($row = Database::fetch_array($res)) {
if ($found == true && empty($next_id)) { if ($found && empty($next_id)) {
$next_id = intval($row['id']); $next_id = intval($row['id']);
$next_display_order = intval($row['display_order']); $next_display_order = intval($row['display_order']);
} }
@ -167,7 +167,7 @@ class Thematic
// get last done thematic advance before move thematic list // get last done thematic advance before move thematic list
$last_done_thematic_advance = $this->get_last_done_thematic_advance(); $last_done_thematic_advance = $this->get_last_done_thematic_advance();
if (!empty($next_display_order) && !empty($current_id)) { if (!empty($next_display_order) && !empty($current_id)) {
$sql = "UPDATE $tbl_thematic SET display_order = $next_display_order WHERE id = $current_id "; $sql = "UPDATE $tbl_thematic SET display_order = $next_display_order WHERE id = $current_id ";
Database::query($sql); Database::query($sql);
@ -176,27 +176,27 @@ class Thematic
$sql = "UPDATE $tbl_thematic SET display_order = $current_display_order WHERE id = $next_id "; $sql = "UPDATE $tbl_thematic SET display_order = $current_display_order WHERE id = $next_id ";
Database::query($sql); Database::query($sql);
} }
// update done advances with de current thematic list // update done advances with de current thematic list
$update_done_advances = $this->update_done_thematic_advances($last_done_thematic_advance); $update_done_advances = $this->update_done_thematic_advances($last_done_thematic_advance);
} }
/** /**
* get thematic list * get thematic list
* @param int Thematic id (optional), get list by id * @param int Thematic id (optional), get list by id
* @return array Thematic data * @return array Thematic data
*/ */
public function get_thematic_list($thematic_id = null, $course_code = null, $session_id = null) { public function get_thematic_list($thematic_id = null, $course_code = null, $session_id = null) {
// set current course and session // set current course and session
if (isset($course_code)) { if (isset($course_code)) {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC, $course_info['dbName']); $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC, $course_info['dbName']);
} else { } else {
$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
} }
if (isset($session_id)) { if (isset($session_id)) {
$session_id = intval($session_id); $session_id = intval($session_id);
} else { } else {
@ -204,11 +204,11 @@ class Thematic
} }
$data = array(); $data = array();
$condition = ''; $condition = '';
if (isset($thematic_id)) { if (isset($thematic_id)) {
$thematic_id = intval($thematic_id); $thematic_id = intval($thematic_id);
$condition = " WHERE id = $thematic_id "; $condition = " WHERE id = $thematic_id ";
} else { } else {
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$condition = " WHERE active = 1 $condition_session "; $condition = " WHERE active = 1 $condition_session ";
} }
@ -216,46 +216,46 @@ class Thematic
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res) > 0) { if (Database::num_rows($res) > 0) {
if (!empty($thematic_id)) { if (!empty($thematic_id)) {
$data = Database::fetch_array($res); $data = Database::fetch_array($res);
} else { } else {
while ($row = Database::fetch_array($res)) { while ($row = Database::fetch_array($res)) {
$data[$row['id']] = $row; $data[$row['id']] = $row;
} }
} }
} }
return $data; return $data;
} }
/** /**
* insert or update a thematic * insert or update a thematic
* @return int last thematic id * @return int last thematic id
*/ */
public function thematic_save() { public function thematic_save() {
global $_course; global $_course;
// definition database table // definition database table
$tbl_thematic = Database::get_course_table(TABLE_THEMATIC); $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
// protect data // protect data
$id = intval($this->thematic_id); $id = intval($this->thematic_id);
$title = Database::escape_string($this->thematic_title); $title = Database::escape_string($this->thematic_title);
$content = Database::escape_string($this->thematic_content); $content = Database::escape_string($this->thematic_content);
$session_id = intval($this->session_id); $session_id = intval($this->session_id);
$user_id = api_get_user_id(); $user_id = api_get_user_id();
// get the maximum display order of all the glossary items // get the maximum display order of all the glossary items
$max_thematic_item = $this->get_max_thematic_item(); $max_thematic_item = $this->get_max_thematic_item();
if (empty($id)) { if (empty($id)) {
// insert // insert
$sql = "INSERT INTO $tbl_thematic(title, content, active, display_order, session_id) VALUES ('$title', '$content', 1, ".(intval($max_thematic_item)+1).", $session_id) "; $sql = "INSERT INTO $tbl_thematic(title, content, active, display_order, session_id) VALUES ('$title', '$content', 1, ".(intval($max_thematic_item)+1).", $session_id) ";
Database::query($sql); Database::query($sql);
$last_id = Database::insert_id(); $last_id = Database::insert_id();
if (Database::affected_rows()) { if (Database::affected_rows()) {
// save inside item property table // save inside item property table
$last_id = Database::insert_id(); $last_id = Database::insert_id();
api_item_property_update($_course, 'thematic', $last_id,"ThematicAdded", $user_id); api_item_property_update($_course, 'thematic', $last_id,"ThematicAdded", $user_id);
} }
} else { } else {
// update // update
$sql = "UPDATE $tbl_thematic SET title = '$title', content = '$content', session_id = $session_id WHERE id = $id "; $sql = "UPDATE $tbl_thematic SET title = '$title', content = '$content', session_id = $session_id WHERE id = $id ";
@ -265,10 +265,10 @@ class Thematic
// save inside item property table // save inside item property table
api_item_property_update($_course, 'thematic', $last_id,"ThematicUpdated", $user_id); api_item_property_update($_course, 'thematic', $last_id,"ThematicUpdated", $user_id);
} }
} }
return $last_id; return $last_id;
} }
/** /**
* Delete logically (set active field to 0) a thematic * Delete logically (set active field to 0) a thematic
* @param int|array One or many thematic ids * @param int|array One or many thematic ids
@ -302,24 +302,24 @@ class Thematic
api_item_property_update($_course, 'thematic', $thematic_id,"ThematicDeleted", $user_id); api_item_property_update($_course, 'thematic', $thematic_id,"ThematicDeleted", $user_id);
} }
} }
return $affected_rows; return $affected_rows;
} }
/** /**
* Get the total number of thematic advance inside current course * Get the total number of thematic advance inside current course
* @see SortableTable#get_total_number_of_items() * @see SortableTable#get_total_number_of_items()
*/ */
public function get_number_of_thematic_advances() { public function get_number_of_thematic_advances() {
global $thematic_id; global $thematic_id;
$tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE); $tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic_advance WHERE thematic_id = $thematic_id "; $sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic_advance WHERE thematic_id = $thematic_id ";
$res = Database::query($sql); $res = Database::query($sql);
$res = Database::query($sql); $res = Database::query($sql);
$obj = Database::fetch_object($res); $obj = Database::fetch_object($res);
return $obj->total_number_of_items; return $obj->total_number_of_items;
} }
/** /**
* Get the thematic advances to display on the current page (fill the sortable-table) * Get the thematic advances to display on the current page (fill the sortable-table)
* @param int offset of first user to recover * @param int offset of first user to recover
@ -329,8 +329,8 @@ class Thematic
* @see SortableTable#get_table_data($from) * @see SortableTable#get_table_data($from)
*/ */
public function get_thematic_advance_data($from, $number_of_items, $column, $direction) { public function get_thematic_advance_data($from, $number_of_items, $column, $direction) {
global $thematic_id; global $thematic_id;
$tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE); $tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$thematic_data = self::get_thematic_list($thematic_id); $thematic_data = self::get_thematic_list($thematic_id);
$column = intval($column); $column = intval($column);
$from = intval($from); $from = intval($from);
@ -342,98 +342,98 @@ class Thematic
id AS col0, id AS col0,
start_date AS col1, start_date AS col1,
duration AS col2, duration AS col2,
content AS col3 content AS col3
FROM $tbl_thematic_advance FROM $tbl_thematic_advance
WHERE thematic_id = $thematic_id WHERE thematic_id = $thematic_id
ORDER BY col$column $direction LIMIT $from,$number_of_items "; ORDER BY col$column $direction LIMIT $from,$number_of_items ";
$res = Database::query($sql); $res = Database::query($sql);
$data = array (); $data = array ();
$i = 1; $i = 1;
while ($thematic_advance = Database::fetch_row($res)) { while ($thematic_advance = Database::fetch_row($res)) {
$thematic_advance[1] = api_get_local_time($thematic_advance[1]); $thematic_advance[1] = api_get_local_time($thematic_advance[1]);
$thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG); $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$actions = ''; $actions = '';
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>&nbsp;'; $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>&nbsp;';
$actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a></center>'; $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a></center>';
$data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions); $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions);
} }
$i++; $i++;
} }
return $data; return $data;
} }
/** /**
* get thematic advance data by tematic id * get thematic advance data by tematic id
* @param int Thematic id * @param int Thematic id
* @param string Course code (optional) * @param string Course code (optional)
* @return array data * @return array data
*/ */
public function get_thematic_advance_by_thematic_id($thematic_id, $course_code = null) { public function get_thematic_advance_by_thematic_id($thematic_id, $course_code = null) {
// set current course // set current course
if (isset($course_code)) { if (isset($course_code)) {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE, $course_info['dbName']); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE, $course_info['dbName']);
} else { } else {
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
} }
$thematic_id = intval($thematic_id); $thematic_id = intval($thematic_id);
$data = array(); $data = array();
$sql = "SELECT * FROM $tbl_thematic_advance WHERE thematic_id = $thematic_id "; $sql = "SELECT * FROM $tbl_thematic_advance WHERE thematic_id = $thematic_id ";
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res) > 0) { if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_array($res)) { while ($row = Database::fetch_array($res)) {
$data[] = $row; $data[] = $row;
} }
} }
return $data; return $data;
} }
/** /**
* get thematic advance list * get thematic advance list
* @param int Thematic advance id (optional), get data by thematic advance list * @param int Thematic advance id (optional), get data by thematic advance list
* @param string Course code (optional) * @param string Course code (optional)
* @return array data * @return array data
*/ */
public function get_thematic_advance_list($thematic_advance_id = null, $course_code = null) { public function get_thematic_advance_list($thematic_advance_id = null, $course_code = null) {
// set current course // set current course
if (isset($course_code)) { if (isset($course_code)) {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE, $course_info['dbName']); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE, $course_info['dbName']);
} else { } else {
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
} }
$data = array(); $data = array();
$condition = ''; $condition = '';
if (isset($thematic_advance_id)) { if (isset($thematic_advance_id)) {
$thematic_advance_id = intval($thematic_advance_id); $thematic_advance_id = intval($thematic_advance_id);
$condition = " WHERE id = $thematic_advance_id "; $condition = " WHERE id = $thematic_advance_id ";
} }
$sql = "SELECT * FROM $tbl_thematic_advance $condition ORDER BY start_date "; $sql = "SELECT * FROM $tbl_thematic_advance $condition ORDER BY start_date ";
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res) > 0) { if (Database::num_rows($res) > 0) {
if (!empty($thematic_advance_id)) { if (!empty($thematic_advance_id)) {
$data = Database::fetch_array($res); $data = Database::fetch_array($res);
} else { } else {
// group all data group by thematic id // group all data group by thematic id
$tmp = array(); $tmp = array();
while ($row = Database::fetch_array($res)) { while ($row = Database::fetch_array($res)) {
$tmp[] = $row['thematic_id']; $tmp[] = $row['thematic_id'];
if (in_array($row['thematic_id'], $tmp)) { if (in_array($row['thematic_id'], $tmp)) {
$data[$row['thematic_id']][$row['id']] = $row; $data[$row['thematic_id']][$row['id']] = $row;
} }
} }
} }
} }
return $data; return $data;
} }
/** /**
* insert or update a thematic advance * insert or update a thematic advance
* @return int last thematic advance id * @return int last thematic advance id
@ -442,9 +442,9 @@ class Thematic
global $_course; global $_course;
// definition database table // definition database table
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
// protect data // protect data
$id = intval($this->thematic_advance_id); $id = intval($this->thematic_advance_id);
$tematic_id = intval($this->thematic_id); $tematic_id = intval($this->thematic_id);
@ -454,7 +454,7 @@ class Thematic
$duration = intval($this->duration); $duration = intval($this->duration);
$user_id = api_get_user_id(); $user_id = api_get_user_id();
if (empty($id)) { if (empty($id)) {
// insert // insert
$sql = "INSERT INTO $tbl_thematic_advance (thematic_id, attendance_id, content, start_date, duration) VALUES ($tematic_id, $attendance_id, '$content', '".api_get_utc_datetime($start_date)."', $duration) "; $sql = "INSERT INTO $tbl_thematic_advance (thematic_id, attendance_id, content, start_date, duration) VALUES ($tematic_id, $attendance_id, '$content', '".api_get_utc_datetime($start_date)."', $duration) ";
Database::query($sql); Database::query($sql);
@ -472,11 +472,11 @@ class Thematic
api_item_property_update($_course, 'thematic_advance', $last_id,"ThematicAdvanceUpdated", $user_id); api_item_property_update($_course, 'thematic_advance', $last_id,"ThematicAdvanceUpdated", $user_id);
} }
} }
return $last_id; return $last_id;
} }
/** /**
* delete thematic advance * delete thematic advance
* @param int Thematic advance id * @param int Thematic advance id
@ -485,7 +485,7 @@ class Thematic
public function thematic_advance_destroy($thematic_advance_id) { public function thematic_advance_destroy($thematic_advance_id) {
global $_course; global $_course;
// definition database table // definition database table
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
// protect data // protect data
@ -498,10 +498,10 @@ class Thematic
if ($affected_rows) { if ($affected_rows) {
api_item_property_update($_course, 'thematic_advance', $thematic_advance_id,"ThematicAdvanceDeleted", $user_id); api_item_property_update($_course, 'thematic_advance', $thematic_advance_id,"ThematicAdvanceDeleted", $user_id);
} }
return $affected_rows; return $affected_rows;
} }
/** /**
* get thematic plan data * get thematic plan data
* @param int Thematic id (optional), get data by thematic id * @param int Thematic id (optional), get data by thematic id
@ -509,8 +509,8 @@ class Thematic
* @return array Thematic plan data * @return array Thematic plan data
*/ */
public function get_thematic_plan_data($thematic_id = null, $description_type = null) { public function get_thematic_plan_data($thematic_id = null, $description_type = null) {
// definition database table // definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN); $tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
$data = array(); $data = array();
$condition = ''; $condition = '';
@ -522,50 +522,50 @@ class Thematic
$description_type = intval($description_type); $description_type = intval($description_type);
$condition .= " AND description_type = $description_type "; $condition .= " AND description_type = $description_type ";
} }
$sql = "SELECT * FROM $tbl_thematic_plan WHERE 1 $condition"; $sql = "SELECT * FROM $tbl_thematic_plan WHERE 1 $condition";
$rs = Database::query($sql); $rs = Database::query($sql);
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
if (!isset($thematic_id) && !isset($description_type)) { if (!isset($thematic_id) && !isset($description_type)) {
// group all data group by thematic id // group all data group by thematic id
$tmp = array(); $tmp = array();
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
$tmp[] = $row['thematic_id']; $tmp[] = $row['thematic_id'];
if (in_array($row['thematic_id'], $tmp)) { if (in_array($row['thematic_id'], $tmp)) {
$data[$row['thematic_id']][$row['id']] = $row; $data[$row['thematic_id']][$row['id']] = $row;
} }
} }
} else { } else {
while ($row = Database::fetch_array($rs)) { while ($row = Database::fetch_array($rs)) {
$data[] = $row; $data[] = $row;
} }
} }
} }
return $data; return $data;
} }
/** /**
* insert or update a thematic plan * insert or update a thematic plan
* @return int affected rows * @return int affected rows
*/ */
public function thematic_plan_save() { public function thematic_plan_save() {
global $_course; global $_course;
// definition database table // definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN); $tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
// protect data // protect data
$thematic_id = intval($this->thematic_id); $thematic_id = intval($this->thematic_id);
$title = Database::escape_string($this->thematic_plan_title); $title = Database::escape_string($this->thematic_plan_title);
$description = Database::escape_string($this->thematic_plan_description); $description = Database::escape_string($this->thematic_plan_description);
$description_type = intval($this->thematic_plan_description_type); $description_type = intval($this->thematic_plan_description_type);
$user_id = api_get_user_id(); $user_id = api_get_user_id();
// check thematic plan type already exists // check thematic plan type already exists
$sql = "SELECT id FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type = $description_type "; $sql = "SELECT id FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type = $description_type ";
$rs = Database::query($sql); $rs = Database::query($sql);
$affected_rows = 0; $affected_rows = 0;
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
$row_thematic_plan = Database::fetch_array($rs); $row_thematic_plan = Database::fetch_array($rs);
@ -586,11 +586,11 @@ class Thematic
if ($affected_rows) { if ($affected_rows) {
api_item_property_update($_course, 'thematic_plan', $last_id,"ThematicPlanAdded", $user_id); api_item_property_update($_course, 'thematic_plan', $last_id,"ThematicPlanAdded", $user_id);
} }
} }
return $affected_rows; return $affected_rows;
} }
/** /**
* delete a thematic plan description * delete a thematic plan description
* @param int Thematic id * @param int Thematic id
@ -598,15 +598,15 @@ class Thematic
* @return int Affected rows * @return int Affected rows
*/ */
public function thematic_plan_destroy($thematic_id, $description_type) { public function thematic_plan_destroy($thematic_id, $description_type) {
// definition database table // definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN); $tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
// protect data // protect data
$thematic_id = intval($thematic_id); $thematic_id = intval($thematic_id);
$description_type = intval($description_type); $description_type = intval($description_type);
$user_id = api_get_user_id(); $user_id = api_get_user_id();
// get thematic plan id // get thematic plan id
$thematic_plan_data = $this->get_thematic_plan_data($thematic_id, $description_type); $thematic_plan_data = $this->get_thematic_plan_data($thematic_id, $description_type);
$thematic_plan_id = $thematic_plan_data[0]['id']; $thematic_plan_id = $thematic_plan_data[0]['id'];
@ -615,45 +615,45 @@ class Thematic
$sql = "DELETE FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type = $description_type "; $sql = "DELETE FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type = $description_type ";
Database::query($sql); Database::query($sql);
$affected_rows = Database::affected_rows(); $affected_rows = Database::affected_rows();
if ($affected_rows) { if ($affected_rows) {
api_item_property_update($_course, 'thematic_plan', $thematic_plan_id,"ThematicPlanDeleted", $user_id); api_item_property_update($_course, 'thematic_plan', $thematic_plan_id,"ThematicPlanDeleted", $user_id);
} }
return $affected_rows; return $affected_rows;
} }
/** /**
* Get next description type for a new thematic plan description (option 'others') * Get next description type for a new thematic plan description (option 'others')
* @param int Thematic id * @param int Thematic id
* @return int New Description type * @return int New Description type
*/ */
public function get_next_description_type($thematic_id) { public function get_next_description_type($thematic_id) {
// definition database table // definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN); $tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
// protect data // protect data
$thematic_id = intval($thematic_id); $thematic_id = intval($thematic_id);
$description_type = intval($description_type); $description_type = intval($description_type);
$next_description_type = 0; $next_description_type = 0;
$sql = "SELECT MAX(description_type) as max FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type >= ".ADD_THEMATIC_PLAN." "; $sql = "SELECT MAX(description_type) as max FROM $tbl_thematic_plan WHERE thematic_id = $thematic_id AND description_type >= ".ADD_THEMATIC_PLAN." ";
$rs = Database::query($sql); $rs = Database::query($sql);
$row = Database::fetch_array($rs); $row = Database::fetch_array($rs);
$last_description_type = $row['max']; $last_description_type = $row['max'];
if (isset($last_description_type)) { if (isset($last_description_type)) {
$row = Database::fetch_array($rs); $row = Database::fetch_array($rs);
$next_description_type = $last_description_type + 1; $next_description_type = $last_description_type + 1;
} else { } else {
$next_description_type = ADD_THEMATIC_PLAN; $next_description_type = ADD_THEMATIC_PLAN;
} }
return $next_description_type; return $next_description_type;
} }
/** /**
* update done thematic advances from thematic details interface * update done thematic advances from thematic details interface
* @param int Thematic id * @param int Thematic id
@ -667,14 +667,14 @@ class Thematic
$affected_rows = 0; $affected_rows = 0;
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$a_thematic_advance_ids = array(); $a_thematic_advance_ids = array();
if (!empty($thematic_data)) { if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) { foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id']; $thematic_id = $thematic['id'];
if (!empty($thematic_advance_data[$thematic['id']])) { if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
$a_thematic_advance_ids[] = $thematic_advance['id']; $a_thematic_advance_ids[] = $thematic_advance['id'];
// update done thematic for previous advances ((done_advance = 1)) // update done thematic for previous advances ((done_advance = 1))
$upd = "UPDATE $tbl_thematic_advance set done_advance = 1 WHERE id = ".$thematic_advance['id']." "; $upd = "UPDATE $tbl_thematic_advance set done_advance = 1 WHERE id = ".$thematic_advance['id']." ";
Database::query($upd); Database::query($upd);
@ -684,13 +684,13 @@ class Thematic
} }
if ($thematic_advance['id'] == $thematic_advance_id) { if ($thematic_advance['id'] == $thematic_advance_id) {
break 2; break 2;
} }
} }
} }
} }
} }
// Update done thematic for others advances (done_advance = 0) // Update done thematic for others advances (done_advance = 0)
if (!empty($a_thematic_advance_ids) && count($a_thematic_advance_ids) > 0) { if (!empty($a_thematic_advance_ids) && count($a_thematic_advance_ids) > 0) {
$upd = "UPDATE $tbl_thematic_advance set done_advance = 0 WHERE id NOT IN(".implode(',',$a_thematic_advance_ids).") "; $upd = "UPDATE $tbl_thematic_advance set done_advance = 0 WHERE id NOT IN(".implode(',',$a_thematic_advance_ids).") ";
Database::query($upd); Database::query($upd);
@ -700,46 +700,46 @@ class Thematic
$rs_thematic_done = Database::query("SELECT ref FROM $tbl_item_property WHERE tool='thematic_advance' AND lastedit_type='ThematicAdvanceDone'"); $rs_thematic_done = Database::query("SELECT ref FROM $tbl_item_property WHERE tool='thematic_advance' AND lastedit_type='ThematicAdvanceDone'");
if (Database::num_rows($rs_thematic_done) > 0) { if (Database::num_rows($rs_thematic_done) > 0) {
while ($row_thematic_done = Database::fetch_array($rs_thematic_done)) { while ($row_thematic_done = Database::fetch_array($rs_thematic_done)) {
$ref = $row_thematic_done['ref']; $ref = $row_thematic_done['ref'];
if (in_array($ref, $a_thematic_advance_ids)) { continue; } if (in_array($ref, $a_thematic_advance_ids)) { continue; }
// update items // update items
Database::query("UPDATE $tbl_item_property SET lastedit_date='".date('Y-m-d H:i:s', time())."', lastedit_type='ThematicAdvanceUpdated', lastedit_user_id = $user_id WHERE tool='thematic_advance' AND ref=$ref"); Database::query("UPDATE $tbl_item_property SET lastedit_date='".date('Y-m-d H:i:s', time())."', lastedit_type='ThematicAdvanceUpdated', lastedit_user_id = $user_id WHERE tool='thematic_advance' AND ref=$ref");
} }
} }
} }
return $affected_rows; return $affected_rows;
} }
/** /**
* Get last done thematic advance from thematic details interface * Get last done thematic advance from thematic details interface
* @return int Last done thematic advance id * @return int Last done thematic advance id
*/ */
public function get_last_done_thematic_advance() { public function get_last_done_thematic_advance() {
$thematic_data = $this->get_thematic_list(); $thematic_data = $this->get_thematic_list();
$thematic_advance_data = $this->get_thematic_advance_list(); $thematic_advance_data = $this->get_thematic_advance_list();
$a_thematic_advance_ids = array(); $a_thematic_advance_ids = array();
$last_done_advance_id = 0; $last_done_advance_id = 0;
if (!empty($thematic_data)) { if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) { foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id']; $thematic_id = $thematic['id'];
if (!empty($thematic_advance_data[$thematic['id']])) { if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
if ($thematic_advance['done_advance'] == 1) { if ($thematic_advance['done_advance'] == 1) {
$a_thematic_advance_ids[] = $thematic_advance['id']; $a_thematic_advance_ids[] = $thematic_advance['id'];
} }
} }
} }
} }
} }
if (!empty($a_thematic_advance_ids)) { if (!empty($a_thematic_advance_ids)) {
$last_done_advance_id = array_pop($a_thematic_advance_ids); $last_done_advance_id = array_pop($a_thematic_advance_ids);
$last_done_advance_id = intval($last_done_advance_id); $last_done_advance_id = intval($last_done_advance_id);
} }
return $last_done_advance_id; return $last_done_advance_id;
} }
/** /**
@ -747,21 +747,21 @@ class Thematic
* @return int next thematic advance not done * @return int next thematic advance not done
*/ */
public function get_next_thematic_advance_not_done() { public function get_next_thematic_advance_not_done() {
$thematic_data = $this->get_thematic_list(); $thematic_data = $this->get_thematic_list();
$thematic_advance_data = $this->get_thematic_advance_list(); $thematic_advance_data = $this->get_thematic_advance_list();
$a_thematic_advance_ids = array(); $a_thematic_advance_ids = array();
$next_advance_not_done = 0; $next_advance_not_done = 0;
if (!empty($thematic_data)) { if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) { foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id']; $thematic_id = $thematic['id'];
if (!empty($thematic_advance_data[$thematic['id']])) { if (!empty($thematic_advance_data[$thematic['id']])) {
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
if ($thematic_advance['done_advance'] == 0) { if ($thematic_advance['done_advance'] == 0) {
$a_thematic_advance_ids[] = $thematic_advance['id']; $a_thematic_advance_ids[] = $thematic_advance['id'];
} }
} }
} }
} }
} }
@ -769,10 +769,10 @@ class Thematic
$next_advance_not_done = array_shift($a_thematic_advance_ids); $next_advance_not_done = array_shift($a_thematic_advance_ids);
$next_advance_not_done = intval($next_advance_not_done); $next_advance_not_done = intval($next_advance_not_done);
} }
return $next_advance_not_done; return $next_advance_not_done;
} }
/** /**
* Get total average of thematic advances * Get total average of thematic advances
* @param string Course code (optional) * @param string Course code (optional)
@ -780,15 +780,15 @@ class Thematic
* @return float Average of thematic advances * @return float Average of thematic advances
*/ */
public function get_total_average_of_thematic_advances($course_code = null, $session_id = null) { public function get_total_average_of_thematic_advances($course_code = null, $session_id = null) {
$thematic_data = $this->get_thematic_list(null, $course_code, $session_id); $thematic_data = $this->get_thematic_list(null, $course_code, $session_id);
$thematic_advance_data = $this->get_thematic_advance_list(null, $course_code); $thematic_advance_data = $this->get_thematic_advance_list(null, $course_code);
$a_average_of_advances_by_thematic = array(); $a_average_of_advances_by_thematic = array();
$total_average = 0; $total_average = 0;
if (!empty($thematic_data)) { if (!empty($thematic_data)) {
foreach ($thematic_data as $thematic) { foreach ($thematic_data as $thematic) {
$thematic_id = $thematic['id']; $thematic_id = $thematic['id'];
$a_average_of_advances_by_thematic[$thematic_id] = $this->get_average_of_advances_by_thematic($thematic_id, $course_code); $a_average_of_advances_by_thematic[$thematic_id] = $this->get_average_of_advances_by_thematic($thematic_id, $course_code);
} }
} }
@ -796,44 +796,44 @@ class Thematic
if (!empty($a_average_of_advances_by_thematic)) { if (!empty($a_average_of_advances_by_thematic)) {
$count_tematics = count($thematic_data); $count_tematics = count($thematic_data);
$score = array_sum($a_average_of_advances_by_thematic); $score = array_sum($a_average_of_advances_by_thematic);
$total_average = round(($score*100)/($count_tematics*100)); $total_average = round(($score*100)/($count_tematics*100));
} }
return $total_average; return $total_average;
} }
/** /**
* Get average of advances by thematic * Get average of advances by thematic
* @param int Thematic id * @param int Thematic id
* @param string Course code (optional) * @param string Course code (optional)
* @return float Average of thematic advances * @return float Average of thematic advances
*/ */
public function get_average_of_advances_by_thematic($thematic_id, $course_code = null) { public function get_average_of_advances_by_thematic($thematic_id, $course_code = null) {
$thematic_advance_data = $this->get_thematic_advance_by_thematic_id($thematic_id, $course_code); $thematic_advance_data = $this->get_thematic_advance_by_thematic_id($thematic_id, $course_code);
$average = 0; $average = 0;
if (!empty($thematic_advance_data)) { if (!empty($thematic_advance_data)) {
// get all done advances by thematic // get all done advances by thematic
$advances = array(); $advances = array();
$count_done_advances = 0; $count_done_advances = 0;
$average = 0; $average = 0;
foreach ($thematic_advance_data as $thematic_advance) { foreach ($thematic_advance_data as $thematic_advance) {
if ($thematic_advance['done_advance'] == 1) { if ($thematic_advance['done_advance'] == 1) {
$count_done_advances++; $count_done_advances++;
} }
$advances[] = $thematic_advance['done_advance']; $advances[] = $thematic_advance['done_advance'];
} }
// calculate average by thematic // calculate average by thematic
$count_total_advances = count($advances); $count_total_advances = count($advances);
$average = round(($count_done_advances*100)/$count_total_advances); $average = round(($count_done_advances*100)/$count_total_advances);
} }
return $average; return $average;
} }
/** /**
* set attributes for fields of thematic table * set attributes for fields of thematic table
* @param int Thematic id * @param int Thematic id
@ -842,17 +842,17 @@ class Thematic
* @param int Session id * @param int Session id
* @return void * @return void
*/ */
public function set_thematic_attributes($id = null, $title = '', $content = '', $session_id = 0) { public function set_thematic_attributes($id = null, $title = '', $content = '', $session_id = 0) {
$this->thematic_id = $id; $this->thematic_id = $id;
$this->thematic_title = $title; $this->thematic_title = $title;
$this->thematic_content = $content; $this->thematic_content = $content;
$this->session_id = $session_id; $this->session_id = $session_id;
} }
/** /**
* set attributes for fields of thematic_plan table * set attributes for fields of thematic_plan table
* @param int Thematic id * @param int Thematic id
* @param string Thematic plan title * @param string Thematic plan title
* @param string Thematic plan description * @param string Thematic plan description
* @param int Thematic plan description type * @param int Thematic plan description type
* @return void * @return void
@ -861,13 +861,13 @@ class Thematic
$this->thematic_id = $thematic_id; $this->thematic_id = $thematic_id;
$this->thematic_plan_title = $title; $this->thematic_plan_title = $title;
$this->thematic_plan_description = $description; $this->thematic_plan_description = $description;
$this->thematic_plan_description_type = $description_type; $this->thematic_plan_description_type = $description_type;
} }
/** /**
* set attributes for fields of thematic_advance table * set attributes for fields of thematic_advance table
* @param int Thematic advance id * @param int Thematic advance id
* @param int Thematic id * @param int Thematic id
* @param int Attendance id * @param int Attendance id
* @param string Content * @param string Content
* @param string Date and time * @param string Date and time
@ -880,9 +880,9 @@ class Thematic
$this->attendance_id = $attendance_id; $this->attendance_id = $attendance_id;
$this->thematic_advance_content = $content; $this->thematic_advance_content = $content;
$this->start_date = $start_date; $this->start_date = $start_date;
$this->duration = $duration; $this->duration = $duration;
} }
/** /**
* set thematic id * set thematic id
* @param int Thematic id * @param int Thematic id
@ -891,15 +891,15 @@ class Thematic
public function set_thematic_id($thematic_id) { public function set_thematic_id($thematic_id) {
$this->thematic_id = $thematic_id; $this->thematic_id = $thematic_id;
} }
/** /**
* get thematic id * get thematic id
* @return void * @return void
*/ */
public function get_thematic_id() { public function get_thematic_id() {
return $this->thematic_id; return $this->thematic_id;
} }
/** /**
* Get thematic plan titles by default * Get thematic plan titles by default
* @return array * @return array
@ -911,7 +911,7 @@ class Thematic
$default_thematic_plan_titles[3]= get_lang('Infrastructure'); $default_thematic_plan_titles[3]= get_lang('Infrastructure');
$default_thematic_plan_titles[4]= get_lang('Methodology'); $default_thematic_plan_titles[4]= get_lang('Methodology');
$default_thematic_plan_titles[5]= get_lang('AditionalNotes'); $default_thematic_plan_titles[5]= get_lang('AditionalNotes');
$default_thematic_plan_titles[6]= get_lang('Others'); $default_thematic_plan_titles[6]= get_lang('Others');
return $default_thematic_plan_titles; return $default_thematic_plan_titles;
} }
@ -923,8 +923,8 @@ class Thematic
$default_thematic_plan_icon = array(); $default_thematic_plan_icon = array();
$default_thematic_plan_icon[1]= 'spire.gif'; $default_thematic_plan_icon[1]= 'spire.gif';
$default_thematic_plan_icon[2]= 'korganizer.gif'; $default_thematic_plan_icon[2]= 'korganizer.gif';
$default_thematic_plan_icon[3]= 'kcmdf_big.gif'; $default_thematic_plan_icon[3]= 'kcmdf_big.gif';
$default_thematic_plan_icon[4]= 'misc.gif'; $default_thematic_plan_icon[4]= 'misc.gif';
$default_thematic_plan_icon[5]= 'ktip.gif'; $default_thematic_plan_icon[5]= 'ktip.gif';
$default_thematic_plan_icon[6]= 'new_test.gif'; $default_thematic_plan_icon[6]= 'new_test.gif';
return $default_thematic_plan_icon; return $default_thematic_plan_icon;
@ -940,10 +940,10 @@ class Thematic
$question[2]= get_lang('SkillToAcquireQuestions'); $question[2]= get_lang('SkillToAcquireQuestions');
$question[3]= get_lang('InfrastructureQuestions'); $question[3]= get_lang('InfrastructureQuestions');
$question[4]= get_lang('MethodologyQuestions'); $question[4]= get_lang('MethodologyQuestions');
$question[5]= get_lang('AditionalNotesQuestions'); $question[5]= get_lang('AditionalNotesQuestions');
return $question; return $question;
} }
/** /**
* buid a string datetime from array * buid a string datetime from array
* @param array array containing data e.g: $array('Y'=>'2010', 'F' => '02', 'd' => '10', 'H' => '12', 'i' => '30') * @param array array containing data e.g: $array('Y'=>'2010', 'F' => '02', 'd' => '10', 'H' => '12', 'i' => '30')

@ -197,7 +197,7 @@ class Tracking {
$rs = Database::query($sql); $rs = Database::query($sql);
if (Database::num_rows($rs)>0) { if (Database::num_rows($rs)>0) {
if ($first_login_date = Database::result($rs, 0, 0)) { if ($first_login_date = Database::result($rs, 0, 0)) {
if ($convert_date == true) { if ($convert_date) {
return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT, date_default_timezone_get()); return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
} else { } else {
return $first_login_date; return $first_login_date;
@ -237,13 +237,13 @@ class Tracking {
//If the last connection is > than 7 days, the text is red //If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds //345600 = 7 days in seconds
if ($currentTimestamp - $timestamp > 604800) { if ($currentTimestamp - $timestamp > 604800) {
if ($convert_date == true) { if ($convert_date) {
return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . (api_is_allowed_to_edit()?' <a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'" title="'.get_lang('RemindInactiveUser').'"><img align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" /></a>':'').'</span>'; return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . (api_is_allowed_to_edit()?' <a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'" title="'.get_lang('RemindInactiveUser').'"><img align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" /></a>':'').'</span>';
} else { } else {
return $last_login_date; return $last_login_date;
} }
} else { } else {
if ($convert_date == true) { if ($convert_date) {
return api_format_date($last_login_date, DATE_FORMAT_SHORT); return api_format_date($last_login_date, DATE_FORMAT_SHORT);
} else { } else {
return $last_login_date; return $last_login_date;
@ -493,7 +493,7 @@ class Tracking {
} }
// average progress = total sum divided by the number of views // average progress = total sum divided by the number of views
// summed up. // summed up.
if ($return_array == false) { if (!$return_array) {
$avg_progress = round($sum / $number_items, 1); $avg_progress = round($sum / $number_items, 1);
return $avg_progress; return $avg_progress;
} else { } else {
@ -733,7 +733,7 @@ class Tracking {
//var_dump($lp_with_quiz); //var_dump($lp_with_quiz);
if ($lp_with_quiz != 0 ) { if ($lp_with_quiz != 0 ) {
if ($return_array == false) { if (!$return_array) {
$score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
return $score_of_scorm_calculate; return $score_of_scorm_calculate;
} else { } else {

@ -428,7 +428,7 @@ class UserManager
$sql = "SELECT user_id FROM $t_uf uf INNER JOIN $t_ufv ufv ON ufv.field_id=uf.id WHERE field_variable='$original_user_id_name' AND field_value='$original_user_id_value';"; $sql = "SELECT user_id FROM $t_uf uf INNER JOIN $t_ufv ufv ON ufv.field_id=uf.id WHERE field_variable='$original_user_id_name' AND field_value='$original_user_id_value';";
$res = Database::query($sql); $res = Database::query($sql);
$row = Database::fetch_object($res); $row = Database::fetch_object($res);
if ($row != false) { if ($row) {
return $row->user_id; return $row->user_id;
} else { } else {
return 0; return 0;
@ -1052,7 +1052,7 @@ class UserManager
break; break;
} }
} }
if ($check == false) { if (!$check) {
return false; //option value not found return false; //option value not found
} }
} else { } else {
@ -1133,7 +1133,7 @@ class UserManager
$sort_direction = strtoupper($direction); $sort_direction = strtoupper($direction);
} }
$sqlf = "SELECT * FROM $t_uf "; $sqlf = "SELECT * FROM $t_uf ";
if ($all_visibility == false) { if (!$all_visibility) {
$sqlf .= " WHERE field_visible = 1 "; $sqlf .= " WHERE field_visible = 1 ";
} }
$sqlf .= " ORDER BY ".$columns[$column]." $sort_direction " ; $sqlf .= " ORDER BY ".$columns[$column]." $sort_direction " ;
@ -1205,7 +1205,7 @@ class UserManager
public static function get_number_of_extra_fields($all_visibility = true) { public static function get_number_of_extra_fields($all_visibility = true) {
$t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD); $t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
$sqlf = "SELECT * FROM $t_uf "; $sqlf = "SELECT * FROM $t_uf ";
if ($all_visibility == false) { if (!$all_visibility) {
$sqlf .= " WHERE field_visible = 1 "; $sqlf .= " WHERE field_visible = 1 ";
} }
$sqlf .= " ORDER BY field_order"; $sqlf .= " ORDER BY field_order";
@ -1444,7 +1444,7 @@ class UserManager
$sql = "SELECT f.id as id, f.field_variable as fvar, f.field_type as type FROM $t_uf f "; $sql = "SELECT f.id as id, f.field_variable as fvar, f.field_type as type FROM $t_uf f ";
$filter_cond = ''; $filter_cond = '';
if ($all_visibility == false) { if (!$all_visibility) {
if (isset($field_filter)) { if (isset($field_filter)) {
$field_filter = intval($field_filter); $field_filter = intval($field_filter);
$filter_cond .= " AND field_filter = $field_filter "; $filter_cond .= " AND field_filter = $field_filter ";
@ -1528,7 +1528,7 @@ class UserManager
$sql .= " WHERE f.field_variable = '$field_variable' "; $sql .= " WHERE f.field_variable = '$field_variable' ";
if ($all_visibility == false) { if (!$all_visibility) {
$sql .= " AND f.field_visible = 1 "; $sql .= " AND f.field_visible = 1 ";
} }
@ -1658,7 +1658,7 @@ class UserManager
ON (user_field.id = user_field_values.field_id) ON (user_field.id = user_field_values.field_id)
WHERE $where"; WHERE $where";
if ($all_visibility == true) { if ($all_visibility) {
$sql .= " AND user_field.field_visible = 1 "; $sql .= " AND user_field.field_visible = 1 ";
} else { } else {
$sql .= " AND user_field.field_visible = 0 "; $sql .= " AND user_field.field_visible = 0 ";
@ -2991,7 +2991,7 @@ class UserManager
$tbl_my_message = Database :: get_main_table(TABLE_MAIN_MESSAGE); $tbl_my_message = Database :: get_main_table(TABLE_MAIN_MESSAGE);
$friend_id = intval($friend_id); $friend_id = intval($friend_id);
if ($real_removed == true) { if ($real_removed) {
//Delete user friend //Delete user friend
/* /*
$sql_delete_relationship1 = 'UPDATE ' . $tbl_my_friend .' SET relation_type='.USER_RELATION_TYPE_DELETED.' WHERE friend_user_id='.$friend_id; $sql_delete_relationship1 = 'UPDATE ' . $tbl_my_friend .' SET relation_type='.USER_RELATION_TYPE_DELETED.' WHERE friend_user_id='.$friend_id;

@ -677,7 +677,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
} // end else } // end else
//Now check for anonymous user mode //Now check for anonymous user mode
if (isset($use_anonymous) && $use_anonymous == true) { if ($use_anonymous) {
//if anonymous mode is set, then try to set the current user as anonymous //if anonymous mode is set, then try to set the current user as anonymous
//if he doesn't have a login yet //if he doesn't have a login yet
api_set_anonymous(); api_set_anonymous();
@ -691,7 +691,7 @@ if (isset($use_anonymous) && $use_anonymous == true) {
if (!empty($cDir)) { if (!empty($cDir)) {
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php';
$c = CourseManager::get_course_id_from_path($cDir); $c = CourseManager::get_course_id_from_path($cDir);
if ($c != false) { $cidReq = $c; } if ($c) { $cidReq = $c; }
} }
// if the requested course is different from the course in session // if the requested course is different from the course in session

Loading…
Cancel
Save