Minor - format code, removing unused commented code.

1.9.x
Julio Montoya 10 years ago
parent 7304449bb3
commit 22767cd915
  1. 3
      main/attendance/attendance_controller.php
  2. 91
      main/blog/blog.php
  3. 6
      main/blog/blog_admin.php
  4. 17
      main/calendar/agenda.inc.php
  5. 12
      main/calendar/allagendas.php
  6. 10
      main/calendar/ical_export.php
  7. 17
      main/calendar/myagenda.inc.php
  8. 2
      main/chat/chat_chat.php
  9. 2
      main/chat/chat_hidden.php
  10. 2
      main/chat/chat_message.php
  11. 4
      main/chat/chat_whoisonline.php
  12. 1
      main/course_description/add.php
  13. 6
      main/course_home/3column.php
  14. 1
      main/course_info/delete_course.php
  15. 2
      main/course_info/download.php
  16. 13
      main/course_info/infocours.php
  17. 4
      main/course_progress/index.php
  18. 4
      main/course_progress/thematic.php
  19. 32
      main/course_progress/thematic_controller.php
  20. 4
      main/coursecopy/classes/Announcement.class.php
  21. 8
      main/coursecopy/classes/CourseBuilder.class.php
  22. 43
      main/coursecopy/classes/CourseRestorer.class.php
  23. 2
      main/coursecopy/classes/CourseSelectForm.class.php
  24. 24
      main/coursecopy/classes/Event.class.php
  25. 1
      main/create_course/add_course.php
  26. 14
      main/dashboard/index.php
  27. 1
      main/dropbox/dropbox_functions.inc.php
  28. 1
      main/dropbox/dropbox_init.inc.php
  29. 1
      main/dropbox/index.php
  30. 57
      main/exercice/admin.php
  31. 9
      main/exercice/export/aiken/aiken_import.inc.php
  32. 5
      main/exercice/export/exercise_import.inc.php
  33. 32
      main/exercice/export/exercise_import.php
  34. 1
      main/exercice/export/qti2/qti2_export.php
  35. 7
      main/exercice/export/scorm/scorm_export.php
  36. 127
      main/forum/forumfunction.inc.php
  37. 2
      main/forum/forumqualify.php
  38. 2
      main/forum/index.php
  39. 1
      main/forum/reply.php
  40. 7
      main/forum/viewforum.php
  41. 1
      main/forum/viewpost.php
  42. 2
      main/glossary/index.php
  43. 115
      main/gradebook/lib/be/category.class.php
  44. 8
      main/gradebook/lib/be/evaluation.class.php
  45. 1
      main/gradebook/lib/be/exerciselink.class.php
  46. 2
      main/gradebook/lib/be/linkfactory.class.php
  47. 9
      main/gradebook/lib/be/result.class.php
  48. 2
      main/gradebook/lib/fe/displaygradebook.php
  49. 13
      main/upload/form.document.php
  50. 11
      main/upload/upload.document.php

