Minor - merge language file

1.9.x
Yannick Warnier 11 years ago
commit 104a8449d0
  1. 111
      custompages/index-unlogged.php
  2. 4
      main/admin/resume_session.php
  3. 4
      main/admin/settings.lib.php
  4. 4
      main/admin/settings.php
  5. 46
      main/admin/user_edit.php
  6. 3
      main/attendance/attendance_controller.php
  7. 91
      main/blog/blog.php
  8. 6
      main/blog/blog_admin.php
  9. 17
      main/calendar/agenda.inc.php
  10. 12
      main/calendar/allagendas.php
  11. 10
      main/calendar/ical_export.php
  12. 17
      main/calendar/myagenda.inc.php
  13. 2
      main/chat/chat_chat.php
  14. 2
      main/chat/chat_hidden.php
  15. 2
      main/chat/chat_message.php
  16. 4
      main/chat/chat_whoisonline.php
  17. 1
      main/course_description/add.php
  18. 6
      main/course_home/3column.php
  19. 1
      main/course_info/delete_course.php
  20. 2
      main/course_info/download.php
  21. 13
      main/course_info/infocours.php
  22. 4
      main/course_progress/index.php
  23. 4
      main/course_progress/thematic.php
  24. 32
      main/course_progress/thematic_controller.php
  25. 4
      main/coursecopy/classes/Announcement.class.php
  26. 8
      main/coursecopy/classes/CourseBuilder.class.php
  27. 43
      main/coursecopy/classes/CourseRestorer.class.php
  28. 2
      main/coursecopy/classes/CourseSelectForm.class.php
  29. 24
      main/coursecopy/classes/Event.class.php
  30. 1
      main/create_course/add_course.php
  31. 14
      main/dashboard/index.php
  32. 11
      main/document/document.inc.php
  33. 11
      main/document/document.php
  34. 1
      main/document/upload.php
  35. 1
      main/dropbox/dropbox_functions.inc.php
  36. 1
      main/dropbox/dropbox_init.inc.php
  37. 1
      main/dropbox/index.php
  38. 57
      main/exercice/admin.php
  39. 9
      main/exercice/export/aiken/aiken_import.inc.php
  40. 5
      main/exercice/export/exercise_import.inc.php
  41. 32
      main/exercice/export/exercise_import.php
  42. 1
      main/exercice/export/qti2/qti2_export.php
  43. 7
      main/exercice/export/scorm/scorm_export.php
  44. 127
      main/forum/forumfunction.inc.php
  45. 2
      main/forum/forumqualify.php
  46. 2
      main/forum/index.php
  47. 1
      main/forum/reply.php
  48. 7
      main/forum/viewforum.php
  49. 1
      main/forum/viewpost.php
  50. 2
      main/glossary/index.php
  51. 115
      main/gradebook/lib/be/category.class.php
  52. 8
      main/gradebook/lib/be/evaluation.class.php
  53. 1
      main/gradebook/lib/be/exerciselink.class.php
  54. 2
      main/gradebook/lib/be/linkfactory.class.php
  55. 9
      main/gradebook/lib/be/result.class.php
  56. 2
      main/gradebook/lib/fe/displaygradebook.php
  57. 79
      main/inc/lib/document.lib.php
  58. 9
      main/inc/lib/sessionmanager.lib.php
  59. 0
      main/lang/english/accessibility.inc.php
  60. 0
      main/lang/english/admin.inc.php
  61. 0
      main/lang/english/agenda.inc.php
  62. 0
      main/lang/english/announcements.inc.php
  63. 0
      main/lang/english/blog.inc.php
  64. 0
      main/lang/english/chat.inc.php
  65. 0
      main/lang/english/course_description.inc.php
  66. 0
      main/lang/english/course_home.inc.php
  67. 0
      main/lang/english/course_info.inc.php
  68. 0
      main/lang/english/coursebackup.inc.php
  69. 0
      main/lang/english/courses.inc.php
  70. 0
      main/lang/english/create_course.inc.php
  71. 0
      main/lang/english/document.inc.php
  72. 0
      main/lang/english/dropbox.inc.php
  73. 0
      main/lang/english/exercice.inc.php
  74. 0
      main/lang/english/external_module.inc.php
  75. 0
      main/lang/english/forum.inc.php
  76. 0
      main/lang/english/glossary.inc.php
  77. 0
      main/lang/english/gradebook.inc.php
  78. 0
      main/lang/english/group.inc.php
  79. 0
      main/lang/english/help.inc.php
  80. 0
      main/lang/english/hotspot.inc.php
  81. 0
      main/lang/english/import.inc.php
  82. 0
      main/lang/english/index.inc.php
  83. 0
      main/lang/english/install.inc.php
  84. 0
      main/lang/english/learnpath.inc.php
  85. 0
      main/lang/english/link.inc.php
  86. 0
      main/lang/english/md_document.inc.php
  87. 0
      main/lang/english/md_link.inc.php
  88. 0
      main/lang/english/md_mix.inc.php
  89. 0
      main/lang/english/md_scorm.inc.php
  90. 0
      main/lang/english/messages.inc.php
  91. 0
      main/lang/english/myagenda.inc.php
  92. 0
      main/lang/english/notebook.inc.php
  93. 0
      main/lang/english/notification.inc.php
  94. 0
      main/lang/english/registration.inc.php
  95. 0
      main/lang/english/reservation.inc.php
  96. 0
      main/lang/english/resourcelinker.inc.php
  97. 0
      main/lang/english/scorm.inc.php
  98. 0
      main/lang/english/scormbuilder.inc.php
  99. 0
      main/lang/english/scormdocument.inc.php
  100. 0
      main/lang/english/slideshow.inc.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,4 +1,4 @@
