Format code

ofaj
jmontoyaa 10 years ago
parent 9fdfffb032
commit 73314b2f6a
  1. 1
      main/attendance/attendance_controller.php
  2. 5
      main/calendar/agenda.php
  3. 8
      main/calendar/agenda_js.php
  4. 6
      main/calendar/agenda_list.php
  5. 4
      main/calendar/download.php
  6. 24
      main/calendar/ical_export.php
  7. 2
      main/course_description/add.php
  8. 4
      main/course_description/listing.php
  9. 35
      main/course_home/2column.php
  10. 21
      main/course_home/3column.php
  11. 2
      main/course_home/activity.php
  12. 10
      main/course_home/course_home.php
  13. 12
      main/course_home/vertical_activity.php
  14. 5
      main/course_info/delete_course.php
  15. 4
      main/course_info/download.php
  16. 6
      main/course_progress/index.php
  17. 8
      main/course_progress/thematic_advance.php
  18. 10
      main/course_progress/thematic_controller.php
  19. 89
      main/course_progress/thematic_plan.php
  20. 3
      main/inc/lib/GamificationUtils.php
  21. 1
      main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
  22. 7
      main/inc/lib/access_url_edit_sessions_to_url_functions.lib.php
  23. 42
      main/inc/lib/add_course.lib.inc.php
  24. 7
      main/inc/lib/add_courses_to_session_functions.lib.php
  25. 4
      main/inc/lib/add_many_session_to_category_functions.lib.php
  26. 14
      main/inc/lib/app_view.php
  27. 3695
      main/inc/lib/attendance.lib.php
  28. 33
      main/inc/lib/auth.lib.php
  29. 7
      main/inc/lib/career.lib.php
  30. 2
      main/inc/lib/certificate.lib.php
  31. 23
      main/inc/lib/course.lib.php
  32. 53
      main/inc/lib/course_category.lib.php
  33. 3
      main/inc/lib/course_description.lib.php
  34. 18
      main/inc/lib/course_home.lib.php
  35. 39
      main/inc/lib/document.lib.php
  36. 11
      main/inc/lib/event_email_template.class.php
  37. 5
      main/inc/lib/events.lib.php
  38. 5
      main/inc/lib/events_dispatcher.class.php
  39. 1
      main/inc/lib/events_email.class.php
  40. 9
      main/inc/lib/export.lib.inc.php
  41. 10
      main/inc/lib/extra_field.lib.php
  42. 1
      main/inc/lib/extra_field_option.lib.php
  43. 3
      main/inc/lib/extra_field_value.lib.php
  44. 34
      main/inc/lib/grade_model.lib.php
  45. 14
      main/inc/lib/groupmanager.lib.php
  46. 6
      main/inc/lib/image.lib.php
  47. 56
      main/inc/lib/myspace.lib.php