@ -163,7 +163,6 @@
*/
public function attendance_delete($attendance_id) {
$attendance = new Attendance();
//$attendance_id = intval($attendance_id);
if (!empty($attendance_id)) {
$affected_rows = $attendance->attendance_delete($attendance_id);
}
@ -179,7 +178,6 @@
*/
public function attendance_restore($attendance_id) {
$attendance = new Attendance();
//$attendance_id = intval($attendance_id);
if (!empty($attendance_id)) {
$affected_rows = $attendance->attendance_restore($attendance_id);
}
@ -488,7 +486,6 @@
}
$max_cols_per_page = 12; //10 dates + 2 name and number
$max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;//10
//var_dump($cols);exit;
$rows = count($data_table);
if ($cols > $max_cols_per_page) {

@ -128,24 +128,21 @@ if (!empty($_GET['unregister']))
Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
}
if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks')
{
if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
if (isset($_GET['do']) && $_GET['do'] == 'delete')
{
Blog :: delete_task($blog_id, (int)$_GET['task_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted'));
}
if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment')
{
if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') {
Blog :: delete_assigned_task($blog_id, Database::escape_string((int)$_GET['task_id']), Database::escape_string((int)$_GET['user_id']));
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted'));
}
}
if (isset($_GET['action']) && $_GET['action'] == 'view_post')
{
if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
$task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
if (isset($_GET['do']) && $_GET['do'] == 'delete_comment')
@ -202,8 +199,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post')
$htmlHeadXtra[] = '<script src="tbl_change.js" type="text/javascript"></script>';
// Set bredcrumb
switch ($current_page)
{
switch ($current_page) {
case 'new_post' :
$nameTools = get_lang('NewPost');
$interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", "name" => Blog :: get_blog_title($blog_id));
@ -240,14 +236,11 @@ switch ($current_page)
}
// feedback messages
if (!empty($return_message))
{
if ($return_message['type'] == 'confirmation')
{
if (!empty($return_message)) {
if ($return_message['type'] == 'confirmation') {
Display::display_confirmation_message($return_message['message']);
}
if ($return_message['type'] == 'error')
{
if ($return_message['type'] == 'error') {
Display::display_error_message($return_message['message']);
}
}
@ -276,12 +269,12 @@ Display::display_introduction_section(TOOL_BLOG);
<td width="10%" style="float;left;" class="blog_left" valign="top">
<?php
$month = (int)$_GET['month'] ? (int)$_GET['month'] : (int) date('m');
$year = (int)$_GET['year'] ? (int)$_GET['year'] : date('Y');
Blog :: display_minimonthcalendar($month, $year, $blog_id);
$month = isset($_GET['month']) ? (int)$_GET['month'] : (int) date('m');
$year = isset($_GET['year']) ? (int)$_GET['year'] : date('Y');
Blog::display_minimonthcalendar($month, $year, $blog_id);
?>
<br />
<br />
<table width="100%">
<tr>
@ -312,11 +305,11 @@ Blog :: display_minimonthcalendar($month, $year, $blog_id);
<td valign="top" class="blog_right">
<?php
if ($error)
if (isset($error)) {
Display :: display_error_message($message);
}
if ($flag == '1')
{
if (isset($flag) && $flag == '1') {
$current_page = "manage_tasks";
Blog :: display_assign_task_form($blog_id);
}
@ -358,21 +351,14 @@ switch ($current_page) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
}
Blog :: display_form_new_post($blog_id);
}
else
{
if (isset ($_GET['filter']) && !empty ($_GET['filter']))
{
} else {
if (isset($_GET['filter']) && !empty($_GET['filter'])) {
Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
}
else
{
} else {
Blog :: display_blog_posts($blog_id);
}
}
}
else
{
} else {
api_not_allowed();
}
break;
@ -382,55 +368,43 @@ switch ($current_page) {
case 'edit_post' :
$task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id))
{
if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) {
// we show the form if
// 1. no post data
// 2. there is post data and the required field is empty
if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title'])))
{
if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) {
// if there is post data there is certainly an error in the form
if ($_POST)
{
if ($_POST) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
}
Blog :: display_form_edit_post($blog_id, Database::escape_string((int)$_GET['post_id']));
}
else
{
if (isset ($_GET['filter']) && !empty ($_GET['filter']))
{
} else {
if (isset ($_GET['filter']) && !empty ($_GET['filter'])) {
Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
}
else
{
} else {
Blog :: display_blog_posts($blog_id);
}
}
}
else
{
} else {
api_not_allowed();
}
break;
case 'manage_members' :
if (api_is_allowed('BLOG_'.$blog_id, 'member_management'))
{
if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) {
Blog :: display_form_user_subscribe($blog_id);
echo '<br /><br />';
Blog :: display_form_user_unsubscribe($blog_id);
}
else
} else {
api_not_allowed();
}
break;
case 'manage_rights' :
Blog :: display_form_user_rights($blog_id);
break;
case 'manage_tasks' :
if (api_is_allowed('BLOG_'.$blog_id, 'task_management'))
{
if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) {
if (isset($_GET['do']) && $_GET['do'] == 'add')
{
Blog :: display_new_task_form($blog_id);
@ -468,12 +442,9 @@ switch ($current_page) {
break;
case '' :
default :
if (isset ($_GET['filter']) && !empty ($_GET['filter']))
{
if (isset ($_GET['filter']) && !empty ($_GET['filter'])) {
Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
}
else
{
} else {
Blog :: display_blog_posts($blog_id);
}
}

@ -49,8 +49,8 @@ if (api_is_allowed_to_edit()) {
'name' => $current_section
);
Display::display_header('');
} else {
}
} else {
}
echo '<div class="actions">';
echo "<a href='".api_get_self()."?".api_get_cidreq()."&action=add'>",Display::return_icon('new_blog.png',get_lang('AddBlog'),'',ICON_SIZE_MEDIUM)."</a>";
echo '</div>';
@ -83,7 +83,7 @@ if (api_is_allowed_to_edit()) {
Display::display_confirmation_message(get_lang('BlogDeleted'));
}
/*
/*
DISPLAY
*/
//api_display_tool_title($nameTools);

@ -795,9 +795,6 @@ function selectAll(cbList,bSelect,showwarning) {
}
document.new_calendar_item.submit();
}
}
function reverseAll(cbList)
@ -847,15 +844,12 @@ function plus_ical() {
*/
function user_group_filter_javascript()
{
return "<script language=\"JavaScript\" type=\"text/JavaScript\">
<!--
return "<script>
function MM_jumpMenu(targ,selObj,restore){
eval(targ+\".location='\"+selObj.options[selObj.selectedIndex].value+\"'\");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
";
</script>";
}
/**
@ -911,7 +905,6 @@ function get_course_users()
*/
function get_course_groups()
{
$group_list = array();
$group_list = CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id());
return $group_list;
}
@ -1405,7 +1398,11 @@ function show_user_group_filter_form()
$option = "<optgroup label=\"".get_lang("Groups")."\">";
foreach ($group_list as $this_group) {
// echo "<option value=\"agenda.php?isStudentView=true&amp;group=".$this_group['id']."\">".$this_group['name']."</option>";
$has_access = GroupManager::user_has_access(api_get_user_id(), $this_group['id'], GroupManager::GROUP_TOOL_CALENDAR);
$has_access = GroupManager::user_has_access(
api_get_user_id(),
$this_group['id'],
GroupManager::GROUP_TOOL_CALENDAR
);
$result = GroupManager::get_group_properties($this_group['id']);
if ($result['calendar_state'] != '0') {

@ -158,17 +158,13 @@ function get_agenda_items_by_course_list($course_list, $month, $year, $session_i
ORDER BY start_date ";
$result = Database::query($sqlquery);
while ($item = Database::fetch_array($result,'ASSOC')) {
//var_dump($item);
//taking the day
$agendaday = date("j",strtotime($item['start_date']));
if(!isset($items[$agendaday])){$items[$agendaday]=array();}
//taking the time
$time = date("H:i",strtotime($item['start_date']));
//var_dump($time );
$end_time= date("H:i",strtotime($item['end_date']));
$URL = api_get_path(WEB_PATH)."main/calendar/allagendas.php?cidReq=".urlencode($code)."&amp;sort=asc&amp;view=list&amp;day=$agendaday&amp;month=$month&amp;year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item
//var_dump($URL);
if ($setting_agenda_link == 'coursecode') {
//$title=$array_course_info['title'];
$agenda_link = api_substr($title, 0, 14);
@ -260,14 +256,8 @@ if(!empty($my_session_id)) {
$_SESSION['my_course_list'] = array();
$my_course_list = array();
} else {
//echo 'here';
$my_course_list = $_SESSION['my_course_list'];
//var_dump($_SESSION['my_course_list'], $my_course_list);
$my_course_list = $_SESSION['my_course_list'];
$my_course_list_keys = array_keys($my_course_list);
//var_dump($my_course_list, $my_course_list_keys);
if (!in_array($my_course_id, $my_course_list_keys)) {
$course_info = api_get_course_info_by_id($my_course_id);
$_SESSION['my_course_list'][$my_course_id] = $course_info;

@ -74,14 +74,12 @@ if (!empty($event)) {
$vevent->setClass('PRIVATE');
break;
}
$event['start_date'] = api_get_local_time($event['start_date']);
$event['end_date'] = api_get_local_time($event['end_date']);
switch($type) {
case 'personal':
case 'personal':
case 'platform':
$vevent->setProperty( 'summary', api_convert_encoding($event['title'],'UTF-8', $charset));
if(empty($event['start_date'])){header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));}
@ -105,7 +103,7 @@ if (!empty($event)) {
$ical->setComponent ($vevent); // add event to calendar
$ical->returnCalendar();
break;
case 'course':
case 'course':
$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']);

@ -869,27 +869,15 @@ function show_simple_personal_agenda($user_id) {
$style = "datanow";
$text_style = "text";
}
/*--------------------------------------------------
display: date and time
--------------------------------------------------*/
// adding an internal anchor
$content.= date("d", strtotime($myrow["date"]))." ".$MonthsLong[date("n", strtotime($myrow["date"])) - 1]." ".date("Y", strtotime($myrow["date"]))."&nbsp;";
$content.= strftime(get_lang("timeNoSecFormat"), strtotime($myrow["date"]));
/*--------------------------------------------------
display: the title
--------------------------------------------------*/
$content.= '<br />';
$content.= $myrow['title'];
$content.= '<br />';
/*--------------------------------------------------
display: the content
--------------------------------------------------*/
/*
$content = $myrow['title'];
$content = make_clickable($content);
*/
return $content;
}
} else {
@ -941,8 +929,7 @@ function get_personal_agenda_items_between_dates($user_id, $date_start='', $date
// get agenda-items for every course
$courses = api_get_user_courses($user_id,false);
require_once(api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
foreach ($courses as $id => $course)
{
foreach ($courses as $id => $course) {
$c = api_get_course_info($course['code']);
//databases of the courses
$t_a = Database :: get_course_table(TABLE_AGENDA, $course['db']);

@ -33,7 +33,7 @@ if (!empty($course)) {
list($pseudo_user) = Database::fetch_row($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$isMaster = (bool)api_is_course_admin();
$date_now = date('Y-m-d');
$basepath_chat = '';

@ -30,7 +30,7 @@ $result = Database::query($query);
list($pseudo_user) = Database::fetch_row($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$isMaster = (bool)api_is_course_admin();
$date_now = date('Y-m-d');

@ -79,7 +79,7 @@ if (!empty($course) && !empty($_user['user_id'])) {
list($pseudo_user) = Database::fetch_row($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$isMaster = (bool)api_is_course_admin();
$user_id = Database::result($result, 0, 'user_id');
$firstname = Database::result($result, 0, 'firstname');

@ -43,8 +43,8 @@ if (!empty($course)) {
list($pseudo_user) = Database::fetch_array($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = api_is_course_admin();
$date_inter = date('Y-m-d H:i:s', time() - 120);

@ -9,6 +9,7 @@
// protect a course script
api_protect_course_script(true);
// display categories
$categories = array ();
foreach ($default_description_titles as $id => $title) {

@ -113,7 +113,7 @@ elseif ($restore) { // visibility 0,2 -> 1
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 = $_configuration['root_sys'].'/'.$currentCourseID.'/images/';
$racine = api_get_path(SYS_PATH).'/'.$currentCourseID.'/images/';
$chemin = $racine;
$name = $tool[1];
$image = $tool[3];
@ -165,7 +165,7 @@ elseif (isset($update) && $update) {
// Work with data post askable by admin of course
if ($is_platformAdmin && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
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
if ($askDelete) {
@ -219,7 +219,7 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
/* TOOLS FOR PLATFORM ADMIN ONLY */
if ($is_platformAdmin && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
$content .= "<tr>"."<td colspan=\"6\">".
"<hr noshade size=\"1\" />".
"</td>"."</tr>\n".

@ -23,7 +23,6 @@ $current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
$_course = api_get_course_info();
$current_course_code = $_course['official_code'];
$current_course_name = $_course['name'];

@ -48,11 +48,11 @@ if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) {
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: public');
header('Pragma: no-cache');
header('Content-Type: '.$content_type);
header('Content-Length: '.filesize($archive_path.$archive_file));
header('Content-Disposition: attachment; filename='.$archive_file);
readfile($archive_path.$archive_file);
exit;
} else {
api_not_allowed(true);
}

@ -92,7 +92,7 @@ while ($a_titulars = Database::fetch_array($q_result_titulars)) {
$s_selected_tutor = api_get_person_name($s_firstname, $s_lastname);
}
$s_disabled_select_titular = '';
if (!$is_courseAdmin) {
if (!api_is_course_admin()) {
$s_disabled_select_titular = 'disabled=disabled';
}
$a_profs[api_get_person_name($s_firstname, $s_lastname)] = api_get_person_name($s_lastname, $s_firstname).' ('.$s_username.')';
@ -103,7 +103,7 @@ $categories = getCategoriesCanBeAddedInCourse($_course['categoryCode']);
$linebreak = '<div class="row"><div class="label"></div><div class="formw" style="border-bottom:1px dashed grey"></div></div>';
// Build the form
$form = new FormValidator('update_course');
$form = new FormValidator('update_course', 'post', api_get_self().'?'.api_get_cidreq());
// COURSE SETTINGS
$form->addElement('html', '<div><h3>'.Display::return_icon('settings.png', Security::remove_XSS(get_lang('CourseSettings')),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('CourseSettings')).'</h3><div>');
@ -305,13 +305,6 @@ if (api_get_setting('allow_course_theme') == 'true') {
$group[]=$form->createElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
$form->addGroup($group, '', array(get_lang("AllowLearningPathTheme")), '');
}
/*
$group = array(
$form->createElement('radio', 'lp_return_link', get_lang('LpReturnLink'), get_lang('RedirectToTheLearningPathList'), 1),
$form->createElement('radio', 'lp_return_link', null, get_lang('RedirectToCourseHome'), 0)
);
$form->addGroup($group, '', array(get_lang("LpReturnLink")), '');
*/
if (is_settings_editable()) {
$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
@ -374,9 +367,7 @@ $all_course_information = CourseManager::get_course_information($_course['sysCod
$values = array();
$values['title'] = $_course['name'];
//$values['visual_code'] = $_course['official_code'];
$values['category_code'] = $_course['categoryCode'];
//$values['tutor_name'] = $_course['titular'];
$values['course_language'] = $_course['language'];
$values['department_name'] = $_course['extLink']['name'];
$values['department_url'] = $_course['extLink']['url'];

@ -322,7 +322,7 @@ switch ($action) {
}
case 'thematic_plan_list':
$thematic_controller->thematic_plan($action);
break;
break;
case 'thematic_advance_add':
case 'thematic_advance_edit':
case 'thematic_advance_delete':
@ -331,5 +331,5 @@ switch ($action) {
}
case 'thematic_advance_list':
$thematic_controller->thematic_advance($action);
break;
break;
}

@ -53,8 +53,8 @@ if ($action == 'thematic_list') {
$table->display();
} elseif ($action == 'thematic_details') {
if ($last_id) {
if (isset($last_id) && $last_id) {
$link_to_thematic_plan = '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$last_id.'">'.Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style'=>'vertical-align:middle;float:none;'),ICON_SIZE_SMALL).'</a>';
$link_to_thematic_advance = '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$last_id.'">'.Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style'=>'vertical-align:middle;float:none;'),ICON_SIZE_SMALL).'</a>';
Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull').'<br />'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'),$link_to_thematic_plan, $link_to_thematic_advance), false);

@ -17,12 +17,14 @@
* the requested action
* @package chamilo.course_progress
*/
class ThematicController {
class ThematicController
{
/**
* Constructor
*/
public function __construct() {
public function __construct()
{
$this->toolname = 'course_progress';
$this->view = new View($this->toolname);
}
@ -30,9 +32,10 @@ class ThematicController {
/**
* This method is used for thematic control (update, insert or listing)
* @param string Action
* render to thematic.php
* render to thematic.php
*/
public function thematic($action) {
public function thematic($action)
{
$thematic = new Thematic();
$data = array();
$error = false;
@ -180,7 +183,7 @@ class ThematicController {
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
$advance_html = null;
if (!empty($data)) {
foreach ($data as $advance) {
foreach ($data as $advance) {
$advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG) . ' ('.$advance['duration'].' '.get_lang('HourShort').')<br />'.$advance['content'].'<br />';
}
}
@ -192,7 +195,7 @@ class ThematicController {
'add_signatures' => true,
'format' => 'A4-L',
'orientation' => 'L'
);
);
Export::export_table_pdf($table, $params);
break;
case 'moveup':
@ -237,10 +240,7 @@ class ThematicController {
$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
$data['thematic_plan_div'] = $thematic->get_thematic_plan_div($thematic_plan_data);
$data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data);
$data['thematic_plan_data'] = $thematic_plan_data;
$data['thematic_advance_data'] = $thematic_advance_data;
$data['thematic_data'] = $thematic_data;
@ -261,9 +261,10 @@ class ThematicController {
/**
* This method is used for thematic plan control (update, insert or listing)
* @param string Action
* render to thematic_plan.php
* render to thematic_plan.php
*/
public function thematic_plan($action) {
public function thematic_plan($action)
{
$thematic = new Thematic();
$data = array();
@ -310,11 +311,12 @@ class ThematicController {
}
}
$thematic_id = intval($_GET['thematic_id']);
if ($action == 'thematic_plan_list') {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
}
$thematic_id = intval($_GET['thematic_id']);
$description_type = intval($_GET['description_type']);
if (!empty($thematic_id) && !empty($description_type)) {
@ -353,10 +355,10 @@ class ThematicController {
/**
* This method is used for thematic advance control (update, insert or listing)
* @param string Action
* render to thematic_advance.php
* render to thematic_advance.php
*/
public function thematic_advance($action) {
public function thematic_advance($action)
{
$thematic = new Thematic();
$attendance = new Attendance();
$data = array();

@ -47,8 +47,8 @@ class Announcement extends Resource
* @param string $date
* @param int display_order
*/
function Announcement($id, $title, $content, $date, $display_order, $email_sent, $path, $filename, $size, $comment)
{
function Announcement($id, $title, $content, $date, $display_order, $email_sent, $path, $filename, $size, $comment)
{
parent::Resource($id,RESOURCE_ANNOUNCEMENT);
$this->content = $content;

@ -82,7 +82,7 @@ class CourseBuilder
$this->course->path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/';
$this->course->backup_path = api_get_path(SYS_COURSE_PATH).$_course['path'];
$this->course->encoding = api_get_system_encoding(); //current platform encoding
// db_name is deprecated (only one database now)
$this->course->db_name = $_course['dbName'];
$this->course->info = $_course;
}
@ -783,7 +783,8 @@ class CourseBuilder
/**
* Build the announcements
*/
public function build_announcements($session_id = 0, $course_code = '', $with_base_content = false, $id_list = array()) {
public function build_announcements($session_id = 0, $course_code = '', $with_base_content = false, $id_list = array())
{
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$course_id = api_get_course_int_id();
@ -1128,8 +1129,7 @@ class CourseBuilder
//$thematic_plan_complete_list[$item['ref']] = $item;
}
}
//$sql = 'SELECT * FROM '.$table_thematic_plan.' WHERE c_id = '.$course_id.' AND thematic_id = '.$row['id'];
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)

@ -279,6 +279,7 @@ class CourseRestorer
$course_info = api_get_course_info($destination_course_code);
if ($this->course->has_resources(RESOURCE_DOCUMENT)) {
$table = Database :: get_course_table(TABLE_DOCUMENT);
$resources = $this->course->resources;
$path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/';
@ -549,7 +550,9 @@ class CourseRestorer
$x = $x + 1;
$new_base_foldername = $document_path[1].'_'.$x;
$new_base_path = $orig_base_path.'_'.$x;
if ($_SESSION['new_base_foldername'] == $new_base_foldername) break;
if ($_SESSION['new_base_foldername'] == $new_base_foldername) {
break;
}
$folder_exists = file_exists($new_base_path);
}
$_SESSION['new_base_foldername'] = $new_base_foldername;
@ -586,7 +589,9 @@ class CourseRestorer
$file_info = pathinfo($dest_document_path);
if (in_array($file_info['extension'], array('html','htm'))) {
$content = file_get_contents($dest_document_path);
if (UTF8_CONVERT) $content = utf8_encode($content);
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$content,
$this->course->code,
@ -594,7 +599,7 @@ class CourseRestorer
$this->course->backup_path,
$this->course->info['path']
);
file_put_contents($dest_document_path,$content);
file_put_contents($dest_document_path, $content);
}
}
@ -634,7 +639,9 @@ class CourseRestorer
$file_info = pathinfo($path.$new_file_name);
if (in_array($file_info['extension'], array('html','htm'))) {
$content = file_get_contents($path.$new_file_name);
if (UTF8_CONVERT) $content = utf8_encode($content);
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$content,
$this->course->code,
@ -680,7 +687,9 @@ class CourseRestorer
$file_info = pathinfo($path.$new_file_name);
if (in_array($file_info['extension'], array('html','htm'))) {
$content = file_get_contents($path.$new_file_name);
if (UTF8_CONVERT) $content = utf8_encode($content);
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$content,
$this->course->code,
@ -735,7 +744,9 @@ class CourseRestorer
$file_info = pathinfo($path.$document->path);
if (in_array($file_info['extension'], array('html','htm'))) {
$content = file_get_contents($path.$document->path);
if (UTF8_CONVERT) $content = utf8_encode($content);
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$content,
$this->course->code,
@ -874,7 +885,13 @@ class CourseRestorer
$params['forum_category'] = $cat_id;
unset($params['forum_id']);
$params['forum_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course($params['forum_comment'], $this->course->code, $this->course->destination_path, $this->course->backup_path, $this->course->info['path']);
$params['forum_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$params['forum_comment'],
$this->course->code,
$this->course->destination_path,
$this->course->backup_path,
$this->course->info['path']
);
if (!empty($params['forum_image'])) {
$original_forum_image = $this->course->path.'upload/forum/images/'.$params['forum_image'];
@ -1301,7 +1318,7 @@ class CourseRestorer
'c_id' => $this->destination_course_id,
'title' => self::DBUTF8($quiz->title),
'description' => self::DBUTF8($quiz->description),
'type' => $quiz->quiz_type,
'type' => isset($quiz->quiz_type) ? $quiz->quiz_type : $quiz->type,
'random' => $quiz->random,
'active' => $quiz->active,
'sound' => self::DBUTF8($doc),
@ -2320,8 +2337,14 @@ class CourseRestorer
$condition_session
";
Database::query($sql);
$my_id = Database::get_last_insert_id();
api_item_property_update($this->destination_course_info, TOOL_GLOSSARY, $my_id,"GlossaryAdded", api_get_user_id());
$my_id = Database::insert_id();
api_item_property_update(
$this->destination_course_info,
TOOL_GLOSSARY,
$my_id,
"GlossaryAdded",
api_get_user_id()
);
$this->course->resources[RESOURCE_GLOSSARY][$id]->destination_id = Database::insert_id();
}

@ -556,7 +556,7 @@ class CourseSelectForm
* @param array $hidden_fiels Hidden fields to add to the form.
* @param boolean the document array will be serialize. This is used in the course_copy.php file
*/
function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize=false)
function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false)
{
?>
<script>

@ -18,39 +18,39 @@ class Event extends Resource
/**
* The title
*/
var $title;
public $title;
/**
* The content
*/
var $content;
public $content;
/**
* The start date
*/
var $start_date;
public $start_date;
/**
* The end date
*/
var $end_date;
public $end_date;
/**
* The attachment path
*/
var $attachment_path;
public $attachment_path;
/**
* The attachment filename
*/
var $attachment_filename;
public $attachment_filename;
/**
* The attachment size
*/
var $attachment_size;
public $attachment_size;
/**
* The attachment comment
*/
var $attachment_comment;
public $attachment_comment;
/**
* Create a new Event
* @param int $id

@ -189,7 +189,6 @@ if ($form->validate()) {
$course_values = $form->exportValues();
$wanted_code = $course_values['wanted_code'];
//$tutor_name = $course_values['tutor_name'];
$category_code = $course_values['category_code'];
$title = $course_values['title'];
$course_language = $course_values['course_language'];

@ -51,16 +51,16 @@ if (isset($_GET['path'])) {
}
// distpacher actions to controller
switch ($action) {
case 'listing':
switch ($action) {
case 'listing':
$dashboard_controller->display();
break;
case 'store_user_block':
case 'store_user_block':
$dashboard_controller->store_user_block();
break;
case 'disable_block':
break;
case 'disable_block':
$dashboard_controller->close_user_block($path);
break;
default :
break;
default :
$dashboard_controller->display();
}

@ -80,7 +80,6 @@ function handle_multiple_actions()
}
// STEP 3C: moving
if (strstr($_POST['action'], 'move_')) {
// check move_received_n or move_sent_n command
if (strstr($_POST['action'], 'received')) {

@ -128,6 +128,7 @@ require_once '../inc/global.inc.php';
$is_allowed_in_course = api_is_allowed_in_course();
$is_courseTutor = api_is_course_tutor();
$is_courseAdmin = api_is_course_admin();
$current_course_tool = TOOL_DROPBOX;
// the dropbox configuration parameters

@ -567,7 +567,6 @@ if ($action != 'add') {
if ($category['sent'] == '1') {
$moveList[$category['cat_id']] = $category['cat_name'];
$dropbox_category_data[] = $category['cat_id']; // This is where the checkbox icon for the files appear.
$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&amp;view_sent_category='.$category['cat_id'].'&amp;view='.$view.'">';
$dropbox_category_data[] = $link_open.build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>';

@ -44,9 +44,6 @@
* @author Olivier Brouckaert
* Modified by Hubert Borderiou 21-10-2011 Question by category
*/
/**
* Code
*/
use \ChamiloSession as Session;
@ -91,7 +88,6 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') {
if (empty($exerciseId)) {
$exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']):'0';
}
if (empty($newQuestion)) {
$newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0;
}
@ -121,7 +117,8 @@ $cancelAnswers = isset($cancelAnswers) ? $cancelAnswers : null;
$modifyIn = isset($modifyIn) ? $modifyIn : null;
$cancelQuestion = isset($cancelQuestion) ? $cancelQuestion : null;
// Cleaning all incomplete attempts of the admin/teacher to avoid weird problems when changing the exercise settings, number of questions, etc
/* Cleaning all incomplete attempts of the admin/teacher to avoid weird problems
when changing the exercise settings, number of questions, etc */
delete_all_incomplete_attempts(api_get_user_id(), $exerciseId, api_get_course_id(), api_get_session_id());
@ -140,31 +137,39 @@ $picturePath = $documentPath.'/images';
$audioPath = $documentPath.'/audio';
// the 5 types of answers
$aType = array(get_lang('UniqueSelect'),get_lang('MultipleSelect'),get_lang('FillBlanks'),get_lang('Matching'),get_lang('FreeAnswer'));
$aType = array(
get_lang('UniqueSelect'),
get_lang('MultipleSelect'),
get_lang('FillBlanks'),
get_lang('Matching'),
get_lang('FreeAnswer')
);
// tables used in the exercise tool
if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
require_once 'export/qti2/qti2_export.php';
$export = export_question($_GET['questionId'],true);
$qid = (int)$_GET['questionId'];
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$temp_dir_short = uniqid();
$temp_zip_dir = $archive_path."/".$temp_dir_short;
if(!is_dir($temp_zip_dir)) mkdir($temp_zip_dir, api_get_permissions_for_new_directories());
$temp_zip_file = $temp_zip_dir."/".api_get_unique_id().".zip";
$temp_xml_file = $temp_zip_dir."/qti2export_".$qid.'.xml';
file_put_contents($temp_xml_file,$export);
$zip_folder=new PclZip($temp_zip_file);
$zip_folder->add($temp_xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
$name = 'qti2_export_'.$qid.'.zip';
DocumentManager::file_send_for_download($temp_zip_file,true,$name);
unlink($temp_zip_file);
unlink($temp_xml_file);
rmdir($temp_zip_dir);
//DocumentManager::string_send_for_download($export,true,'qti2export_q'.$_GET['questionId'].'.xml');
exit; //otherwise following clicks may become buggy
require_once 'export/qti2/qti2_export.php';
$export = export_question($_GET['questionId'], true);
$qid = (int)$_GET['questionId'];
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$temp_dir_short = uniqid();
$temp_zip_dir = $archive_path."/".$temp_dir_short;
if (!is_dir($temp_zip_dir)) {
mkdir($temp_zip_dir, api_get_permissions_for_new_directories());
}
$temp_zip_file = $temp_zip_dir."/".api_get_unique_id().".zip";
$temp_xml_file = $temp_zip_dir."/qti2export_".$qid.'.xml';
file_put_contents($temp_xml_file, $export);
$zip_folder = new PclZip($temp_zip_file);
$zip_folder->add($temp_xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
$name = 'qti2_export_'.$qid.'.zip';
DocumentManager::file_send_for_download($temp_zip_file, true, $name);
unlink($temp_zip_file);
unlink($temp_xml_file);
rmdir($temp_zip_dir);
//DocumentManager::string_send_for_download($export,true,'qti2export_q'.$_GET['questionId'].'.xml');
exit; //otherwise following clicks may become buggy
}
// Exercise object creation.

@ -288,13 +288,10 @@ function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile)
$answers_array = array();
$new_question = true;
} else {
if (empty($exercise_info['question'][$question_index]['title']))
{
if (strlen($info) < 40)
{
if (empty($exercise_info['question'][$question_index]['title'])) {
if (strlen($info) < 40) {
$exercise_info['question'][$question_index]['title'] = $info;
} else
{
} else {
//Question itself (use a 40-chars long title and a larger description)
$exercise_info['question'][$question_index]['title'] = trim(substr($info,0,40)).'...';
$exercise_info['question'][$question_index]['description'] = $info;

@ -9,11 +9,6 @@
* @author claro team <cvs@claroline.net>
* @author Guillaume Lederer <guillaume@claroline.net>
*/
/**
* Security check
*/
if (count(get_included_files()) == 1)
die('---');
/**
* function to create a temporary directory (SAME AS IN MODULE ADMIN)

@ -13,7 +13,9 @@ require '../../inc/global.inc.php';
//SECURITY CHECK
if ( api_is_platform_admin() ) api_not_allowed();
if (api_is_platform_admin()) {
api_not_allowed();
}
//DECLARE NEEDED LIBRARIES
@ -27,8 +29,8 @@ include_once 'qti/qti_classes.php';
//SQL table name
$tbl_exercise = Database::get_course_table(TABLE_QUIZ_TEST);
$tbl_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
$tbl_exercise = Database::get_course_table(TABLE_QUIZ_TEST);
$tbl_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
$tbl_rel_exercise_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
// tool libraries
@ -41,7 +43,7 @@ $nameTools = get_lang('ImportExercise');
//bredcrump
$interbredcrump[]= array ('url' => '../exercice.php','name' => get_lang('Exercises'));
$interbredcrump[] = array('url' => '../exercice.php', 'name' => get_lang('Exercises'));
//----------------------------------
// EXECUTE COMMAND
@ -49,8 +51,7 @@ $interbredcrump[]= array ('url' => '../exercice.php','name' => get_lang('Exercis
$cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import');
switch ( $cmd )
{
switch ($cmd) {
case 'show_import' :
{
$display = '<p>'
@ -68,23 +69,20 @@ switch ( $cmd )
}
break;
case 'import' :
{
case 'import': {
//include needed librabries for treatment
$result_log = import_exercise($_FILES['uploadedExercise']['name']);
//display the result message (fail or success)
$dialogBox = '';
foreach ($result_log as $log)
{
$dialogBox .= $log . '<br>';
foreach ($result_log as $log) {
$dialogBox .= $log.'<br>';
}
}
break;
break;
}
//----------------------------------
@ -114,11 +112,15 @@ Display::display_introduction_section(TOOL_QUIZ, array(
//Display Forms or dialog box(if needed)
if ( isset($dialogBox) ) echo Display::display_normal_message($dialogBox,false);
if (isset($dialogBox)) {
echo Display::display_normal_message($dialogBox, false);
}
//display content
if (isset($display) ) echo $display;
if (isset($display)) {
echo $display;
}
//footer display

@ -205,7 +205,6 @@ class ImsSection
*/
function export_ordering()
{
$out = '';
if ($n = $this->exercise->getShuffle()) {
$out.= "<selection_ordering>"

@ -35,8 +35,7 @@ class ScormAssessmentItem
{
$this->question = $question;
//$this->answer = new Answer($question->id);
$this->question->setAnswer();
$this->question->setAnswer();
$this->questionIdent = "QST_" . $question->id ;
$this->standalone = $standalone;
//echo "<pre>".print_r($this,1)."</pre>";
@ -85,14 +84,12 @@ class ScormAssessmentItem
if ($this->standalone) {
$css = '<style type="text/css" media="screen, projection">'."\n";
$css .= '/*<![CDATA[*/'."\n";
//$css .= '@import "'.api_get_path(WEB_PATH).'main/css/public_admin/default.css";'."\n";
$css .= '/*]]>*/'."\n";
$css .= '</style>'."\n";
$css .= '<style type="text/css" media="print">'."\n";
$css .= '/*<![CDATA[*/'."\n";
//$css .= '@import "'.api_get_path(WEB_PATH).'main/css/public_admin/print.css";'."\n";
$css .= '/*]]>*/'."\n";
$css .= '</style>'."\n";
$css .= '</style>'."\n";
}
return $css;
}

@ -21,9 +21,6 @@
* @todo complete the missing phpdoc the correct order should be
*/
/**
* code
*/
use \ChamiloSession as Session;
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
@ -376,6 +373,7 @@ function delete_forum_image($forum_id)
$row = Database::fetch_array($result);
if ($row['forum_image'] != '') {
$del_file = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/forum/images/'.$row['forum_image'];
return @unlink($del_file);
} else {
return false;
@ -406,7 +404,13 @@ function show_edit_forumcategory_form($inputvalues = array())
$form->addElement('text', 'forum_category_title', get_lang('Title'), 'class="input_titles"');
//$form->applyFilter('forum_category_title', 'html_filter');
$form->addElement('html_editor', 'forum_category_comment', get_lang('Comment'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
$form->addElement(
'html_editor',
'forum_category_comment',
get_lang('Comment'),
null,
array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200')
);
//$form->applyFilter('forum_category_comment', 'html_filter');
$form->addElement('style_submit_button', 'SubmitEditForumCategory', get_lang('ModifyCategory'), 'class="save"');
@ -594,7 +598,15 @@ function store_forum($values)
WHERE c_id = $course_id AND forum_id='".Database::escape_string($values['forum_id'])."'";
Database::query($sql);
api_item_property_update($_course, TOOL_FORUM, Database::escape_string($values['forum_id']), 'ForumUpdated', api_get_user_id(), $group_id);
api_item_property_update(
$_course,
TOOL_FORUM,
Database::escape_string($values['forum_id']),
'ForumUpdated',
api_get_user_id(),
$group_id
);
$return_message = get_lang('ForumEdited');
} else {
@ -603,7 +615,7 @@ function store_forum($values)
$new_file_name = isset($new_file_name) ? $new_file_name : '';
$sql_image = "'".$new_file_name."', ";
}
$b = $values['forum_comment'];
$b = isset($values['forum_comment']) ? $values['forum_comment'] : null;
$sql = "INSERT INTO ".$table_forums." (c_id, forum_title, forum_image, forum_comment, forum_category, allow_anonymous, allow_edit, approval_direct_post, allow_attachments, allow_new_threads, default_view, forum_of_group, forum_group_public_private, forum_order, session_id)
VALUES (
@ -630,6 +642,7 @@ function store_forum($values)
}
$return_message = get_lang('ForumAdded');
}
return $return_message;
}
@ -781,6 +794,7 @@ function check_if_last_post_of_thread($thread_id)
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result);
return $row;
} else {
return false;
@ -839,6 +853,7 @@ function display_lock_unlock_icon($content, $id, $current_lock_status, $addition
if ($content == 'thread') {
if (api_resource_is_locked_by_gradebook($id, LINK_FORUM_THREAD)) {
echo Display::return_icon('lock_na.png', get_lang('ResourceLockedByGradebook'), array(), ICON_SIZE_SMALL);
return;
}
}
@ -868,7 +883,7 @@ function display_lock_unlock_icon($content, $id, $current_lock_status, $addition
* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
* @param $id is the id of the item we want to display the icons for
* @param $list is an array of all the items. All items in this list should have an up and down icon except for the first (no up icon) and the last (no down icon)
* The key of this $list array is the id of the item.
* The key of this $list array is the id of the item.
*
* @return void HTML
*
@ -1089,6 +1104,7 @@ function move_up_down($content, $direction, $id)
Database::query($sql_update1);
Database::query($sql_update2);
}
return get_lang(ucfirst($content).'Moved');
}
@ -1171,6 +1187,7 @@ function get_forum_categories($id = '')
$forum_categories_list = $row;
}
}
return $forum_categories_list;
}
@ -1215,6 +1232,7 @@ function get_forums_in_category($cat_id)
while ($row = Database::fetch_array($result)) {
$forum_list[$row['forum_id']] = $row;
}
return $forum_list;
}
@ -1242,10 +1260,12 @@ function get_forums($id = '', $course_code = '', $includeGroupsForum = true)
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
// GETTING ALL THE FORUMS
// Condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, true, true);
$course_id = $course_info['real_id'];
$forum_list = array();
$includeGroupsForumSelect = "";
if (!$includeGroupsForum) {
@ -1407,7 +1427,7 @@ function get_forums($id = '', $course_code = '', $includeGroupsForum = true)
$forum_list['number_of_posts'] = $row3['number_of_posts'];
}
}
/* Finding the last post information
(last_post_id, last_poster_id, last_post_date, last_poster_name, last_poster_lastname, last_poster_firstname)*/
if ($id == '') {
@ -1433,6 +1453,7 @@ function get_forums($id = '', $course_code = '', $includeGroupsForum = true)
$forum_list['last_poster_lastname'] = $last_post_info_of_forum['last_poster_lastname'];
$forum_list['last_poster_firstname'] = $last_post_info_of_forum['last_poster_firstname'];
}
return $forum_list;
}
@ -1516,6 +1537,7 @@ function get_last_post_information($forum_id, $show_invisibles = false, $course_
$return_array['last_poster_name'] = $row['poster_name'];
$return_array['last_poster_lastname'] = $row['lastname'];
$return_array['last_poster_firstname'] = $row['firstname'];
return $return_array;
} else {
// We have to loop through the results to find the first one that is actually visible to students (forum_category, forum, thread AND post are visible).
@ -1527,6 +1549,7 @@ function get_last_post_information($forum_id, $show_invisibles = false, $course_
$return_array['last_poster_name'] = $row['poster_name'];
$return_array['last_poster_lastname'] = $row['lastname'];
$return_array['last_poster_firstname'] = $row['firstname'];
return $return_array;
}
}
@ -1611,6 +1634,7 @@ function get_threads($forum_id, $course_code = null)
while ($row = Database::fetch_array($result, 'ASSOC')) {
$thread_list[] = $row;
}
return $thread_list;
}
@ -1626,7 +1650,6 @@ function get_posts($thread_id)
{
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
//$tableItemProperty = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id();
$sessionId = api_get_session_id();
@ -1661,6 +1684,7 @@ function get_posts($thread_id)
while ($row = Database::fetch_array($result)) {
$post_list[] = $row;
}
return $post_list;
}
@ -1686,6 +1710,7 @@ function get_post_information($post_id)
posts.post_id='".Database::escape_string($post_id)."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
return $row;
}
@ -1714,6 +1739,7 @@ function get_thread_information($thread_id)
";
$result = Database::query($sql);
$row = Database::fetch_array($result);
return $row;
}
@ -1771,6 +1797,7 @@ function get_thread_users_details($thread_id)
course_code = '".$course_code."' $orderby";
}
$result = Database::query($sql);
return $result;
}
@ -1840,6 +1867,7 @@ function get_thread_users_qualify($thread_id)
$orderby ";
}
$result = Database::query($sql);
return $result;
}
@ -1907,6 +1935,7 @@ function get_thread_users_not_qualify($thread_id)
AND course_code = '".$course_code."' AND post.c_id = $course_id $orderby";
}
$result = Database::query($sql);
return $result;
}
@ -1966,6 +1995,7 @@ function get_forumcategory_information($cat_id)
forumcategories.cat_id='".Database::escape_string($cat_id)."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
return $row;
}
@ -1989,6 +2019,7 @@ function count_number_of_forums_in_category($cat_id)
WHERE c_id = $course_id AND forum_category='".Database::escape_string($cat_id)."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
return $row['number_of_forums'];
}
@ -2007,6 +2038,7 @@ function store_thread($current_forum, $values)
{
$_course = api_get_course_info();
$_user = api_get_user_info();
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
@ -2287,6 +2319,7 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
if (($action == 'quote' || $action == 'replymessage') && isset($my_post)) {
// We also need to put the parent_id of the post in a hidden form when we are quoting or replying to a message (<> reply to a thread !!!)
$form->addElement('hidden', 'post_parent_id', intval($my_post));
// If we are replying or are quoting then we display a default title.
$values = get_post_information($my_post);
$defaults['post_title'] = get_lang('ReplyShort').api_html_entity_decode($values['post_title'], ENT_QUOTES);
@ -2311,9 +2344,11 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
$values = $form->exportValues();
if ($values['thread_qualify_gradebook'] == '1' && empty($values['weight_calification'])) {
Display::display_error_message(get_lang('YouMustAssignWeightOfQualification').'&nbsp;<a href="javascript:window.back()">'.get_lang('Back').'</a>', false);
return false;
}
Security::clear_token();
return $values;
}
} else {
@ -2366,12 +2401,14 @@ function store_theme_qualify($user_id, $thread_id, $thread_qualify = 0, $qualify
$sql = "INSERT INTO $table_threads_qualify (c_id, user_id, thread_id,qualify,qualify_user_id,qualify_time,session_id)
VALUES (".$course_id.", '".$user_id."','".$thread_id."',".(float) $thread_qualify.", '".$qualify_user_id."','".$qualify_time."','".$session_id."')";
$res = Database::query($sql);
return $res;
} else {
$sql1 = "SELECT qualify FROM ".$table_threads_qualify." WHERE c_id = $course_id AND user_id=".$user_id." and thread_id=".$thread_id.";";
$rs = Database::query($sql1);
$row = Database::fetch_array($rs);
$row[1] = "update";
return $row;
}
} else {
@ -2415,6 +2452,7 @@ function show_qualify($option, $user_id, $thread_id)
}
$rs = Database::query($sql);
$row = Database::fetch_array($rs);
return $row[0];
}
@ -2447,6 +2485,7 @@ function get_historical_qualify($user_id, $thread_id, $opt)
while ($row = Database::fetch_array($rs, 'ASSOC')) {
$my_qualify_log[] = $row;
}
return $my_qualify_log;
}
@ -2463,8 +2502,15 @@ function get_historical_qualify($user_id, $thread_id, $opt)
* @author Isaac Flores <isaac.flores@dokeos.com>, U.N.A.S University
* @version October 2008, dokeos 1.8.6
*/
function store_qualify_historical($option, $couser_id, $forum_id, $user_id, $thread_id, $current_qualify, $qualify_user_id)
{
function store_qualify_historical(
$option,
$couser_id,
$forum_id,
$user_id,
$thread_id,
$current_qualify,
$qualify_user_id
) {
$table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
@ -2511,6 +2557,7 @@ function current_qualify_of_thread($thread_id, $session_id)
$res = Database::query("SELECT qualify FROM $table_threads_qualify WHERE c_id = $course_id AND thread_id = $thread_id AND session_id = $session_id");
$row = Database::fetch_array($res, 'ASSOC');
return $row['qualify'];
}
@ -2527,6 +2574,7 @@ function store_reply($current_forum, $values)
$_course = api_get_course_info();
$forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$post_date = api_get_utc_datetime();
if ($current_forum['approval_direct_post'] == '1' && !api_is_allowed_to_edit(null, true)) {
@ -2605,6 +2653,7 @@ function store_reply($current_forum, $values)
}
//$message .= '<br />'.get_lang('ReturnTo').' <a href="viewforum.php?'.api_get_cidreq().'&amp;forum='.$values['forum_id'].'&amp;gidReq='.$_SESSION['toolgroup'].'&amp;origin='.$origin.'">'.get_lang('Forum').'</a><br />';
//$message .= get_lang('ReturnTo').' <a href="viewthread.php?'.api_get_cidreq().'&amp;forum='.$values['forum_id'].'&amp;thread='.$values['thread_id'].'&amp;gidReq='.$_SESSION['toolgroup'].'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'">'.get_lang('Message').'</a>';
// Setting the notification correctly.
$my_post_notification = isset($values['post_notification']) ? $values['post_notification'] : null;
if ($my_post_notification == 1) {
@ -2620,10 +2669,12 @@ function store_reply($current_forum, $values)
Session::erase('addedresourceid');
$return['msg'] = $message;
$return['type'] = 'confirmation';
} else {
$return['msg'] = get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst');
$return['type'] = 'error';
}
return $return;
}
@ -2897,6 +2948,7 @@ function display_user_image($user_id, $name, $origin = '')
if ($user_id != 0) {
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$friends_profile = UserManager::get_picture_user($user_id, $image_path['file'], 0, USER_IMAGE_SIZE_MEDIUM, 'width="96" height="96" ');
return $link.'<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' alt="'.$name.'" title="'.$name.'" /></a>';
} else {
return $link.'<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" title="'.$name.'" /></a>';
@ -2950,6 +3002,7 @@ function forum_not_allowed_here()
{
Display :: display_error_message(get_lang('NotAllowedHere'));
Display :: display_footer();
return false;
}
@ -3024,6 +3077,7 @@ function get_post_topics_of_forum($forum_id)
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id();
if (api_is_allowed_to_edit(null, true)) {
@ -3088,6 +3142,7 @@ function get_post_topics_of_forum($forum_id)
}
$return = array('number_of_topics' => $number_of_topics, 'number_of_posts' => $number_of_posts);
return $return;
}
@ -3144,6 +3199,7 @@ function get_unaproved_messages($forum_id)
while ($row = Database::fetch_array($result)) {
$return_array[] = $row['thread_id'];
}
return $return_array;
}
@ -3248,10 +3304,6 @@ function handle_mail_cue($content, $id)
while ($row = Database::fetch_array($result)) {
send_mail($row, get_thread_information($post_info['thread_id']));
}
// Deleting the relevant entries from the mailcue.
//$sql_delete_mailcue = "DELETE FROM $table_mailcue WHERE c_id = $course_id AND post_id='".Database::escape_string($id)."' AND thread_id='".Database::escape_string($post_info['thread_id'])."'";
//$result = Database::query($sql_delete_mailcue);
} elseif ($content == 'thread') {
// Sending the mail to all the users that wanted to be informed for replies on this thread.
$sql = "SELECT users.firstname, users.lastname, users.user_id, users.email
@ -3319,7 +3371,6 @@ function send_mail($user_info = array(), $thread_information = array())
if ($user_info['user_id'] <> $user_id) {
MessageManager::send_message($user_info['user_id'], $subject, $email_body, null, null, null, null, null, null, $user_id);
//@api_mail_html(api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $user_info['email'], $email_subject, $email_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail']);
}
}
@ -3395,6 +3446,7 @@ function move_post_form()
// Invisible form: the post_id
$form->addElement('hidden', 'post_id', intval($_GET['post']));
// Dropdown list: Threads of this forum
$threads = get_threads($_GET['forum']);
//my_print_r($threads);
@ -3522,6 +3574,7 @@ function store_move_post($values)
$sql = "UPDATE $table_threads SET thread_replies=thread_replies+1 WHERE c_id = $course_id AND thread_id='".intval($_POST['thread'])."'";
Database::query($sql);
}
return get_lang('ThreadMoved');
}
@ -3642,7 +3695,6 @@ function display_forum_search_results($search_term)
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$session_id = api_get_session_id();
$gradebook = Security::remove_XSS($_GET['gradebook']);
$course_id = api_get_course_int_id();
@ -3753,6 +3805,7 @@ function search_link()
$return .= '<a href="'.$url.'">'.Display::return_icon('delete.gif', get_lang('RemoveSearchResults')).'</a>';
}
}
return $return;
}
@ -3875,6 +3928,7 @@ function get_attachment($post_id)
if (Database::num_rows($result) != 0) {
$row = Database::fetch_array($result);
}
return $row;
}
@ -4000,13 +4054,13 @@ function get_forums_of_group($group_id)
$sql3 = "SELECT count(post_id) AS number_of_posts, forum_id
FROM $table_posts
WHERE c_id = $course_id GROUP BY forum_id";
}
// Handling all the forum information.
$result = Database::query($sql);
$forum_list = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
$forum_list[$row['forum_id']] = $row;
}
@ -4085,6 +4139,7 @@ function set_notification($content, $id, $add_only = false)
$result = Database::query($sql);
Session::erase('forum_notification');
get_notifications_of_user(0, true);
return get_lang('YouWillBeNotifiedOfNewPosts');
} else {
if (!$add_only) {
@ -4093,6 +4148,7 @@ function set_notification($content, $id, $add_only = false)
Database::query($sql);
Session::erase('forum_notification');
get_notifications_of_user(0, true);
return get_lang('YouWillNoLongerBeNotifiedOfNewPosts');
}
}
@ -4136,6 +4192,7 @@ function get_notifications($content, $id)
while ($row = Database::fetch_array($result)) {
$return['user'.$row['user_id']] = array('email' => $row['email'], 'user_id' => $row['user_id']);
}
return $return;
}
@ -4154,7 +4211,6 @@ function get_notifications($content, $id)
*/
function send_notifications($forum_id = 0, $thread_id = 0, $post_id = 0)
{
//$_user = api_get_user_info();
$_course = api_get_course_info();
// The content of the mail
@ -4180,22 +4236,19 @@ function send_notifications($forum_id = 0, $thread_id = 0, $post_id = 0)
$users_to_be_notified = array_merge($users_to_be_notified_by_forum, $users_to_be_notified_by_thread);
$sender_id = api_get_user_id();
if (is_array($users_to_be_notified)) {
foreach ($users_to_be_notified as $value) {
//if ($value['email'] != $_user['email']) {
$user_info = api_get_user_info($value['user_id']);
$email_body = get_lang('Dear').' '.api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS).", <br />\n\r";
$email_body .= get_lang('NewForumPost').": ".$current_forum['forum_title'].' - '.$current_thread['thread_title']." <br />\n";
$email_body .= get_lang('Course').': '.$_course['name'].' - ['.$_course['official_code']."] <br />\n";
$email_body .= get_lang('YouWantedToStayInformed')."<br />\n";
$email_body .= get_lang('ThreadCanBeFoundHere').': <br /> <a href="'.$thread_link.'">'.$thread_link."</a>\n";
MessageManager::send_message_simple(
$value['user_id'], $subject, $email_body, $sender_id
);
//}
$user_info = api_get_user_info($value['user_id']);
$email_body = get_lang('Dear').' '.api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS).", <br />\n\r";
$email_body .= get_lang('NewForumPost').": ".$current_forum['forum_title'].' - '.$current_thread['thread_title']." <br />\n";
$email_body .= get_lang('Course').': '.$_course['name'].' - ['.$_course['official_code']."] <br />\n";
$email_body .= get_lang('YouWantedToStayInformed')."<br />\n";
$email_body .= get_lang('ThreadCanBeFoundHere').': <br /> <a href="'.$thread_link.'">'.$thread_link."</a>\n";
MessageManager::send_message_simple(
$value['user_id'], $subject, $email_body, $sender_id
);
}
}
}
@ -4256,6 +4309,7 @@ function count_number_of_post_in_thread($thread_id)
}
$sql = "SELECT * FROM $table_posts WHERE c_id = $course_id AND thread_id='".Database::escape_string($thread_id)."' ";
$result = Database::query($sql);
return count(Database::store_result($result));
}
@ -4279,6 +4333,7 @@ function count_number_of_post_for_user_thread($thread_id, $user_id)
$count = Database::fetch_array($result);
$count = $count['count'];
}
return $count;
}
@ -4295,6 +4350,7 @@ function count_number_of_user_in_course($course_id)
$sql = "SELECT * FROM $table_course_rel_user WHERE course_code ='".Database::escape_string($course_id)."' ";
$result = Database::query($sql);
return count(Database::store_result($result));
}
@ -4367,6 +4423,7 @@ function get_thread_user_post($course_code, $thread_id, $user_id)
$post_list[] = $row2;
}
}
return $post_list;
}
@ -4384,6 +4441,7 @@ function get_name_thread_by_id($thread_id)
$sql = "SELECT thread_title FROM ".$t_forum_thread." WHERE c_id = $course_id AND thread_id = '".intval($thread_id)."' ";
$result = Database::query($sql);
$row = Database::fetch_array($result);
return $row[0];
}
@ -4452,6 +4510,7 @@ function get_all_post_from_user($user_id, $course_code)
}$j++;
}
}
return $forum_results;
}
@ -4484,6 +4543,7 @@ function get_thread_user_post_limit($course_code, $thread_id, $user_id, $limit =
$row['status'] = '1';
$post_list[] = $row;
}
return $post_list;
}
@ -4506,6 +4566,7 @@ function calculate_children($rows)
_phorum_recursive_sort($rows, $sorted_rows);
unset($sorted_rows[0]);
}
return $sorted_rows;
}

