| ');
$active_group = array();
@@ -881,7 +906,6 @@ if ($table->get_total_number_of_items() == 0) {
if (api_get_multiple_access_url() && isset($_REQUEST['keyword'])) {
$keyword = Database::escape_string($_REQUEST['keyword']);
- //$conditions = array('firstname' => $keyword, 'lastname' => $keyword, 'username' => $keyword);
$conditions = array('username' => $keyword);
$user_list = UserManager::get_user_list($conditions, array(), false, ' OR ');
if (!empty($user_list)) {
diff --git a/main/attendance/attendance_controller.php b/main/attendance/attendance_controller.php
index 6d35d5efec..6e3479e67f 100755
--- a/main/attendance/attendance_controller.php
+++ b/main/attendance/attendance_controller.php
@@ -536,10 +536,46 @@ class AttendanceController
'pdf_teachers' => $teacherName,
'pdf_course_category' => $courseCategory['name'],
'format' => 'A4-L',
- 'orientation' => 'L'
+ 'orientation' => 'L'
);
Export::export_html_to_pdf($content, $params);
exit;
}
+
+ /**
+ * Gets attendace base in the table:
+ * TABLE_STATISTIC_TRACK_E_COURSE_ACCESS
+ * @throws ViewException
+ */
+ public function calendarLogins()
+ {
+ $form = new FormValidator(
+ 'search',
+ 'post',
+ api_get_self().'?'.api_get_cidreq().'&action=calendar_logins'
+ );
+ $form->addDateRangePicker('range', get_lang('Range'));
+ $form->add_button('submit', get_lang('submit'));
+ $table = null;
+
+ if ($form->validate()) {
+ $values = $form->getSubmitValues();
+
+ $startDate = api_get_utc_datetime($values['range_start']);
+ $endDate = api_get_utc_datetime($values['range_end']);
+
+ $attendance = new Attendance();
+ $table = $attendance->getAttendanceLogins($startDate, $endDate);
+ }
+
+ $data = array(
+ 'form' => $form->return_form(),
+ 'table' => $table
+ );
+ $this->view->set_data($data);
+ $this->view->set_layout('layout');
+ $this->view->set_template('calendar_logins');
+ $this->view->render();
+ }
}
diff --git a/main/attendance/attendance_list.php b/main/attendance/attendance_list.php
index f871895e89..772b548abe 100755
--- a/main/attendance/attendance_list.php
+++ b/main/attendance/attendance_list.php
@@ -16,7 +16,12 @@ if (api_is_allowed_to_edit(null, true)) {
$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
}
echo '';
}
$attendance = new Attendance();
diff --git a/main/attendance/calendar_logins.php b/main/attendance/calendar_logins.php
new file mode 100644
index 0000000000..bfb44b1705
--- /dev/null
+++ b/main/attendance/calendar_logins.php
@@ -0,0 +1,11 @@
+';
+echo ''.
+ Display::return_icon('back.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).'';
+echo '';
+
+echo $form;
+echo $table;
diff --git a/main/attendance/index.php b/main/attendance/index.php
index 12c6bab4b6..94f2b69917 100755
--- a/main/attendance/index.php
+++ b/main/attendance/index.php
@@ -48,7 +48,8 @@ $actions = array(
'attendance_delete_select',
'attendance_restore',
'attendance_sheet_export_to_pdf',
- 'attendance_sheet_list_no_edit'
+ 'attendance_sheet_list_no_edit',
+ 'calendar_logins'
);
$actions_calendar = array(
@@ -303,6 +304,11 @@ switch ($action) {
case 'calendar_list' :
$attendance_controller->attendance_calendar($action, $attendance_id, $calendar_id);
break;
+ case 'calendar_logins':
+ if (api_is_allowed_to_edit(null, true)) {
+ $attendance_controller->calendarLogins();
+ }
+ break;
default :
$attendance_controller->attendance_list();
}
diff --git a/main/coursecopy/classes/CourseArchiver.class.php b/main/coursecopy/classes/CourseArchiver.class.php
index 80d128de43..0b958857c2 100755
--- a/main/coursecopy/classes/CourseArchiver.class.php
+++ b/main/coursecopy/classes/CourseArchiver.class.php
@@ -1,5 +1,4 @@
$file, 'date' => $date, 'course_code' => $course_code);
+ $backup_files[] = array(
+ 'file' => $file,
+ 'date' => $date,
+ 'course_code' => $course_code
+ );
}
}
}
closedir($dir);
}
+
return $backup_files;
}
@@ -174,8 +181,10 @@ class CourseArchiver
$new_dir = api_get_path(SYS_ARCHIVE_PATH);
if (is_dir($new_dir) && is_writable($new_dir)) {
move_uploaded_file($file, api_get_path(SYS_ARCHIVE_PATH).$new_filename);
+
return $new_filename;
}
+
return false;
}
@@ -218,7 +227,7 @@ class CourseArchiver
return new Course();
}
$course->backup_path = $unzip_dir;
+
return $course;
}
-
}
diff --git a/main/coursecopy/classes/CourseBuilder.class.php b/main/coursecopy/classes/CourseBuilder.class.php
index 11d64dea72..98a1e2b698 100755
--- a/main/coursecopy/classes/CourseBuilder.class.php
+++ b/main/coursecopy/classes/CourseBuilder.class.php
@@ -29,13 +29,14 @@ require_once 'Work.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php';
/**
- * Class which can build a course-object from a Chamilo-course.
+ * Class CourseBuilder
+ * Builds a course-object from a Chamilo-course.
* @author Bart Mollet
* @package chamilo.backup
*/
class CourseBuilder
{
- /** Course */
+ /** @var Course */
public $course;
/* With this array you can filter the tools you want to be parsed by
@@ -67,8 +68,10 @@ class CourseBuilder
/**
* Create a new CourseBuilder
+ * @param string $type
+ * @param null $course
*/
- public function __construct($type='', $course = null)
+ public function __construct($type='', $course = null)
{
$_course = api_get_course_info();
@@ -87,7 +90,6 @@ class CourseBuilder
}
/**
- *
* @param array $array
*/
public function set_tools_to_build($array)
@@ -121,7 +123,7 @@ class CourseBuilder
* @param bool true if you want to get the elements that exists in the course and
* in the session, (session_id = 0 or session_id = X)
*/
- public function build($session_id = 0, $course_code = '', $with_base_content = false)
+ public function build($session_id = 0, $course_code = '', $with_base_content = false)
{
$table_link = Database :: get_course_table(TABLE_LINKED_RESOURCES);
$table_properties = Database :: get_course_table(TABLE_ITEM_PROPERTY);
@@ -467,7 +469,7 @@ class CourseBuilder
//select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
} else {
$sql = "SELECT * FROM $table_qui WHERE c_id = $course_id AND active >=0 AND session_id = 0";
- //select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
+ //select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
}
$db_result = Database::query($sql);
@@ -747,11 +749,11 @@ class CourseBuilder
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$survey = new Survey($obj->survey_id, $obj->code,$obj->title,
- $obj->subtitle, $obj->author, $obj->lang,
- $obj->avail_from, $obj->avail_till, $obj->is_shared,
- $obj->template, $obj->intro, $obj->surveythanks,
- $obj->creation_date, $obj->invited, $obj->answered,
- $obj->invite_mail, $obj->reminder_mail);
+ $obj->subtitle, $obj->author, $obj->lang,
+ $obj->avail_from, $obj->avail_till, $obj->is_shared,
+ $obj->template, $obj->intro, $obj->surveythanks,
+ $obj->creation_date, $obj->invited, $obj->answered,
+ $obj->invite_mail, $obj->reminder_mail);
$sql = 'SELECT * FROM '.$table_question.' WHERE c_id = '.$course_id.' AND survey_id = '.$obj->survey_id;
$db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2)){
@@ -925,75 +927,75 @@ class CourseBuilder
$db_result = Database::query($sql);
if ($db_result)
- while ($obj = Database::fetch_object($db_result)) {
- $items = array();
- $sql_items = "SELECT * FROM ".$table_item." WHERE c_id = '$course_id' AND lp_id = ".$obj->id;
- $db_items = Database::query($sql_items);
- while ($obj_item = Database::fetch_object($db_items)) {
- $item['id'] = $obj_item->id;
- $item['item_type'] = $obj_item->item_type;
- $item['ref'] = $obj_item->ref;
- $item['title'] = $obj_item->title;
- $item['description'] = $obj_item->description;
- $item['path'] = $obj_item->path;
- $item['min_score'] = $obj_item->min_score;
- $item['max_score'] = $obj_item->max_score;
- $item['mastery_score'] = $obj_item->mastery_score;
- $item['parent_item_id'] = $obj_item->parent_item_id;
- $item['previous_item_id'] = $obj_item->previous_item_id;
- $item['next_item_id'] = $obj_item->next_item_id;
- $item['display_order'] = $obj_item->display_order;
- $item['prerequisite'] = $obj_item->prerequisite;
- $item['parameters'] = $obj_item->parameters;
- $item['launch_data'] = $obj_item->launch_data;
- $item['audio'] = $obj_item->audio;
- $items[] = $item;
- }
+ while ($obj = Database::fetch_object($db_result)) {
+ $items = array();
+ $sql_items = "SELECT * FROM ".$table_item." WHERE c_id = '$course_id' AND lp_id = ".$obj->id;
+ $db_items = Database::query($sql_items);
+ while ($obj_item = Database::fetch_object($db_items)) {
+ $item['id'] = $obj_item->id;
+ $item['item_type'] = $obj_item->item_type;
+ $item['ref'] = $obj_item->ref;
+ $item['title'] = $obj_item->title;
+ $item['description'] = $obj_item->description;
+ $item['path'] = $obj_item->path;
+ $item['min_score'] = $obj_item->min_score;
+ $item['max_score'] = $obj_item->max_score;
+ $item['mastery_score'] = $obj_item->mastery_score;
+ $item['parent_item_id'] = $obj_item->parent_item_id;
+ $item['previous_item_id'] = $obj_item->previous_item_id;
+ $item['next_item_id'] = $obj_item->next_item_id;
+ $item['display_order'] = $obj_item->display_order;
+ $item['prerequisite'] = $obj_item->prerequisite;
+ $item['parameters'] = $obj_item->parameters;
+ $item['launch_data'] = $obj_item->launch_data;
+ $item['audio'] = $obj_item->audio;
+ $items[] = $item;
+ }
- $sql_tool = "SELECT id FROM $table_tool
+ $sql_tool = "SELECT id FROM $table_tool
WHERE
c_id = $course_id AND
(link LIKE '%lp_controller.php%lp_id=".$obj->id."%' AND image='scormbuilder.gif') AND
visibility = '1' ";
- $db_tool = Database::query($sql_tool);
+ $db_tool = Database::query($sql_tool);
- if (Database::num_rows($db_tool)) {
- $visibility = '1';
- } else {
- $visibility = '0';
- }
+ if (Database::num_rows($db_tool)) {
+ $visibility = '1';
+ } else {
+ $visibility = '0';
+ }
- $lp = new CourseCopyLearnpath(
- $obj->id,
- $obj->lp_type,
- $obj->name,
- $obj->path,
- $obj->ref,
- $obj->description,
- $obj->content_local,
- $obj->default_encoding,
- $obj->default_view_mod,
- $obj->prevent_reinit,
- $obj->force_commit,
- $obj->content_maker,
- $obj->display_order,
- $obj->js_lib,
- $obj->content_license,
- $obj->debug,
- $visibility,
- $obj->author,
- $obj->preview_image,
- $obj->use_max_score,
- $obj->autolunch,
- $obj->created_on,
- $obj->modified_on,
- $obj->publicated_on,
- $obj->expired_on,
- $obj->session_id,
- $items
- );
- $this->course->add_resource($lp);
- }
+ $lp = new CourseCopyLearnpath(
+ $obj->id,
+ $obj->lp_type,
+ $obj->name,
+ $obj->path,
+ $obj->ref,
+ $obj->description,
+ $obj->content_local,
+ $obj->default_encoding,
+ $obj->default_view_mod,
+ $obj->prevent_reinit,
+ $obj->force_commit,
+ $obj->content_maker,
+ $obj->display_order,
+ $obj->js_lib,
+ $obj->content_license,
+ $obj->debug,
+ $visibility,
+ $obj->author,
+ $obj->preview_image,
+ $obj->use_max_score,
+ $obj->autolunch,
+ $obj->created_on,
+ $obj->modified_on,
+ $obj->publicated_on,
+ $obj->expired_on,
+ $obj->session_id,
+ $items
+ );
+ $this->course->add_resource($lp);
+ }
// Save scorm directory (previously build_scorm_documents())
$i = 1;
@@ -1092,7 +1094,7 @@ class CourseBuilder
$course_id = $course_info['real_id'];
if (!empty($session_id) && !empty($course_code)) {
- $session_id = intval($session_id);
+ $session_id = intval($session_id);
if ($with_base_content) {
$session_condition = api_get_session_condition($session_id, true, true);
} else {
@@ -1111,8 +1113,8 @@ class CourseBuilder
}
/**
- * Build the Surveys
- */
+ * Build the Surveys
+ */
public function build_thematic($session_id = 0, $course_code = '', $with_base_content = false, $id_list = array())
{
$table_thematic = Database :: get_course_table(TABLE_THEMATIC);
@@ -1149,7 +1151,7 @@ class CourseBuilder
//$thematic_plan_complete_list[$item['ref']] = $item;
}
}
- if (count($thematic_plan_id_list) > 0) {
+ if (count($thematic_plan_id_list) > 0) {
$sql = "SELECT tp.*
FROM $table_thematic_plan tp
INNER JOIN $table_thematic t ON (t.id=tp.thematic_id)
@@ -1169,8 +1171,8 @@ class CourseBuilder
}
/**
- * Build the attendances
- */
+ * Build the attendances
+ */
public function build_attendance($session_id = 0, $course_code = '', $with_base_content = false, $id_list = array())
{
$table_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
@@ -1196,21 +1198,23 @@ class CourseBuilder
/**
* Build the works (or "student publications", or "assignments")
+ *
+ * @param int $session_id
+ * @param string $course_code
+ * @param bool $with_base_content
+ * @param array $id_list
*/
public function build_works($session_id = 0, $course_code = '', $with_base_content = false, $id_list = array())
{
$table_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
- //$table_work_assignment = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
-
$course_id = api_get_course_int_id();
-
$sessionCondition = api_get_session_condition($session_id, true, $with_base_content);
$sql = "SELECT * FROM $table_work
WHERE
- c_id = $course_id
+ c_id = $course_id
$sessionCondition AND
- filetype = \'folder\' AND
+ filetype = 'folder' AND
parent_id = 0 AND
active = 1";
$db_result = Database::query($sql);
diff --git a/main/coursecopy/classes/CourseCopyLearnpath.class.php b/main/coursecopy/classes/CourseCopyLearnpath.class.php
index b87da7798d..813574f0b1 100755
--- a/main/coursecopy/classes/CourseCopyLearnpath.class.php
+++ b/main/coursecopy/classes/CourseCopyLearnpath.class.php
@@ -1,11 +1,13 @@
* @package chamilo.backup
*/
-class CourseCopyLearnpath extends Resource {
+class CourseCopyLearnpath extends Resource
+{
/**
* Type of learnpath (can be dokeos (1), scorm (2), aicc (3))
*/
@@ -106,9 +108,35 @@ class CourseCopyLearnpath extends Resource {
* @param string $visibility
* @param array $items
*/
- function CourseCopyLearnpath($id,$type,$name, $path,$ref,$description,$content_local,$default_encoding,$default_view_mode,$prevent_reinit,$force_commit,
- $content_maker, $display_order,$js_lib,$content_license,$debug, $visibility, $author, $preview_image,
- $use_max_score, $autolunch, $created_on, $modified_on, $publicated_on, $expired_on, $session_id, $items) {
+ public function CourseCopyLearnpath(
+ $id,
+ $type,
+ $name,
+ $path,
+ $ref,
+ $description,
+ $content_local,
+ $default_encoding,
+ $default_view_mode,
+ $prevent_reinit,
+ $force_commit,
+ $content_maker,
+ $display_order,
+ $js_lib,
+ $content_license,
+ $debug,
+ $visibility,
+ $author,
+ $preview_image,
+ $use_max_score,
+ $autolunch,
+ $created_on,
+ $modified_on,
+ $publicated_on,
+ $expired_on,
+ $session_id,
+ $items
+ ) {
parent::Resource($id,RESOURCE_LEARNPATH);
$this->lp_type = $type;
$this->name = $name;
@@ -147,6 +175,7 @@ class CourseCopyLearnpath extends Resource {
{
return $this->items;
}
+
/**
* Check if a given resource is used as an item in this chapter
*/
@@ -154,13 +183,14 @@ class CourseCopyLearnpath extends Resource {
{
foreach ($this->items as $item) {
if ($item['id'] == $resource->get_id() &&
- isset($item['type']) && $item['type'] == $resource->get_type()
- ) {
+ isset($item['type']) && $item['type'] == $resource->get_type()
+ ) {
return true;
}
}
return false;
}
+
/**
* Show this learnpath
*/
diff --git a/main/coursecopy/classes/CourseCopyTestCategory.php b/main/coursecopy/classes/CourseCopyTestCategory.php
index 72f38e5c76..5b3efa70f3 100755
--- a/main/coursecopy/classes/CourseCopyTestCategory.php
+++ b/main/coursecopy/classes/CourseCopyTestCategory.php
@@ -34,7 +34,8 @@ class CourseCopyTestcategory extends Resource
/**
* Show the test_category title, used in the partial recycle_course.php form
*/
- function show() {
+ function show()
+ {
parent::show();
echo $this->title;
}
diff --git a/main/coursecopy/classes/CourseDescription.class.php b/main/coursecopy/classes/CourseDescription.class.php
index 8401cc23cf..42946b7aa2 100755
--- a/main/coursecopy/classes/CourseDescription.class.php
+++ b/main/coursecopy/classes/CourseDescription.class.php
@@ -21,24 +21,27 @@ class CourseDescription extends Resource
/**
* The description type
*/
- var $description_type;
+ var $description_type;
/**
* Create a new course description
* @param int $id
* @param string $title
* @param string $content
*/
- function __construct($id,$title,$content,$description_type) {
+ function __construct($id,$title,$content,$description_type)
+ {
parent::Resource($id,RESOURCE_COURSEDESCRIPTION);
$this->title = $title;
$this->content = $content;
$this->description_type = $description_type;
}
+
/**
* Show this Event
*/
- function show() {
+ function show()
+ {
parent::show();
echo $this->title;
}
-}
\ No newline at end of file
+}
diff --git a/main/coursecopy/copy_course_session.php b/main/coursecopy/copy_course_session.php
index d4e7934301..84a7b53835 100755
--- a/main/coursecopy/copy_course_session.php
+++ b/main/coursecopy/copy_course_session.php
@@ -90,7 +90,7 @@ function make_select_session_list($name, $sessions, $attr = array())
function display_form()
{
$html = '';
- $sessions = SessionManager::get_sessions_list(null, array('name ASC'));
+ $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
// Actions
$html .= ' ';
@@ -166,7 +166,7 @@ function search_courses($id_session, $type)
// Build select for destination sessions where is not included current session from select origin
if (!empty($id_session)) {
- $sessions = SessionManager::get_sessions_list(null, array('name ASC'));
+ $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
$select_destination .= ' ');
@@ -292,7 +292,17 @@ $form->addElement('html', '');
$form->addElement('style_submit_button', 'submitDocument', get_lang('SendDocument'), 'class="upload"');
$form->add_real_progress_bar('DocumentUpload', 'file');
-$defaults = array('index_document' => 'checked="checked"');
+$fileExistsOption = api_get_configuration_value('document_if_file_exists_option');
+
+$defaultFileExistsOption = 'rename';
+if (!empty($fileExistsOption)) {
+ $defaultFileExistsOption = $fileExistsOption;
+}
+
+$defaults = array(
+ 'index_document' => 'checked="checked"',
+ 'if_exists' => $defaultFileExistsOption
+);
$form->setDefaults($defaults);
diff --git a/main/dropbox/index.php b/main/dropbox/index.php
index 68aef7f876..a17d3e5284 100755
--- a/main/dropbox/index.php
+++ b/main/dropbox/index.php
@@ -5,7 +5,7 @@
require_once 'dropbox_init.inc.php';
// get the last time the user accessed the tool
-if ($_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') {
+if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') {
$last_access = get_last_tool_access(TOOL_DROPBOX);
$_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access;
} else {
@@ -181,9 +181,11 @@ if (isset($_GET['error']) AND !empty($_GET['error'])) {
Display :: display_normal_message(get_lang($_GET['error']));
}
+$dropbox_data_sent = array();
+$movelist = array();
+$dropbox_data_recieved = array();
if ($action != 'add') {
-
// Getting all the categories in the dropbox for the given user
$dropbox_categories = get_dropbox_categories();
// Greating the arrays with the categories for the received files and for the sent files
diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php
index 6e01b60196..adb7485bfb 100755
--- a/main/exercice/exercice.php
+++ b/main/exercice/exercice.php
@@ -405,7 +405,9 @@ if (Database :: num_rows($result_total)) {
//get HotPotatoes files (active and inactive)
if ($is_allowedToEdit) {
$sql = "SELECT * FROM $TBL_DOCUMENT
- WHERE c_id = $courseId AND path LIKE '".Database :: escape_string($uploadPath)."/%/%'";
+ WHERE
+ c_id = $courseId AND
+ path LIKE '".Database :: escape_string($uploadPath.'/%/%')."'";
$res = Database::query($sql);
$hp_count = Database :: num_rows($res);
} else {
@@ -413,7 +415,7 @@ if ($is_allowedToEdit) {
WHERE
d.id = ip.ref AND
ip.tool = '".TOOL_DOCUMENT."' AND
- d.path LIKE '".Database :: escape_string($uploadPath)."/%/%' AND
+ d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' AND
ip.visibility ='1' AND
d.c_id = ".$courseId." AND
ip.c_id = ".$courseId;
@@ -920,7 +922,7 @@ if ($is_allowedToEdit) {
d.id = ip.ref AND
ip.tool = '".TOOL_DOCUMENT."' AND
(d.path LIKE '%htm%') AND
- d.path LIKE '".Database :: escape_string($uploadPath)."/%/%'
+ d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."'
LIMIT ".$from.",".$limit; // only .htm or .html files listed
} else {
$sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
@@ -931,7 +933,7 @@ if ($is_allowedToEdit) {
d.id = ip.ref AND
ip.tool = '".TOOL_DOCUMENT."' AND
(d.path LIKE '%htm%') AND
- d.path LIKE '".Database :: escape_string($uploadPath)."/%/%' AND
+ d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' AND
ip.visibility='1'
LIMIT ".$from.",".$limit;
}
diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php
index 9a0b73250f..6d36767778 100755
--- a/main/exercice/exercise.lib.php
+++ b/main/exercice/exercise.lib.php
@@ -1379,7 +1379,9 @@ function get_exam_results_data(
$teacher_id_list[] = $teacher['user_id'];
}
- //Simple exercises
+ $list_info = array();
+
+ // Simple exercises
if (empty($hotpotatoe_where)) {
$column = !empty($column) ? Database::escape_string($column) : null;
$from = intval($from);
@@ -1407,7 +1409,7 @@ function get_exam_results_data(
$lp_list_obj = new learnpathList(api_get_user_id());
$lp_list = $lp_list_obj->get_flat_list();
- $list_info = array();
+
if (is_array($results)) {
$users_array_id = array();
diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php
index d5ff900ba4..a9cd087e99 100755
--- a/main/exercice/exercise_show.php
+++ b/main/exercice/exercise_show.php
@@ -72,6 +72,7 @@ if (api_is_course_session_coach(
}
}
+$maxEditors = isset($_configuration['exercise_max_fckeditors_in_page']) ? $_configuration['exercise_max_fckeditors_in_page'] : 0;
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor || api_is_session_admin() || api_is_drh();
//Getting results from the exe_id. This variable also contain all the information about the exercise
@@ -128,6 +129,8 @@ if ($origin != 'learnpath') {
}
?>
';
diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php
index eabb2d45f2..f66bce6415 100755
--- a/main/newscorm/learnpath.class.php
+++ b/main/newscorm/learnpath.class.php
@@ -4,8 +4,8 @@
use \ChamiloSession as Session;
/**
- * This class defines the parent attributes and methods for Chamilo learnpaths and SCORM
- * learnpaths. It is used by the scorm class.
+ * This class defines the parent attributes and methods for Chamilo learnpaths
+ * and SCORM learnpaths. It is used by the scorm class.
*
* @package chamilo.learnpath
* @author Yannick Warnier
@@ -457,7 +457,6 @@ class learnpath
$parent = intval($parent);
$previous = intval($previous);
- $type = Database::escape_string($type);
$id = intval($id);
$max_time_allowed = Database::escape_string(htmlentities($max_time_allowed));
if (empty ($max_time_allowed)) {
@@ -515,7 +514,7 @@ class learnpath
$new_item_id = -1;
$id = Database::escape_string($id);
-
+ $typeCleaned = Database::escape_string($type);
if ($type == 'quiz') {
$sql = 'SELECT SUM(ponderation)
FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
@@ -555,7 +554,7 @@ class learnpath
") VALUES (
$course_id ,
".$this->get_id() . ", ".
- "'" . $type . "', ".
+ "'" . $typeCleaned . "', ".
"'', ".
"'" . $title . "', ".
"'" . $description . "', ".
@@ -587,7 +586,7 @@ class learnpath
") VALUES (".
$course_id. ",".
$this->get_id() . ",".
- "'" . $type . "',".
+ "'" . $typeCleaned . "',".
"'',".
"'" . $title . "',".
"'" . $description . "',".
@@ -760,13 +759,13 @@ class learnpath
$publicated_on = api_get_utc_datetime();
}
} else {
- $publicated_on = Database::escape_string(api_get_utc_datetime($publicated_on));
+ $publicated_on = Database::escape_string(api_get_utc_datetime($publicated_on));
}
if ($expired_on == '0000-00-00 00:00:00' || empty($expired_on)) {
$expired_on = '';
} else {
- $expired_on = Database::escape_string(api_get_utc_datetime($expired_on));
+ $expired_on = Database::escape_string(api_get_utc_datetime($expired_on));
}
while (Database :: num_rows($res_name)) {
@@ -967,7 +966,7 @@ class learnpath
}
*/
}
- $this->ordered_items = array ();
+ $this->ordered_items = array();
$this->index = 0;
unset ($this->lp_id);
//unset other stuff
@@ -1465,7 +1464,6 @@ class learnpath
}
$prerequisite_id = Database::escape_string($prerequisite_id);
-
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
if (!is_numeric($mastery_score) || $mastery_score < 0) {
@@ -1674,7 +1672,7 @@ class learnpath
if ($this->debug > 0) {
error_log('New LP - In learnpath::get_current_item_id()', 0);
}
- if (!empty ($this->current)) {
+ if (!empty($this->current)) {
$current = $this->current;
}
if ($this->debug > 2) {
@@ -1814,7 +1812,7 @@ class learnpath
/**
* Gets the information about an item in a format usable as JavaScript to update
* the JS API by just printing this content into the section of the message frame
- * @param integer Item ID
+ * @param int $item_id
* @return string
*/
public function get_js_info($item_id = '')
@@ -1824,7 +1822,7 @@ class learnpath
}
$info = '';
- $item_id = Database::escape_string($item_id);
+ $item_id = intval($item_id);
if (!empty($item_id) && is_object($this->items[$item_id])) {
//if item is defined, return values from DB
@@ -3294,9 +3292,9 @@ class learnpath
/**
* Gets a link to the resource from the present location, depending on item ID.
- * @param string Type of link expected
- * @param integer Learnpath item ID
- * @return string Link to the lp_item resource
+ * @param string $type Type of link expected
+ * @param integer $item_id Learnpath item ID
+ * @return string $provided_toc Link to the lp_item resource
*/
public function get_link($type = 'http', $item_id = null, $provided_toc = false)
{
@@ -3326,7 +3324,7 @@ class learnpath
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$lp_item_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
- $item_id = Database::escape_string($item_id);
+ $item_id = intval($item_id);
$sql = "SELECT l.lp_type as ltype, l.path as lpath, li.item_type as litype, li.path as lipath, li.parameters as liparams
FROM $lp_table l
@@ -3366,7 +3364,6 @@ class learnpath
// Now go through the specific cases to get the end of the path
// @todo Use constants instead of int values.
-
switch ($lp_type) {
case 1 :
if ($lp_item_type == 'dokeos_chapter') {
@@ -3425,13 +3422,13 @@ class learnpath
}
if ($type_quiz) {
- $lp_item_id = Database::escape_string($lp_item_id);
- $lp_view_id = Database::escape_string($lp_view_id);
+ $lp_item_id = intval($lp_item_id);
+ $lp_view_id = intval($lp_view_id);
$sql = "SELECT count(*) FROM $lp_item_view_table
WHERE
c_id = $course_id AND
- lp_item_id='" . (int) $lp_item_id . "' AND
- lp_view_id ='" . (int) $lp_view_id . "' AND
+ lp_item_id='" . $lp_item_id . "' AND
+ lp_view_id ='" . $lp_view_id . "' AND
status='completed'";
$result = Database::query($sql);
$row_count = Database :: fetch_row($result);
@@ -4114,7 +4111,7 @@ class learnpath
{
$course_id = api_get_course_int_id();
$tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
- $lp_id = Database::escape_string($lp_id);
+ $lp_id = intval($lp_id);
$sql = "SELECT * FROM $tbl_lp where c_id = ".$course_id." AND id=$lp_id";
$result = Database::query($sql);
if (Database::num_rows($result)) {
@@ -4341,7 +4338,7 @@ class learnpath
/**
* Sets the current item ID (checks if valid and authorized first)
- * @param integer New item ID. If not given or not authorized, defaults to current
+ * @param integer $item_id New item ID. If not given or not authorized, defaults to current
*/
public function set_current_item($item_id = null)
{
@@ -4358,7 +4355,7 @@ class learnpath
error_log('New LP - New current item given is ' . $item_id . '...', 0);
}
if (is_numeric($item_id)) {
- $item_id = Database::escape_string($item_id);
+ $item_id = intval($item_id);
// TODO: Check in database here.
$this->last = $this->current;
$this->current = $item_id;
@@ -4442,11 +4439,11 @@ class learnpath
}
if (empty ($name))
return false;
- $this->maker = Database::escape_string($name);
+ $this->maker = $name;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$course_id = api_get_course_int_id();
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET content_maker = '" . $this->maker . "'
+ $sql = "UPDATE $lp_table SET content_maker = '" . Database::escape_string($this->maker) . "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
@@ -4468,11 +4465,11 @@ class learnpath
if (empty($name)) {
return false;
}
- $this->name = Database::escape_string($name);
+ $this->name = $name;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
$course_id = api_get_course_int_id();
- $sql = "UPDATE $lp_table SET name = '" . $this->name . "'
+ $sql = "UPDATE $lp_table SET name = '" . Database::escape_string($this->name). "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new name : ' . $this->name, 0);
@@ -4582,10 +4579,10 @@ class learnpath
if ($this->debug > 0) {
error_log('New LP - In learnpath::set_theme()', 0);
}
- $this->theme = Database::escape_string($name);
+ $this->theme = $name;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET theme = '" . $this->theme . "'
+ $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
@@ -4606,10 +4603,11 @@ class learnpath
error_log('New LP - In learnpath::set_preview_image()', 0);
}
- $this->preview_image = Database::escape_string($name);
+ $this->preview_image = $name;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET preview_image = '" . $this->preview_image . "'
+ $sql = "UPDATE $lp_table SET
+ preview_image = '" . Database::escape_string($this->preview_image). "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
@@ -4628,10 +4626,10 @@ class learnpath
if ($this->debug > 0) {
error_log('New LP - In learnpath::set_author()', 0);
}
- $this->author = Database::escape_string($name);
+ $this->author = $name;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET author = '" . $this->author . "'
+ $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
@@ -4704,10 +4702,11 @@ class learnpath
if (empty ($name))
return false;
- $this->proximity = Database::escape_string($name);
+ $this->proximity = $name;
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET content_local = '" . $this->proximity . "'
+ $sql = "UPDATE $lp_table SET
+ content_local = '" . Database::escape_string($name) . "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
@@ -4756,7 +4755,7 @@ class learnpath
/**
* Sets and saves the expired_on date
- * @param string Optional string giving the new author of this learnpath
+ * @param string $expired_on Optional string giving the new author of this learnpath
* @return bool Returns true if author's name is not empty
*/
public function set_expired_on($expired_on)
@@ -4767,13 +4766,14 @@ class learnpath
}
if (!empty($expired_on)) {
- $this->expired_on = Database::escape_string(api_get_utc_datetime($expired_on));
+ $this->expired_on = api_get_utc_datetime($expired_on);
} else {
$this->expired_on = '';
}
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET expired_on = '" . $this->expired_on . "'
+ $sql = "UPDATE $lp_table SET
+ expired_on = '" . Database::escape_string($this->expired_on) . "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
@@ -4784,7 +4784,7 @@ class learnpath
/**
* Sets and saves the publicated_on date
- * @param string Optional string giving the new author of this learnpath
+ * @param string $publicated_on Optional string giving the new author of this learnpath
* @return bool Returns true if author's name is not empty
*/
public function set_publicated_on($publicated_on)
@@ -4794,13 +4794,14 @@ class learnpath
error_log('New LP - In learnpath::set_expired_on()', 0);
}
if (!empty($publicated_on)) {
- $this->publicated_on = Database::escape_string(api_get_utc_datetime($publicated_on));
+ $this->publicated_on = api_get_utc_datetime($publicated_on);
} else {
$this->publicated_on = '';
}
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
- $sql = "UPDATE $lp_table SET publicated_on = '" . $this->publicated_on . "'
+ $sql = "UPDATE $lp_table SET
+ publicated_on = '" . Database::escape_string($this->publicated_on) . "'
WHERE c_id = ".$course_id." AND id = '$lp_id'";
if ($this->debug > 2) {
error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
@@ -4811,7 +4812,6 @@ class learnpath
/**
* Sets and saves the expired_on date
- * @param string Optional string giving the new author of this learnpath
* @return bool Returns true if author's name is not empty
*/
public function set_modified_on()
@@ -4837,7 +4837,8 @@ class learnpath
* @param string Error message. If empty, reinits the error string
* @return void
*/
- public function set_error_msg($error = '') {
+ public function set_error_msg($error = '')
+ {
if ($this->debug > 0) {
error_log('New LP - In learnpath::set_error_msg()', 0);
}
@@ -4849,9 +4850,10 @@ class learnpath
}
/**
- * Launches the current item if not 'sco' (starts timer and make sure there is a record ready in the DB)
- * @param boolean Whether to allow a new attempt or not
- * @return boolean True
+ * Launches the current item if not 'sco'
+ * (starts timer and make sure there is a record ready in the DB)
+ * @param boolean $allow_new_attempt Whether to allow a new attempt or not
+ * @return boolean
*/
public function start_current_item($allow_new_attempt = false)
{
@@ -4865,7 +4867,6 @@ class learnpath
($type == 1 && $item_type != TOOL_QUIZ && $item_type != TOOL_HOTPOTATOES)
) {
$this->items[$this->current]->open($allow_new_attempt);
-
$this->autocomplete_parents($this->current);
$prereq_check = $this->prerequisites_match($this->current);
$this->items[$this->current]->save(false, $prereq_check);
@@ -5710,17 +5711,28 @@ class learnpath
$return .= "\tm.add(" . $menu . ", -1, '" . addslashes(Security::remove_XSS(($this->name))) . "');\n";
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
- $sql = " SELECT id, title, description, item_type, path, parent_item_id, previous_item_id, next_item_id, max_score, min_score, mastery_score, display_order
+ $sql = " SELECT
+ id,
+ title,
+ description,
+ item_type,
+ path,
+ parent_item_id,
+ previous_item_id,
+ next_item_id,
+ max_score,
+ min_score,
+ mastery_score,
+ display_order
FROM $tbl_lp_item
- WHERE c_id = ".$course_id." AND lp_id = " . Database::escape_string($this->lp_id);
+ WHERE c_id = ".$course_id." AND lp_id = " . intval($this->lp_id);
$result = Database::query($sql);
$arrLP = array ();
while ($row = Database :: fetch_array($result)) {
$row['title'] = Security :: remove_XSS($row['title']);
$row['description'] = Security :: remove_XSS($row['description']);
-
- $arrLP[] = array (
+ $arrLP[] = array(
'id' => $row['id'],
'item_type' => $row['item_type'],
'title' => $row['title'],
@@ -6007,9 +6019,10 @@ class learnpath
fputs($fp, $content);
fclose($fp);
- $sql_update = "UPDATE " . $table_doc ." SET title='".Database::escape_string($_POST['title'])."'
- WHERE c_id = ".$course_id." AND id = " . $document_id;
- Database::query($sql_update);
+ $sql = "UPDATE " . $table_doc ." SET
+ title='".Database::escape_string($_POST['title'])."'
+ WHERE c_id = ".$course_id." AND id = " . $document_id;
+ Database::query($sql);
}
}
}
@@ -6026,9 +6039,8 @@ class learnpath
$return = '';
if (is_numeric($item_id)) {
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
- $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
$sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
- WHERE c_id = ".$course_id." AND lp.id = " . Database::escape_string($item_id);
+ WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
$result = Database::query($sql);
while ($row = Database :: fetch_array($result,'ASSOC')) {
$_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
@@ -6057,11 +6069,12 @@ class learnpath
}
break;
case TOOL_DOCUMENT:
- $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
- $sql_doc = "SELECT path FROM " . $tbl_doc . " WHERE c_id = ".$course_id." AND id = " . Database::escape_string($row['path']);
- $result = Database::query($sql_doc);
- $path_file = Database::result($result, 0, 0);
- $path_parts = pathinfo($path_file);
+ $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
+ $sql_doc = "SELECT path FROM " . $tbl_doc . "
+ WHERE c_id = ".$course_id." AND id = " . Database::escape_string($row['path']);
+ $result = Database::query($sql_doc);
+ $path_file = Database::result($result, 0, 0);
+ $path_parts = pathinfo($path_file);
// TODO: Correct the following naive comparisons, also, htm extension is missing.
if (in_array($path_parts['extension'], array(
'html',
@@ -6095,7 +6108,8 @@ class learnpath
$return = '';
if (is_numeric($item_id)) {
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
- $sql = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = " . Database::escape_string($item_id);
+ $sql = "SELECT * FROM $tbl_lp_item
+ WHERE c_id = ".$course_id." AND id = " . intval($item_id);
$res = Database::query($sql);
$row = Database::fetch_array($res);
@@ -6116,9 +6130,10 @@ class learnpath
$sql_step = " SELECT lp.*, doc.path as dir
FROM " . $tbl_lp_item . " as lp
LEFT JOIN " . $tbl_doc . " as doc ON doc.id = lp.path
- WHERE lp.c_id = $course_id AND
- doc.c_id = $course_id AND
- lp.id = " . Database::escape_string($item_id);
+ WHERE
+ lp.c_id = $course_id AND
+ doc.c_id = $course_id AND
+ lp.id = " . intval($item_id);
$res_step = Database::query($sql_step);
$row_step = Database :: fetch_array($res_step);
$return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6128,7 +6143,8 @@ class learnpath
$link_id = (string) $row['path'];
if (ctype_digit($link_id)) {
$tbl_link = Database :: get_course_table(TABLE_LINK);
- $sql_select = 'SELECT url FROM ' . $tbl_link . ' WHERE c_id = '.$course_id.' AND id = ' . Database::escape_string($link_id);
+ $sql_select = 'SELECT url FROM ' . $tbl_link . '
+ WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
$res_link = Database::query($sql_select);
$row_link = Database :: fetch_array($res_link);
if (is_array($row_link)) {
@@ -7792,9 +7808,7 @@ class learnpath
WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
$result = Database::query($sql);
-
- $arrLP = array ();
-
+ $arrLP = array();
while ($row = Database :: fetch_array($result)) {
$arrLP[] = array (
'id' => $row['id'],
diff --git a/main/newscorm/lp_ajax_switch_item.php b/main/newscorm/lp_ajax_switch_item.php
index 371cbefad8..2b6a932065 100755
--- a/main/newscorm/lp_ajax_switch_item.php
+++ b/main/newscorm/lp_ajax_switch_item.php
@@ -232,7 +232,8 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
if ($debug > 1) {
error_log('Prereq_match() returned '.htmlentities($mylp->error), 0);
}
- $_SESSION['scorm_item_id'] = $new_item_id; // Save the new item ID for the exercise tool to use.
+ // Save the new item ID for the exercise tool to use.
+ $_SESSION['scorm_item_id'] = $new_item_id;
$_SESSION['lpobject'] = serialize($mylp);
return $return;
}
diff --git a/main/newscorm/lp_ajax_switch_item_toc.php b/main/newscorm/lp_ajax_switch_item_toc.php
index 7593d7798e..8267243118 100755
--- a/main/newscorm/lp_ajax_switch_item_toc.php
+++ b/main/newscorm/lp_ajax_switch_item_toc.php
@@ -167,4 +167,11 @@ function switch_item_toc($lp_id, $user_id, $view_id, $current_item, $next_item)
$_SESSION['lpobject'] = serialize($mylp);
return $return;
}
-echo switch_item_toc($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid'], $_POST['next']);
+
+echo switch_item_toc(
+ $_POST['lid'],
+ $_POST['uid'],
+ $_POST['vid'],
+ $_POST['iid'],
+ $_POST['next']
+);
diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php
index f305658ee8..3c7f836610 100755
--- a/main/newscorm/lp_controller.php
+++ b/main/newscorm/lp_controller.php
@@ -1060,8 +1060,11 @@ switch ($action) {
break;
case 'content':
if ($debug > 0) error_log('New LP - content action triggered', 0);
- if ($debug > 0) error_log('New LP - Item id is '.$_GET['item_id'], 0);
- if (!$lp_found) { error_log('New LP - No learnpath given for content', 0); require 'lp_list.php'; }
+ if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
+ if (!$lp_found) {
+ error_log('New LP - No learnpath given for content', 0);
+ require 'lp_list.php';
+ }
else {
$_SESSION['oLP']->save_last();
$_SESSION['oLP']->set_current_item($_GET['item_id']);
diff --git a/main/reservation/rsys.php b/main/reservation/rsys.php
index 5472906e60..44b551473b 100755
--- a/main/reservation/rsys.php
+++ b/main/reservation/rsys.php
@@ -1,14 +1,18 @@
';
}
- if ($lijn2[5] == 0) {
- $tabel[$count][5] = ' ';
- } else {
- $tabel[$count][5] = ' ';
- }
- $controle = true;
- }
- }
- if (!$controle) {
- $tabel[$count][2] = ' ';
- $tabel[$count][3] = ' ';
- $tabel[$count][4] = ' ';
- $tabel[$count][5] = ' ';
- }
- $tabel[$count][6] = $itemid."-".$lijn[0];
+ if ($lijn2[5] == 0) {
+ $tabel[$count][5] = ' ';
+ } else {
+ $tabel[$count][5] = ' ';
+ }
+ $controle = true;
+ }
+ }
+ if (!$controle) {
+ $tabel[$count][2] = ' ';
+ $tabel[$count][3] = ' ';
+ $tabel[$count][4] = ' ';
+ $tabel[$count][5] = ' ';
+ }
+ $tabel[$count][6] = $itemid."-".$lijn[0];
}
}
return $tabel;
@@ -927,7 +931,7 @@ class Rsys {
*/
function get_table_reservations($from, $per_page, $column, $direction) {
$sql = "SELECT DISTINCT r.id AS col0, i.name AS col1, DATE_FORMAT(r.start_at,'%Y-%m-%d %H:%i') AS col2, DATE_FORMAT(r.end_at,'%Y-%m-%d %H:%i') AS col3," .
- "DATE_FORMAT(r.subscribe_from,'%Y-%m-%d %k:%i') AS col4, DATE_FORMAT(r.subscribe_until,'%Y-%m-%d %k:%i') AS col5,IF(timepicker <> 0, '".get_lang('TimePicker')."',CONCAT(r.subscribers,'/',r.max_users)) AS col6, r.notes AS col7, r.id as col8
+ "DATE_FORMAT(r.subscribe_from,'%Y-%m-%d %k:%i') AS col4, DATE_FORMAT(r.subscribe_until,'%Y-%m-%d %k:%i') AS col5,IF(timepicker <> 0, '".get_lang('TimePicker')."',CONCAT(r.subscribers,'/',r.max_users)) AS col6, r.notes AS col7, r.id as col8
FROM ".Rsys :: getTable('reservation')." r
INNER JOIN ".Rsys :: getTable('item')." i ON r.item_id=i.id
LEFT JOIN ".Rsys :: getTable('item_rights')." ir ON ir.item_id=i.id
@@ -1005,10 +1009,10 @@ class Rsys {
LEFT JOIN ".Database :: get_main_table(TABLE_MAIN_CLASS)." c ON ir.class_id=c.id AND ir.item_id = r.item_id
LEFT JOIN ".Database :: get_main_table(TABLE_MAIN_CLASS_USER)." cu ON cu.class_id = c.id
WHERE ((ir.m_reservation=1 AND cu.user_id='".api_get_user_id()."') OR i.creator='".api_get_user_id()."' OR 1=". (api_is_platform_admin() ? 1 : 0).')';
- if (isset ($_GET['keyword'])) {
- $keyword = Database::escape_string(trim($_GET['keyword']));
- $sql .= " AND (i.name LIKE '%".$keyword."%' OR i.description LIKE '%".$keyword."%' OR r.notes LIKE '%".$keyword."%')";
- }
+ if (isset ($_GET['keyword'])) {
+ $keyword = Database::escape_string(trim($_GET['keyword']));
+ $sql .= " AND (i.name LIKE '%".$keyword."%' OR i.description LIKE '%".$keyword."%' OR r.notes LIKE '%".$keyword."%')";
+ }
return Database::result(Database::query($sql), 0, 0);
}
@@ -1033,7 +1037,7 @@ class Rsys {
return 2;
}
if ($start_at < (date( 'Y-m-d H:i:s',time())))
- return 3;
+ return 3;
if (($stamp_start_date != $stamp_end_date) && $timepicker == '1')
{
return 4;
@@ -1192,10 +1196,10 @@ class Rsys {
WHERE ((ir.m_reservation=1 AND cu.user_id='".api_get_user_id()."')
OR i2.creator='".api_get_user_id()."'
OR 1=". (api_is_platform_admin() ? 1 : 0)."))";
- if (isset ($_GET['keyword'])) {
- $keyword = Database::escape_string(trim($_GET['keyword']));
- $sql .= " AND (i1.name LIKE '%".$keyword."%' or r1.start_at LIKE '%".$keyword."%' or r1.end_at LIKE '%".$keyword."%' or u.lastname LIKE '%".$keyword."%' or u.firstname LIKE '%".$keyword."%' or s.start_at LIKE '%".$keyword."%' or s.end_at LIKE '%".$keyword."%')";
- }
+ if (isset ($_GET['keyword'])) {
+ $keyword = Database::escape_string(trim($_GET['keyword']));
+ $sql .= " AND (i1.name LIKE '%".$keyword."%' or r1.start_at LIKE '%".$keyword."%' or r1.end_at LIKE '%".$keyword."%' or u.lastname LIKE '%".$keyword."%' or u.firstname LIKE '%".$keyword."%' or s.start_at LIKE '%".$keyword."%' or s.end_at LIKE '%".$keyword."%')";
+ }
return Database::result(Database::query($sql), 0, 0);
}
@@ -1228,10 +1232,10 @@ class Rsys {
WHERE ((ir.m_reservation=1 AND cu.user_id='".api_get_user_id()."')
OR i2.creator='".api_get_user_id()."'
OR 1=". (api_is_platform_admin() ? 1 : 0)."))";
- if (isset ($_GET['keyword'])) {
- $keyword = Database::escape_string(trim($_GET['keyword']));
- $sql .= " AND (i1.name LIKE '%".$keyword."%' or c.name LIKE '%".$keyword."%' or r1.start_at LIKE '%".$keyword."%' or r1.end_at LIKE '%".$keyword."%' or u.lastname LIKE '%".$keyword."%' or u.firstname LIKE '%".$keyword."%' or s.start_at LIKE '%".$keyword."%' or s.end_at LIKE '%".$keyword."%')";
- }
+ if (isset ($_GET['keyword'])) {
+ $keyword = Database::escape_string(trim($_GET['keyword']));
+ $sql .= " AND (i1.name LIKE '%".$keyword."%' or c.name LIKE '%".$keyword."%' or r1.start_at LIKE '%".$keyword."%' or r1.end_at LIKE '%".$keyword."%' or u.lastname LIKE '%".$keyword."%' or u.firstname LIKE '%".$keyword."%' or s.start_at LIKE '%".$keyword."%' or s.end_at LIKE '%".$keyword."%')";
+ }
$sql .= " ORDER BY col".$column." ".$direction." LIMIT ".$from.",".$per_page;
/*$result = Database::query($sql);
while ($array = Database::fetch_array($result, 'NUM'))
diff --git a/main/social/group_topics.php b/main/social/group_topics.php
index 7e7e6c87cd..fd2ca973c3 100755
--- a/main/social/group_topics.php
+++ b/main/social/group_topics.php
@@ -1,5 +1,6 @@
diff --git a/main/social/groups.php b/main/social/groups.php
index 322a6370a2..20610891fb 100755
--- a/main/social/groups.php
+++ b/main/social/groups.php
@@ -1,5 +1,6 @@
@@ -47,9 +48,7 @@ function remove_image_form(id_elem1) {
if (filepaths.childNodes.length < 3) {
var link_attach = document.getElementById("link-more-attach");
if (link_attach) {
- link_attach.innerHTML=\'' . get_lang(
- 'AddOneMoreFile'
- ) . '\';
+ link_attach.innerHTML=\'' . get_lang('AddOneMoreFile') . '\';
}
}
}
@@ -67,10 +66,7 @@ function add_image_form() {
filepaths.appendChild(elem1);
id_elem1 = "filepath_"+counter_image;
id_elem1 = "\'"+id_elem1+"\'";
- document.getElementById("filepath_"+counter_image).innerHTML = " ";
-
+ document.getElementById("filepath_"+counter_image).innerHTML = " ";
if (filepaths.childNodes.length == 3) {
var link_attach = document.getElementById("link-more-attach");
if (link_attach) {
@@ -92,34 +88,33 @@ jQuery(document).ready(function() {
$("#tab_browse").bind("tabsselect", function(event, ui) {
window.location.href=ui.tab;
});
+
$("#tabs").tabs();
$("#tab_browse").tabs();
-
var valor = "' . $anchor . '";
$(".head").click(function() {
- $(this).next().next().slideToggle("fast");
- image_clicked = $("#" + this.id + " img").attr("src");
- image_clicked_info = image_clicked.split("/");
- image_real_clicked = image_clicked_info[image_clicked_info.length-1];
- image_path = image_clicked.split("img");
- current_path = image_path[0]+"img/";
- if (image_real_clicked == "div_show.gif") {
- current_path = current_path+"div_hide.gif";
- $("#" + this.id + " img").attr("src", current_path);
- } else {
- current_path = current_path+"div_show.gif";
- $("#" + this.id + " img").attr("src", current_path)
- }
- return false;
- }).next().next().hide();
+ $(this).next().next().slideToggle("fast");
+ image_clicked = $("#" + this.id + " img").attr("src");
+ image_clicked_info = image_clicked.split("/");
+ image_real_clicked = image_clicked_info[image_clicked_info.length-1];
+ image_path = image_clicked.split("img");
+ current_path = image_path[0]+"img/";
+ if (image_real_clicked == "div_show.gif") {
+ current_path = current_path+"div_hide.gif";
+ $("#" + this.id + " img").attr("src", current_path);
+ } else {
+ current_path = current_path+"div_show.gif";
+ $("#" + this.id + " img").attr("src", current_path)
+ }
+ return false;
+ }).next().next().hide();
// anchor for current topic
if (valor) {
$("#"+valor).show();
window.location = document.URL+"#"+valor;
}
-
});
';
diff --git a/main/social/message_for_group_form.inc.php b/main/social/message_for_group_form.inc.php
index aad98fd704..1531461564 100755
--- a/main/social/message_for_group_form.inc.php
+++ b/main/social/message_for_group_form.inc.php
@@ -4,9 +4,7 @@
* Form for group message
* @package chamilo.social
*/
-/**
- * Initialization
- */
+
$language_file = array('registration', 'messages', 'userInfo', 'admin');
$cidReset = true;
require_once '../inc/global.inc.php';
@@ -36,19 +34,15 @@ if (isset($_REQUEST['user_friend'])) {
}
$group_id = intval($_GET['group_id']);
+$message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null;
-$message_id = intval($_GET['message_id']);
$actions = array(
'add_message_group',
'edit_message_group',
'reply_message_group'
);
-$allowed_action = (isset($_GET['action']) && in_array(
- $_GET['action'],
- $actions
- )) ? Security::remove_XSS($_GET['action']) : '';
-
+$allowed_action = (isset($_GET['action']) && in_array($_GET['action'], $actions)) ? Security::remove_XSS($_GET['action']) : '';
$to_group = '';
$subject = '';
$message = '';
@@ -75,24 +69,15 @@ if (!empty($group_id) && $allowed_action) {
}
}
-$page_item = !empty($_GET['topics_page_nr']) ? intval(
- $_GET['topics_page_nr']
-) : 1;
-$param_item_page = isset($_GET['items_page_nr']) && isset($_GET['topic_id']) ? ('&items_' . intval(
- $_GET['topic_id']
- ) . '_page_nr=' . (!empty($_GET['topics_page_nr']) ? intval(
- $_GET['topics_page_nr']
- ) : 1)) : '';
+$page_item = !empty($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : 1;
+$param_item_page = isset($_GET['items_page_nr']) && isset($_GET['topic_id']) ? ('&items_' . intval($_GET['topic_id']) . '_page_nr=' . (!empty($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : 1)) : '';
$param_item_page .= '&topic_id=' . intval($_GET['topic_id']);
-$page_topic = !empty($_GET['topics_page_nr']) ? intval(
- $_GET['topics_page_nr']
-) : 1;
+$page_topic = !empty($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : 1;
+$anchor = isset($_GET['anchor_topic']) ? Security::remove_XSS($_GET['anchor_topic']) : null;
?>
|