<?php
<?php
/* For licensing terms, see /license.txt */
/**
* Redirect script
@ -7,35 +7,37 @@
/**
* Initialization
*/
//require_once('main/inc/global.inc.php');
//require_once('main/inc/global.inc.php');
require_once('language.php');
/**
* Homemade micro-controller
*/
if (isset($_GET['loginFailed'])){
if (isset($_GET['error'])) {
switch ($_GET['error']) {
case 'account_expired':
$error_message = custompages_get_lang('AccountExpired');
break;
case 'account_inactive':
$error_message = custompages_get_lang('AccountInactive');
break;
case 'user_password_incorrect':
$error_message = custompages_get_lang('InvalidId');
break;
case 'access_url_inactive':
$error_message = custompages_get_lang('AccountURLInactive');
break;
default :
$error_message = custompages_get_lang('InvalidId');
if (isset($_GET['loginFailed'])) {
if (isset($_GET['error'])) {
switch ($_GET['error']) {
case 'account_expired':
$error_message = custompages_get_lang('AccountExpired');
break;
case 'account_inactive':
$error_message = custompages_get_lang('AccountInactive');
break;
case 'user_password_incorrect':
$error_message = custompages_get_lang('InvalidId');
break;
case 'access_url_inactive':
$error_message = custompages_get_lang('AccountURLInactive');
break;
default :
$error_message = custompages_get_lang('InvalidId');
}
} else {
$error_message = get_lang('InvalidId');
}
} else {
$error_message = get_lang('InvalidId');
}
}
$rootWeb = api_get_path('WEB_PATH');
$rootWeb = api_get_path('WEB_PATH');
/**
* HTML output
*/
@ -52,14 +54,14 @@ if (isset($_GET['loginFailed'])){
<![endif]-->
<script type="text/javascript" src="<?php echo $rootWeb ?>main/inc/lib/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (top.location != location)
top.location.href = document.location.href ;
if (top.location != location) {
top.location.href = document.location.href;
}
// Handler pour la touche retour
$('input').keyup(function(e) {
$('input').keyup(function(e) {
if (e.keyCode == 13) {
$('#login-form').submit();
}
@ -76,34 +78,43 @@ if (isset($_GET['loginFailed'])){
<img src="<?php echo api_get_path(WEB_PATH)?>/custompages/images/header.png" alt="Logo" />
</div> <!-- #header -->
<div id="login-form-box" class="form-box">
<div id="login-form-info" class="form-info">
<?php if (isset($content['info']) && !empty($content['info'] )) {
echo $content['info'];
}?>
</div>
<?php if (isset($error_message)) {
echo '<div id="login-form-info" class="form-error">'.$error_message.'</div>';
}?>
<form id="login-form" class="form" action="<?php echo api_get_path(WEB_PATH)?>index.php" method="post">
<div>
<label for="login">*<?php echo custompages_get_lang('User');?></label>
<input name="login" type="text" /><br />
<label for="password">*<?php echo custompages_get_lang('langPass');?></label>
<input name="password" type="password" /><br />
</div>
</form>
<div id="login-form-submit" class="form-submit" onclick="document.forms['login-form'].submit();">
<span><?php echo custompages_get_lang('LoginEnter');?></span>
</div> <!-- #form-submit -->
<div id="login-form-info" class="form-info">
<?php if (isset($content['info']) && !empty($content['info'])) {
echo $content['info'];
}
?>
</div>
<?php if (isset($error_message)) {
echo '<div id="login-form-info" class="form-error">'.$error_message.'</div>';
}
?>
<form id="login-form" class="form" action="<?php echo api_get_path(WEB_PATH)?>index.php" method="post">
<div>
<label for="login">*<?php echo custompages_get_lang('User');?></label>
<input name="login" type="text" /><br />
<label for="password">*<?php echo custompages_get_lang('langPass');?></label>
<input name="password" type="password" /><br />
</div>
</form>
<div id="login-form-submit" class="form-submit" onclick="document.forms['login-form'].submit();">
<span><?php echo custompages_get_lang('LoginEnter');?></span>
</div> <!-- #form-submit -->
<div id="links">
<a href="<?php echo api_get_path(WEB_PATH)?>main/auth/inscription.php"><?php echo custompages_get_lang('langReg')?></a><br />
<a href="<?php echo api_get_path(WEB_PATH)?>main/auth/lostPassword.php"><?php echo custompages_get_lang('langLostPassword')?></a>
<?php if (api_get_setting('allow_registration') === 'true') { ?>
<a href="<?php echo api_get_path(WEB_PATH); ?>main/auth/inscription.php">
<?php echo custompages_get_lang('langReg')?>
</a><br />
<?php } ?>
<a href="<?php echo api_get_path(WEB_PATH); ?>main/auth/lostPassword.php">
<?php echo custompages_get_lang('langLostPassword')?>
</a>
</div>
</div> <!-- #form -->
<div id="footer">
<img src="<?php echo api_get_path(WEB_PATH)?>/custompages/images/footer.png" />
<img src="<?php echo api_get_path(WEB_PATH); ?>/custompages/images/footer.png" />
</div> <!-- #footer -->
</div> <!-- #wrapper -->
</body>
</html>

@ -325,7 +325,7 @@ if ($session['nbr_courses'] == 0) {
if (SessionManager::orderCourseIsEnabled()) {
$upIcon = 'up.png';
$urlUp = api_get_self().'?id_session='.$id_session.'&course_code='.$course['code'].'&action=move_up&list='.$list;
$urlUp = api_get_self().'?id_session='.$id_session.'&course_code='.$course['code'].'&action=move_up';
if ($count == 0) {
$upIcon = 'up_na.png';
@ -338,7 +338,7 @@ if ($session['nbr_courses'] == 0) {
);
$downIcon = 'down.png';
$downUrl = api_get_self().'?id_session='.$id_session.'&course_code='.$course['code'].'&action=move_down&list='.$list;
$downUrl = api_get_self().'?id_session='.$id_session.'&course_code='.$course['code'].'&action=move_down';
if ($count +1 == count($courses)) {
$downIcon = 'down_na.png';

@ -111,7 +111,7 @@ function handle_extensions()
function handle_plugins()
{
$plugin_obj = new AppPlugin();
$token = Security::get_token();
if (isset($_POST['submit_plugins'])) {
store_plugins();
// Add event to the system log.
@ -126,7 +126,7 @@ function handle_plugins()
//Plugins NOT installed
echo Display::page_subheader(get_lang('Plugins'));
echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'">';
echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token=' . $token . '">';
echo '<table class="data_table">';
echo '<tr>';
echo '<th width="20px">';

@ -443,7 +443,9 @@ if (!empty($_GET['category'])) {
case 'Plugins':
// Displaying the extensions: Plugins.
// This will be available to all the sites (access_urls).
if (isset($_POST['submit_dashboard_plugins'])) {
$securityToken = Security::remove_XSS($_GET['sec_token']);
if (isset($_POST['submit_dashboard_plugins']) && Security::check_token($securityToken)) {
Security::clear_token();
$affected_rows = DashboardManager::store_dashboard_plugins($_POST);
if ($affected_rows) {
// add event to system log

@ -6,9 +6,7 @@
// Language files that should be included
$language_file = array('admin', 'registration');
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
@ -182,9 +180,9 @@ if (api_get_setting('login_is_email') != 'true') {
// Password
$form->addElement('radio', 'reset_password', get_lang('Password'), get_lang('DontResetPassword'), 0);
$nb_ext_auth_source_added = 0;
if (count($extAuthSource) > 0) {
if (isset($extAuthSource) && count($extAuthSource) > 0) {
$auth_sources = array();
foreach($extAuthSource as $key => $info) {
foreach ($extAuthSource as $key => $info) {
// @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
@ -325,11 +323,12 @@ if ($form->validate()) {
if ($user['status'] == DRH && $is_user_subscribed_in_course) {
$error_drh = true;
} else {
$userInfo = api_get_user_info($user_id);
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = $user_data['picture_uri'];
if ($user['delete_picture']) {
if (isset($user['delete_picture']) && $user['delete_picture']) {
$picture_uri = UserManager::delete_user_picture($user_id);
} elseif (!empty($picture['name'])) {
$picture_uri = UserManager::update_user_picture($user_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
@ -338,18 +337,18 @@ if ($form->validate()) {
$lastname = $user['lastname'];
$firstname = $user['firstname'];
$password = $user['password'];
$auth_source = $user['auth_source'];
$auth_source = isset($user['auth_source']) ? $user['auth_source'] : $userInfo['auth_source'];
$official_code = $user['official_code'];
$email = $user['email'];
$phone = $user['phone'];
$username = $user['username'];
$username = isset($user['username']) ? $user['username'] : $userInfo['username'];
$status = intval($user['status']);
$platform_admin = intval($user['platform_admin']);
$send_mail = intval($user['send_mail']);
$reset_password = intval($user['reset_password']);
$hr_dept_id = intval($user['hr_dept_id']);
$hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null;
$language = $user['language'];
if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) {
$expiration_date = return_datetime_from_array($user['expiration_date']);
} else {
@ -366,12 +365,35 @@ if ($form->validate()) {
if (api_get_setting('login_is_email') == 'true') {
$username = $email;
}
UserManager::update_user($user_id, $firstname, $lastname, $username, $password, $auth_source, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active, null, $hr_dept_id, null, $language, null, $send_mail, $reset_password);
UserManager::update_user(
$user_id,
$firstname,
$lastname,
$username,
$password,
$auth_source,
$email,
$status,
$official_code,
$phone,
$picture_uri,
$expiration_date,
$active,
null,
$hr_dept_id,
null,
$language,
null,
$send_mail,
$reset_password
);
if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) {
$up = UserManager::update_openid($user_id,$user['openid']);
}
if ($user_id != $_SESSION['_uid']) {
$currentUserId = api_get_user_id();
if ($user_id != $currentUserId) {
if ($platform_admin == 1) {
UserManager::add_user_as_admin($user_id);
} else {
@ -464,4 +486,4 @@ $content .= $form->return_form();
$tpl = new Template($tool_name);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$tpl->display_one_col_template();

@ -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();
}

@ -17,7 +17,8 @@
* @todo this funcionality is really bad : jmontoya
* @return string html form
*/
function build_directory_selector($folders, $document_id, $group_dir = '', $change_renderer = false) {
function build_directory_selector($folders, $document_id, $group_dir = '', $change_renderer = false)
{
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$course_id = api_get_course_int_id();
$folder_titles = array();
@ -29,7 +30,8 @@ function build_directory_selector($folders, $document_id, $group_dir = '', $chan
}
$folder_sql = implode("','", $escaped_folders);
$sql = "SELECT * FROM $doc_table WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('" . $folder_sql . "')";
$sql = "SELECT * FROM $doc_table
WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('" . $folder_sql . "')";
$res = Database::query($sql);
$folder_titles = array();
while ($obj = Database::fetch_object($res)) {
@ -88,6 +90,7 @@ function build_directory_selector($folders, $document_id, $group_dir = '', $chan
}
}
$html = $form->toHtml();
return $html;
}
@ -649,8 +652,8 @@ function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0,
return $modify_icons;
}
function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '') {
function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '')
{
$form = new FormValidator('move_to', 'post', api_get_self());
// Form title

@ -809,8 +809,6 @@ $(document).ready( function() {
});
</script>';
// Lib for event log, stats & tracking & record of the access
event_access_tool(TOOL_DOCUMENT);
@ -849,6 +847,7 @@ if ($is_allowed_to_edit ||
false,
$session_id
);
$move_path = $document_to_move['path'];
if (!empty($document_to_move)) {
$folders = DocumentManager::get_all_document_folders(
@ -857,7 +856,7 @@ if ($is_allowed_to_edit ||
$is_allowed_to_edit || $group_member_with_upload_rights
);
//filter if is my shared folder. TODO: move this code to build_move_to_selector function
// filter if is my shared folder. TODO: move this code to build_move_to_selector function
if (is_my_shared_folder(api_get_user_id(), $curdirpath, $session_id) && !$is_allowed_to_edit) {
//only main user shared folder
$main_user_shared_folder_main = '/shared_folder/sf_user_'.api_get_user_id();
@ -869,6 +868,7 @@ if ($is_allowed_to_edit ||
$user_shared_folders[] = $fold;
}
}
$moveForm .= '<legend>'.get_lang('Move').'</legend>';
$moveForm .= build_move_to_selector(
$user_shared_folders,
@ -1534,6 +1534,7 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
} else {
$document_name = basename($document_data['path']);
}
$row['name'] = $document_name;
// Data for checkbox
if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($documentAndFolders) > 1) {
@ -1577,6 +1578,7 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
// Comments => display comment under the document name
$display_size = format_file_size($size);
$row[] = '<span style="display:none;">'.$size.'</span>'.
$invisibility_span_open.
$display_size.
@ -1587,9 +1589,10 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$last_edit_date = api_get_local_time($document_data['lastedit_date']);
$display_date = date_to_str_ago($last_edit_date).
' <div class="muted"><small>'.$last_edit_date."</small></div>";
$row[] = $invisibility_span_open.$display_date.$invisibility_span_close;
// Admins get an edit column
// Admins get an edit column
if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $session_id)) {
$is_template = isset($document_data['is_template']) ? $document_data['is_template'] : false;
// If readonly, check if it the owner of the file or if the user is an admin

@ -107,7 +107,6 @@ $courseDir = $_course['path'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$courseDir;
$sessionId = api_get_session_id();
$selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : null;
$document_data = DocumentManager::get_document_data_by_id($_REQUEST['id'], api_get_course_id(), true, $sessionId);

@ -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

@ -17,8 +17,10 @@ class DocumentManager
}
/**
* @param string
* @return the document folder quota for the current course, in bytes, or the default quota
* @param string $course_code
*
* @return int the document folder quota for the current course in bytes
* or the default quota
*/
public static function get_course_quota($course_code = null)
{
@ -300,6 +302,7 @@ class DocumentManager
* @param string $full_file_name
* @param boolean $forced
* @param string $name
*
* @return false if file doesn't exist, true if stream succeeded
*/
public static function file_send_for_download($full_file_name, $forced = false, $name = '')
@ -339,6 +342,7 @@ class DocumentManager
$res = fopen($full_file_name, 'r');
fpassthru($res);
return true;
} else {
//no forced download, just let the browser decide what to do according to the mimetype
@ -377,6 +381,7 @@ class DocumentManager
header('Content-Disposition: inline; filename= ' . $filename);
}
readfile($full_file_name);
return true;
}
}
@ -387,9 +392,10 @@ class DocumentManager
* otherwise it may cause subsequent use of the page to want to download
* other pages in php rather than interpreting them.
*
* @param string The string contents
* @param boolean Whether "save" mode is forced (or opening directly authorized)
* @param string The name of the file in the end (including extension)
* @param string $full_string The string contents
* @param boolean $forced Whether "save" mode is forced (or opening directly authorized)
* @param string $name The name of the file in the end (including extension)
*
* @return false if file doesn't exist, true if stream succeeded
*/
public static function string_send_for_download($full_string, $forced = false, $name = '')
@ -522,13 +528,24 @@ class DocumentManager
// The given path will not end with a slash, unless it's the root '/'
// so no root -> add slash
$added_slash = ($path == '/') ? '' : '/';
$added_slash = $path == '/' ? '' : '/';
// Condition for the session
$current_session_id = api_get_session_id();
$condition_session = " AND (id_session = '$current_session_id' OR (id_session = '0') )";
$condition_session .= self::getSessionFolderFilters($originalPath, $current_session_id);
$sessionId = api_get_session_id();
$condition_session = " AND (id_session = '$sessionId' OR (id_session = '0') )";
$condition_session .= self::getSessionFolderFilters($originalPath, $sessionId);
$sharedCondition = null;
if ($originalPath == '/shared_folder') {
$students = CourseManager::get_user_list_from_course_code($_course['code'], $sessionId);
if (!empty($students)) {
$conditionList = array();
foreach ($students as $studentId => $studentInfo) {
$conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
}
$sharedCondition .= ' AND docs.path IN ("' . implode('","', $conditionList) . '")';
}
}
$sql = "SELECT
docs.id,
@ -557,6 +574,7 @@ class DocumentManager
last.visibility
$visibility_bit
$condition_session
$sharedCondition
";
$result = Database::query($sql);
@ -614,7 +632,7 @@ class DocumentManager
}
//@todo use the DocumentManager::is_visible function
// Checking disponibility in a session
// Checking visibility in a session
foreach ($my_repeat_ids as $id) {
foreach ($doc_list as $row) {
if ($id == $row['id']) {
@ -644,13 +662,13 @@ class DocumentManager
}
}
// Checking parents visibility
// Checking parents visibility.
$final_document_data = array();
foreach ($document_data as $row) {
$is_visible = DocumentManager::check_visibility_tree(
$row['id'],
$_course['code'],
$current_session_id,
$sessionId,
api_get_user_id(),
$to_group_id
);
@ -671,6 +689,7 @@ class DocumentManager
/**
* Gets the paths of all folders in a course
* can show all folders (except for the deleted ones) or only visible ones
*
* @param array $_course
* @param int $to_group_id
* @param boolean $can_see_invisible
@ -679,7 +698,7 @@ class DocumentManager
*/
public static function get_all_document_folders(
$_course,
$to_group_id = '0',
$to_group_id = 0,
$can_see_invisible = false
) {
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
@ -687,6 +706,16 @@ class DocumentManager
$to_group_id = intval($to_group_id);
$document_folders = array();
$students = CourseManager::get_user_list_from_course_code($_course['code'], api_get_session_id());
$sharedCondition = null;
if (!empty($students)) {
$conditionList = array();
foreach ($students as $studentId => $studentInfo) {
$conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
}
}
if ($can_see_invisible) {
//condition for the session
$session_id = api_get_session_id();
@ -708,7 +737,7 @@ class DocumentManager
WHERE
docs.filetype = 'folder' AND
last.to_group_id = " . $to_group_id . " AND
docs.path NOT LIKE '%shared_folder%' AND
docs.path NOT LIKE '%shared_folder%' AND
last.visibility <> 2 $condition_session ";
} else {
$sql = "SELECT DISTINCT docs.id, path
@ -725,7 +754,6 @@ class DocumentManager
last.visibility <> 2
$show_users_condition $condition_session ";
}
$result = Database::query($sql);
if ($result && Database::num_rows($result) != 0) {
@ -733,6 +761,13 @@ class DocumentManager
if (DocumentManager::is_folder_to_avoid($row['path'])) {
continue;
}
if (strpos($row['path'], '/shared_folder/') !== false) {
if (!in_array($row['path'], $conditionList)) {
continue;
}
}
$document_folders[$row['id']] = $row['path'];
}
@ -766,7 +801,7 @@ class DocumentManager
$visibleFolders[$row['id']] = $row['path'];
}
//condition for the session
// Condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
//get invisible folders
@ -1498,7 +1533,6 @@ class DocumentManager
*/
public static function is_visible_by_id($doc_id, $course_info, $session_id, $user_id, $admins_can_see_everything = true)
{
$is_visible = false;
$user_in_course = false;
//1. Checking the course array
@ -1512,7 +1546,6 @@ class DocumentManager
$doc_id = intval($doc_id);
$session_id = intval($session_id);
//2. Course and Session visibility are handle in local.inc.php/global.inc.php
//3. Checking if user exist in course/session
@ -1532,11 +1565,11 @@ class DocumentManager
}
}
//4. Checking document visibility (i'm repeating the code in order to be more clear when reading ) - jm
// 4. Checking document visibility (i'm repeating the code in order to be more clear when reading ) - jm
if ($user_in_course) {
//4.1 Checking document visibility for a Course
// 4.1 Checking document visibility for a Course
if ($session_id == 0) {
$item_info = api_get_item_property_info($course_info['real_id'], 'document', $doc_id, 0);
@ -1551,7 +1584,7 @@ class DocumentManager
}
}
} else {
//4.2 Checking document visibility for a Course in a Session
// 4.2 Checking document visibility for a Course in a Session
$item_info = api_get_item_property_info($course_info['real_id'], 'document', $doc_id, 0);
$item_info_in_session = api_get_item_property_info($course_info['real_id'], 'document', $doc_id, $session_id);
@ -4028,7 +4061,7 @@ class DocumentManager
}
/**
* Sets
* Sets
* @param string $file ($document_data['path'])
* @param string $file_url_sys
* @return string

@ -4569,7 +4569,7 @@ class SessionManager
* @param string $courseCode
* @return bool
*/
public function move($direction, $sessionId, $courseCode)
public static function move($direction, $sessionId, $courseCode)
{
if (!self::orderCourseIsEnabled()) {
return false;
@ -4596,6 +4596,9 @@ class SessionManager
$count++;
}
// Loading new positions.
$courseList = self::get_course_list_by_session_id($sessionId, null, 'position');
$found = false;
switch ($direction) {
@ -4636,7 +4639,7 @@ class SessionManager
* @param string $courseCode
* @return bool
*/
public function moveUp($sessionId, $courseCode)
public static function moveUp($sessionId, $courseCode)
{
return self::move('up', $sessionId, $courseCode);
}
@ -4646,7 +4649,7 @@ class SessionManager
* @param string $courseCode
* @return bool
*/
public function moveDown($sessionId, $courseCode)
public static function moveDown($sessionId, $courseCode)
{
return self::move('down', $sessionId, $courseCode);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save