@ -27,9 +27,7 @@ if (isset($_GET['origin'])) {
}
$user_id = isset($_GET['user_id']) ? intval($_GET['user_id']) : null;
api_block_course_item_locked_by_gradebook($_GET['thread'], LINK_FORUM_THREAD);
$nameTools = get_lang('ToolForum');
/* Including necessary files */

@ -196,6 +196,7 @@ if (api_is_allowed_to_edit(false, true)) {
Display::return_icon('new_forum.png', get_lang('AddForum'),'',ICON_SIZE_MEDIUM).'</a>';
}
}
echo '</div>';
// Fixes error if there forums with no category.
@ -293,6 +294,7 @@ if (is_array($forumCategories)) {
if (api_is_allowed_to_edit(false, true)) {
$show_forum = true;
} else {
// you are not a teacher
// it is not a group forum => show forum (invisible forums are already left out see get_forums function)
if ($forum['forum_of_group'] == '0') {
$show_forum = true;

@ -92,6 +92,7 @@ if ($current_forum['forum_of_group'] != 0) {
}
/* Breadcrumbs */
$gradebook = null;
if (isset($_SESSION['gradebook'])){
$gradebook = Security::remove_XSS($_SESSION['gradebook']);

@ -70,10 +70,8 @@ $is_group_tutor = false;
if (!empty($groupId)) {
//Group info & group category info
$group_properties = GroupManager::get_group_properties($groupId);
//User has access in the group?
$user_has_access_in_group = GroupManager::user_has_access($userid, $groupId, GroupManager::GROUP_TOOL_FORUM);
$user_has_access_in_group = GroupManager::user_has_access($userid, $groupId, GroupManager::GROUP_TOOL_FORUM);
$is_group_tutor = GroupManager::is_tutor_of_group(api_get_user_id(), $groupId);
//Course
@ -98,6 +96,7 @@ if (!empty($groupId)) {
$my_search = isset($_GET['search']) ? $_GET['search'] : '';
$my_action = isset($_GET['action']) ? $_GET['action'] : '';
$gradebook = null;
if (isset($_SESSION['gradebook'])){
$gradebook = $_SESSION['gradebook'];
@ -277,7 +276,6 @@ if (!empty($message)) {
echo '<div class="actions">';
if ($origin != 'learnpath') {
if ($origin=='group') {
echo '<a href='.api_get_path(WEB_CODE_PATH).'"group/group_space.php?'.api_get_cidreq().'&amp;gradebook='.$gradebook.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('Groups'),'',ICON_SIZE_MEDIUM).'</a>';
} else {
@ -416,7 +414,6 @@ if (is_array($threads)) {
echo '<td>'.$last_post.'</td>';
echo '<td class="td_actions">';
// Get attachment id.
if (isset($row['post_id'])) {
$attachment_list = get_attachment($row['post_id']);

@ -45,6 +45,7 @@ $current_thread = get_thread_information($_GET['thread']); // Note: This has to
$current_forum = get_forum_information($current_thread['forum_id']); // Note: This has to be validated that it is an existing forum.
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$whatsnew_post_info = $_SESSION['whatsnew_post_info'];
/* Header and Breadcrumbs */
if (isset($_SESSION['gradebook'])){

@ -25,7 +25,7 @@ api_protect_course_script(true);
// Additional javascripts.
$htmlHeadXtra[] = GlossaryManager::javascript_glossary();
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#glossary_title").focus();
}

@ -78,7 +78,7 @@ class Category implements GradebookItem
public function is_locked()
{
return isset($this->locked) && $this->locked == 1 ? true : false ;
return isset($this->locked) && $this->locked == 1 ? true : false;
}
public function is_visible()
@ -86,27 +86,27 @@ class Category implements GradebookItem
return $this->visible;
}
public function set_id ($id)
public function set_id($id)
{
$this->id = $id;
}
public function set_name ($name)
public function set_name($name)
{
$this->name = $name;
}
public function set_description ($description)
public function set_description($description)
{
$this->description = $description;
}
public function set_user_id ($user_id)
public function set_user_id($user_id)
{
$this->user_id = $user_id;
}
public function set_course_code ($course_code)
public function set_course_code($course_code)
{
$this->course_code = $course_code;
}
@ -120,31 +120,32 @@ class Category implements GradebookItem
{
$this->parent = intval($parent);
}
/**
* Filters to int and sets the session ID
* @param int The session ID from the Dokeos course session
*/
public function set_session_id ($session_id = 0)
public function set_session_id($session_id = 0)
{
$this->session_id = (int)$session_id;
}
public function set_weight ($weight)
public function set_weight($weight)
{
$this->weight = $weight;
}
public function set_visible ($visible)
public function set_visible($visible)
{
$this->visible = $visible;
}
public function set_grade_model_id ($id)
public function set_grade_model_id($id)
{
$this->grade_model_id = $id;
}
public function set_locked ($locked)
public function set_locked($locked)
{
$this->locked = $locked;
}
@ -181,6 +182,7 @@ class Category implements GradebookItem
$skill_select[$skill['id']] = $skill['name'];
}
}
return $skill_select;
}
@ -246,6 +248,7 @@ class Category implements GradebookItem
if (isset($id) && (int)$id === 0 ) {
$cats = array();
$cats[] = Category::create_root_category();
return $cats;
}
@ -337,7 +340,7 @@ class Category implements GradebookItem
private function create_root_category()
{
$cat= new Category();
$cat = new Category();
$cat->set_id(0);
$cat->set_name(get_lang('RootCat'));
$cat->set_description(null);
@ -351,9 +354,9 @@ class Category implements GradebookItem
private static function create_category_objects_from_sql_result($result)
{
$allcat=array();
$allcat = array();
while ($data = Database::fetch_array($result)) {
$cat= new Category();
$cat = new Category();
$cat->set_id($data['id']);
$cat->set_name($data['name']);
$cat->set_description($data['description']);
@ -366,8 +369,9 @@ class Category implements GradebookItem
$cat->set_certificate_min_score($data['certif_min_score']);
$cat->set_grade_model_id($data['grade_model_id']);
$cat->set_locked($data['locked']);
$allcat[]=$cat;
$allcat[] = $cat;
}
return $allcat;
}
@ -627,18 +631,19 @@ class Category implements GradebookItem
/**
* Shows all information of an category
*/
public function shows_all_information_an_category ($selectcat='')
{
if($selectcat=='') {
return null;
} else {
$tbl_category=Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql='SELECT name,description,user_id,course_code,parent_id,weight,visible,certif_min_score,session_id FROM '.$tbl_category.' c WHERE c.id='.intval($selectcat);
$result=Database::query($sql);
$row=Database::fetch_array($result,'ASSOC');
return $row;
}
}
public function shows_all_information_an_category($selectcat = '')
{
if ($selectcat == '') {
return null;
} else {
$tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql='SELECT name,description,user_id,course_code,parent_id,weight,visible,certif_min_score,session_id FROM '.$tbl_category.' c WHERE c.id='.intval($selectcat);
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
return $row;
}
}
/**
* Check if a category name (with the same parent category) already exists
@ -698,6 +703,7 @@ class Category implements GradebookItem
return true;
}
}
return false;
}
@ -731,9 +737,9 @@ class Category implements GradebookItem
}
// calculate score
$rescount = 0;
$ressum = 0;
$weightsum = 0;
$rescount = 0;
$ressum = 0;
$weightsum = 0;
if (!empty($cats)) {
/** @var Category $cat */
@ -776,14 +782,14 @@ class Category implements GradebookItem
if (isset($linkres) && $link->get_weight() != 0) {
$linkweight = $link->get_weight();
$link_res_denom = ($linkres[1]==0) ? 1 : $linkres[1];
$link_res_denom = ($linkres[1] == 0) ? 1 : $linkres[1];
$rescount++;
$weightsum += $linkweight;
$ressum += (($linkres[0]/$link_res_denom) * $linkweight);
$ressum += (($linkres[0] / $link_res_denom) * $linkweight);
} else {
// Ddding if result does not exists
if ($link->get_weight() != 0) {
$linkweight = $link->get_weight();
$linkweight = $link->get_weight();
$weightsum += $linkweight;
}
}
@ -793,7 +799,7 @@ class Category implements GradebookItem
if ($rescount == 0) {
return null;
} else {
return array ($ressum, $weightsum);
return array($ressum, $weightsum);
}
}
@ -802,9 +808,9 @@ class Category implements GradebookItem
*/
public function delete_all()
{
$cats = Category::load(null, null, $this->course_code, $this->id, null);
$cats = Category::load(null, null, $this->course_code, $this->id, null);
$evals = Evaluation::load(null, null, $this->course_code, $this->id, null);
$links = LinkFactory::load(null,null,null,null,$this->course_code,$this->id,null);
$links = LinkFactory::load(null, null, null, null, $this->course_code, $this->id, null);
if (!empty($cats)) {
foreach ($cats as $cat) {
$cat->delete_all();
@ -888,8 +894,6 @@ class Category implements GradebookItem
} else {
$sql.=' AND coalesce(session_id,0)=0';
}
}
$result = Database::query($sql);
$cats = Category::create_category_objects_from_sql_result($result);
@ -946,7 +950,7 @@ class Category implements GradebookItem
* Can this category be moved to somewhere else ?
* The root and courses cannot be moved.
*/
public function is_movable ()
public function is_movable()
{
return (!(!isset ($this->id) || $this->id == 0 || $this->is_course()));
}
@ -1011,6 +1015,7 @@ class Category implements GradebookItem
$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
}
}
return $targets;
}
@ -1074,7 +1079,6 @@ class Category implements GradebookItem
{
$targets = array();
$level = 0;
$root = array(0, get_lang('RootCat'), $level);
$targets[] = $root;
@ -1111,6 +1115,7 @@ class Category implements GradebookItem
$targets = Category::add_subtree($targets, $level+1, $cat->get_id(),$visible);
}
}
return $targets;
}
@ -1141,8 +1146,8 @@ class Category implements GradebookItem
while ($data=Database::fetch_array($result)) {
$cats[] = array ($data['code'], $data['title']);
}
return $cats;
return $cats;
}
/**
@ -1207,14 +1212,19 @@ class Category implements GradebookItem
if (count($evals) != 0) {
return true;
} else {
$cats = Category::load(null, null, null, $this->id,
api_is_allowed_to_edit() ? null : 1);
$cats = Category::load(
null,
null,
null,
$this->id,
api_is_allowed_to_edit() ? null : 1
);
foreach ($cats as $cat) {
if ($cat->has_evaluations_with_results_for_student ($stud_id)) {
if ($cat->has_evaluations_with_results_for_student($stud_id)) {
return true;
}
}
return false;
}
}
@ -1230,8 +1240,13 @@ class Category implements GradebookItem
{
$creator = (api_is_allowed_to_edit() && !api_is_platform_admin()) ? api_get_user_id() : null;
$crsindcats = Category::load(null,$creator,'0',$cat_id,
api_is_allowed_to_edit() ? null : 1);
$crsindcats = Category::load(
null,
$creator,
'0',
$cat_id,
api_is_allowed_to_edit() ? null : 1
);
if (!empty($crsindcats)) {
foreach ($crsindcats as $crsindcat) {
@ -1302,6 +1317,7 @@ class Category implements GradebookItem
return Category::load(null, null, $course_code, $this->id, null, $session_id, $order);
}
}
return array();
}
@ -1490,14 +1506,15 @@ class Category implements GradebookItem
$foundcats[] = $search_cat;
}
}
return $foundcats;
}
/**
* This function, locks a category , only one who can unlock it is the platform administrator.
* @param int locked 1 or unlocked 0
* @return bool
*
* */
public function lock($locked)
{
@ -1573,8 +1590,6 @@ class Category implements GradebookItem
$item = $evals_links[$count];
$score = $item->calc_score($user_id);
$divide = ( ($score[1])==0 ) ? 1 : $score[1];
//$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$item_value = $score[0]/$divide*$item->get_weight()*$sub_cat_percentage/$main_weight;
$item_value = $score[0]/$divide*$item->get_weight();
/*var_dump($score[0], $divide, $item->get_weight(), $item_value);
echo '---';-*/

@ -270,9 +270,7 @@ class Evaluation implements GradebookItem
$this->type = 'evaluation';
}
$sql .= ", '".api_get_utc_datetime()."'";
$sql .= ',\''.Database::escape_string($this->type).'\'';
$sql .= ")";
Database::query($sql);
@ -417,7 +415,6 @@ class Evaluation implements GradebookItem
Database::query($sql);
}
/**
* Delete this evaluation and all underlying results.
*/
@ -426,7 +423,6 @@ class Evaluation implements GradebookItem
$this->delete();
}
/**
* Check if the given score is possible for this evaluation
*/
@ -444,7 +440,6 @@ class Evaluation implements GradebookItem
public function calc_score($stud_id = null)
{
$results = Result::load(null, $stud_id, $this->id);
$rescount = 0;
$sum = 0;
foreach ($results as $res) {
@ -463,7 +458,6 @@ class Evaluation implements GradebookItem
} else {
return array ($sum, $rescount);
}
}
/**
@ -529,8 +523,6 @@ class Evaluation implements GradebookItem
$this->save();
}
/**
* Retrieve evaluations where a student has results for
* and return them as an array of Evaluation objects

@ -303,7 +303,6 @@ class ExerciseLink extends AbstractLink
} else {
return get_lang('Quiz');
}
}
public function needs_name_and_description()

@ -48,7 +48,7 @@ class LinkFactory
$category_id,
$visible
);
}
}
/**
* Get the link object referring to an evaluation

@ -1,36 +1,27 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Defines a gradebook Result object
* @author Bert Steppé, Stijn Konings
* @package chamilo.gradebook
*/
/**
* Class
* @package chamilo.gradebook
*/
class Result
{
// PROPERTIES
private $id;
private $user_id;
private $evaluation;
private $created_at;
private $score;
// CONSTRUCTORS
function Result()
{
$this->created_at = api_get_utc_datetime();
}
// GETTERS AND SETTERS
public function get_id()
{
return $this->id;

@ -1,11 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
/**
* Class
* @package chamilo.gradebook

@ -21,17 +21,6 @@ api_display_tool_title($nameTools.$add_group_to_title);
<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;">
</div>
<div id="upload_form_div" name="form_div" style="display:block;">
<?php
/*
<div id="folderselector">
//form to select directory
//$folders = DocumentManager::get_all_document_folders($_course,$to_group_id,$is_allowed_to_edit);
//include_once('../document/document.inc.php'); //this should be removed when the functions there are moved to inc/lib
//echo(build_directory_selector($folders,$path,$group_properties['directory']));
</div>
*/
?>
<form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', ''));?>','upload_form_div');">
<input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
<input type="hidden" name="tool" value="<?php echo $my_tool; ?>">
@ -45,4 +34,4 @@ api_display_tool_title($nameTools.$add_group_to_title);
FOOTER
*/
Display::display_footer();
?>
?>

@ -3,7 +3,7 @@
/**
* Process part of the document sub-process for upload. This script MUST BE included by upload/index.php
* as it prepares most of the variables needed here.
*
*
* @todo check if this file is deprecated ... jmontoya
* @package chamilo.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
@ -83,7 +83,7 @@ if(isset($_FILES['user_upload'])) {
}
//missing images are submitted
if(isset($_POST['submit_image'])) {
$number_of_uploaded_images = count($_FILES['img_file']['name']);
$number_of_uploaded_images = count($_FILES['img_file']['name']);
//if images are uploaded
if ($number_of_uploaded_images > 0)
{
@ -137,11 +137,6 @@ else { //give them a link to create a directory
?>
<div id="folderselector">
<?php
//form to select directory
//$folders = DocumentManager::get_all_document_folders($_course,$to_group_id,$is_allowed_to_edit);
//echo(build_directory_selector($folders,$path,$group_properties['directory']));
?>
</div>
<!-- start upload form -->
@ -188,4 +183,4 @@ else { //give them a link to create a directory
<p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
<?php
Display::display_footer();
Display::display_footer();

Loading…
Cancel
Save