@ -608,7 +608,6 @@ class AttendanceController
* Gets attendance base in the table:
* TABLE_STATISTIC_TRACK_E_COURSE_ACCESS
* @param bool $showForm
* @throws ViewException
*/
public function getAttendanceBaseInLogin($showForm = false, $exportToPdf = true)
{

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* @package chamilo.calendar
*/
use ChamiloSession as Session;
// use anonymous mode when accessing this course tool
$use_anonymous = true;
require_once '../inc/global.inc.php';
@ -40,7 +40,6 @@ $eventId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
$type = $event_type = isset($_GET['type']) ? $_GET['type'] : null;
$htmlHeadXtra[] = "<script>
function plus_repeated_event() {
if (document.getElementById('options2').style.display == 'none') {
document.getElementById('options2').style.display = 'block';

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* @package chamilo.calendar
*/
use ChamiloSession as Session;
// use anonymous mode when accessing this course tool
$use_anonymous = true;
@ -174,7 +174,6 @@ if (empty($defaultView)) {
}
/* month, basicWeek, agendaWeek, agendaDay */
$tpl->assign('default_view', $defaultView);
if ($type == 'course' && !empty($session_id)) {
@ -210,7 +209,6 @@ $form = new FormValidator(
array('id' => 'add_event_form')
);
$form->addElement('html', '<span id="calendar_course_info"></span><div id="visible_to_input">');
$sendTo = $agenda->parseAgendaFilter($userId);
@ -241,7 +239,7 @@ $form->addHtmlEditor(
]
);
if ($agenda->type == 'course') {
if ($agenda->type === 'course') {
$form->addElement('html', '<div id="add_as_announcement_div" style="display: none">');
$form->addElement('checkbox', 'add_as_annonuncement', null, get_lang('AddAsAnnouncement'));
$form->addElement('html', '</div>');

@ -33,14 +33,14 @@ if (!empty($currentCourseId) && $currentCourseId != -1) {
$this_section = SECTION_COURSES;
} else {
// Agenda is out of the course tool (e.g personal agenda)
// Little hack to sort the events by start date in personal agenda (Agenda events List view - See #8014)
usort($events, function($a, $b) {
$t1 = strtotime($a['start']);
$t2 = strtotime($b['start']);
return $t1 - $t2;
});
$url = false;
if (!empty($events)) {
foreach ($events as &$event) {
@ -72,8 +72,6 @@ if (api_is_allowed_to_edit()) {
// Just needs course ID
$courseInfo = array('real_id' => intval($_GET['cid']));
$agenda->changeVisibility($_GET['id'], $_GET['visibility'], $courseInfo);
} else {
// personal and admin do not have visibility property
}
}
header('Location: '. api_get_self());

@ -80,8 +80,8 @@ if (Database::num_rows($result)) {
$title = str_replace(' ', '_', $row['filename']);
if (Security::check_abs_path(
$full_file_name,
api_get_path(SYS_COURSE_PATH).$course_info['path'].'/upload/calendar/')
) {
api_get_path(SYS_COURSE_PATH).$course_info['path'].'/upload/calendar/'
)) {
DocumentManager::file_send_for_download($full_file_name, true, $title);
}
}

@ -51,7 +51,7 @@ if (!empty($event)) {
$ical->setConfig('url',api_get_path(WEB_PATH));
$vevent = new vevent();
switch($_GET['class']) {
switch ($_GET['class']) {
case 'public':
$vevent->setClass('PUBLIC');
break;
@ -69,18 +69,26 @@ if (!empty($event)) {
$event['start_date'] = api_get_local_time($event['start_date']);
$event['end_date'] = api_get_local_time($event['end_date']);
switch($type) {
switch ($type) {
case 'personal':
case 'platform':
$vevent->setProperty( 'summary', api_convert_encoding($event['title'],'UTF-8', $charset));
$vevent->setProperty('summary', api_convert_encoding($event['title'], 'UTF-8', $charset));
if(empty($event['start_date'])){header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));}
list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$event['start_date']);
$vevent->setProperty('dtstart',array('year'=>$y,'month'=>$m,'day'=>$d,'hour'=>$h,'min'=>$M,'sec'=>$s));
if(empty($event['end_date'])) {
$y2=$y;$m2=$m;$d2=$d;$h2=$h;$M2=$M+15;$s2=$s;
if($M2>60){$M2=$M2-60;$h2+=1;}
if (empty($event['end_date'])) {
$y2 = $y;
$m2 = $m;
$d2 = $d;
$h2 = $h;
$M2 = $M + 15;
$s2 = $s;
if ($M2 > 60) {
$M2 = $M2 - 60;
$h2 += 1;
}
} else {
list($y2,$m2,$d2,$h2,$M2,$s2) = preg_split('/[\s:-]/',$event['end_date']);
list($y2, $m2, $d2, $h2, $M2, $s2) = preg_split('/[\s:-]/', $event['end_date']);
}
$vevent->setProperty('dtend',array('year'=>$y2,'month'=>$m2,'day'=>$d2,'hour'=>$h2,'min'=>$M2,'sec'=>$s2));
//$vevent->setProperty( 'LOCATION', get_lang('Unknown') ); // property name - case independent
@ -130,5 +138,5 @@ if (!empty($event)) {
}
} else {
header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));
die();
exit;
}

@ -13,7 +13,7 @@ api_protect_course_script(true);
// display categories
$categories = array ();
foreach ($default_description_titles as $id => $title) {
$categories[$id] = $title;
$categories[$id] = $title;
}
$categories[ADD_BLOCK] = get_lang('NewBloc');

@ -24,11 +24,11 @@ if (api_is_allowed_to_edit(null,true)) {
foreach ($categories as $id => $title) {
if ($i==ADD_BLOCK) {
echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
break;
} else {
echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
$i++;
}
}

@ -29,28 +29,21 @@ if (api_is_allowed_to_edit(null, true)) {
$msgDestroy = get_lang('DelLk').'<br />';
$msgDestroy .= '<a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;';
$msgDestroy .= '<a href="'.api_get_self().'?destroy=yes&amp;id='.$id.'">'.get_lang('Yes').'</a>';
$show_message .= Display :: return_message($msgDestroy, 'confirmation',false);
}
/*
* Process hiding a tools from available tools.
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
*/
elseif ($_GET['destroy']) {
$show_message .= Display :: return_message($msgDestroy, 'confirmation', false);
} elseif ($_GET['destroy']) {
/*
* Process hiding a tools from available tools.
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
*/
Database::query("UPDATE $tool_table SET visibility='2' WHERE c_id = $course_id AND id='".$id."'");
}
/* HIDE */
elseif ($_GET['hide']) { // visibility 1 -> 0
} elseif ($_GET['hide']) {
/* HIDE */
// visibility 1 -> 0
Database::query("UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'");
$show_message .= Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
}
/* REACTIVATE */
elseif ($_GET["restore"]) { // visibility 0,2 -> 1
} elseif ($_GET["restore"]) {
// visibility 0,2 -> 1
/* REACTIVATE */
Database::query("UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'");
$show_message .= Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation');
}
@ -79,8 +72,8 @@ if (api_is_platform_admin()) {
/* TOOLS VISIBLE FOR EVERYBODY */
$content .= '<div class="everybodyview">';
$content .= '<table width="100%">';
$content .= '<div class="everybodyview">';
$content .= '<table width="100%">';
$content .= CourseHome::show_tool_2column(TOOL_PUBLIC);
$content .= '</table>';
$content .= '</div>';

@ -13,8 +13,8 @@
* @package chamilo.course_home
*/
$hide = isset($_GET['hide']) && $_GET['hide'] == 'yes' ? 'yes' : null;
$restore = isset($_GET['restore']) && $_GET['restore'] == 'yes' ? 'yes' : null;
$hide = isset($_GET['hide']) && $_GET['hide'] === 'yes' ? 'yes' : null;
$restore = isset($_GET['restore']) && $_GET['restore'] === 'yes' ? 'yes' : null;
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
$course_id = api_get_course_int_id();
@ -108,12 +108,12 @@ elseif ($restore) { // visibility 0,2 -> 1
* Editing "apparance" of a tools on the course Home Page.
*/
elseif (isset($update) && $update) {
$result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id=$id");
$tool = Database::fetch_array($result);
$racine = api_get_path(SYS_PATH).'/'.$currentCourseID.'/images/';
$chemin = $racine;
$name = $tool[1];
$image = $tool[3];
$result = Database::query("SELECT * FROM $TBL_ACCUEIL WHERE c_id = $course_id AND id=$id");
$tool = Database::fetch_array($result);
$racine = api_get_path(SYS_PATH).'/'.$currentCourseID.'/images/';
$chemin = $racine;
$name = $tool[1];
$image = $tool[3];
$content .= "<tr>\n".
"<td colspan=\"4\">\n".
@ -159,9 +159,7 @@ elseif (isset($update) && $update) {
}
}
// Work with data post askable by admin of course
if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
// Show message to confirm that a tools must be hide from aivailable tools
// visibility 0,1->2
@ -191,13 +189,10 @@ if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coa
$content .= "<table class=\"item\" align=\"center\" border=\"0\" width=\"95%\">\n";
/* TOOLS FOR EVERYBODY */
$content .= "<tr>\n<td colspan=\"6\">&nbsp;</td>\n</tr>\n";
$content .= "<tr>\n<td colspan=\"6\">";
$content .= CourseHome::show_tool_3column('Basic');
$content .= CourseHome::show_tool_3column('External');
$content .= "</td>\n</tr>\n";

@ -39,7 +39,7 @@ if (api_is_platform_admin()) {
// Course legal
$enabled = api_get_plugin_setting('courselegal', 'tool_enable');
$pluginExtra = null;
if ($enabled == 'true') {
if ($enabled === 'true') {
require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php';
$plugin = CourseLegalPlugin::create();
$pluginExtra = $plugin->getTeacherLink();

@ -305,15 +305,13 @@ if ($show_autolaunch_lp_warning) {
);
}
if (api_get_setting('homepage_view') == 'activity' ||
api_get_setting('homepage_view') == 'activity_big'
) {
if (api_get_setting('homepage_view') === 'activity' || api_get_setting('homepage_view') === 'activity_big') {
require 'activity.php';
} elseif (api_get_setting('homepage_view') == '2column') {
} elseif (api_get_setting('homepage_view') === '2column') {
require '2column.php';
} elseif (api_get_setting('homepage_view') == '3column') {
} elseif (api_get_setting('homepage_view') === '3column') {
require '3column.php';
} elseif (api_get_setting('homepage_view') == 'vertical_activity') {
} elseif (api_get_setting('homepage_view') === 'vertical_activity') {
require 'vertical_activity.php';
}

@ -13,7 +13,6 @@
* @package chamilo.course_home
*/
// MAIN CODE
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
@ -99,26 +98,25 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
$content .= CourseHome::show_tools_category($my_list);
$content .= '</div>';
// TOOLS AUTHORING
} else {
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
if (count($my_list) > 0) {
$content .= '<div class="course-student-view-activity-3col">';
//ordering by get_lang name
$order_tool_list = array();
foreach($my_list as $key=>$new_tool) {
foreach ($my_list as $key => $new_tool) {
$tool_name = CourseHome::translate_tool_name($new_tool);
$order_tool_list [$key]= $tool_name;
}
natsort($order_tool_list);
$my_temp_tool_array = array();
foreach($order_tool_list as $key=>$new_tool) {
foreach ($order_tool_list as $key => $new_tool) {
$my_temp_tool_array[] = $my_list[$key];
}
$my_list = $my_temp_tool_array;
$i = 0;
foreach($my_list as $new_tool) {
foreach ($my_list as $new_tool) {
if ($i >= 10) {
$my_list2[] = $new_tool;
} else {
@ -126,8 +124,8 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
}
$i++;
}
$content .=CourseHome::show_tools_category($my_list1);
$content .=CourseHome::show_tools_category($my_list2);
$content .= CourseHome::show_tools_category($my_list1);
$content .= CourseHome::show_tools_category($my_list2);
$content .= '</div>';
}
}

@ -21,12 +21,12 @@ $current_course_code = $_course['official_code'];
$current_course_name = $_course['name'];
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
api_not_allowed(true);
}
$tool_name = get_lang('DelCourse');
if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
if (isset($_GET['delete']) && $_GET['delete'] === 'yes') {
CourseManager::delete_course($_course['sysCode']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_course['sysCode']);
@ -38,7 +38,6 @@ $tool_name = get_lang('DelCourse');
$message = '<h2>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h2>';
$message .=get_lang('HasDel');
$message .= '<br /><br /><a href="../../index.php">'.get_lang('BackHome').' '.api_get_setting('siteName').'</a>';
} else {
$message = '<h3>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h3>';
$message .= '<p>'.get_lang('ByDel').'</p>';

@ -31,12 +31,12 @@ $content_type = '';
if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
$content_type = 'application/force-download';
} elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
} elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
$content_type = 'application/force-download';
}
if (empty($content_type)) {
api_not_allowed(true);
api_not_allowed(true);
}
if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) {

@ -239,7 +239,7 @@ switch ($action) {
case 'thematic_import':
case 'moveup':
case 'movedown':
if (!api_is_allowed_to_edit(null,true)) {
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
case 'thematic_list':
@ -251,7 +251,7 @@ switch ($action) {
case 'thematic_plan_add':
case 'thematic_plan_edit':
case 'thematic_plan_delete':
if (!api_is_allowed_to_edit(null,true)) {
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
case 'thematic_plan_list':
@ -260,7 +260,7 @@ switch ($action) {
case 'thematic_advance_add':
case 'thematic_advance_edit':
case 'thematic_advance_delete':
if (!api_is_allowed_to_edit(null,true)) {
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
case 'thematic_advance_list':

@ -11,10 +11,10 @@
// protect a course script
api_protect_course_script(true);
if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
$header_form = get_lang('NewThematicAdvance');
if ($action == 'thematic_advance_edit') {
if ($action === 'thematic_advance_edit') {
$header_form = get_lang('EditThematicAdvance');
}
@ -25,7 +25,7 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
'index.php?action=thematic_advance_list&thematic_id='.$thematic_id.'&'.api_get_cidreq(
)
);
$form->addElement('header', $header_form);
$form->addElement('header', $header_form);
//$form->addElement('hidden', 'thematic_advance_token',$token);
$form->addElement('hidden', 'action', $action);
@ -35,7 +35,7 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
if (!empty($thematic_id)) {
$form->addElement('hidden', 'thematic_id', $thematic_id);
}
$radios = array();
$radios[] = $form->createElement(
'radio',

@ -30,7 +30,7 @@ class ThematicController
/**
* This method is used for thematic control (update, insert or listing)
* @param string Action
* @param string $action
* render to thematic.php
*/
public function thematic($action)
@ -351,7 +351,7 @@ class ThematicController
$description_type = isset($_GET['description_type']) ? intval($_GET['description_type']) : null;
if (!empty($thematic_id) && !empty($description_type)) {
if ($action == 'thematic_plan_delete') {
if ($action === 'thematic_plan_delete') {
if (api_is_allowed_to_edit(null, true)) {
$thematic->thematic_plan_destroy($thematic_id, $description_type);
}
@ -362,7 +362,7 @@ class ThematicController
}
$data['thematic_id'] = $thematic_id;
$data['description_type'] = $description_type;
} else if (!empty($thematic_id) && $action == 'thematic_plan_list') {
} else if (!empty($thematic_id) && $action === 'thematic_plan_list') {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
$data['thematic_id'] = $thematic_id;
}
@ -386,11 +386,11 @@ class ThematicController
/**
* This method is used for thematic advance control (update, insert or listing)
* render to thematic_advance.php
* @param string $action
* @param string $action
*
*/
public function thematic_advance($action)
{
{
$thematic = new Thematic();
$attendance = new Attendance();
$data = array();

@ -16,11 +16,12 @@ foreach($thematic_plan_data as $thematic_item) {
}
$new_id = ADD_THEMATIC_PLAN;
if (!empty($thematic_simple_list))
foreach($thematic_simple_list as $item) {
if ($item >= ADD_THEMATIC_PLAN) {
$new_id = $item + 1;
$default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
if (!empty($thematic_simple_list)) {
foreach ($thematic_simple_list as $item) {
if ($item >= ADD_THEMATIC_PLAN) {
$new_id = $item + 1;
$default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
}
}
}
@ -33,46 +34,46 @@ if (isset($message) && $message == 'ok') {
Display::display_normal_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull'));
}
if ($action == 'thematic_plan_list') {
$form = new FormValidator(
'thematic_plan_add',
'POST',
'index.php?action=thematic_plan_list&thematic_id='.$thematic_id.'&'.api_get_cidreq()
);
$form->addElement('hidden', 'action', 'thematic_plan_add');
//$form->addElement('hidden', 'thematic_plan_token', $token);
$form->addElement('hidden', 'thematic_id', $thematic_id);
if ($action === 'thematic_plan_list') {
$form = new FormValidator(
'thematic_plan_add',
'POST',
'index.php?action=thematic_plan_list&thematic_id='.$thematic_id.'&'.api_get_cidreq()
);
$form->addElement('hidden', 'action', 'thematic_plan_add');
//$form->addElement('hidden', 'thematic_plan_token', $token);
$form->addElement('hidden', 'thematic_id', $thematic_id);
foreach ($default_thematic_plan_title as $id => $title) {
$form->addElement('hidden', 'description_type['.$id.']', $id);
$form->addText('title['.$id.']', get_lang('Title'), false, array('size'=>'50'));
$form->addHtmlEditor(
'description['.$id.']',
get_lang('Description'),
false,
false,
array(
'ToolbarStartExpanded' => 'false',
'ToolbarSet' => 'TrainingDescription',
'Height' => '150'
)
);
foreach ($default_thematic_plan_title as $id => $title) {
$form->addElement('hidden', 'description_type['.$id.']', $id);
$form->addText('title['.$id.']', get_lang('Title'), false, array('size'=>'50'));
$form->addHtmlEditor(
'description['.$id.']',
get_lang('Description'),
false,
false,
array(
'ToolbarStartExpanded' => 'false',
'ToolbarSet' => 'TrainingDescription',
'Height' => '150'
)
);
if (!empty($thematic_simple_list) && in_array($id, $thematic_simple_list)) {
$thematic_plan = $new_thematic_plan_data[$id];
// set default values
$default['title['.$id.']'] = $thematic_plan['title'];
$default['description['.$id.']'] = $thematic_plan['description'];
$thematic_plan = null;
} else {
$thematic_plan = null;
$default['title['.$id.']'] = $title;
$default['description['.$id.']']= '';
}
$form->setDefaults($default);
if (!empty($thematic_simple_list) && in_array($id, $thematic_simple_list)) {
$thematic_plan = $new_thematic_plan_data[$id];
// set default values
$default['title['.$id.']'] = $thematic_plan['title'];
$default['description['.$id.']'] = $thematic_plan['description'];
$thematic_plan = null;
} else {
$thematic_plan = null;
$default['title['.$id.']'] = $title;
$default['description['.$id.']']= '';
}
$form->addButtonSave(get_lang('Save'));
$form->display();
$form->setDefaults($default);
}
$form->addButtonSave(get_lang('Save'));
$form->display();
} elseif ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
if ($description_type >= ADD_THEMATIC_PLAN) {
$header_form = get_lang('NewBloc');
@ -80,7 +81,7 @@ if ($action == 'thematic_plan_list') {
$header_form = $default_thematic_plan_title[$description_type];
}
if (!$error) {
$token = md5(uniqid(rand(),TRUE));
$token = md5(uniqid(rand(), true));
$_SESSION['thematic_plan_token'] = $token;
}
@ -135,7 +136,7 @@ if ($action == 'thematic_plan_list') {
// error messages
if ($error) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
$form->display();
}

@ -76,10 +76,8 @@ class GamificationUtils
$learnPathId,
$userId
);
$score += $learnPath->getCalculateScore($sessionId);
}
$totalPoints += round($score / count($learnPaths), 2);
}
@ -182,7 +180,6 @@ class GamificationUtils
public static function getTotalUserStars($userId, $userStatus)
{
$stars = 0;
$sessions = SessionManager::getSessionsFollowedByUser(
$userId,
$userStatus

@ -55,6 +55,7 @@ class Accessurleditcoursestourl
}
}
$xajax_response -> addAssign('ajax_list_courses','innerHTML',api_utf8_encode($return));
return $xajax_response;
}
}

@ -4,10 +4,9 @@
* Definition of the Accessurleditsessiontourl class
* @package chamilo.library
*/
/**
* Init
*/
require_once ('xajax/xajax.inc.php');
require_once 'xajax/xajax.inc.php';
/**
* Accessurleditsessiontourl class
* Contains several functions dealing with displaying,

@ -18,8 +18,14 @@ class AddCourse
* @todo Eliminate the global variables.
* @assert (null) === false
*/
public static function define_course_keys($wanted_code, $prefix_for_all = '', $prefix_for_base_name = '', $prefix_for_path = '', $add_unique_prefix = false, $use_code_indepedent_keys = true)
{
public static function define_course_keys(
$wanted_code,
$prefix_for_all = '',
$prefix_for_base_name = '',
$prefix_for_path = '',
$add_unique_prefix = false,
$use_code_indepedent_keys = true
) {
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$wanted_code = CourseManager::generate_course_code($wanted_code);
$keys_course_code = $wanted_code;
@ -86,7 +92,7 @@ class AddCourse
$perm_file = api_get_permissions_for_new_files();
$htmlpage = "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>Not authorized</title>\n </head>\n <body>\n </body>\n</html>";
$cp = api_get_path(SYS_COURSE_PATH) . $course_repository;
//Creating document folder
mkdir($cp, $perm);
mkdir($cp . '/document', $perm);
@ -431,45 +437,20 @@ class AddCourse
}
$courseInfo = api_get_course_info_by_id($course_id);
$now = api_get_utc_datetime();
$tbl_course_homepage = Database::get_course_table(TABLE_TOOL_LIST);
$TABLEINTROS = Database::get_course_table(TABLE_TOOL_INTRO);
$TABLEGROUPCATEGORIES = Database::get_course_table(
TABLE_GROUP_CATEGORY
);
$TABLEITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TABLETOOLAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLETOOLANNOUNCEMENTS = Database::get_course_table(
TABLE_ANNOUNCEMENT
);
$TABLETOOLDOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
$TABLEQUIZ = Database::get_course_table(TABLE_QUIZ_TEST);
$TABLEQUIZQUESTION = Database::get_course_table(
TABLE_QUIZ_TEST_QUESTION
);
$TABLEQUIZQUESTIONLIST = Database::get_course_table(
TABLE_QUIZ_QUESTION
);
$TABLEQUIZANSWERSLIST = Database::get_course_table(TABLE_QUIZ_ANSWER);
$TABLESETTING = Database::get_course_table(TABLE_COURSE_SETTING);
$TABLEFORUMCATEGORIES = Database::get_course_table(
TABLE_FORUM_CATEGORY
);
$TABLEFORUMS = Database::get_course_table(TABLE_FORUM);
$TABLEFORUMTHREADS = Database::get_course_table(TABLE_FORUM_THREAD);
$TABLEFORUMPOSTS = Database::get_course_table(TABLE_FORUM_POST);
$TABLEGRADEBOOK = Database::get_main_table(
TABLE_MAIN_GRADEBOOK_CATEGORY
);
$TABLEGRADEBOOKLINK = Database::get_main_table(
TABLE_MAIN_GRADEBOOK_LINK
);
$TABLEGRADEBOOKCERT = Database::get_main_table(
TABLE_MAIN_GRADEBOOK_CERTIFICATE
);
include_once api_get_path(SYS_CODE_PATH) . 'lang/english/trad4all.inc.php';
$file_to_include = api_get_path(SYS_CODE_PATH) . 'lang/' . $language . '/trad4all.inc.php';
@ -628,7 +609,7 @@ class AddCourse
}
}
if (api_get_setting('search_enabled') == 'true') {
if (api_get_setting('search_enabled') === 'true') {
Database::query(
"INSERT INTO $tbl_course_homepage (c_id, id, name, link, image, visibility, admin, address, added_tool, target, category, session_id)
VALUES ($course_id, 23, '" . TOOL_SEARCH . "','search/','info.gif','" . self::string2binary(
@ -660,7 +641,6 @@ class AddCourse
VALUES ($course_id, 27, '" . TOOL_COURSE_MAINTENANCE . "','course_info/maintenance.php','backup.gif','$visible_for_course_admin','1','',0,'_self', 'admin','0')"
);
$defaultEmailExerciseAlert = 1;
$alert = api_get_setting('email_alert_manager_on_new_quiz');
if ($alert === 'true') {
$defaultEmailExerciseAlert = 1;
@ -1226,8 +1206,6 @@ class AddCourse
$visual_code = $params['visual_code'];
$directory = $params['directory'];
$tutor_name = isset($params['tutor_name']) ? $params['tutor_name'] : null;
//$description = $params['description'];
$category_code = isset($params['course_category']) ? $params['course_category'] : '';
$course_language = isset($params['course_language']) && !empty($params['course_language']) ? $params['course_language'] : api_get_setting(
'platformLanguage'

@ -44,7 +44,7 @@ class AddCourseToSession
}
}
if ($type=='single') {
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT
course.code,
@ -101,9 +101,8 @@ class AddCourseToSession
$rs = Database::query($sql);
$course_list = array();
if ($type=='single') {
while($course = Database :: fetch_array($rs)) {
if ($type == 'single') {
while ($course = Database :: fetch_array($rs)) {
$course_list[] = $course['code'];
$course_title=str_replace("'","\'",$course_title);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['code'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />';

@ -7,7 +7,8 @@
/**
* Requires
*/
require_once ('xajax/xajax.inc.php');
require_once 'xajax/xajax.inc.php';
/**
* AddManySessionToCategoryFunctions class
*/
@ -46,6 +47,7 @@ class AddManySessionToCategoryFunctions
$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
}
$_SESSION['course_list'] = $course_list;
return $xajax_response;
}
}

@ -2,12 +2,8 @@
/* For licensing terms, see /license.txt */
/**
* This library provides methods for using views with MVC pattern
* @package chamilo.library
* @author Christian Fasanando <christian1827@gmail.com>
* Class View
*/
class ViewException extends Exception {}
class View
{
private $data;
@ -31,7 +27,7 @@ class View
if (is_dir($path)) {
$this->tool_path = $path;
} else {
throw new ViewException('View::__construct() $path directory does not exist ' . $path);
throw new Exception('View::__construct() $path directory does not exist ' . $path);
}
}
}
@ -43,7 +39,7 @@ class View
public function set_data($data)
{
if (!is_array($data)) {
throw new ViewException('View::set_data() $data must to be an array, you have sent a' . gettype( $data ));
throw new Exception('View::set_data() $data must to be an array, you have sent a' . gettype( $data ));
}
$this->data = $data;
}
@ -78,7 +74,7 @@ class View
if (file_exists($target)) {
require_once $target;
} else {
throw new ViewException('View::render() invalid file path '.$target);
throw new Exception('View::render() invalid file path '.$target);
}
}
@ -96,7 +92,7 @@ class View
$content = ob_get_clean();
return $content;
} else {
throw new ViewException('View::render_template() invalid file path '.$target);
throw new Exception('View::render_template() invalid file path '.$target);
}
}
}

File diff suppressed because it is too large Load Diff

@ -170,7 +170,6 @@ class Auth
$without_special_courses
ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
$result = Database::query($sql);
$number_of_courses = Database::num_rows($result);
$data = array();
while ($course = Database::fetch_array($result)) {
$data[$course['user_course_cat']][] = $course;
@ -380,10 +379,12 @@ class Auth
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$category_id = intval($category_id);
$result = false;
$sql_delete = "DELETE FROM $tucc
WHERE id='" . $category_id . "' and user_id='" . $current_user_id . "'";
$resultQuery = Database::query($sql_delete);
if (Database::affected_rows($resultQuery)) {
$sql = "DELETE FROM $tucc
WHERE
id='" . $category_id . "' AND
user_id='" . $current_user_id . "'";
$resultQuery = Database::query($sql);
if (Database::affected_rows($resultQuery)) {
$result = true;
}
$sql = "UPDATE $TABLECOURSUSER
@ -527,6 +528,7 @@ class Auth
}
CourseManager::unsubscribe_user($current_user_id, $course_code);
return $result;
}
@ -545,24 +547,31 @@ class Auth
$result = false;
// step 1: we determine the max value of the user defined course categories
$sql = "SELECT sort FROM $tucc WHERE user_id='" . $current_user_id . "' ORDER BY sort DESC";
$sql = "SELECT sort FROM $tucc
WHERE user_id='" . $current_user_id . "'
ORDER BY sort DESC";
$rs_sort = Database::query($sql);
$maxsort = Database::fetch_array($rs_sort);
$nextsort = $maxsort['sort'] + 1;
// step 2: we check if there is already a category with this name, if not we store it, else we give an error.
$sql = "SELECT * FROM $tucc WHERE user_id='" . $current_user_id . "' AND title='" . $category_title . "'ORDER BY sort DESC";
$sql = "SELECT * FROM $tucc
WHERE
user_id='" . $current_user_id . "' AND
title='" . $category_title . "'
ORDER BY sort DESC";
$rs = Database::query($sql);
if (Database::num_rows($rs) == 0) {
$sql_insert = "INSERT INTO $tucc (user_id, title,sort)
VALUES ('" . $current_user_id . "', '" . api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding()) . "', '" . $nextsort . "')";
$resultQuery = Database::query($sql_insert);
$sql = "INSERT INTO $tucc (user_id, title,sort)
VALUES ('" . $current_user_id . "', '" . api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding()) . "', '" . $nextsort . "')";
$resultQuery = Database::query($sql);
if (Database::affected_rows($resultQuery)) {
$result = true;
}
} else {
$result = false;
}
return $result;
}
@ -601,7 +610,7 @@ class Auth
/**
* Subscribe the user to a given course
* @param string Course code
* @param string $course_code Course code
* @return string Message about results
*/
public function subscribe_user($course_code)
@ -700,7 +709,7 @@ class Auth
* @param string $date in Y-m-d format
* @return int
*/
function countSessions($date = null)
public function countSessions($date = null)
{
$count = 0;
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);

@ -201,9 +201,9 @@ class Career extends Model
*/
public function get_status($career_id)
{
$TBL_CAREER = Database::get_main_table(TABLE_CAREER);
$TBL_CAREER = Database::get_main_table(TABLE_CAREER);
$career_id = intval($career_id);
$sql = "SELECT status FROM $TBL_CAREER WHERE id = '$career_id'";
$sql = "SELECT status FROM $TBL_CAREER WHERE id = '$career_id'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$data = Database::fetch_array($result);
@ -254,7 +254,8 @@ class Career extends Model
);
}
public function update($params) {
public function update($params)
{
if (isset($params['description'])) {
$params['description'] = Security::remove_XSS($params['description']);
}

@ -276,7 +276,7 @@ class Certificate extends Model
$path_certificate
) {
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
if (!UserManager::is_user_certified($cat_id,$user_id)) {
if (!UserManager::is_user_certified($cat_id, $user_id)) {
$sql='UPDATE '.$table_certificate.' SET path_certificate="'.Database::escape_string($path_certificate).'"
WHERE cat_id="'.intval($cat_id).'" AND user_id="'.intval($user_id).'" ';
Database::query($sql);

@ -710,7 +710,7 @@ class CourseManager
/**
* Gets the course code from the course id. Returns null if course id was not found
*
* @param int Course id
* @param int $id Course id
* @return string Course code
* @assert ('') === false
*/
@ -1606,7 +1606,7 @@ class CourseManager
* @param array $sessionIdList
* @return array|int
*/
static function get_count_user_list_from_course_code(
public static function get_count_user_list_from_course_code(
$resumed_report = false,
$extra_field = array(),
$courseCodeList = array(),
@ -1929,7 +1929,6 @@ class CourseManager
$orderList = false
) {
$teacher_list = self::get_teacher_list_from_course_code($course_code);
$teacher_string = '';
$html = '';
$list = array();
if (!empty($teacher_list)) {
@ -1959,7 +1958,7 @@ class CourseManager
$html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher);
}
$html .= '</ul>';
}else{
} else {
$html .= array_to_string($list, $separator);
}
}
@ -2476,7 +2475,8 @@ class CourseManager
$student = api_get_user_info($user_id);
$name_course = $information['title'];
$sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " WHERE c_id ='" . $courseId . "'";
$sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
WHERE c_id ='" . $courseId . "'";
// TODO: Ivan: This is a mistake, please, have a look at it. Intention here is diffcult to be guessed.
//if ($send_to_tutor_also = true)
@ -2635,9 +2635,9 @@ class CourseManager
// get course list not auto-register. Use Distinct to avoid multiple
// entries when a course is assigned to a HRD (DRH) as watcher
$sql = "SELECT DISTINCT(course.code), course.id as real_id
FROM $tbl_course course
INNER JOIN $tbl_course_user cru ON course.id = cru.c_id
WHERE cru.user_id='$user_id' $without_special_courses";
FROM $tbl_course course
INNER JOIN $tbl_course_user cru ON course.id = cru.c_id
WHERE cru.user_id='$user_id' $without_special_courses";
}
$result = Database::query($sql);
@ -2810,7 +2810,8 @@ class CourseManager
$id = (int)$id;
$table = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "UPDATE $table SET $name = '" . Database::escape_string($value) . "'
WHERE id = '$id';";
WHERE id = '$id'";
return Database::query($sql);
}
@ -2837,7 +2838,8 @@ class CourseManager
$i++;
}
}
$sql .= " WHERE id = '$id';";
$sql .= " WHERE id = '$id'";
return Database::query($sql);
}
@ -2859,6 +2861,7 @@ class CourseManager
'variable' => $variable,
'value' => $value
];
return $extraFieldValues->save($params);
}

@ -543,8 +543,8 @@ class CourseCategory
'parent_id' => null,
'tree_pos' => 0,
'count_courses' => $countCourses
);
while ($row = Database::fetch_array($result)) {
$count_courses = self::countCoursesInCategory($row['code']);
$row['count_courses'] = $count_courses;
@ -734,11 +734,11 @@ class CourseCategory
$category_code = '';
}
$sql = "SELECT * FROM $tbl_course
WHERE
category_code='$category_code'
$without_special_courses
$visibilityCondition
ORDER BY title $limitFilter ";
WHERE
category_code='$category_code'
$without_special_courses
$visibilityCondition
ORDER BY title $limitFilter ";
}
//showing only the courses of the current Chamilo access_url_id
@ -747,23 +747,23 @@ class CourseCategory
$tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
if ($category_code != "ALL") {
$sql = "SELECT * FROM $tbl_course as course
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $url_access_id AND
category_code='$category_code'
$without_special_courses
$visibilityCondition
ORDER BY title $limitFilter";
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $url_access_id AND
category_code='$category_code'
$without_special_courses
$visibilityCondition
ORDER BY title $limitFilter";
} else {
$sql = "SELECT * FROM $tbl_course as course
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $url_access_id
$without_special_courses
$visibilityCondition
ORDER BY title $limitFilter";
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $url_access_id
$without_special_courses
$visibilityCondition
ORDER BY title $limitFilter";
}
}
}
@ -801,6 +801,7 @@ class CourseCategory
'count_connections' => $count_connections_last_month
);
}
return $courses;
}
@ -821,11 +822,11 @@ class CourseCategory
$whereCondition = " AND a.access_url_id = ".api_get_current_access_url_id();
$sql = "SELECT code, name, auth_course_child, auth_cat_child
FROM ".$tbl_category." c
$conditions
WHERE parent_id ".(empty($parentCode) ? "IS NULL" : "='".Database::escape_string($parentCode)."'")."
$whereCondition
ORDER BY name, code";
FROM $tbl_category c
$conditions
WHERE parent_id ".(empty($parentCode) ? "IS NULL" : "='".Database::escape_string($parentCode)."'")."
$whereCondition
ORDER BY name, code";
$res = Database::query($sql);
while ($cat = Database::fetch_array($res, 'ASSOC')) {

@ -289,7 +289,7 @@ class CourseDescription
$this->id,
$this->session_id,
$this->course_id ? $this->course_id : api_get_course_int_id(),
],
]
]
);
@ -449,6 +449,7 @@ class CourseDescription
$information[6] = get_lang('HumanAndTechnicalResourcesInformation');
$information[7] = get_lang('AssessmentInformation');
//$information[8]= get_lang('ThematicAdvanceInformation');
return $information;
}

@ -23,7 +23,7 @@ class CourseHome
$course_id = api_get_course_int_id();
switch ($cat) {
case 'Basic' :
case 'Basic':
$condition_display_tools = ' WHERE a.c_id = '.$course_id.' AND a.link=t.link AND t.position="basic" ';
if ((api_is_coach() || api_is_course_tutor()) && $_SESSION['studentview'] != 'studentview') {
$condition_display_tools = ' WHERE a.c_id = '.$course_id.' AND a.link=t.link AND (t.position="basic" OR a.name = "'.TOOL_TRACKING.'") ';
@ -32,7 +32,7 @@ class CourseHome
$sql = "SELECT a.*, t.image img, t.row, t.column FROM $TBL_ACCUEIL a, $TABLE_TOOLS t
$condition_display_tools ORDER BY t.row, t.column";
break;
case 'External' :
case 'External':
if (api_is_allowed_to_edit()) {
$sql = "SELECT a.*, t.image img FROM $TBL_ACCUEIL a, $TABLE_TOOLS t
WHERE a.c_id = $course_id AND ((a.link=t.link AND t.position='external')
@ -45,12 +45,12 @@ class CourseHome
ORDER BY a.id";
}
break;
case 'courseAdmin' :
case 'courseAdmin':
$sql = "SELECT a.*, t.image img, t.row, t.column FROM $TBL_ACCUEIL a, $TABLE_TOOLS t
WHERE a.c_id = $course_id AND admin=1 AND a.link=t.link ORDER BY t.row, t.column";
break;
case 'platformAdmin' :
case 'platformAdmin':
$sql = "SELECT *, image img FROM $TBL_ACCUEIL WHERE c_id = $course_id AND visibility = 2 ORDER BY id";
}
$result = Database::query($sql);
@ -552,7 +552,6 @@ class CourseHome
// Grabbing all the links that have the property on_homepage set to 1
$course_link_table = Database::get_course_table(TABLE_LINK);
$course_item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$condition_session = api_get_session_condition($session_id, true, true, 'tip.session_id');
switch ($course_tool_category) {
@ -661,7 +660,7 @@ class CourseHome
{
$_user = api_get_user_info();
$theme = api_get_setting('homepage_view');
if ($theme == 'vertical_activity') {
if ($theme === 'vertical_activity') {
//ordering by get_lang name
$order_tool_list = array();
if (is_array($all_tools_list) && count($all_tools_list) > 0) {
@ -699,7 +698,6 @@ class CourseHome
foreach ($all_tools_list as & $tool) {
$item = array();
$studentview = false;
$tool['original_link'] = $tool['link'];
if ($tool['image'] == 'scormbuilder.gif') {
@ -1083,6 +1081,7 @@ class CourseHome
$lp_id = intval($a_param_lp_id[1]);
}
}
return $lp_id;
}
@ -1090,7 +1089,7 @@ class CourseHome
* @param bool $include_admin_tools
* @return array
*/
static function get_navigation_items($include_admin_tools = false)
public static function get_navigation_items($include_admin_tools = false)
{
$navigation_items = array();
$course_id = api_get_course_int_id();
@ -1237,6 +1236,7 @@ class CourseHome
}
$html .= '</div>';
}
return $html;
}
@ -1416,7 +1416,7 @@ class CourseHome
}
$params = [
'custom_icon' => '',
'custom_icon' => ''
];
Database::update(

@ -1025,6 +1025,7 @@ class DocumentManager
$sql = "SELECT filetype FROM $TABLE_DOCUMENT
WHERE c_id = $course_id AND id= $document_id";
$result = Database::fetch_array(Database::query($sql), 'ASSOC');
return $result['filetype'] == 'folder';
}
@ -1303,7 +1304,7 @@ class DocumentManager
public static function delete_document_from_search_engine($course_id, $document_id)
{
// remove from search engine if enabled
if (api_get_setting('search_enabled') == 'true') {
if (api_get_setting('search_enabled') === 'true') {
$tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
$sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1';
$sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_DOCUMENT, $document_id);
@ -1847,7 +1848,7 @@ class DocumentManager
* @param bool $is_preview
* @return array
*/
static function get_all_info_to_certificate($user_id, $course_id, $is_preview = false)
public static function get_all_info_to_certificate($user_id, $course_id, $is_preview = false)
{
$info_list = array();
$user_id = intval($user_id);
@ -2381,6 +2382,7 @@ class DocumentManager
}
}
}
return $checked_array_list;
}
@ -2485,7 +2487,7 @@ class DocumentManager
*
* @return string new content html with replaced urls or return false if content is not a string
*/
static function replace_urls_inside_content_html_from_copy_course(
public static function replace_urls_inside_content_html_from_copy_course(
$content_html,
$origin_course_code,
$destination_course_directory,
@ -2647,7 +2649,7 @@ class DocumentManager
* @param string destination
* @return string new content html with replaced urls or return false if content is not a string
*/
function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path)
public function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path)
{
if (substr($original_path, strlen($original_path) - 1, strlen($original_path)) == '/') {
$original = $original_path . $file_name;
@ -3023,7 +3025,7 @@ class DocumentManager
*
* @return int total size
*/
static function documents_total_space($course_id = null, $group_id = null, $session_id = null)
public static function documents_total_space($course_id = null, $group_id = null, $session_id = null)
{
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
@ -3071,7 +3073,7 @@ class DocumentManager
/**
* Here we count 1 Kilobyte = 1024 Bytes, 1 Megabyte = 1048576 Bytes
*/
static function display_quota($course_quota, $already_consumed_space)
public static function display_quota($course_quota, $already_consumed_space)
{
$course_quota_m = round($course_quota / 1048576);
$already_consumed_space_m = round($already_consumed_space / 1048576);
@ -3120,7 +3122,7 @@ class DocumentManager
*
* Here we count 1 Kilobyte = 1024 Bytes, 1 Megabyte = 1048576 Bytes
*/
static function display_simple_quota($course_quota, $already_consumed_space)
public static function display_simple_quota($course_quota, $already_consumed_space)
{
$course_quota_m = round($course_quota / 1048576);
$already_consumed_space_m = round($already_consumed_space / 1048576, 2);
@ -3142,7 +3144,8 @@ class DocumentManager
*
* @see enough_space() uses documents_total_space() function
*/
static function enough_space($file_size, $max_dir_space) {
public static function enough_space($file_size, $max_dir_space)
{
if ($max_dir_space) {
$already_filled_space = self::documents_total_space();
if (($file_size + $already_filled_space) > $max_dir_space) {
@ -3156,7 +3159,7 @@ class DocumentManager
* @param array $params count, url, extension
* @return string
*/
static function generate_jplayer_jquery($params = array())
public static function generate_jplayer_jquery($params = array())
{
$js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
@ -3190,7 +3193,7 @@ class DocumentManager
* @param string
* @return string html content
*/
static function generate_media_preview($i, $type = 'simple')
public static function generate_media_preview($i, $type = 'simple')
{
$i = intval($i);
@ -4340,7 +4343,6 @@ class DocumentManager
public static function getDocumentDefaultVisibility($courseCode)
{
$settings = api_get_setting('tool_visible_by_default_at_creation');
$defaultVisibility = 'visible';
if (isset($settings['documents'])) {
@ -4403,6 +4405,7 @@ class DocumentManager
$html .= '<param name="ShowTime" value="true" />';
$html .= '<param name="ShowRecordButton" value="false" />';
$html .= '</applet>';
return $html;
}
@ -4875,6 +4878,7 @@ class DocumentManager
}
$name = $dir.$fileName.$suffix.'.'.$extension;
return $name;
}
@ -5181,7 +5185,7 @@ class DocumentManager
$url_path = urlencode($document_data['path']);
// Add class="invisible" on invisible files
$visibility_class = ($visibility == false) ? ' class="muted"' : '';
$visibility_class = $visibility == false ? ' class="muted"' : '';
$forcedownload_link = null;
$forcedownload_icon = null;
$prevent_multiple_click = null;
@ -5217,9 +5221,6 @@ class DocumentManager
$path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq();
$url = $www . $path;
}
/*$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read
$url = $www . $path;*/
} else {
$url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'];
}
@ -5256,7 +5257,6 @@ class DocumentManager
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
$send_to = null;
$checkExtension = $path;
if (!$show_as_icon) {
@ -5288,8 +5288,8 @@ class DocumentManager
}
// Copy files to users myfiles
if (api_get_setting('allow_social_tool') == 'true' &&
api_get_setting('users_copy_files') == 'true' &&
if (api_get_setting('allow_social_tool') === 'true' &&
api_get_setting('users_copy_files') === 'true' &&
!api_is_anonymous()
) {
$copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq();
@ -5789,6 +5789,7 @@ class DocumentManager
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' .
Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a>';
}
return $modify_icons;
}
@ -5888,6 +5889,7 @@ class DocumentManager
}
$form->addElement('select', 'move_to', get_lang('MoveTo'), $options);
$form->addButtonNext(get_lang('MoveElement'), 'move_file_submit');
return $form->returnForm();
}
@ -5925,6 +5927,7 @@ class DocumentManager
$tmp_folders_titles[$tmp_path] = $tmp_title;
}
}
return $path_displayed;
}

@ -7,7 +7,7 @@
class EventEmailTemplate extends Model
{
public $table;
public $columns = array('id', 'message','subject','event_type_name','activated');
public $columns = array('id', 'message', 'subject', 'event_type_name', 'activated');
/**
* Constructor
@ -17,6 +17,10 @@ class EventEmailTemplate extends Model
$this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
}
/**
* @param array $where_conditions
* @return array
*/
public function get_all($where_conditions = array())
{
return Database::select(
@ -43,11 +47,14 @@ class EventEmailTemplate extends Model
return $content;
}
/**
* @return array
*/
public function get_status_list()
{
return array(
EVENT_EMAIL_TEMPLATE_ACTIVE => get_lang('Enabled'),
EVENT_EMAIL_TEMPLATE_INACTIVE => get_lang('Disabled'),
EVENT_EMAIL_TEMPLATE_INACTIVE => get_lang('Disabled')
);
}

@ -58,7 +58,6 @@ class Event
public static function event_login($userId)
{
$userInfo = api_get_user_info($userId);
$userId = intval($userId);
if (empty($userInfo)) {
@ -235,6 +234,7 @@ class Event
'".api_get_session_id()."'
)";
Database::query($sql);
return 1;
}
@ -567,8 +567,10 @@ class Event
}
$attempt_id = $exe_id;
}
return $attempt_id;
} else {
return false;
}
}
@ -1788,6 +1790,7 @@ class Event
WHERE user_from = '.$user_from.' AND user_to = '.$user_to.' AND event_type_name = "'.$event_name.'"';
}
$result = Database::store_result(Database::query($sql), 'ASSOC');
return $result[0]["total"];
}

@ -10,6 +10,11 @@
*/
class EventsDispatcher
{
/**
* @param string $event_name
* @param array $event_data
* @return bool
*/
public static function events($event_name, $event_data = array())
{
global $event_config;

@ -7,7 +7,6 @@
*/
class EventsMail
{
/**
* Sends email according to an event
*

@ -43,7 +43,7 @@ class Export
public static function arrayToCsv($data, $filename = 'export')
{
if (empty($data)) {
return false;
}
@ -59,7 +59,7 @@ class Export
DocumentManager::file_send_for_download($filePath, true, $filename.'.csv');
exit;
}
}
/**
* Export tabular data to XLS-file
@ -82,7 +82,7 @@ class Export
DocumentManager::file_send_for_download($filePath, true, $filename.'.xlsx');
exit;
}
}
/**
* Export tabular data to XLS-file (as html table)
@ -151,7 +151,7 @@ class Export
fclose($handle);
DocumentManager :: file_send_for_download($file, true, $filename.'.xml');
exit;
}
}
/**
* Export hierarchical tabular data to XML-file
@ -343,5 +343,4 @@ class Export
}
}
}
}

@ -85,6 +85,8 @@ class ExtraField extends Model
*/
public function __construct($type)
{
parent::__construct();
$this->type = $type;
$this->table = Database::get_main_table(TABLE_EXTRA_FIELD);
@ -108,7 +110,7 @@ class ExtraField extends Model
$this->primaryKey = 'id';
break;
case 'session':
$this->extraFieldType = EntityExtraField::SESSION_FIELD_TYPE;
$this->extraFieldType = EntityExtraField::SESSION_FIELD_TYPE;
$this->primaryKey = 'id';
break;
case 'question':
@ -1619,7 +1621,11 @@ EOF;
return $return;
}
function setupBreadcrumb(&$breadcrumb, $action)
/**
* @param $breadcrumb
* @param $action
*/
public function setupBreadcrumb(&$breadcrumb, $action)
{
if ($action == 'add') {
$breadcrumb[] = array('url' => $this->pageUrl, 'name' => $this->pageName);

@ -26,6 +26,7 @@ class ExtraFieldOption extends Model
*/
public function __construct($type)
{
parent::__construct();
$this->type = $type;
$extraField = new ExtraField($this->type);
$this->extraField = $extraField;

@ -36,6 +36,7 @@ class ExtraFieldValue extends Model
*/
public function __construct($type)
{
parent::__construct();
$this->type = $type;
$extraField = new ExtraField($this->type);
$this->extraField = $extraField;
@ -173,7 +174,7 @@ class ExtraFieldValue extends Model
$tags = array_merge($tags, $tagsResult);
}
}
foreach ($tags as $tag) {
$tagUses = $em
->getRepository('ChamiloCoreBundle:ExtraFieldRelTag')

@ -15,6 +15,7 @@ class GradeModel extends Model
*/
public function __construct()
{
parent::__construct();
$this->table = Database::get_main_table(TABLE_GRADE_MODEL);
}
@ -123,11 +124,11 @@ class GradeModel extends Model
for ($i = 0; $i <= $max; $i++) {
$counter = $i;
$form->addElement('text', 'components['.$i.'][percentage]', null);
$form->addElement('text', 'components['.$i.'][acronym]', null);
$form->addElement('text', 'components['.$i.'][title]', null);
$form->addElement('hidden', 'components['.$i.'][id]', null);
$form->addElement('text', 'components['.$i.'][acronym]', null);
$form->addElement('text', 'components['.$i.'][title]', null);
$form->addElement('hidden', 'components['.$i.'][id]', null);
$template_percentage =
$template_percentage =
'<div id=' . $i . ' style="display: '.(($i<=$nr_items)?'inline':'none').';" class="control-group">
<p>
<label class="control-label">{label}</label>
@ -195,6 +196,10 @@ class GradeModel extends Model
return $form;
}
/**
* @param $id
* @return array|null
*/
public function get_components($id)
{
$obj = new GradeModelComponents();
@ -204,6 +209,11 @@ class GradeModel extends Model
return null;
}
/**
* @param array $params
* @param bool $show_query
* @return bool
*/
public function save($params, $show_query = false)
{
$id = parent::save($params, $show_query);
@ -242,10 +252,12 @@ class GradeModel extends Model
//$params['components']
}
/**
* @param int $id
*/
public function delete($id)
{
parent::delete($id);
//event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
}
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null)
@ -290,14 +302,24 @@ class GradeModelComponents extends Model
public $table;
public $columns = array('id', 'title', 'percentage', 'acronym', 'grade_model_id');
/**
* GradeModelComponents constructor.
*/
public function __construct()
{
$this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
parent::__construct();
$this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
}
/**
* @param array $params
* @param bool $show_query
* @return bool
*/
public function save($params, $show_query = false)
{
$id = parent::save($params, $show_query);
return $id;
}
}

@ -386,7 +386,7 @@ class GroupManager
if (api_is_course_coach()) {
//a coach can only delete courses from his session
for ($i=0 ; $i<count($group_ids) ; $i++) {
for ($i = 0; $i < count($group_ids); $i++) {
if (!api_is_element_in_the_session(TOOL_GROUP,$group_ids[$i])) {
array_splice($group_ids,$i,1);
$i--;
@ -641,6 +641,7 @@ class GroupManager
WHERE c_id = $course_id ";
$res = Database::query($sql);
$obj = Database::fetch_object($res);
return $obj->number_of_groups;
}
@ -682,7 +683,8 @@ class GroupManager
$id = intval($id);
$table_group_cat = Database :: get_course_table(TABLE_GROUP_CATEGORY);
$sql = "SELECT * FROM $table_group_cat
WHERE c_id = $course_id AND id = $id LIMIT 1";
WHERE c_id = $course_id AND id = $id
LIMIT 1";
$res = Database::query($sql);
return Database::fetch_array($res);
@ -815,7 +817,7 @@ class GroupManager
WHERE c_id = $course_id ";
$res = Database::query($sql);
$obj = Database::fetch_object($res);
if (!isset ($obj->new_order)) {
if (!isset($obj->new_order)) {
$obj->new_order = 1;
}
@ -1078,6 +1080,7 @@ class GroupManager
while ($obj = Database::fetch_object($res)) {
$users[] = api_get_user_info($obj->user_id);
}
return $users;
}
@ -1100,6 +1103,7 @@ class GroupManager
while ($obj = Database::fetch_object($res)) {
$users[] = api_get_user_info($obj->user_id);
}
return $users;
}
@ -1121,6 +1125,7 @@ class GroupManager
while ($obj = Database::fetch_object($res)) {
$users[] = api_get_user_info($obj->user_id);
}
return $users;
}
@ -1146,6 +1151,7 @@ class GroupManager
while ($row = Database::fetch_array($rs)) {
$result[] = $row['user_id'];
}
return $result;
}
@ -1180,7 +1186,7 @@ class GroupManager
$group_ids = array_map('intval', $group_ids);
if (api_is_course_coach()) {
for ($i=0 ; $i< count($group_ids) ; $i++) {
for ($i=0 ; $i < count($group_ids) ; $i++) {
if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])){
array_splice($group_ids,$i,1);
$i--;

@ -30,7 +30,8 @@ class Image
}
}
public function resize($max_size_for_picture) {
public function resize($max_size_for_picture)
{
$image_size = $this->get_image_size($this->image_wrapper->path);
$width = $image_size['width'];
$height = $image_size['height'];
@ -49,7 +50,8 @@ class Image
}
}
public function crop($cropParameters) {
public function crop($cropParameters)
{
$image_size = $this->get_image_size($this->image_wrapper->path);
$src_width = $image_size['width'];
$src_height = $image_size['height'];

@ -19,13 +19,34 @@ class MySpace
{
$actions = array(
//array('url' => api_get_path(WEB_CODE_PATH).'mySpace/index.php', 'content' => get_lang('Home')),
array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=coaches', 'content' => get_lang('DisplayCoaches')),
array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=user', 'content' => get_lang('DisplayUserOverview')),
array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=session', 'content' => get_lang('DisplaySessionOverview')),
array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=course', 'content' => get_lang('DisplayCourseOverview')),
array('url' => api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin', 'content' => get_lang('LPQuestionListResults')),
array('url' => api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin', 'content' => get_lang('LPExerciseResultsBySession')),
['url' => api_get_path(WEB_CODE_PATH) . 'mySpace/admin_view.php?display=accessoverview', 'content' => get_lang('DisplayAccessOverview') . ' (' . get_lang('Beta') . ')']
array(
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=coaches',
'content' => get_lang('DisplayCoaches'),
),
array(
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=user',
'content' => get_lang('DisplayUserOverview'),
),
array(
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=session',
'content' => get_lang('DisplaySessionOverview'),
),
array(
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=course',
'content' => get_lang('DisplayCourseOverview'),
),
array(
'url' => api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin',
'content' => get_lang('LPQuestionListResults'),
),
array(
'url' => api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin',
'content' => get_lang('LPExerciseResultsBySession'),
),
[
'url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=accessoverview',
'content' => get_lang('DisplayAccessOverview').' ('.get_lang('Beta').')',
],
);
return Display :: actions($actions, null);
@ -34,10 +55,19 @@ class MySpace
public static function getTopMenu()
{
$menu_items = array();
$menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher');
$menu_items[] = Display::url(
Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
);
$menu_items[] = Display::url(
Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32),
api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher'
);
$menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), '#');
$menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
$menu_items[] = Display::url(
Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32),
api_get_path(WEB_CODE_PATH).'tracking/exams.php'
);
$menu = null;
foreach ($menu_items as $item) {
$menu .= $item;
@ -54,7 +84,7 @@ class MySpace
* @param string $file_name The name of the file which contains exported data.
* @return string mixed Returns a message (string) if an error occurred.
*/
function export_csv($header, $data, $file_name = 'export.csv')
public function export_csv($header, $data, $file_name = 'export.csv')
{
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$archive_url = api_get_path(WEB_CODE_PATH).'course_info/download.php?archive=';
@ -93,7 +123,7 @@ class MySpace
* @param int Session id (optional, default = 0)
* @return array Conections
*/
static function get_connections_to_course($user_id, $courseId, $session_id = 0)
public static function get_connections_to_course($user_id, $courseId, $session_id = 0)
{
// Database table definitions
$tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
@ -128,7 +158,7 @@ class MySpace
* @param int $session_id
* @return array|bool
*/
static function get_connections_from_course_list($user_id, $course_list, $session_id = 0)
public static function get_connections_from_course_list($user_id, $course_list, $session_id = 0)
{
// Database table definitions
$tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);

Loading…
Cancel
Save