Merge pull request #10 from chamilo/1.11.x

1.11.x
pull/2487/head
Rafael 9 years ago committed by GitHub
commit 0be9cc6eae
  1. 20
      .codeclimate.yml
  2. 162
      .scrutinizer.yml
  3. 48
      .styleci.yml
  4. 11
      404.php
  5. 3
      custompages/language.php
  6. 6
      license.txt
  7. 27
      main/admin/access_url_add_usergroup_to_url.php
  8. 40
      main/admin/access_url_add_users_to_url.php
  9. 38
      main/admin/access_url_check_user_session.php
  10. 7
      main/admin/access_url_edit.php
  11. 2
      main/admin/access_url_edit_course_category_to_url.php
  12. 31
      main/admin/access_url_edit_courses_to_url.php
  13. 2
      main/admin/access_url_edit_usergroup_to_url.php
  14. 6
      main/admin/access_url_edit_users_to_url.php
  15. 34
      main/admin/access_urls.php
  16. 5
      main/admin/add_courses_to_usergroup.php
  17. 8
      main/admin/add_sessions_to_promotion.php
  18. 32
      main/admin/add_sessions_to_usergroup.php
  19. 2
      main/admin/archive_cleanup.php
  20. 22
      main/admin/career_dashboard.php
  21. 4
      main/admin/cli.php
  22. 100
      main/admin/configure_extensions.php
  23. 2
      main/admin/configure_inscription.php
  24. 2
      main/admin/course_add.php
  25. 2
      main/admin/course_category.php
  26. 29
      main/admin/course_create_content.php
  27. 4
      main/admin/course_edit.php
  28. 10
      main/admin/course_intro_pdf_import.php
  29. 30
      main/admin/course_list.php
  30. 7
      main/admin/course_request_accepted.php
  31. 5
      main/admin/course_request_edit.php
  32. 7
      main/admin/course_request_rejected.php
  33. 1
      main/admin/course_request_review.php
  34. 6
      main/admin/course_user_import.php
  35. 27
      main/admin/dashboard_add_courses_to_user.php
  36. 10
      main/admin/dashboard_add_sessions_to_user.php
  37. 6
      main/admin/dashboard_add_users_to_user.php
  38. 6
      main/admin/event_type.php
  39. 2
      main/admin/export_certificates.php
  40. 31
      main/admin/extra_field_options.php
  41. 3
      main/admin/languages.php
  42. 38
      main/admin/ldap_import_students_to_session.php
  43. 2
      main/admin/skills_wheel.php
  44. 2
      main/admin/system_status.php
  45. 4
      main/admin/usergroup_export.php
  46. 38
      main/admin/usergroups.php
  47. 44
      main/announcements/announcements.php
  48. 4
      main/announcements/download.php
  49. 12
      main/attendance/attendance_edit.php
  50. 2
      main/auth/conditional_login/complete_phone_number.php
  51. 2
      main/auth/lostPassword.php
  52. 2
      main/auth/shibboleth/test/shibboleth_test.class.php
  53. 46
      main/blog/blog.php
  54. 6
      main/calendar/ical_export.php
  55. 10
      main/course_description/add.php
  56. 12
      main/course_description/edit.php
  57. 18
      main/course_description/listing.php
  58. 7
      main/course_home/course_home.php
  59. 30
      main/course_progress/index.php
  60. 132
      main/course_progress/thematic.php
  61. 52
      main/course_progress/thematic_controller.php
  62. 48
      main/course_progress/thematic_plan.php
  63. 30
      main/coursecopy/copy_course.php
  64. 63
      main/cron/import_csv.php
  65. 5
      main/document/edit_draw.php
  66. 21
      main/exercise/exercise_result.class.php
  67. 43
      main/exercise/fill_blanks.class.php
  68. 347
      main/exercise/hotpotatoes_exercise_result.class.php
  69. 3
      main/exercise/overview.php
  70. 6
      main/forum/newthread.php
  71. 2
      main/gradebook/gradebook_add_link.php
  72. 4
      main/gradebook/gradebook_add_result.php
  73. 6
      main/gradebook/lib/be/category.class.php
  74. 1516
      main/gradebook/lib/be/evaluation.class.php
  75. 470
      main/gradebook/lib/be/forumthreadlink.class.php
  76. 4
      main/gradebook/lib/be/linkfactory.class.php
  77. 5
      main/gradebook/lib/fe/gradebooktable.class.php
  78. 10
      main/gradebook/lib/fe/usertable.class.php
  79. 2
      main/inc/ajax/link.ajax.php
  80. 4
      main/inc/ajax/session.ajax.php
  81. 2
      main/inc/lib/AnnouncementEmail.php
  82. 14
      main/inc/lib/AnnouncementManager.php
  83. 10
      main/inc/lib/TicketManager.php
  84. 8
      main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
  85. 206
      main/inc/lib/add_courses_to_session_functions.lib.php
  86. 49
      main/inc/lib/add_many_session_to_category_functions.lib.php
  87. 15
      main/inc/lib/agenda.lib.php
  88. 4
      main/inc/lib/app_view.php
  89. 9
      main/inc/lib/banner.lib.php
  90. 130
      main/inc/lib/course.lib.php
  91. 8
      main/inc/lib/display.lib.php
  92. 2
      main/inc/lib/exercise_show_functions.lib.php
  93. 4
      main/inc/lib/extra_field_option.lib.php
  94. 10
      main/inc/lib/formvalidator/FormValidator.class.php
  95. 4
      main/inc/lib/grade_model.lib.php
  96. 2
      main/inc/lib/hook/HookManagement.php
  97. 11
      main/inc/lib/internationalization.lib.php
  98. 15
      main/inc/lib/link.lib.php
  99. 3
      main/inc/lib/login.lib.php
  100. 2
      main/inc/lib/lp_item.lib.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -11,11 +11,14 @@ engines:
enabled: true
config:
standard: "PSR1,PSR2"
checks:
PSR1 Classes ClassDeclaration MissingNamespace:
enabled: false
PSR1 Files SideEffects FoundWithSymbols:
enabled: false
duplication:
enabled: true
config:
languages:
- php
enabled: false
ratings:
paths:
@ -24,12 +27,16 @@ ratings:
- '**.css'
exclude_paths:
- cli-config.php
- app/cache/
- app/logs/
- app/config/
- app/Migrations/
- app/Resources/
- main/admin/db.php
- main/auth/cas/lib/CAS/
- main/auth/shibboleth
- main/auth/openid
- main/inc/lib/browser/
- main/inc/lib/freemindflashbrowser/
- main/inc/lib/internationalization_database/
@ -49,6 +56,11 @@ exclude_paths:
- main/template/
- main/img/
- main/lang/
- plugin/buycourses/src/Culqi/
- plugin/buycourses/src/Requests/
- plugin/kannelsms/vendor/
- plugin/clockworksms/vendor/
- plugin/pens/lib
- tests/
- vendor/
- web/

@ -11,42 +11,6 @@ build:
'phar.readonly': false
hosts:
my.chamilodev.net: '127.0.0.1'
filter:
excluded_paths:
- 'app/cache/*'
- 'app/logs/*'
- 'documentation/*'
- 'app/Migrations/*'
- 'app/Resources/*'
- 'main/admin/db.php'
- 'main/auth/cas/lib/CAS/*'
- 'main/inc/lib/browser/*'
- 'main/inc/lib/freemindflashbrowser/*'
- 'main/inc/lib/internationalization_database/*'
- 'main/inc/lib/javascript/*'
- 'main/inc/lib/kses-0.2.2/*'
- 'main/inc/lib/mimetex/*'
- 'main/inc/lib/nanogong/*'
- 'main/inc/lib/nusoap/*'
- 'main/inc/lib/opengraph/*'
- 'main/inc/lib/ppt2png/*'
- 'main/inc/lib/phpseclib'
- 'main/inc/lib/pear/*'
- 'main/inc/lib/phpmailer/*'
- 'main/inc/lib/phpseclib/*'
- 'main/inc/lib/svg-edit/*'
- 'main/inc/lib/swfobject/*'
- 'main/inc/lib/wami-recorder/*'
- 'main/inc/lib/xajax/*'
- 'main/lp/packaging/*'
- 'main/template/*'
- 'main/img/*'
- 'main/lang/*'
- 'main/default_course_document'
- 'fonts'
- 'tests/*'
- 'vendor/*'
- 'web/*'
checks:
php:
no_trailing_whitespace: true
@ -119,47 +83,87 @@ coding_style:
constants:
true_false_null: lower
tools:
php_mess_detector:
enabled: true
extensions:
- php
command: phpmd
filter:
paths: { }
excluded_paths:
- 'tests/*'
- 'vendor/*'
config:
rulesets:
- codesize
#tools:
# php_mess_detector:
# enabled: true
# extensions:
# - php
# command: phpmd
# config:
# rulesets:
# - codesize
# php_analyzer:
# enabled: true
# filter:
# excluded_paths:
# - 'tests/*'
# extensions:
# - php
# php_code_sniffer:
# enabled: true
# config:
# standard: PSR2
# extensions:
# - php
# command: phpcs
# filter:
# excluded_paths:
# - 'tests/*'
# sensiolabs_security_checker:
# enabled: true
# php_pdepend:
# command: pdepend
# configuration_file: ~
# suffixes:
# - php
# excluded_dirs:
# - 'vendor'
# - 'tests/*'
# enabled: true
# php_code_coverage: true
php_analyzer:
enabled: true
filter:
excluded_paths:
- 'tests/*'
extensions:
- php
php_code_sniffer:
enabled: true
config:
standard: PSR2
extensions:
- php
command: phpcs
filter:
excluded_paths:
- 'tests/*'
sensiolabs_security_checker:
enabled: true
php_pdepend:
command: pdepend
configuration_file: ~
suffixes:
- php
excluded_dirs:
- 'vendor'
- 'tests/*'
enabled: true
php_code_coverage: true
filter:
excluded_paths:
- 'cli-config.php'
- 'app/cache/*'
- 'app/logs/*'
- 'app/config/*'
- 'documentation/*'
- 'app/Migrations/*'
- 'app/Resources/*'
- 'main/admin/db.php'
- 'main/auth/cas/lib/CAS/*'
- 'main/auth/shibboleth/*'
- 'main/auth/openid/*'
- 'main/inc/lib/browser/*'
- 'main/inc/lib/freemindflashbrowser/*'
- 'main/inc/lib/internationalization_database/*'
- 'main/inc/lib/javascript/*'
- 'main/inc/lib/kses-0.2.2/*'
- 'main/inc/lib/mimetex/*'
- 'main/inc/lib/nanogong/*'
- 'main/inc/lib/nusoap/*'
- 'main/inc/lib/opengraph/*'
- 'main/inc/lib/ppt2png/*'
- 'main/inc/lib/phpseclib'
- 'main/inc/lib/pear/*'
- 'main/inc/lib/phpmailer/*'
- 'main/inc/lib/phpseclib/*'
- 'main/inc/lib/svg-edit/*'
- 'main/inc/lib/swfobject/*'
- 'main/inc/lib/wami-recorder/*'
- 'main/inc/lib/xajax/*'
- 'main/lp/packaging/*'
- 'main/template/*'
- 'main/img/*'
- 'main/lang/*'
- 'main/default_course_document'
- 'plugin/buycourses/src/Culqi/*'
- 'plugin/buycourses/src/Requests/*'
- 'plugin/kannelsms/vendor/*'
- 'plugin/clockworksms/vendor/*'
- 'plugin/pens/lib/'
- 'tests/*'
- 'vendor/*'
- 'web/*'

@ -1,48 +0,0 @@
preset: symfony
enabled:
- class_keyword_remove
- combine_consecutive_unsets
- long_array_syntax
- newline_after_open_tag
- no_php4_constructor
- no_useless_else
- ordered_class_elements
- ordered_use
finder:
exclude:
- 'app/cache/*'
- 'app/logs/*'
- 'documentation/*'
- 'app/Migrations/*'
- 'app/Resources/*'
- 'main/admin/db.php'
- 'main/auth/cas/lib/CAS/*'
- 'main/inc/lib/browser/*'
- 'main/inc/lib/freemindflashbrowser/*'
- 'main/inc/lib/internationalization_database/*'
- 'main/inc/lib/javascript/*'
- 'main/inc/lib/kses-0.2.2/*'
- 'main/inc/lib/mimetex/*'
- 'main/inc/lib/nanogong/*'
- 'main/inc/lib/nusoap/*'
- 'main/inc/lib/opengraph/*'
- 'main/inc/lib/ppt2png/*'
- 'main/inc/lib/phpseclib'
- 'main/inc/lib/pear/*'
- 'main/inc/lib/phpmailer/*'
- 'main/inc/lib/phpseclib/*'
- 'main/inc/lib/svg-edit/*'
- 'main/inc/lib/swfobject/*'
- 'main/inc/lib/wami-recorder/*'
- 'main/inc/lib/xajax/*'
- 'main/lp/packaging/*'
- 'main/template/*'
- 'main/img/*'
- 'main/lang/*'
- 'main/default_course_document'
- 'fonts'
- 'tests/*'
- 'vendor/*'
- 'web/*'

@ -1,11 +0,0 @@
<?php
// HTTP404 page with neat styling
// 2011, Jean-Karim Bockstael <jeankarim@cblue.be>
// ErrorDocument 404 /404/
require_once '../main/inc/global.inc.php';
$msg = get_lang('FileNotFound');
Display::display_header($msg);
Display::display_error_message($msg);
Display::display_footer();

@ -23,8 +23,9 @@ $chamilo_langs = array(
);
$lang_match = $chamilo_langs[get_preferred_language($available_langs)];
// recover previous value ...
if (isset($_SESSION['user_language_choice']))
if (isset($_SESSION['user_language_choice'])) {
$lang_match = $_SESSION['user_language_choice'];
}
// Chamilo parameter, on logout
if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) {

@ -1,11 +1,11 @@
Chamilo LMS - elearning and course management software
Copyright (c) 2008-2012 BeezNest Latino SAC, Peru & BeezNest Belgium SPRL, Belgium
Copyright (c) 2008-2017 BeezNest Latino SAC, Peru & BeezNest Belgium SPRL, Belgium
Copyright (c) 2012 Université de Genève, Switzerland
Copyright (c) 2010-2012 Université de Grenoble, France
Copyright (c) 2010-2017 Université de Grenoble, France
Copyright (c) 2011-2012 CBlue SPRL, Belgium
Copyright (c) Juan Carlos Raña (independent), Spain
Copyright (c) 2004-2012 Juan Carlos Raña (independent), Spain
Copyright (c) 2004-2009 Dokeos SPRL, Belgium
Copyright (c) 2003-2007 Ghent University (UGent)
Copyright (c) 2001-2004 Universite catholique de Louvain (UCL)

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
*/
* This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
@ -18,7 +18,6 @@ if (!api_get_multiple_access_url()) {
}
$userGroup = new UserGroup();
$form_sent = 0;
$firstLetterUserGroup = null;
$courses = array();
@ -30,8 +29,8 @@ $tbl_user = Database:: get_main_table(TABLE_MAIN_USER);
$tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE);
$tool_name = get_lang('AddUserGroupToURL');
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
Display::display_header($tool_name);
@ -46,8 +45,8 @@ api_display_tool_title($tool_name);
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array() ;
$urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
$userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array();
$urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
$firstLetterUserGroup = $_POST['first_letter_user_group'];
if ($form_sent == 1) {
@ -84,10 +83,10 @@ $db_urls = Database::store_result($result);
<?php echo get_lang('FirstLetter'); ?> :
<select name="first_letter_user_group" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();">
<option value="">--</option>
<?php
<?php
echo Display::get_alphabet_options($firstLetterUserGroup);
echo Display::get_numeric_options(0, 9, $firstLetterUserGroup);
?>
?>
</select>
</td>
<td width="20%">&nbsp;</td>
@ -109,7 +108,7 @@ $db_urls = Database::store_result($result);
</td>
<td width="40%" align="center">
<select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
<?php foreach ($db_urls as $url_obj) { ?>
<?php foreach ($db_urls as $url_obj) { ?>
<option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?>
</option>
<?php } ?>

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
*/
* This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
@ -20,13 +20,13 @@ if (!api_get_multiple_access_url()) {
$form_sent = 0;
$first_letter_user = '';
$first_letter_course = '';
$courses = array ();
$courses = array();
$url_list = array();
$users = array();
$tbl_access_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_access_url = Database:: get_main_table(TABLE_MAIN_ACCESS_URL);
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER);
/* Header */
$tool_name = get_lang('AddUsersToURL');
@ -37,8 +37,9 @@ Display :: display_header($tool_name);
echo '<div class="actions">';
echo Display::url(
Display::return_icon('edit.png', get_lang('EditUsersToURL'),''),
api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php');
Display::return_icon('edit.png', get_lang('EditUsersToURL'), ''),
api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'
);
echo '</div>';
api_display_tool_title($tool_name);
@ -48,17 +49,18 @@ if ($_POST['form_sent']) {
$users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ;
$url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
$first_letter_user = $_POST['first_letter_user'];
foreach($users as $key => $value) {
foreach ($users as $key => $value) {
$users[$key] = intval($value);
}
if ($form_sent == 1) {
if (count($users) == 0 || count($url_list) == 0) {
Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL'));
Display:: display_error_message(
get_lang('AtLeastOneUserAndOneURL')
);
} else {
UrlManager::add_users_to_urls($users,$url_list);
Display :: display_confirmation_message(get_lang('UsersBelongURL'));
UrlManager::add_users_to_urls($users, $url_list);
Display:: display_confirmation_message(get_lang('UsersBelongURL'));
}
}
}
@ -115,13 +117,13 @@ unset($result);
<tr>
<td width="40%" align="center">
<select name="user_list[]" multiple="multiple" size="20" style="width:380px;">
<?php
<?php
foreach ($db_users as $user) {
?>
<option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
<?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
<?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
</option>
<?php
<?php
}
?>
</select>

@ -1,10 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Bart Mollet, Julio Montoya lot of fixes
* @package chamilo.admin
*/
/* INIT SECTION */
* @author Bart Mollet, Julio Montoya lot of fixes
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -14,25 +14,30 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
$tool_name = get_lang('SessionOverview');
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$url_id = api_get_current_access_url_id();
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$url_id = api_get_current_access_url_id();
$action = $_GET['action'];
switch($action) {
switch ($action) {
case 'add_user_to_url':
$user_id = $_REQUEST['user_id'];
$result = UrlManager::add_user_to_url($user_id, $url_id);
$user_info = api_get_user_info($user_id);
if ($result) {
$message = Display::return_message(get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']), 'confirm');
$message = Display::return_message(
get_lang('UserAdded').' '.api_get_person_name(
$user_info['firstname'],
$user_info['lastname']
),
'confirm'
);
}
break;
}
@ -44,9 +49,7 @@ if (!empty($message)) {
}
$multiple_url_is_on = api_get_multiple_access_url();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
$session_list = SessionManager::get_sessions_list();
$html = '';
@ -57,11 +60,9 @@ if ($show_users_with_problems) {
$html .= '<a href="'.api_get_self().'?show_users_with_problems=1">'.get_lang('ShowUsersNotAddedInTheURL').'</a>';
}
foreach($session_list as $session_item) {
foreach ($session_list as $session_item) {
$session_id = $session_item['id'];
$html .= '<h3>'.$session_item['name'].'</h3>';
$access_where = "(access_url_id = $url_id OR access_url_id is null )";
if ($show_users_with_problems) {
$access_where = "(access_url_id is null)";
@ -89,7 +90,6 @@ foreach($session_list as $session_item) {
}
$link_to_add_user_in_url = '';
if ($multiple_url_is_on) {
if ($user['access_url_id'] != $url_id) {
$user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), array(), ICON_SIZE_MEDIUM);

@ -1,8 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -51,7 +51,8 @@ if ($form->validate()) {
unlink($url_images_dir . $url_id . '_' . $image_field . '.png');
}
move_uploaded_file(
$_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png'
$_FILES[$image_field]['tmp_name'],
$url_images_dir.$url_id.'_'.$image_field.'.png'
);
}
// else fail silently

@ -7,7 +7,6 @@
// resetting the course id
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$xajax = new xajax();
@ -97,7 +96,6 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
}
Display::display_header($tool_name);
api_display_tool_title($tool_name);
$noUserGroupList = $userGroupList = array();

@ -35,13 +35,13 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdm
$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
$add_type = 'multiple';
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
$access_url_id = 1;
if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') {
$access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id'] != '') {
$access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
}
$xajax -> processRequests();
@ -157,23 +157,23 @@ $url_list = UrlManager::get_url_data();
<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
</div>
<br /><br />
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?> >
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?> >
<?php echo get_lang('SelectUrl').' : '; ?>
<select name="access_url_id" onchange="javascript:send();">
<option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
<?php
$url_selected='';
$url_selected = '';
foreach ($url_list as $url_obj) {
$checked = '';
if (!empty($access_url_id)) {
if ($url_obj[0]==$access_url_id) {
if ($url_obj[0] == $access_url_id) {
$checked = 'selected=true';
$url_selected=$url_obj[1];
$url_selected = $url_obj[1];
}
}
if ($url_obj['active']==1) {
if ($url_obj['active'] == 1) {
?>
<option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
<option <?php echo $checked; ?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
<?php
}
}
@ -196,7 +196,7 @@ $url_list = UrlManager::get_url_data();
<td align="center">
<div id="content_source">
<?php
if($ajax_search) {
if ($ajax_search) {
?>
<input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
<div id="ajax_list_courses"></div>
@ -205,7 +205,7 @@ $url_list = UrlManager::get_url_data();
?>
<select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
<?php
foreach($no_course_list as $no_course) {
foreach ($no_course_list as $no_course) {
?>
<option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
<?php
@ -220,7 +220,7 @@ $url_list = UrlManager::get_url_data();
</td>
<td width="10%" valign="middle" align="center">
<?php
if($ajax_search) {
if ($ajax_search) {
?>
<button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" >
<em class="fa fa-arrow-left"></em>
@ -243,7 +243,7 @@ $url_list = UrlManager::get_url_data();
<td align="center">
<select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
<?php
foreach($course_list as $course) {
foreach ($course_list as $course) {
$courseInfo = api_get_course_info_by_id($course['id']);
?>
<option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option>
@ -258,7 +258,7 @@ $url_list = UrlManager::get_url_data();
<td colspan="3" align="center">
<br />
<?php
if(isset($_GET['add']))
if (isset($_GET['add']))
echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
else
echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
@ -325,7 +325,6 @@ $url_list = UrlManager::get_url_data();
nosessionClasses = makepost(document.getElementById('origin_classes'));
sessionClasses = makepost(document.getElementById('destination_classes'));
xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
xhr_object.onreadystatechange = function() {
if(xhr_object.readyState == 4) {
document.getElementById('content_source').innerHTML = result = xhr_object.responseText;

@ -45,10 +45,8 @@ $htmlHeadXtra[] = '
function add_user_to_url(code, content) {
document.getElementById("course_to_add").value = "";
document.getElementById("ajax_list_courses").innerHTML = "";
destination = document.getElementById("destination_users");
destination.options[destination.length] = new Option(content,code);
destination.selectedIndex = -1;
sortOptions(destination.options);
}

@ -1,8 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
* @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com>
*/
// resetting the course id
$cidReset = true;
@ -48,10 +48,8 @@ $htmlHeadXtra[] = '<script>
function add_user_to_url(code, content) {
document.getElementById("user_to_add").value = "";
document.getElementById("ajax_list_users").innerHTML = "";
destination = document.getElementById("destination_users");
destination.options[destination.length] = new Option(content,code);
destination.selectedIndex = -1;
sortOptions(destination.options);
}

@ -79,16 +79,24 @@ foreach ($url_list as $my_url) {
$url_string .= $my_url['url'].' <br />';
}
}
if(!empty($url_string)) {
Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false);
if (!empty($url_string)) {
Display:: display_warning_message(
get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,
false
);
}
// checking the current installation
if ($current_access_url_id==-1) {
Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH));
} elseif(api_is_platform_admin()) {
$quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id);
if ($quant==0) {
if ($current_access_url_id == -1) {
Display::display_warning_message(
get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)
);
} elseif (api_is_platform_admin()) {
$quant = UrlManager::relation_url_user_exist(
api_get_user_id(),
$current_access_url_id
);
if ($quant == 0) {
Display:: display_warning_message(
'<a href="'.api_get_self().'?action=register&sec_token='.$parameters['sec_token'].'">'.get_lang('ClickToRegisterAdmin').'</a>',
false
@ -135,13 +143,13 @@ foreach ($sortable_data as $row) {
//Status
$active = $row['active'];
if ($active=='1') {
$action='lock';
$image='right';
if ($active == '1') {
$action = 'lock';
$image = 'right';
}
if ($active=='0') {
$action='unlock';
$image='wrong';
if ($active == '0') {
$action = 'unlock';
$image = 'wrong';
}
// you cannot lock the default
if ($row['id']=='1') {

@ -32,7 +32,6 @@ if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
}
$add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = '<script>
function add_user_to_session (code, content) {
@ -87,7 +86,6 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
}
}
// Filters
$filters = array(
array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')),
@ -201,11 +199,8 @@ echo '</div>';
echo '<div id="advanced_search_options" style="display:none">';
$searchForm->display();
echo '</div>';
?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
<?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
echo Display::input('hidden', 'id', $id);
echo Display::input('hidden', 'form_sent', '1');

@ -65,9 +65,9 @@ function validate_filter() {
</script>';
$form_sent = 0;
$errorMsg = '';
$users =$sessions=array();
$form_sent = 0;
$errorMsg = '';
$users = $sessions = array();
$promotion = new Promotion();
$id = intval($_GET['id']);
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@ -86,7 +86,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$promotion_data = $promotion->get($id);
$session_list = SessionManager::get_sessions_list(array(), array('name'));
$session_not_in_promotion = $session_in_promotion= array();
$session_not_in_promotion = $session_in_promotion = array();
if (!empty($session_list)) {
foreach ($session_list as $session) {

@ -98,15 +98,13 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
exit;
}
}
$data = $usergroup->get($id);
$session_list_in = $usergroup->get_sessions_by_usergroup($id);
$session_list = SessionManager::get_sessions_list(array(), array('name'));
//api_display_tool_title($tool_name.' ('.$session_info['name'].')');
$elements_not_in = $elements_in= array();
$data = $usergroup->get($id);
$session_list_in = $usergroup->get_sessions_by_usergroup($id);
$session_list = SessionManager::get_sessions_list(array(), array('name'));
$elements_not_in = $elements_in = array();
if (!empty($session_list)) {
foreach($session_list as $session) {
foreach ($session_list as $session) {
if (in_array($session['id'], $session_list_in)) {
$elements_in[$session['id']] = $session['name'];
} else {
@ -134,17 +132,19 @@ function search_usergroup_sessions($needle,$type) {
array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%"))
);
}
$i=0;
if ($type != 'single') {
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($session_list as $row ) {
foreach ($session_list as $row) {
if (!in_array($row['id'], array_keys($elements_in))) {
$return .= '<option value="'.$row['id'].'">'.$row['name'].'</option>';
}
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_multiple','innerHTML',api_utf8_encode($return));
$xajax_response->addAssign(
'ajax_list_multiple',
'innerHTML',
api_utf8_encode($return)
);
}
}
@ -176,10 +176,10 @@ echo '<div id="advancedSearch" style="display: none">'. get_lang('SearchSessions
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
<?php
echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
echo Display::input('hidden','id',$id);
echo Display::input('hidden','form_sent','1');
echo Display::input('hidden','add_type',null);
if(!empty($errorMsg)) {
echo Display::input('hidden', 'id', $id);
echo Display::input('hidden', 'form_sent', '1');
echo Display::input('hidden', 'add_type', null);
if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg); //main API
}
?>
@ -266,7 +266,7 @@ if(!empty($errorMsg)) {
</table>
</form>
<script type="text/javascript">
<script>
function moveItem(origin , destination) {
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {

@ -16,7 +16,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$form = new FormValidator('archive_cleanup_form', 'post', '', '', array(), FormValidator::LAYOUT_BOX);
$form->addButtonSend(get_lang('ArchiveDirCleanupProceedButton'));

@ -18,8 +18,14 @@ $this_section = SECTION_PLATFORM_ADMIN;
$htmlHeadXtra[] = api_get_jqgrid_js();
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'career_dashboard.php','name' => get_lang('CareersAndPromotions'));
$interbreadcrumb[] = array(
'url' => 'index.php',
'name' => get_lang('PlatformAdmin')
);
$interbreadcrumb[] = array(
'url' => 'career_dashboard.php',
'name' => get_lang('CareersAndPromotions')
);
Display :: display_header(null);
@ -142,19 +148,19 @@ if (!empty($career_arrayer)) {
if (!empty($sessions)) {
foreach ($sessions as $session) {
$course_list = $session['courses'];
$url = Display::url($session['data']['name'],
'../session/resume_session.php?id_session=' . $session['data']['id']);
$url = Display::url(
$session['data']['name'],
'../session/resume_session.php?id_session='.$session['data']['id']
);
echo '<tr>';
//Session name
// Session name
echo Display::tag('td', $url);
echo '<td>';
//Courses
// Courses
echo '<table>';
if (!empty($course_list)) {
foreach ($course_list as $course) {
echo '<tr>';
$url = Display::url(
$course['title'],
api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . $session['data']['id']

@ -6,9 +6,7 @@
* @author Arnaud Ligot, CBlue SPRL
* @package chamilo.admin.cli
*/
/**
* Init section
*/
// we are in the admin area so we do not need a course id
$cidReset = true;
// include global script

@ -17,56 +17,56 @@ $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$message = '';
if (isset($_POST['activeExtension'])) {
switch ($_POST['extension_code']) {
case 'ppt2lp':
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="true"
WHERE variable="service_ppt2lp"
AND subkey="active"';
switch ($_POST['extension_code']) {
case 'ppt2lp':
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="true"
WHERE variable="service_ppt2lp"
AND subkey="active"';
$rs = Database::query($sql);
$rs = Database::query($sql);
if (Database::affected_rows($rs)>0){
$message = get_lang('ServiceActivated');
}
if (Database::affected_rows($rs) > 0) {
$message = get_lang('ServiceActivated');
}
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['host']).'"
WHERE variable="service_ppt2lp"
AND subkey="host"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['host']).'"
WHERE variable="service_ppt2lp"
AND subkey="host"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['port']).'"
WHERE variable="service_ppt2lp"
AND subkey="port"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['port']).'"
WHERE variable="service_ppt2lp"
AND subkey="port"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['ftp_password']).'"
WHERE variable="service_ppt2lp"
AND subkey="ftp_password"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['ftp_password']).'"
WHERE variable="service_ppt2lp"
AND subkey="ftp_password"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['user']).'"
WHERE variable="service_ppt2lp"
AND subkey="user"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['user']).'"
WHERE variable="service_ppt2lp"
AND subkey="user"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['path_to_lzx']).'"
WHERE variable="service_ppt2lp"
AND subkey="path_to_lzx"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['path_to_lzx']).'"
WHERE variable="service_ppt2lp"
AND subkey="path_to_lzx"';
Database::query($sql);
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['size']).'"
WHERE variable="service_ppt2lp"
AND subkey="size"';
Database::query($sql);
break;
}
$sql = 'UPDATE '.$tbl_settings_current.' SET
selected_value="'.addslashes($_POST['size']).'"
WHERE variable="service_ppt2lp"
AND subkey="size"';
Database::query($sql);
break;
}
}
$listActiveServices = array();
@ -76,18 +76,18 @@ $sql = 'SELECT variable FROM '.$tbl_settings_current.'
WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
$rs = Database::query($sql);
while($row = Database::fetch_array($rs)){
$listActiveServices[] = $row['variable'];
while ($row = Database::fetch_array($rs)) {
$listActiveServices[] = $row['variable'];
}
// javascript to handle accordion behaviour
$javascript_message = '';
if(!empty($message)){
$javascript_message = '
document.getElementById("message").style.display = "block";
var timer = setTimeout(hideMessage, 5000);';
if (!empty($message)) {
$javascript_message = '
document.getElementById("message").style.display = "block";
var timer = setTimeout(hideMessage, 5000);';
}
$htmlHeadXtra[]= '<script>
$htmlHeadXtra[] = '<script>
var listeDiv;
var extensionsHeader = new Array();
var extensionsContent = new Array();
@ -135,7 +135,7 @@ Display::display_header($nameTool);
?>
<div id="message" style="display: none">
<?php
if(!empty($message))
if (!empty($message))
Display::display_normal_message($message)
?>
</div>

@ -46,7 +46,7 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdm
$tool_name = get_lang('ConfigureInscription');
if (!empty($action)) {
$interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription'));
switch($action) {
switch ($action) {
case 'edit_top':
$tool_name = get_lang('EditTopRegister');
break;

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @package chamilo.admin
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -1,29 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script allows a platform admin to add dummy content to a course.
*
* @author Bart Mollet <bart.mollet@hogent.be>
* @package chamilo.admin
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section=SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$tool_name = get_lang('DummyCourseCreator');
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
if (api_get_setting('server_type') != 'test') {
echo get_lang('DummyCourseOnlyOnTestServer');
} elseif( isset($_POST['action'])) {
require_once('../coursecopy/classes/DummyCourseCreator.class.php');
$dcc = new DummyCourseCreator();
$dcc->create_dummy_course($_POST['course_code']);
echo get_lang('Done');
} else {
echo get_lang('DummyCourseDescription');
echo '<form method="post"><input type="hidden" name="course_code" value="'.Security::remove_XSS($_GET['course_code']).'"/><input type="submit" name="action" value="'.get_lang('Ok').'"/></form>';
}
Display::display_footer();

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @package chamilo.admin
*/
$cidReset = true;
@ -59,7 +59,7 @@ if (api_is_multiple_url_enabled()) {
ON (u.user_id=url_rel_user.user_id)
WHERE
url_rel_user.access_url_id=" . api_get_current_access_url_id() . " AND
status=1" . $order_clause;
status = 1" . $order_clause;
} else {
$sql = "SELECT user_id, lastname, firstname
FROM $table_user WHERE status='1'" . $order_clause;

@ -89,26 +89,26 @@ function import_pdfs($file, $subDir = '/')
{
$baseDir = api_get_path(SYS_ARCHIVE_PATH);
$uploadPath = 'pdfimport/';
$errors = array ();
$errors = array();
if (!is_dir($baseDir.$uploadPath)) {
@mkdir($baseDir.$uploadPath);
}
if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024*1024*1024)) {
if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024 * 1024 * 1024)) {
error_log('Could not unzip uploaded file in '.__FILE__.', line '.__LINE__);
return $errors;
}
$list = scandir($baseDir.$uploadPath);
$i = 0;
foreach ($list as $file) {
if (substr($file,0,1) == '.' or !is_file($baseDir.$uploadPath.$file)) {
if (substr($file, 0, 1) == '.' or !is_file($baseDir.$uploadPath.$file)) {
continue;
}
$parts = preg_split('/_/',$file);
$parts = preg_split('/_/', $file);
$course = api_get_course_info($parts[0]);
if (count($course) > 0) {
// Build file info because handle_uploaded_document() needs it (name, type, size, tmp_name)
$fileSize = filesize($baseDir.$uploadPath.$file);
$docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2],0,-4));
$docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2], 0, -4));
if ($docId > 0) {
if (!is_file($baseDir.$uploadPath.$file)) {
error_log($baseDir.$uploadPath.$file.' does not exists in '.__FILE__);

@ -26,11 +26,11 @@ function get_number_of_courses()
api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1
) {
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql.= " INNER JOIN $access_url_rel_course_table url_rel_course
$sql .= " INNER JOIN $access_url_rel_course_table url_rel_course
ON (c.id = url_rel_course.c_id)";
}
if (isset ($_GET['keyword'])) {
if (isset($_GET['keyword'])) {
$keyword = Database::escape_string("%".$_GET['keyword']."%");
$sql .= " WHERE (
c.title LIKE '".$keyword."' OR
@ -62,7 +62,7 @@ function get_number_of_courses()
if ((api_is_platform_admin() || api_is_session_admin()) &&
api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1
) {
$sql.= " AND url_rel_course.access_url_id = ".api_get_current_access_url_id();
$sql .= " AND url_rel_course.access_url_id = ".api_get_current_access_url_id();
}
$res = Database::query($sql);
@ -101,11 +101,11 @@ function get_course_data($from, $number_of_items, $column, $direction)
api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1
) {
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql.= " INNER JOIN $access_url_rel_course_table url_rel_course
$sql .= " INNER JOIN $access_url_rel_course_table url_rel_course
ON (course.id = url_rel_course.c_id)";
}
if (isset ($_GET['keyword'])) {
if (isset($_GET['keyword'])) {
$keyword = Database::escape_string("%".trim($_GET['keyword'])."%");
$sql .= " WHERE (
title LIKE '".$keyword."' OR
@ -136,7 +136,7 @@ function get_course_data($from, $number_of_items, $column, $direction)
if ((api_is_platform_admin() || api_is_session_admin()) &&
api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1
) {
$sql.= " AND url_rel_course.access_url_id=".api_get_current_access_url_id();
$sql .= " AND url_rel_course.access_url_id=".api_get_current_access_url_id();
}
$sql .= " ORDER BY col$column $direction ";
@ -206,13 +206,13 @@ function get_course_data_by_session($from, $number_of_items, $column, $direction
if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
$sessionId = intval($_GET['session_id']);
$sql.= " WHERE s.id = ".$sessionId;
$sql .= " WHERE s.id = ".$sessionId;
}
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql);
$courses = array ();
$courses = array();
while ($course = Database::fetch_array($res)) {
// Place colour icons in front of courses.
$show_visual_code = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null;
@ -254,7 +254,7 @@ function modify_courses_filter($code)
*/
function get_course_visibility_icon($v) {
$style = 'margin-bottom:0;margin-right:5px;';
switch($v) {
switch ($v) {
case 0:
return Display::return_icon('bullet_red.png', get_lang('CourseVisibilityClosed'), array('style' => $style));
break;
@ -341,7 +341,7 @@ if (isset ($_GET['search']) && $_GET['search'] === 'advanced') {
$form->setDefaults($defaults);
$content .= $form->returnForm();
} else {
$interbreadcrumb[] = array ('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('CourseList');
if (isset($_GET['delete_course'])) {
CourseManager::delete_course($_GET['delete_course']);
@ -353,7 +353,7 @@ if (isset ($_GET['search']) && $_GET['search'] === 'advanced') {
$form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
$form->addElement('text', 'keyword', null, array('id' => 'course-search-keyword'));
$form->addButtonSearch(get_lang('SearchCourse'));
$advanced = '<a class="btn btn-default" href="'. api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> '.get_lang('AdvancedSearch').'</a>';
$advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> '.get_lang('AdvancedSearch').'</a>';
// Create a filter by session
$sessionFilter = new FormValidator('course_filter', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
@ -374,10 +374,10 @@ if (isset ($_GET['search']) && $_GET['search'] === 'advanced') {
$courseListUrl = api_get_self();
$actions .= '<div class="row">';
$actions .= '<div class="col-md-2">';
$actions .= '<a href="course_add.php">'.Display::return_icon('new_course.png', get_lang('AddCourse'),'',ICON_SIZE_MEDIUM).'</a> ';
$actions .= '<a href="course_add.php">'.Display::return_icon('new_course.png', get_lang('AddCourse'), '', ICON_SIZE_MEDIUM).'</a> ';
if (api_get_setting('course_validation') === 'true') {
$actions .= '<a href="course_request_review.php">'.
Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests'), '', ICON_SIZE_MEDIUM).'</a>';
}
$actions .= '</div>';
$actions .= '<div class="col-md-4">';
@ -415,10 +415,10 @@ if (isset ($_GET['search']) && $_GET['search'] === 'advanced') {
$table = new SortableTable('courses', 'get_number_of_courses', 'get_course_data', 2, 20, 'ASC', 'course-list');
}
$parameters=array();
$parameters = array();
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
$parameters = array('keyword' => Security::remove_XSS($_GET['keyword']));
} elseif (isset ($_GET['keyword_code'])) {
$parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']);
$parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']);

@ -14,9 +14,7 @@
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
// A check whether the course validation feature is enabled.
@ -28,7 +26,6 @@ $message = isset($_GET['message']) ? trim(Security::remove_XSS(stripslashes(urld
$is_error_message = !empty($_GET['is_error_message']);
if ($course_validation_feature) {
/**
* Deletion of a course request.
*/
@ -50,7 +47,7 @@ if ($course_validation_feature) {
elseif (isset($_POST['action'])) {
switch ($_POST['action']) {
// Delete selected courses
case 'delete_course_requests' :
case 'delete_course_requests':
$course_requests = $_POST['course_request'];
if (is_array($_POST['course_request']) && !empty($_POST['course_request'])) {
$success = true;
@ -87,7 +84,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
$from = intval($from);
$number_of_items = intval($number_of_items);
$column = intval($column);
$direction = !in_array(strtolower(trim($direction)), ['asc','desc']) ? 'asc' : $direction;
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$sql = "SELECT
id AS col0,

@ -22,7 +22,6 @@ $id = intval($_GET['id']);
$caller = intval($_GET['caller']);
if ($course_validation_feature) {
// Retrieve request's data from the corresponding database record.
$course_request_info = CourseRequestManager::get_course_request_info($id);
if (!is_array($course_request_info)) {
@ -30,7 +29,6 @@ if ($course_validation_feature) {
$message = get_lang('CourseRequestHasNotBeenFound');
$is_error_message = true;
} else {
// Ensure the database prefix + database name do not get over 40 characters.
$maxlength = 40;
@ -225,7 +223,8 @@ if ($course_validation_feature) {
// Functions.
// Converts the given numerical id to the name of the page that opened this editor.
function get_caller_name($caller_id) {
function get_caller_name($caller_id)
{
switch ($caller_id) {
case 1:
return 'course_request_accepted.php';

@ -30,7 +30,6 @@ $message = isset($_GET['message']) ? trim(Security::remove_XSS(stripslashes(urld
$is_error_message = !empty($_GET['is_error_message']);
if ($course_validation_feature) {
/**
* Acceptance and creation of the requested course.
*/
@ -77,7 +76,7 @@ if ($course_validation_feature) {
*/
switch ($_POST['action']) {
// Delete selected courses
case 'delete_course_requests' :
case 'delete_course_requests':
$course_requests = $_POST['course_request'];
if (is_array($_POST['course_request']) && !empty($_POST['course_request'])) {
$success = true;
@ -99,7 +98,8 @@ if ($course_validation_feature) {
/**
* Get the number of courses which will be displayed.
*/
function get_number_of_requests() {
function get_number_of_requests()
{
return CourseRequestManager::count_course_requests(COURSE_REQUEST_REJECTED);
}
@ -165,7 +165,6 @@ function modify_filter($id) {
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
$tool_name = get_lang('RejectedCourseRequests');
Display :: display_header($tool_name);

@ -33,7 +33,6 @@ $is_error_message = isset($_GET['is_error_message']) ? !empty($_GET['is_error_me
$keyword = isset($_GET['keyword']) ? Database::escape_string(trim($_GET['keyword'])) : '';
if ($course_validation_feature) {
/**
* Course acceptance and creation.
*/

@ -26,7 +26,7 @@ function validate_data($users_courses)
}
// 2. Check whether coursecode exists.
if (isset ($user_course['CourseCode']) && strlen($user_course['CourseCode']) != 0) {
if (isset($user_course['CourseCode']) && strlen($user_course['CourseCode']) != 0) {
// 2.1 Check whethher code has been allready used by this CVS-file.
if (!isset($coursecodes[$user_course['CourseCode']])) {
// 2.1.1 Check whether course with this code exists in the system.
@ -44,7 +44,7 @@ function validate_data($users_courses)
}
// 3. Check whether username exists.
if (isset ($user_course['UserName']) && strlen($user_course['UserName']) != 0) {
if (isset($user_course['UserName']) && strlen($user_course['UserName']) != 0) {
if (UserManager::is_username_available($user_course['UserName'])) {
$user_course['error'] = get_lang('UnknownUser');
$errors[] = $user_course;
@ -52,7 +52,7 @@ function validate_data($users_courses)
}
// 4. Check whether status is valid.
if (isset ($user_course['Status']) && strlen($user_course['Status']) != 0) {
if (isset($user_course['Status']) && strlen($user_course['Status']) != 0) {
if ($user_course['Status'] != COURSEMANAGER && $user_course['Status'] != STUDENT) {
$user_course['error'] = get_lang('UnknownStatus');
$errors[] = $user_course;

@ -44,12 +44,12 @@ if (UserManager::is_admin($user_id)) {
}
$add_type = 'multiple';
if(isset($_GET['add_type']) && $_GET['add_type']!='') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
if (!api_is_platform_admin()) {
api_not_allowed(true);
api_not_allowed(true);
}
function search_courses($needle, $type)
@ -60,8 +60,7 @@ function search_courses($needle, $type)
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$needle = Database::escape_string($needle);
$needle = Database::escape_string($needle);
$assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm);
foreach ($assigned_courses_code as &$value) {
@ -90,14 +89,14 @@ function search_courses($needle, $type)
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" >';
while ($course = Database :: fetch_array($rs)) {
$return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'],ENT_QUOTES).'">'.$course['title'].' ('.$course['code'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
}
return $xajax_response;
$return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" >';
while ($course = Database :: fetch_array($rs)) {
$return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'],ENT_QUOTES).'">'.$course['title'].' ('.$course['code'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
}
return $xajax_response;
}
$xajax->processRequests();
@ -160,7 +159,7 @@ $msg = '';
if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
$courses_list = isset($_POST['CoursesList']) ? $_POST['CoursesList'] : [];
$affected_rows = CourseManager::subscribeCoursesToDrhManager($user_id, $courses_list);
if ($affected_rows) {
if ($affected_rows) {
$msg = get_lang('AssignedCoursesHaveBeenUpdatedSuccessfully');
}
}

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */
/**
* Interface for assigning sessions to Human Resources Manager
* @package chamilo.admin
* Interface for assigning sessions to Human Resources Manager
* @package chamilo.admin
*/
// resetting the course id
$cidReset = true;
@ -88,7 +88,11 @@ function search_sessions($needle, $type)
$return .= '<option value="'.$session['id'].'" title="'.htmlspecialchars($session['name'],ENT_QUOTES).'">'.$session['name'].'</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_sessions_multiple','innerHTML',api_utf8_encode($return));
$xajax_response->addAssign(
'ajax_list_sessions_multiple',
'innerHTML',
api_utf8_encode($return)
);
}
return $xajax_response;

@ -2,9 +2,9 @@
/* For licensing terms, see /license.txt */
/**
* Interface for assigning users to Human Resources Manager
* @package chamilo.admin
*/
* Interface for assigning users to Human Resources Manager
* @package chamilo.admin
*/
// resetting the course id
$cidReset = true;

@ -4,9 +4,7 @@
* Definition of new system event types
* @package chamilo.admin.events
*/
/**
* Init and access validation
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -49,9 +47,7 @@ if ($action == 'modEventType') {
}
$ets = Event::get_all_event_types();
$languages = api_get_languages();
$ajaxPath = api_get_path(WEB_CODE_PATH) . 'inc/ajax/events.ajax.php';
$action_array = array(

@ -6,9 +6,7 @@
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
Display::display_header(null);
$form = new FormValidator('export_certificate');

@ -9,7 +9,6 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
api_protect_admin_script();
@ -18,7 +17,7 @@ api_protect_admin_script();
$htmlHeadXtra[] = api_get_jqgrid_js();
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tool_name = null;
@ -39,23 +38,23 @@ $check = Security::check_token('request');
$token = Security::get_token();
if ($action == 'add') {
$interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
$interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],'name' => $extra_field_info['display_text']);
$interbreadcrumb[]=array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Add'));
$interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
$interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']);
$interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
} elseif ($action == 'edit') {
$interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
$interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],'name' => $extra_field_info['display_text']);
$interbreadcrumb[]=array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
$interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
$interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']);
$interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
} else {
$interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
$interbreadcrumb[]=array(
$interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
$interbreadcrumb[] = array(
'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
'name' => $extra_field_info['display_text']
);
$interbreadcrumb[]=array('url' => '#','name' => get_lang('EditExtraFieldOptions'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditExtraFieldOptions'));
}
//jqgrid will use this URL to do the selects
@ -108,12 +107,12 @@ $extra_params['height'] = 'auto';
//With this function we can add actions to the jgrid (edit, delete, etc)
$action_links = 'function action_formatter(cellvalue, options, rowObject) {
return \'<a href="?action=edit&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(get_lang("ConfirmYourChoice"))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
return \'<a href="?action=edit&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(get_lang("ConfirmYourChoice"))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'.
'\';
}';
$htmlHeadXtra[]='<script>
$htmlHeadXtra[] = '<script>
$(function() {
// grid definition see the $obj->display() function
'.Display::grid_js(

@ -13,9 +13,6 @@
* @since Dokeos 1.6
* @package chamilo.admin
*/
/**
* INIT SECTION
*/
// we are in the admin area so we do not need a course id
$cidReset = true;

@ -9,7 +9,7 @@
* Code
*/
// resetting the course id
$cidReset=true;
$cidReset = true;
require_once('../inc/global.inc.php');
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
@ -17,11 +17,11 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
require('../auth/ldap/authldap.php');
$annee_base=date('Y');
$annee_base = date('Y');
$tool_name = get_lang('LDAPImport');
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var buttoncheck = 1;
@ -64,7 +64,7 @@ if (empty($annee) && empty($id_session))
echo '</div>';
}
elseif(!empty($annee) && empty($id_session))
elseif (!empty($annee) && empty($id_session))
{
Display::display_header($tool_name);
echo '<div style="align:center">';
@ -75,14 +75,14 @@ elseif(!empty($annee) && empty($id_session))
echo '<select name="id_session">';
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " .
$sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date ".
" FROM $tbl_session ".
" ORDER BY name";
$result = Database::query($sql);
$sessions=Database::store_result($result);
$nbr_results=count($sessions);
foreach($sessions as $row) {
$sessions = Database::store_result($result);
$nbr_results = count($sessions);
foreach ($sessions as $row) {
echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
}
echo '</select>';
@ -114,7 +114,7 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed']))
$info = ldap_get_entries($ds, $sr);
for ($key = 0; $key < $info["count"]; $key ++) {
for ($key = 0; $key < $info["count"]; $key++) {
$nom_form[] = $info[$key]["sn"][0];
$prenom_form[] = $info[$key]["givenname"][0];
$email_form[] = $info[$key]["mail"][0];
@ -134,7 +134,7 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed']))
asort($nom_form);
reset($nom_form);
$statut=5;
$statut = 5;
include ('ldap_form_add_users_group.php');
} else {
echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
@ -145,24 +145,24 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed']))
echo '</div>';
}
elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes'))
{
$id=$_POST['username_form'];
$UserList=array();
$id = $_POST['username_form'];
$UserList = array();
$userid_match_login = array();
foreach ($id as $form_index=>$user_id)
{
if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
{
$tmp = ldap_add_user($user_id);
$UserList[]= $tmp;
$UserList[] = $tmp;
$userid_match_login[$tmp] = $user_id;
}
}
if (!empty($_POST['id_session'])) {
$num = 0;
$tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
foreach ($UserList as $user_id) {
$res_user = Database::insert(
$tbl_session_user,
@ -177,7 +177,7 @@ elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
}
}
if($num>0) {
if ($num > 0) {
$sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
$res = Database::query($sql);
}
@ -205,8 +205,8 @@ elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
else
{
Display::display_header($tool_name);
$message=get_lang('NoUserAdded');
Display :: display_normal_message($message,false);
$message = get_lang('NoUserAdded');
Display :: display_normal_message($message, false);
}
echo '<br /><br />';
echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';

@ -37,7 +37,7 @@ if (isset($_GET['skill_id'])) {
$url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$load_user";
$tpl->assign('wheel_url', $url);
$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$tpl->assign('url', $url);
$tpl->assign('isAdministration', true);

@ -11,7 +11,7 @@ require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
// User permissions
api_protect_admin_script();
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
Display :: display_header(get_lang('SystemStatus'));
$diag = new Diagnoser();
$diag->show_html();

@ -13,8 +13,8 @@ api_protect_admin_script();
$tool_name = get_lang('Export');
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ('url' => 'usergroups.php', 'name' => get_lang('Classes'));
$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
set_time_limit(0);

@ -15,16 +15,16 @@ api_protect_limit_for_session_admin();
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
if ($action == 'add') {
$interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes'));
$interbreadcrumb[] = array('url' => '#','name' => get_lang('Add'));
$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
} elseif ($action == 'edit') {
$interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes'));
$interbreadcrumb[] = array('url' => '#','name' => get_lang('Edit'));
$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
} else {
$interbreadcrumb[] = array('url' => '#','name' => get_lang('Classes'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Classes'));
}
// The header.
@ -55,13 +55,13 @@ $columns = array(
);
//Column config
$column_model = array(
array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'),
array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'),
array('name'=>'courses', 'index'=>'courses', 'width'=>'15', 'align'=>'left'),
array('name'=>'sessions', 'index'=>'sessions', 'width'=>'15', 'align'=>'left'),
array('name'=>'group_type', 'index'=>'group_type', 'width'=>'15', 'align'=>'center'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'center', 'sortable'=>'false','formatter'=>'action_formatter'),
$column_model = array(
array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'),
array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'),
array('name'=>'courses', 'index'=>'courses', 'width'=>'15', 'align'=>'left'),
array('name'=>'sessions', 'index'=>'sessions', 'width'=>'15', 'align'=>'left'),
array('name'=>'group_type', 'index'=>'group_type', 'width'=>'15', 'align'=>'center'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'center', 'sortable'=>'false', 'formatter'=>'action_formatter'),
);
//Autowidth
@ -73,11 +73,11 @@ $extra_params['sortorder'] = 'desc';
//With this function we can add actions to the jgrid
$action_links = 'function action_formatter (cellvalue, options, rowObject) {
return \''
.' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('user_to_class.png', get_lang('SubscribeUsersToClass'), null, ICON_SIZE_MEDIUM) . '</a>'
.' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('course_to_class.png', get_lang('SubscribeClassToCourses'), null, ICON_SIZE_MEDIUM) . '</a>'
.' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('sessions_to_class.png', get_lang('SubscribeClassToSessions'), null, ICON_SIZE_MEDIUM) . '</a>'
.' <a href="?action=edit&id=\'+options.rowId+\'">' . Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_SMALL) . '</a>'
.' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'">' . Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_SMALL) . '</a>\';
.' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('user_to_class.png', get_lang('SubscribeUsersToClass'), null, ICON_SIZE_MEDIUM).'</a>'
.' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('course_to_class.png', get_lang('SubscribeClassToCourses'), null, ICON_SIZE_MEDIUM).'</a>'
.' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('sessions_to_class.png', get_lang('SubscribeClassToSessions'), null, ICON_SIZE_MEDIUM).'</a>'
.' <a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_SMALL).'</a>'
.' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_SMALL).'</a>\';
}';
?>
@ -135,7 +135,7 @@ if ($action == 'add') {
} else {
echo '<div class="actions">';
echo '<a href="'.api_get_self().'">'.
Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$token = Security::get_token();
$form->addElement('hidden', 'sec_token');

@ -378,6 +378,9 @@ switch ($action) {
$nameTools = $form_name;
$form->addElement('header', $form_name);
$form->addButtonAdvancedSettings('choose_recipients', [get_lang('ChooseRecipients'), get_lang('AnnouncementChooseRecipientsDescription')]);
$form->addHtml('<div id="choose_recipients_options" style="display: none;">');
$to = [];
if (empty($group_id)) {
if (isset($_GET['remind_inactive'])) {
@ -432,21 +435,16 @@ switch ($action) {
}
$element = CourseManager::addUserGroupMultiSelect($form, array());
$form->setRequired($element);
if (!isset($announcement_to_modify)) {
$announcement_to_modify = '';
}
$form->addCheckBox('email_ann', '', get_lang('EmailOption'));
} else {
if (!isset($announcement_to_modify)) {
$announcement_to_modify = '';
}
$element = CourseManager::addGroupMultiSelect($form, $group_properties['iid'], array());
$form->setRequired($element);
$form->addCheckBox('email_ann', '', get_lang('EmailOption'));
}
$form->addHtml('</div>');
// $form->setRequired($element);
$form->addCheckBox('email_ann', '', get_lang('EmailOption'));
if (!isset($announcement_to_modify)) {
$announcement_to_modify = '';
}
$announcementInfo = AnnouncementManager::get_by_id($course_id, $id);
@ -467,6 +465,25 @@ switch ($action) {
}
}
if (isset($defaults['users'])) {
foreach ($defaults['users'] as $value) {
$parts = explode(':', $value);
if (!isset($parts[1]) || empty($parts[1])) {
continue;
}
$form->addHtml("
<script>
$(document).on('ready', function () {
$('#choose_recipients').click();
});
</script>
");
break;
}
}
$defaults['email_ann'] = true;
$form->addElement('text', 'title', get_lang('EmailTitle'));
@ -506,6 +523,7 @@ switch ($action) {
if ($form->validate()) {
$data = $form->getSubmitValues();
$data['users'] = isset($data['users']) ? $data['users'] : ['everyone'];
$sendToUsersInSession = isset($data['send_to_users_in_session']) ? true : false;

@ -43,7 +43,9 @@ if (is_dir($full_file_name)) {
//remove last slash if present
//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
//mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
while ($doc_url{$dul = strlen($doc_url)-1}=='/') {
$doc_url = substr($doc_url,0,$dul);
}
//create the path
$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
//redirect

@ -12,7 +12,7 @@ api_protect_course_script(true);
// error messages
if (isset($error)) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
if (!isset($error)) {
@ -49,18 +49,18 @@ $form->addHtmlEditor(
if (Gradebook::is_active()) {
if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify_options" style="display:block">');
$form->addElement('html', '<div id="id_qualify_options" style="display:block">');
$form->addElement(
'checkbox',
'attendance_qualify_gradebook',
'',
get_lang('QualifyAttendanceGradebook'),
array('checked'=>'true','onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}')
array('checked'=>'true', 'onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}')
);
$form->addElement('html','<div id="options_field" style="display:block">');
$form->addElement('html', '<div id="options_field" style="display:block">');
} else {
$form->addButtonAdvancedSettings('id_qualify');
$form->addElement('html','<div id="id_qualify_options" style="display:none">');
$form->addElement('html', '<div id="id_qualify_options" style="display:none">');
$form->addElement(
'checkbox',
'attendance_qualify_gradebook',
@ -68,7 +68,7 @@ if (Gradebook::is_active()) {
get_lang('QualifyAttendanceGradebook'),
'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'
);
$form->addElement('html','<div id="options_field" style="display:none">');
$form->addElement('html', '<div id="options_field" style="display:none">');
}
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));

@ -5,7 +5,7 @@ require_once dirname(__FILE__).'/../../inc/global.inc.php';
$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php';
if (! isset($_SESSION['conditional_login']['uid']))
die("Not Authorised");
die("Not Authorised");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">

@ -23,7 +23,7 @@ require_once __DIR__.'/../inc/global.inc.php';
// Forbidden to retrieve the lost password
if (api_get_setting('allow_lostpassword') == 'false') {
api_not_allowed(true);
api_not_allowed(true);
}
$reset = Request::get('reset');

@ -205,7 +205,7 @@ class ShibbolethTest
$message = "Assert failed $message <br/>";
echo $message;
// Dump variable for debug
error_log(print_r(debug_backtrace(),1));
error_log(print_r(debug_backtrace(), 1));
die;
}
else

@ -21,7 +21,7 @@ $current_course_tool = TOOL_BLOGS;
api_protect_course_script(true);
$lib_path = api_get_path(LIBRARY_PATH);
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$nameTools = get_lang('Blogs');
$DaysShort = api_get_week_days_short();
@ -134,7 +134,7 @@ if (!empty($_POST['new_task_execution_submit'])) {
$safe_comment_title,
$safe_comment_text,
$blog_id,
(int)$_GET['post_id'],
(int) $_GET['post_id'],
$_POST['comment_parent_id'],
$_POST['task_id']
);
@ -146,29 +146,29 @@ if (!empty($_POST['new_task_execution_submit'])) {
if (!empty($_POST['register'])) {
if (is_array($_POST['user'])) {
foreach ($_POST['user'] as $index => $user_id) {
Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id);
Blog :: set_user_subscribed((int) $_GET['blog_id'], $user_id);
}
}
}
if (!empty($_POST['unregister'])) {
if (is_array($_POST['user'])) {
foreach ($_POST['user'] as $index => $user_id) {
Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id);
Blog :: set_user_unsubscribed((int) $_GET['blog_id'], $user_id);
}
}
}
if (!empty($_GET['register'])) {
Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
Blog :: set_user_subscribed((int) $_GET['blog_id'], (int) $_GET['user_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered'));
$flag = 1;
}
if (!empty($_GET['unregister'])) {
Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
Blog :: set_user_unsubscribed((int) $_GET['blog_id'], (int) $_GET['user_id']);
}
if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
if (isset($_GET['do']) && $_GET['do'] == 'delete') {
Blog :: delete_task($blog_id, (int)$_GET['task_id']);
Blog :: delete_task($blog_id, (int) $_GET['task_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted'));
}
@ -181,9 +181,9 @@ if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
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') {
if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) {
Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']);
Blog :: delete_comment($blog_id, (int) $_GET['post_id'], (int) $_GET['comment_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted'));
} else {
$error = true;
@ -191,9 +191,9 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
}
}
if (isset($_GET['do']) && $_GET['do'] == 'delete_article') {
if (isset($_GET['do']) && $_GET['do'] == 'delete_article') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) {
Blog :: delete_post($blog_id, (int)$_GET['article_id']);
Blog :: delete_post($blog_id, (int) $_GET['article_id']);
$action = ''; // Article is gone, go to blog home
$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted'));
} else {
@ -204,13 +204,13 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
if (isset($_GET['do']) && $_GET['do'] == 'rate') {
if (isset($_GET['type']) && $_GET['type'] == 'post') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) {
Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']);
Blog :: add_rating('post', $blog_id, (int) $_GET['post_id'], (int) $_GET['rating']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
}
}
if (isset($_GET['type']) && $_GET['type'] == 'comment') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']);
Blog :: add_rating('comment', $blog_id, (int) $_GET['comment_id'], (int) $_GET['rating']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
}
}
@ -289,16 +289,16 @@ if (!empty($return_message)) {
echo '<div class=actions>';
?>
<a href="<?php echo api_get_self(); ?>?blog_id=<?php echo $blog_id ?>&<?php echo api_get_cidreq(); ?>" title="<?php echo get_lang('Home') ?>">
<?php echo Display::return_icon('blog.png', get_lang('Home'),'',ICON_SIZE_MEDIUM); ?></a>
<?php if(api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?>
<?php echo Display::return_icon('blog.png', get_lang('Home'), '', ICON_SIZE_MEDIUM); ?></a>
<?php if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?>
<a href="<?php echo api_get_self(); ?>?action=new_post&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('NewPost') ?>">
<?php echo Display::return_icon('new_article.png', get_lang('NewPost'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?>
<?php if(api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?>
<?php echo Display::return_icon('new_article.png', get_lang('NewPost'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?>
<?php if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?>
<a href="<?php echo api_get_self(); ?>?action=manage_tasks&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageTasks') ?>">
<?php echo Display::return_icon('blog_tasks.png', get_lang('TaskManager'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?>
<?php if(api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?>
<?php echo Display::return_icon('blog_tasks.png', get_lang('TaskManager'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?>
<?php if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?>
<a href="<?php echo api_get_self(); ?>?action=manage_members&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageMembers') ?>">
<?php echo Display::return_icon('blog_admin_users.png', get_lang('MemberManager'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?>
<?php echo Display::return_icon('blog_admin_users.png', get_lang('MemberManager'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?>
<?php
echo '</div>';
@ -315,8 +315,8 @@ Display::display_introduction_section(TOOL_BLOGS);
<div class="panel-heading"><?php echo get_lang('Calendar') ?></div>
<div class="panel-body">
<?php
$month = isset($_GET['month']) ? (int)$_GET['month'] : (int) date('m');
$year = isset($_GET['year']) ? (int)$_GET['year'] : date('Y');
$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);
?>
</div>
@ -362,7 +362,7 @@ $user_task = false;
$course_id = api_get_course_int_id();
if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) {
$task_id = (int)$_GET['task_id'];
$task_id = (int) $_GET['task_id'];
} else {
$task_id = 0;
$tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER);

@ -45,9 +45,9 @@ if (!empty($event)) {
define('ICAL_LANG', api_get_language_isocode());
$ical = new vcalendar();
$ical->setConfig('unique_id',api_get_path(WEB_PATH));
$ical->setProperty( 'method', 'PUBLISH' );
$ical->setConfig('url',api_get_path(WEB_PATH));
$ical->setConfig('unique_id', api_get_path(WEB_PATH));
$ical->setProperty('method', 'PUBLISH');
$ical->setConfig('url', api_get_path(WEB_PATH));
$vevent = new vevent();
switch ($_GET['class']) {

@ -11,26 +11,26 @@
api_protect_course_script(true);
// display categories
$categories = array ();
$categories = array();
foreach ($default_description_titles as $id => $title) {
$categories[$id] = $title;
}
$categories[ADD_BLOCK] = get_lang('NewBloc');
$i=1;
$i = 1;
echo '<div class="actions" style="margin-bottom:30px">';
echo '<a href="index.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ToolCourseDescription'), '', ICON_SIZE_MEDIUM).
'</a>';
ksort($categories);
foreach ($categories as $id => $title) {
if ($i == ADD_BLOCK) {
echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
break;
} else {
echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
$i++;
}
}

@ -34,21 +34,21 @@ foreach ($default_description_titles as $id => $title) {
}
$categories[ADD_BLOCK] = get_lang('NewBloc');
$i=1;
$i = 1;
echo '<div class="actions" style="margin-bottom:30px">';
echo '<a href="index.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ToolCourseDescription'), '', ICON_SIZE_MEDIUM).
'</a>';
ksort($categories);
foreach ($categories as $id => $title) {
if ($i==ADD_BLOCK) {
if ($i == ADD_BLOCK) {
echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
break;
} else {
echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
$i++;
}
}
@ -56,7 +56,7 @@ echo '</div>';
// error messages
if (isset($error) && intval($error) == 1) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
// default header title form

@ -11,18 +11,18 @@
api_protect_course_script(true);
// display actions menu
if (api_is_allowed_to_edit(null,true)) {
if (api_is_allowed_to_edit(null, true)) {
$categories = array();
foreach ($default_description_titles as $id => $title) {
$categories[$id] = $title;
}
$categories[ADD_BLOCK] = get_lang('NewBloc');
$i=1;
$i = 1;
echo '<div class="actions" style="margin-bottom:30px">';
ksort($categories);
foreach ($categories as $id => $title) {
if ($i==ADD_BLOCK) {
if ($i == ADD_BLOCK) {
echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
break;
@ -43,7 +43,7 @@ if ($history) {
<tr>
<td><h3>'.get_lang('ThematicAdvanceHistory').'</h3></td>
<td align="right"><a href="index.php?action=listing">'.
Display::return_icon('info.png',get_lang('BackToCourseDesriptionList'), array('style'=>'vertical-align:middle;'),ICON_SIZE_SMALL).' '.get_lang('BackToCourseDesriptionList').'</a></td></tr></table></div>';
Display::return_icon('info.png', get_lang('BackToCourseDesriptionList'), array('style'=>'vertical-align:middle;'), ICON_SIZE_SMALL).' '.get_lang('BackToCourseDesriptionList').'</a></td></tr></table></div>';
}
$user_info = api_get_user_info();
@ -52,21 +52,21 @@ if (isset($descriptions) && count($descriptions) > 0) {
foreach ($descriptions as $id => $description) {
if (!empty($description)) {
$actions = '';
if (api_is_allowed_to_edit(null,true) && !$history) {
if (api_is_allowed_to_edit(null, true) && !$history) {
if (api_get_session_id() == $description['session_id']) {
$description['title'] = $description['title'].' '.api_get_session_image(api_get_session_id(), $user_info['status']);
// delete
$actions .= '<a href="'.api_get_self().'?id='.$description['id'].'&'.api_get_cidreq_params(api_get_course_id(), $description['session_id']).'&action=delete&description_type='.$description['description_type'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,api_get_system_encoding())).'\')) return false;">';
$actions .= Display::return_icon('delete.png', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'),ICON_SIZE_SMALL);
$actions .= '<a href="'.api_get_self().'?id='.$description['id'].'&'.api_get_cidreq_params(api_get_course_id(), $description['session_id']).'&action=delete&description_type='.$description['description_type'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, api_get_system_encoding())).'\')) return false;">';
$actions .= Display::return_icon('delete.png', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'), ICON_SIZE_SMALL);
$actions .= '</a> ';
// edit
$actions .= '<a href="'.api_get_self().'?id='.$description['id'].'&'.api_get_cidreq_params(api_get_course_id(), $description['session_id']).'&action=edit&description_type='.$description['description_type'].'">';
$actions .= Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align:middle;float:right; padding-right:4px;'),ICON_SIZE_SMALL);
$actions .= Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align:middle;float:right; padding-right:4px;'), ICON_SIZE_SMALL);
$actions .= '</a> ';
} else {
$actions .= Display::return_icon('edit_na.png', get_lang('EditionNotAvailableFromSession'), array('style' => 'vertical-align:middle;float:right;'),ICON_SIZE_SMALL);
$actions .= Display::return_icon('edit_na.png', get_lang('EditionNotAvailableFromSession'), array('style' => 'vertical-align:middle;float:right;'), ICON_SIZE_SMALL);
}
}
echo Display::panel(

@ -162,7 +162,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'subscribe') {
/* Is the user allowed here? */
api_protect_course_script(true);
/* STATISTICS */
if (!isset($coursesAlreadyVisited[$course_code])) {
@ -199,11 +198,9 @@ if (!empty($auto_launch)) {
WHERE c_id = $course_id AND autolaunch = 1 $condition
LIMIT 1";
$result = Database::query($sql);
//If we found nothing in the session we just called the session_id = 0 autolaunch
// If we found nothing in the session we just called the session_id = 0 autolaunch
if (Database::num_rows($result) == 0) {
$condition = '';
} else {
//great, there is an specific auto launch for this session we leave the $condition
}
}
@ -212,7 +209,7 @@ if (!empty($auto_launch)) {
LIMIT 1";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$lp_data = Database::fetch_array($result,'ASSOC');
$lp_data = Database::fetch_array($result, 'ASSOC');
if (!empty($lp_data['id'])) {
if (api_is_platform_admin() || api_is_allowed_to_edit()) {
$show_autolaunch_lp_warning = true;

@ -43,10 +43,11 @@ $actions = array(
'thematic_advance_list',
'thematic_advance_add',
'thematic_advance_edit',
'thematic_advance_delete'
'thematic_advance_delete',
'export_single_thematic'
);
$action = 'thematic_details';
$action = 'thematic_details';
if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], $actions)) {
$action = $_REQUEST['action'];
}
@ -180,7 +181,7 @@ function check_per_custom_date(obj) {
$thematicControl = Session::read('thematic_control');
if ($action == 'thematic_list') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl'));
}
if ($action == 'thematic_add') {
$interbreadcrumb[] = array(
@ -194,10 +195,10 @@ if ($action == 'thematic_edit') {
'url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl,
'name' => get_lang('ThematicControl')
);
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditThematicSection'));
}
if ($action == 'thematic_details') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl'));
}
if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
$interbreadcrumb[] = array(
@ -212,22 +213,22 @@ if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
}
}
if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')');
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')');
if ($description_type >= ADD_THEMATIC_PLAN) {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewBloc'));
} else {
$interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
$interbreadcrumb[] = array('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
}
}
if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
}
if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance'));
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')');
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewThematicAdvance'));
}
if ($action == 'thematic_plan_list') {
@ -269,6 +270,7 @@ switch ($action) {
case 'thematic_export':
case 'thematic_export_pdf':
case 'thematic_details':
case 'export_single_thematic':
$thematic_controller->thematic($action);
break;
case 'thematic_plan_add':

@ -2,11 +2,11 @@
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for thematic control
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> Bug fixing
* @package chamilo.course_progress
*/
* View (MVC patter) for thematic control
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> Bug fixing
* @package chamilo.course_progress
*/
// protect a course script
api_protect_course_script(true);
@ -20,34 +20,33 @@ if (api_is_allowed_to_edit(null, true)) {
echo '<div class="actions">';
switch ($action) {
case 'thematic_add' :
case 'thematic_import_select' :
case 'thematic_add':
case 'thematic_import_select':
echo '<a href="index.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ThematicDetails'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ThematicDetails'), '', ICON_SIZE_MEDIUM).'</a>';
break;
case 'thematic_list' :
case 'thematic_list':
echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'.
Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>';
break;
case 'thematic_details' :
case 'thematic_details':
echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'.
Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_import_select'.$url_token.'">'.
Display::return_icon('import_csv.png',get_lang('ImportThematic'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('import_csv.png', get_lang('ImportThematic'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_export'.$url_token.'">'.
Display::return_icon('export_csv.png',get_lang('ExportThematic'),'', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('export_csv.png', get_lang('ExportThematic'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_export_pdf'.$url_token.'">'.
Display::return_icon('pdf.png',get_lang('ExportToPDF'),'', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
break;
default :
default:
echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'.
Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
}
if ($action == 'thematic_list') {
$table = new SortableTable(
'thematic_list',
array('Thematic', 'get_number_of_thematics'),
@ -56,27 +55,31 @@ if ($action == 'thematic_list') {
$parameters['action'] = $action;
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false, array('style'=>'width:20px;'));
$table->set_header(1, get_lang('Title'), false );
$table->set_header(0, '', false, array('style' => 'width:20px;'));
$table->set_header(1, get_lang('Title'), false);
if (api_is_allowed_to_edit(null, true)) {
$table->set_header(2, get_lang('Actions'), false,array('style'=>'text-align:center;width:40%;'));
$table->set_form_actions(array ('thematic_delete_select' => get_lang('DeleteAllThematics')));
$table->set_header(
2,
get_lang('Actions'),
false,
array('style' => 'text-align:center;width:40%;')
);
$table->set_form_actions(array('thematic_delete_select' => get_lang('DeleteAllThematics')));
}
$table->display();
} elseif ($action == 'thematic_details') {
if (isset($_GET['thematic_plan_save_message']) && $_GET['thematic_plan_save_message'] == 'ok') {
Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull'));
}
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>';
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::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),
get_lang('ThematicSectionHasBeenCreatedSuccessfull').'<br />'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'), $link_to_thematic_plan, $link_to_thematic_advance),
false
);
}
@ -93,7 +96,6 @@ if ($action == 'thematic_list') {
// Display thematic data
if (!empty($thematic_data)) {
// display progress
echo '<div style="text-align:right;"><h2>'.get_lang('Progress').': <span id="div_result">'.$total_average_of_advances.'</span> %</h2></div>';
echo '<table width="100%" class="data_table">';
@ -113,43 +115,52 @@ if ($action == 'thematic_list') {
$actions_first_col = '';
if (api_is_allowed_to_edit(null, true)) {
// Thematic title
$actions_first_col = Display::url(
$actions_first_col = Display::url(
Display::return_icon('cd.gif', get_lang('Copy')),
'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$my_thematic_id.$params.$url_token
);
if (api_get_session_id() == 0 ) {
if (api_get_session_id() == 0) {
if ($thematic['display_order'] > 1) {
$actions_first_col .= ' <a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>';
$actions_first_col .= ' <a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>';
} else {
$actions_first_col .= ' '.Display::return_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
$actions_first_col .= ' '.Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
}
if (isset($thematic['max_thematic_item']) && $thematic['display_order'] < $thematic['max_thematic_item']) {
$actions_first_col .= ' <a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>';
$actions_first_col .= ' <a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>';
} else {
$actions_first_col .= ' '.Display::return_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
$actions_first_col .= ' '.Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
}
}
if (api_get_session_id() == $thematic['session_id']) {
$actions_first_col .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
$actions_first_col .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
$actions_first_col .= Display::url(
Display::return_icon('pdf.png'),
api_get_self().'?'.api_get_cidreq()."$url_token&".http_build_query([
'action' => 'export_single_thematic',
'thematic_id' => $my_thematic_id
])
);
$actions_first_col .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='
.$my_thematic_id.$params.$url_token.'">'
.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
$actions_first_col .= '<a onclick="javascript:if(!confirm(\''
.get_lang('AreYouSureToDelete')
.'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='
.$my_thematic_id.$params.$url_token.'">'
.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
}
$actions_first_col = Display::div($actions_first_col, array('id'=>'thematic_id_content_'.$thematic['id'], 'class'=>'thematic_tools'));
$actions_first_col = Display::div($actions_first_col, array('style'=>'height:20px'));
$actions_first_col = Display::div($actions_first_col, array('id' => 'thematic_id_content_'.$thematic['id'], 'class' => 'thematic_tools'));
$actions_first_col = Display::div($actions_first_col, array('style' => 'height:20px'));
}
echo Display::tag('td', Display::tag('h3', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col, array('id'=>'thematic_td_content_'.$thematic['id'], 'class'=>'thematic_content'));
echo Display::tag('td', Display::tag('h3', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col, array('id' => 'thematic_td_content_'.$thematic['id'], 'class' => 'thematic_content'));
// Display 2nd column - thematic plan data
echo '<td>';
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (api_is_allowed_to_edit(null, true)) {
echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].'&width=700&height=500">'.
Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'),ICON_SIZE_MEDIUM).'</a></div><br />';
Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style' => 'vertical-align:middle'), ICON_SIZE_MEDIUM).'</a></div><br />';
}
if (empty($thematic_plan_div[$thematic['id']])) {
@ -165,14 +176,13 @@ if ($action == 'thematic_list') {
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (api_is_allowed_to_edit(null, true)) {
echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic['id'].'">'.
Display::return_icon('add.png',get_lang('NewThematicAdvance'),'',ICON_SIZE_MEDIUM).'</a></div>';
Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM).'</a></div>';
}
//if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
if (!empty($thematic_advance_data[$thematic['id']])) {
echo '<table width="100%">';
foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
$thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']);
$thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG);
echo '<tr>';
@ -187,24 +197,24 @@ if ($action == 'thematic_list') {
[],
ICON_SIZE_SMALL
),
'index.php?' . api_get_cidreq() . '&' . http_build_query([
'index.php?'.api_get_cidreq().'&'.http_build_query([
'action' => 'thematic_advance_edit',
'thematic_id' => $thematic['id'],
'thematic_advance_id' => $thematic_advance['id']
])
);
$edit_link .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'">'.
Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a></center>';
$edit_link .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'">'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a></center>';
//Links
// Links
$edit_link = Display::div(
Display::div($edit_link , array('id'=>'thematic_advance_tools_'.$thematic_advance['id'], 'class'=>'thematic_advance_actions')),
array('style'=>'height:20px;')
Display::div($edit_link, array('id' => 'thematic_advance_tools_'.$thematic_advance['id'], 'class' => 'thematic_advance_actions')),
array('style' => 'height:20px;')
);
}
$thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null;
echo Display::div($thematic_advance_item, array('id'=>'thematic_advance_'.$thematic_advance['id']));
$thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null;
echo Display::div($thematic_advance_item, array('id' => 'thematic_advance_'.$thematic_advance['id']));
echo $edit_link;
echo '</td>';
@ -246,10 +256,8 @@ if ($action == 'thematic_list') {
echo '<div><em>'.get_lang('ThereIsNoAThematicSection').'</em></div>';
}
} elseif ($action == 'thematic_add' || $action == 'thematic_edit') {
// Display form
$form = new FormValidator('thematic_add','POST','index.php?action=thematic_add&'.api_get_cidreq());
$form = new FormValidator('thematic_add', 'POST', 'index.php?action=thematic_add&'.api_get_cidreq());
if ($action == 'thematic_edit') {
$form->addElement('header', '', get_lang('EditThematicSection'));
}
@ -258,10 +266,10 @@ if ($action == 'thematic_list') {
$form->addElement('hidden', 'action', $action);
if (!empty($thematic_id)) {
$form->addElement('hidden', 'thematic_id',$thematic_id);
$form->addElement('hidden', 'thematic_id', $thematic_id);
}
$form->addText('title', get_lang('Title'), true, array('size'=>'50'));
$form->addText('title', get_lang('Title'), true, array('size' => '50'));
$form->addHtmlEditor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Height' => '150'));
$form->addButtonSave(get_lang('Save'));
@ -270,8 +278,8 @@ if ($action == 'thematic_list') {
if (!empty($thematic_data)) {
if (api_get_session_id()) {
if ($thematic_data['session_id'] != api_get_session_id()) {
$show_form = false;
Display::display_error_message(get_lang('NotAllowedClickBack'),false);
$show_form = false;
Display::display_error_message(get_lang('NotAllowedClickBack'), false);
}
}
// set default values
@ -282,14 +290,14 @@ if ($action == 'thematic_list') {
// error messages
if (isset($error)) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
if ($show_form) {
$form->display();
}
} elseif ($action == 'thematic_import_select') {
// Create form to upload csv file.
$form = new FormValidator('thematic_import','POST','index.php?action=thematic_import&'.api_get_cidreq().$url_token);
$form = new FormValidator('thematic_import', 'POST', 'index.php?action=thematic_import&'.api_get_cidreq().$url_token);
$form->addElement('header', get_lang('ImportThematic'));
$form->addElement('file', 'file');
$form->addElement('checkbox', 'replace', null, get_lang('DeleteAllThematic'));

@ -49,7 +49,6 @@ class ThematicController
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (trim($_POST['title']) !== '') {
if (api_is_allowed_to_edit(null, true)) {
$id = isset($_POST['thematic_id']) ? $_POST['thematic_id'] : null;
$title = trim($_POST['title']);
$content = trim($_POST['content']);
@ -121,7 +120,6 @@ class ThematicController
// Import the progress.
$current_thematic = null;
foreach ($csv_import_array as $key => $item) {
if (!$key) {
continue;
@ -217,20 +215,58 @@ class ThematicController
continue;
}
$plan_html .= '<strong>' . $plan['title'] . '</strong><br /> ' . $plan['description'] . '<br />';
$plan_html .= '<strong>'.$plan['title'].'</strong><br /> '.$plan['description'].'<br />';
}
}
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
$advance_html = null;
if (!empty($data)) {
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 />';
$advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG).' ('.$advance['duration'].' '.get_lang('HourShort').')<br />'.$advance['content'].'<br />';
}
}
$table[] = array($theme['title'], $plan_html, $advance_html);
}
$params = array(
'filename' => get_lang('Thematic') . '-' . api_get_local_time(),
'filename' => get_lang('Thematic').'-'.api_get_local_time(),
'pdf_title' => get_lang('Thematic'),
'add_signatures' => true,
'format' => 'A4-L',
'orientation' => 'L'
);
Export::export_table_pdf($table, $params);
break;
case 'export_single_thematic':
$theme = $thematic->get_thematic_list($thematic_id);
$table = array();
$table[] = array(
get_lang('Thematic'),
get_lang('ThematicPlan'),
get_lang('ThematicAdvance')
);
$data = $thematic->get_thematic_plan_data($theme['id']);
$plan_html = null;
if (!empty($data)) {
foreach ($data as $plan) {
if (empty($plan['description'])) {
continue;
}
$plan_html .= '<h6>'.$plan['title'].'</h6>'.$plan['description'].'<br />';
}
}
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
$advance_html = null;
if (!empty($data)) {
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 />';
}
}
$table[] = array($theme['title'], $plan_html, $advance_html);
$params = array(
'filename' => get_lang('Thematic').'-'.api_get_local_time(),
'pdf_title' => get_lang('Thematic'),
'add_signatures' => true,
'format' => 'A4-L',
@ -325,8 +361,8 @@ class ThematicController
$thematic->thematic_plan_save();
}
$saveRedirect = api_get_path(WEB_PATH) . 'main/course_progress/index.php?';
$saveRedirect.= api_get_cidreq() . '&';
$saveRedirect = api_get_path(WEB_PATH).'main/course_progress/index.php?';
$saveRedirect .= api_get_cidreq().'&';
if (isset($_REQUEST['add_item'])) {
$thematic->set_thematic_plan_attributes(
@ -342,7 +378,7 @@ class ThematicController
'thematic_id' => $_REQUEST['thematic_id']
]);
} else {
$saveRedirect.= 'thematic_plan_save_message=ok';
$saveRedirect .= 'thematic_plan_save_message=ok';
unset($_SESSION['thematic_plan_token']);
$data['message'] = 'ok';

@ -9,10 +9,11 @@
// actions menu
$new_thematic_plan_data = array();
if (!empty($thematic_plan_data))
foreach($thematic_plan_data as $thematic_item) {
$thematic_simple_list[] = $thematic_item['description_type'];
$new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
if (!empty($thematic_plan_data)) {
foreach ($thematic_plan_data as $thematic_item) {
$thematic_simple_list[] = $thematic_item['description_type'];
$new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
}
}
$new_id = ADD_THEMATIC_PLAN;
@ -25,7 +26,7 @@ if (!empty($thematic_simple_list)) {
}
}
$i=1;
$i = 1;
echo Display::tag('h2', $thematic_data['title']);
echo $thematic_data['content'];
@ -56,32 +57,41 @@ if ($action === 'thematic_plan_list') {
$form->addElement('hidden', 'description_type['.$id.']', $id);
$form->addText("title[$id]", [get_lang('Title'), null, $btnDelete], false);
$form->addHtmlEditor(
'description['.$id.']',
get_lang('Description'),
false,
false,
array(
'ToolbarStartExpanded' => 'false',
'ToolbarSet' => 'TrainingDescription',
'Height' => '150'
)
'description['.$id.']',
get_lang('Description'),
false,
false,
array(
'ToolbarStartExpanded' => 'false',
'ToolbarSet' => 'TrainingDescription',
'Height' => '150'
)
);
if (!empty($thematic_simple_list) && in_array($id, $thematic_simple_list)) {
$thematic_plan = $new_thematic_plan_data[$id];
// set default values
$default['title['.$id.']'] = $thematic_plan['title'];
$default['title['.$id.']'] = $thematic_plan['title'];
$default['description['.$id.']'] = $thematic_plan['description'];
$thematic_plan = null;
} else {
$thematic_plan = null;
$default['title['.$id.']'] = $title;
$default['description['.$id.']']= '';
$default['title['.$id.']'] = $title;
$default['description['.$id.']'] = '';
}
$form->setDefaults($default);
}
$form->addGroup([
$form->addButton('add_item', get_lang('SaveAndAddNewItem'), 'plus', 'info', 'default', null, [], true),
$form->addButton(
'add_item',
get_lang('SaveAndAddNewItem'),
'plus',
'info',
'default',
null,
[],
true
),
$form->addButtonSave(get_lang('Save'), 'submit', true)
]);
$form->display();
@ -124,7 +134,7 @@ if ($action === 'thematic_plan_list') {
'ToolbarStartExpanded' => 'false',
'ToolbarSet' => 'TrainingDescription',
'Width' => '80%',
'Height' => '150',
'Height' => '150'
)
);
$form->addButtonSave(get_lang('Save'));

@ -6,6 +6,7 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseBuilder;
use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer;
/**
* @todo rework file in order to use addFlash
* @package chamilo.backup
*/
@ -48,7 +49,6 @@ if (Security::check_token('post') && (
) {
// Clear token
Security::clear_token();
if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') {
$course = CourseSelectForm::get_posted_course('copy_course');
} else {
@ -85,24 +85,22 @@ if (Security::check_token('post') && (
$table_cu = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$user_info = api_get_user_info();
$course_info = api_get_course_info();
$sql = 'SELECT *
FROM '.$table_c.' c, '.$table_cu.' cu
WHERE cu.c_id = c.id';
if (!api_is_platform_admin()) {
$sql .= ' AND cu.status=1 ';
}
$sql .= ' AND
cu.user_id = '.$user_info['user_id'].' AND
c.id != '."'".$course_info['real_id']."'".'
ORDER BY title ASC';
$res = Database::query($sql);
if (Database::num_rows($res) == 0) {
$courseList = CourseManager::get_courses_list_by_user_id(
$user_info['user_id'],
false,
false,
false,
[$course_info['real_id']]
);
if (empty($courseList)) {
Display::display_normal_message(get_lang('NoDestinationCoursesAvailable'));
} else {
$options = array();
while ($obj = Database::fetch_object($res)) {
$courseInfo = api_get_course_info_by_id($obj->c_id);
$options[$courseInfo['code']] = $obj->title.' ('.$obj->code.')';
foreach ($courseList as $courseItem) {
$courseInfo = api_get_course_info_by_id($courseItem['real_id']);
$options[$courseInfo['code']] = $courseInfo['title'].' ('.$courseInfo['code'].')';
}
$form = new FormValidator(

@ -1,6 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CCalendarEvent;
use Chamilo\CourseBundle\Entity\CItemProperty;
if (PHP_SAPI != 'cli') {
die('Run this script through the command line or comment this line in the code');
}
@ -13,6 +16,7 @@ require_once __DIR__.'/../inc/global.inc.php';
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
ini_set('log_errors', '1');
/**
* Class ImportCsv
@ -907,10 +911,7 @@ class ImportCsv
return 0;
}
$this->logger->addInfo(
"Ready to insert events"
);
$this->logger->addInfo('Ready to insert # '.count($eventsToCreate).' events');
$batchSize = $this->batchSize;
$counter = 1;
$em = Database::getManager();
@ -919,11 +920,10 @@ class ImportCsv
$report = [
'mail_sent' => 0,
'mail_not_sent_announcement_exists' => 0,
'mail_not_sent_because_date' => 0,
'mail_not_sent_because_date' => 0
];
$eventsToCreateFinal = [];
foreach ($eventsToCreate as $event) {
$update = false;
$item = null;
@ -955,11 +955,40 @@ class ImportCsv
}
$courseInfo = api_get_course_info_by_id($event['course_id']);
$event['course_info'] = $courseInfo;
$event['update'] = $update;
$event['item'] = $item;
$event['external_event_id'] = $externalEventId;
$event['course_info'] = $courseInfo;
$event['update'] = $update;
$event['item'] = $item;
/* Check if event changed of course code */
/** @var CCalendarEvent $calendarEvent */
$calendarEvent = $em->getRepository('ChamiloCourseBundle:CCalendarEvent')->find($item['item_id']);
if ($calendarEvent) {
$this->logger->addInfo('Calendar event found '.$item['item_id']);
if ($calendarEvent->getCId() != $courseInfo['real_id']) {
$this->logger->addInfo('Move from course #'.$calendarEvent->getCId().' to #'.$courseInfo['real_id']);
// Seems that the course id changed in the csv
$calendarEvent->setCId($courseInfo['real_id']);
$em->persist($calendarEvent);
$em->flush();
$criteria = [
'tool' => 'calendar_event',
'ref' => $item['item_id']
];
/** @var CItemProperty $itemProperty */
$itemProperty = $em->getRepository('ChamiloCourseBundle:CItemProperty')->findOneBy($criteria);
$courseEntity = $em->getRepository('ChamiloCoreBundle:Course')->find($courseInfo['real_id']);
if ($itemProperty && $courseEntity) {
$itemProperty->setCourse($courseEntity);
$em->persist($itemProperty);
$em->flush();
}
}
} else {
$this->logger->addInfo('Calendar event not found '.$item['item_id']);
}
$event['external_event_id'] = $externalEventId;
if (isset($eventStartDateList[$courseInfo['real_id']]) &&
isset($eventStartDateList[$courseInfo['real_id']][$event['session_id']])
) {
@ -983,7 +1012,6 @@ class ImportCsv
$item = $event['item'];
$update = $event['update'];
$externalEventId = $event['external_event_id'];
$info = 'Course: '.$courseInfo['real_id'].' ('.$courseInfo['code'].') - Session: '.$event['session_id'];
$agenda = new Agenda(
@ -996,7 +1024,6 @@ class ImportCsv
$agenda->setSessionId($event['session_id']);
$agenda->setSenderId($event['sender_id']);
$agenda->setIsAllowedToEdit(true);
$eventComment = $event['comment'];
$color = $event['color'];
@ -1094,7 +1121,7 @@ class ImportCsv
1
);
if (count($announcementsWithTitleList) == 0) {
if (count($announcementsWithTitleList) === 0) {
$this->logger->addInfo(
"Mail to be sent because start date: ".$event['start']." and no announcement found."
);
@ -1133,7 +1160,7 @@ class ImportCsv
} else {
$report['mail_not_sent_announcement_exists']++;
$this->logger->addInfo(
"Mail NOT sent. An announcement seems to be already saved in $info"
"Mail NOT sent. An announcement seems to be already saved in '$info'"
);
}
} else {
@ -1141,7 +1168,6 @@ class ImportCsv
$report['mail_not_sent_because_date']++;
}
}
$content = '';
if ($update && isset($item['item_id'])) {
//the event already exists, just update
@ -1158,7 +1184,8 @@ class ImportCsv
$eventComment,
$color,
false,
false
false,
$this->defaultAdminId
);
if ($eventResult !== false) {
@ -1188,7 +1215,6 @@ class ImportCsv
);
if (!empty($eventId)) {
//$extraFieldValue->is_course_model = true;
$extraFieldValue->save(
array(
'value' => $externalEventId,
@ -1300,6 +1326,7 @@ class ImportCsv
}
if ($addTeacherToSession) {
$this->logger->addInfo("Add teacher to all course sessions");
CourseManager::updateTeachers(
$courseInfo,
$row['teachers'],
@ -1313,7 +1340,7 @@ class ImportCsv
CourseManager::updateTeachers(
$courseInfo,
$row['teachers'],
false,
true,
false,
false,
$teacherBackup,

@ -96,13 +96,14 @@ if (!empty($group_id)) {
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
if (!$is_certificate_mode)
if (!$is_certificate_mode) {
$interbreadcrumb[] = array(
"url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(),
"name" => get_lang('Documents'),
);
else
} else {
$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
}
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {

@ -36,20 +36,18 @@ class ExerciseResult
* @param int $user_id User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
* @param int $filter
* @param int $exercise_id
* @param null $hotpotato_name
*
* @return bool
*/
public function getExercisesReporting(
$document_path,
$user_id = null,
$filter = 0,
$exercise_id = 0,
$hotpotato_name = null
$exercise_id = 0
) {
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_TABLE_LP_MAIN = Database::get_course_table(TABLE_LP_MAIN);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
@ -276,32 +274,29 @@ class ExerciseResult
return true;
}
/**
* Exports the complete report as a CSV file *
/**
* Exports the complete report as a CSV file
* @param string $document_path Document path inside the document tool
* @param integer $user_id Optional user ID
* @param boolean $export_user_fields Whether to include user fields or not
* @param int $export_filter
* @param int $exercise_id
* @param string $hotpotato_name
*
* @return boolean False on error
*/
* @return boolean False on error
*/
public function exportCompleteReportCSV(
$document_path = '',
$user_id = null,
$export_user_fields = false,
$export_filter = 0,
$exercise_id = 0,
$hotpotato_name = null
$exercise_id = 0
) {
global $charset;
$this->getExercisesReporting(
$document_path,
$user_id,
$export_filter,
$exercise_id,
$hotpotato_name
$exercise_id
);
$now = api_get_local_time();
$filename = 'exercise_results_'.$now.'.csv';

@ -1099,13 +1099,14 @@ class FillBlanks extends Question
/**
* return the HTML display of the answer
* @param string $answer
* @param bool $resultsDisabled
* @param int $feedbackType
* @param bool $resultsDisabled
* @param bool $showTotalScoreAndUserChoices
*
* @return string
*/
public static function getHtmlDisplayForAnswer(
$answer,
$feedbackType,
$resultsDisabled = false,
$showTotalScoreAndUserChoices = false
) {
@ -1127,13 +1128,17 @@ class FillBlanks extends Question
$listStudentAnswerInfo['studentanswer'][$i] = self::getHtmlRightAnswer(
$listStudentAnswerInfo['studentanswer'][$i],
$listStudentAnswerInfo['tabwords'][$i],
$resultsDisabled
$feedbackType,
$resultsDisabled,
$showTotalScoreAndUserChoices
);
} else {
$listStudentAnswerInfo['studentanswer'][$i] = self::getHtmlWrongAnswer(
$listStudentAnswerInfo['studentanswer'][$i],
$listStudentAnswerInfo['tabwords'][$i],
$resultsDisabled
$feedbackType,
$resultsDisabled,
$showTotalScoreAndUserChoices
);
}
}
@ -1155,12 +1160,26 @@ class FillBlanks extends Question
* @param string $answer
* @param string $correct
* @param string $right
* @param bool $resultsDisabled
*
* @param int $feedbackType
* @param bool $resultsDisabled
* @param bool $showTotalScoreAndUserChoices
* @return string
*/
public static function getHtmlAnswer($answer, $correct, $right, $resultsDisabled = false)
public static function getHtmlAnswer($answer, $correct, $right, $feedbackType, $resultsDisabled = false, $showTotalScoreAndUserChoices = false)
{
$hideExpectedAnswer = false;
if ($feedbackType == 0 && ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ONLY)) {
$hideExpectedAnswer = true;
}
if ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
if ($showTotalScoreAndUserChoices) {
$hideExpectedAnswer = false;
} else {
$hideExpectedAnswer = true;
}
}
$style = "color: green";
if (!$right) {
$style = "color: red; text-decoration: line-through;";
@ -1193,7 +1212,7 @@ class FillBlanks extends Question
$correctAnswerHtml = "<span style='color: green'>".$correct."</span>";
}
if ($resultsDisabled) {
if ($hideExpectedAnswer) {
$correctAnswerHtml = "<span title='".get_lang("ExerciseWithFeedbackWithoutCorrectionComment")."'> - </span>";
}
@ -1214,9 +1233,9 @@ class FillBlanks extends Question
*
* @return string
*/
public static function getHtmlRightAnswer($answer, $correct, $resultsDisabled = false)
public static function getHtmlRightAnswer($answer, $correct, $feedbackType, $resultsDisabled = false, $showTotalScoreAndUserChoices = false)
{
return self::getHtmlAnswer($answer, $correct, true, $resultsDisabled);
return self::getHtmlAnswer($answer, $correct, true, $feedbackType, $resultsDisabled, $showTotalScoreAndUserChoices);
}
/**
@ -1227,9 +1246,9 @@ class FillBlanks extends Question
*
* @return string
*/
public static function getHtmlWrongAnswer($answer, $correct, $resultsDisabled = false)
public static function getHtmlWrongAnswer($answer, $correct, $feedbackType, $resultsDisabled = false, $showTotalScoreAndUserChoices = false)
{
return self::getHtmlAnswer($answer, $correct, false, $resultsDisabled);
return self::getHtmlAnswer($answer, $correct, false, $feedbackType, $resultsDisabled, $showTotalScoreAndUserChoices);
}
/**

@ -14,17 +14,17 @@ class HotpotatoesExerciseResult
//stores the results
private $results = array();
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
* @param string $document_path
*/
public function getExercisesReporting($document_path, $hotpotato_name)
/**
* Gets the results of all students (or just one student if access is limited)
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
* @param string $document_path
*/
public function getExercisesReporting($document_path, $hotpotato_name)
{
$return = array();
$return = array();
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
@ -34,11 +34,11 @@ class HotpotatoesExerciseResult
$hotpotato_name = Database::escape_string($hotpotato_name);
if (!empty($exercise_id)) {
$session_id_and .= " AND exe_exo_id = $exercise_id ";
$session_id_and .= " AND exe_exo_id = $exercise_id ";
}
if (empty($user_id)) {
$sql="SELECT firstname as userpart1, lastname as userpart2 ,
$sql = "SELECT firstname as userpart1, lastname as userpart2 ,
email,
tth.exe_name,
tth.exe_result,
@ -50,9 +50,7 @@ class HotpotatoesExerciseResult
tth.exe_name = '$hotpotato_name'
ORDER BY tth.c_id ASC, tth.exe_date ASC";
} else {
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
// get only this user's results
$sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE
@ -65,39 +63,26 @@ class HotpotatoesExerciseResult
$results = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx,'ASSOC')) {
while ($rowx = Database::fetch_array($resx, 'ASSOC')) {
$results[] = $rowx;
}
$hpresults = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx,'ASSOC')) {
while ($rowx = Database::fetch_array($resx, 'ASSOC')) {
$hpresults[] = $rowx;
}
/*if ($filter) {
switch ($filter) {
case 1 :
$filter_by_not_revised = true;
break;
case 2 :
$filter_by_revised = true;
break;
default :
null;
}
}*/
// Print the Result of Hotpotatoes Tests
if (is_array($hpresults)) {
for($i = 0; $i < sizeof($hpresults); $i++) {
for ($i = 0; $i < sizeof($hpresults); $i++) {
$return[$i] = array();
$title = GetQuizName($hpresults[$i]['exe_name'], $document_path);
if ($title =='') {
$title = basename($hpresults[$i]['exe_name']);
}
if(empty($user_id)) {
$return[$i]['email'] = $hpresults[$i]['email'];
if (empty($user_id)) {
$return[$i]['email'] = $hpresults[$i]['email'];
$return[$i]['first_name'] = $hpresults[$i]['userpart1'];
$return[$i]['last_name'] = $hpresults[$i]['userpart2'];
}
@ -111,60 +96,49 @@ class HotpotatoesExerciseResult
$this->results = $return;
return true;
}
}
/**
* Exports the complete report as a CSV file
* @param string $document_path Document path inside the document tool
* @param string $hotpotato_name
/**
* Exports the complete report as a CSV file
* @param string Document path inside the document tool
* @param integer Optional user ID
* @param boolean Whether to include user fields or not
* @return boolean False on error
*/
public function exportCompleteReportCSV($document_path = '', $hotpotato_name)
* @return boolean False on error
*/
public function exportCompleteReportCSV($document_path = '', $hotpotato_name = '')
{
global $charset;
$this->getExercisesReporting($document_path, $hotpotato_name);
$filename = 'exercise_results_'.date('YmdGis').'.csv';
if (!empty($user_id)) {
$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
}
$data = '';
global $charset;
$this->getExercisesReporting($document_path, $hotpotato_name);
$filename = 'exercise_results_'.date('YmdGis').'.csv';
if (!empty($user_id)) {
$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
}
$data = '';
if (api_is_western_name_order()) {
if(!empty($this->results[0]['first_name'])) {
if (!empty($this->results[0]['first_name'])) {
$data .= get_lang('FirstName').';';
}
if(!empty($this->results[0]['last_name'])) {
if (!empty($this->results[0]['last_name'])) {
$data .= get_lang('LastName').';';
}
} else {
if(!empty($this->results[0]['last_name'])) {
if (!empty($this->results[0]['last_name'])) {
$data .= get_lang('LastName').';';
}
if(!empty($this->results[0]['first_name'])) {
if (!empty($this->results[0]['first_name'])) {
$data .= get_lang('FirstName').';';
}
}
$data .= get_lang('Email').';';
/*if ($export_user_fields) {
//show user fields section with a big th colspan that spans over all fields
$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
$num = count($extra_user_fields);
foreach($extra_user_fields as $field) {
$data .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";';
}
}*/
$data .= get_lang('Title').';';
$data .= get_lang('StartDate').';';
$data .= get_lang('Score').';';
$data .= get_lang('Total').';';
$data .= "\n";
//results
foreach($this->results as $row) {
$data .= get_lang('Title').';';
$data .= get_lang('StartDate').';';
$data .= get_lang('Score').';';
$data .= get_lang('Total').';';
$data .= "\n";
// Results
foreach ($this->results as $row) {
if (api_is_western_name_order()) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
@ -174,49 +148,46 @@ class HotpotatoesExerciseResult
}
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',$row['exe_date']).';';
$data .= str_replace("\r\n",' ',$row['result']).';';
$data .= str_replace("\r\n",' ',$row['max']).';';
$data .= "\n";
}
/*if ($export_user_fields) {
//show user fields data, if any, for this user
$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
foreach($user_fields_values as $value) {
$data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
}
}*/
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',$row['exe_date']).';';
$data .= str_replace("\r\n",' ',$row['result']).';';
$data .= str_replace("\r\n",' ',$row['max']).';';
$data .= "\n";
}
//output the results
$len = strlen($data);
header('Content-type: application/octet-stream');
header('Content-Type: application/force-download');
header('Content-length: '.$len);
if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
header('Content-Disposition: filename= '.$filename);
} else {
header('Content-Disposition: attachment; filename= '.$filename);
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
header('Pragma: ');
header('Cache-Control: ');
header('Cache-Control: public'); // IE cannot download from sessions without a cache
}
header('Content-Description: '.$filename);
header('Content-transfer-encoding: binary');
// @todo add this utf-8 header for all csv files
echo "\xEF\xBB\xBF"; // force utf-8 header of csv file
echo $data;
return true;
}
/**
* Exports the complete report as an XLS file
* @return boolean False on error
*/
//output the results
$len = strlen($data);
header('Content-type: application/octet-stream');
header('Content-Type: application/force-download');
header('Content-length: '.$len);
if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
header('Content-Disposition: filename= '.$filename);
} else {
header('Content-Disposition: attachment; filename= '.$filename);
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
header('Pragma: ');
header('Cache-Control: ');
header('Cache-Control: public'); // IE cannot download from sessions without a cache
}
header('Content-Description: '.$filename);
header('Content-transfer-encoding: binary');
// @todo add this utf-8 header for all csv files
echo "\xEF\xBB\xBF"; // force utf-8 header of csv file
echo $data;
return true;
}
/**
* Exports the complete report as an XLS file
* @param string $document_path
* @param null $user_id
* @param bool $export_user_fields
* @param int $export_filter
* @param int $exercise_id
* @param null $hotpotato_name
* @return bool
*/
public function exportCompleteReportXLS(
$document_path = '',
$user_id = null,
@ -225,36 +196,41 @@ class HotpotatoesExerciseResult
$exercise_id = 0,
$hotpotato_name = null
) {
global $charset;
$this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
$filename = 'exercise_results_'.api_get_local_time().'.xls';
if (!empty($user_id)) {
$filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
}
global $charset;
$this->getExercisesReporting(
$document_path,
$user_id,
$export_filter,
$exercise_id,
$hotpotato_name
);
$filename = 'exercise_results_'.api_get_local_time().'.xls';
if (!empty($user_id)) {
$filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
}
$spreadsheet = new PHPExcel();
$spreadsheet->setActiveSheetIndex(0);
$worksheet = $spreadsheet->getActiveSheet();
$line = 0;
$column = 0; //skip the first column (row titles)
$line = 0;
$column = 0; //skip the first column (row titles)
// check if exists column 'user'
$with_column_user = false;
foreach ($this->results as $result) {
if (!empty($result['last_name']) && !empty($result['first_name'])) {
$with_column_user = true;
break;
}
}
// check if exists column 'user'
$with_column_user = false;
foreach ($this->results as $result) {
if (!empty($result['last_name']) && !empty($result['first_name'])) {
$with_column_user = true;
break;
}
}
if ($with_column_user) {
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Email'));
$column++;
if ($with_column_user) {
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Email'));
$column++;
if (api_is_western_name_order()) {
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName'));
$column++;
} else {
@ -263,14 +239,21 @@ class HotpotatoesExerciseResult
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$column++;
}
}
if ($export_user_fields) {
//show user fields section with a big th colspan that spans over all fields
$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
}
//show the fields names for user fields
foreach ($extra_user_fields as $field) {
if ($export_user_fields) {
//show user fields section with a big th colspan that spans over all fields
$extra_user_fields = UserManager::get_extra_fields(
0,
1000,
5,
'ASC',
false,
1
);
//show the fields names for user fields
foreach ($extra_user_fields as $field) {
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
@ -280,27 +263,27 @@ class HotpotatoesExerciseResult
$charset
)
);
$column++;
}
}
$column++;
}
}
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Title'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('StartDate'));
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Title'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('StartDate'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('EndDate'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Duration').' ('.get_lang('MinMinutes').')');
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Score'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Total'));
$column++;
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Score'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Total'));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Status'));
$line++;
$line++;
foreach ($this->results as $row) {
$column = 0;
foreach ($this->results as $row) {
$column = 0;
if ($with_column_user) {
$worksheet->setCellValueByColumnAndRow(
@ -325,38 +308,44 @@ class HotpotatoesExerciseResult
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$column++;
}
}
if ($export_user_fields) {
//show user fields data, if any, for this user
$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
foreach($user_fields_values as $value) {
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
$column++;
}
}
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['start_date']);
}
if ($export_user_fields) {
//show user fields data, if any, for this user
$user_fields_values = UserManager::get_extra_user_data(
$row['user_id'],
false,
false,
false,
true
);
foreach ($user_fields_values as $value) {
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
$column++;
}
}
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['start_date']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['end_date']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['end_date']);
$worksheet->setCellValueByColumnAndRow($column, $line, $row['duration']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['result']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['max']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['duration']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['result']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['max']);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['status']);
$line++;
}
$line++;
}
$file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
$writer = new PHPExcel_Writer_Excel2007($spreadsheet);
$writer->save($file);
DocumentManager::file_send_for_download($file, true, $filename);
return true;
}
return true;
}
}

@ -268,8 +268,7 @@ if (!empty($attempts)) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) {
$header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'));
}
else {
} else {
$header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details'));
}
break;

@ -51,12 +51,12 @@ $current_forum_category = get_forumcategory_information($current_forum['forum_ca
/* Breadcrumbs */
if (isset($_SESSION['gradebook'])){
if (isset($_SESSION['gradebook'])) {
$gradebook = Security::remove_XSS($_SESSION['gradebook']);
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
$interbreadcrumb[] = array(
'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
'name' => get_lang('ToolGradebook')
);
@ -114,7 +114,7 @@ if (!empty($groupId)) {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('NewTopic'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => get_lang('NewTopic'));
} else {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']);

@ -14,7 +14,7 @@ api_block_anonymous_users();
GradebookUtils::block_students();
$courseCode = isset($_GET['course_code']) ? Security::remove_XSS($_GET['course_code']) : null;
$selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$course_info = api_get_course_info($courseCode);
$tbl_forum_thread = Database :: get_course_table(TABLE_FORUM_THREAD);

@ -41,7 +41,9 @@ if ($add_result_form->validate()) {
$res->set_evaluation_id($values['evaluation_id']);
$res->set_user_id(key($scores));
//if no scores are given, don't set the score
if ((!empty ($row)) || ($row == '0')) $res->set_score($row);
if ((!empty ($row)) || ($row == '0')) {
$res->set_score($row);
}
$res->add();
next($scores);
}

@ -1052,7 +1052,7 @@ class Category implements GradebookItem
if ($session_id) {
$link->set_session_id($session_id);
}
$linkres = $link->calc_score($stud_id, $type);
if (!empty($linkres) && $link->get_weight() != 0) {
$students[$stud_id] = $linkres[0];
@ -1825,9 +1825,9 @@ class Category implements GradebookItem
WHERE parent_id = '.intval($catId);
$result = Database::query($sql);
$allcats = Category::create_category_objects_from_sql_result($result);
$categories = Category::create_category_objects_from_sql_result($result);
return $allcats;
return $categories;
}
/**

File diff suppressed because it is too large Load Diff

@ -10,47 +10,47 @@
*/
class ForumThreadLink extends AbstractLink
{
private $forum_thread_table = null;
private $itemprop_table = null;
private $forum_thread_table = null;
private $itemprop_table = null;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->set_type(LINK_FORUM_THREAD);
}
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->set_type(LINK_FORUM_THREAD);
}
/**
* @return string
*/
public function get_type_name()
{
return get_lang('ForumThreads');
}
/**
* @return string
*/
public function get_type_name()
{
return get_lang('ForumThreads');
}
/**
* @return bool
*/
public function is_allowed_to_change_name()
{
return false;
}
/**
* @return bool
*/
public function is_allowed_to_change_name()
{
return false;
}
/**
* Generate an array of exercises that a teacher hasn't created a link for.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function get_not_created_links()
{
if (empty($this->course_code)) {
die('Error in get_not_created_links() : course code not set');
}
/**
* Generate an array of exercises that a teacher hasn't created a link for.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function get_not_created_links()
{
if (empty($this->course_code)) {
return [];
}
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT thread_id,thread_title,thread_title_qualify
FROM '.$this->get_forum_thread_table().'
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT thread_id,thread_title,thread_title_qualify
FROM '.$this->get_forum_thread_table().'
forum_thread WHERE thread_id NOT IN
(
SELECT ref_id FROM '.$tbl_grade_links.'
@ -60,8 +60,7 @@ class ForumThreadLink extends AbstractLink
)
AND forum_thread.session_id='.api_get_session_id();
$result = Database::query($sql);
$result = Database::query($sql);
$cats = array();
while ($data = Database::fetch_array($result)) {
if (isset($data['thread_title_qualify']) && $data['thread_title_qualify'] != "") {
@ -75,7 +74,7 @@ class ForumThreadLink extends AbstractLink
}
return $cats;
}
}
/**
* Generate an array of all exercises available.
@ -84,7 +83,7 @@ class ForumThreadLink extends AbstractLink
public function get_all_links()
{
if (empty($this->course_code)) {
die('Error in get_not_created_links() : course code not set');
return [];
}
$tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD);
@ -108,18 +107,18 @@ class ForumThreadLink extends AbstractLink
'.$session_condition.'
';
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
if ( isset($data['thread_title_qualify']) && $data['thread_title_qualify'] != "") {
$cats[] = array($data['thread_id'], $data['thread_title_qualify']);
} else {
$cats[] = array($data['thread_id'], $data['thread_title']);
}
}
$my_cats = isset($cats) ? $cats : null;
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
if (isset($data['thread_title_qualify']) && $data['thread_title_qualify'] != '') {
$cats[] = array($data['thread_id'], $data['thread_title_qualify']);
} else {
$cats[] = array($data['thread_id'], $data['thread_title']);
}
}
$my_cats = isset($cats) ? $cats : null;
return $my_cats;
}
return $my_cats;
}
/**
* Has anyone done this exercise yet ?
@ -138,50 +137,55 @@ class ForumThreadLink extends AbstractLink
$number = Database::fetch_row($result);
return $number[0] != 0;
}
}
/**
* @param int $stud_id
/**
* @param int $stud_id
* @param string $type
*
* @return array|null
*/
public function calc_score($stud_id = null, $type = null)
{
* @return array|null
*/
public function calc_score($stud_id = null, $type = null)
{
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$threadInfo = get_thread_information('', $this->get_ref_id());
$thread_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$thread_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$sessionId = $this->get_session_id();
$sessionCondition = api_get_session_condition($sessionId, true, false, 'session_id');
$sql = 'SELECT thread_qualify_max
FROM '.Database :: get_course_table(TABLE_FORUM_THREAD)."
WHERE
c_id = ".$this->course_id." AND
thread_id = '".$this->get_ref_id()."'
$sessionCondition
$sessionCondition = api_get_session_condition(
$sessionId,
true,
false,
'session_id'
);
$sql = 'SELECT thread_qualify_max
FROM '.Database :: get_course_table(TABLE_FORUM_THREAD)."
WHERE
c_id = ".$this->course_id." AND
thread_id = '".$this->get_ref_id()."'
$sessionCondition
";
$query = Database::query($sql);
$assignment = Database::fetch_array($query);
$sql = "SELECT * FROM $thread_qualify
WHERE
c_id = ".$this->course_id." AND
thread_id = ".$this->get_ref_id()."
$sessionCondition
$query = Database::query($sql);
$assignment = Database::fetch_array($query);
$sql = "SELECT * FROM $thread_qualify
WHERE
c_id = ".$this->course_id." AND
thread_id = ".$this->get_ref_id()."
$sessionCondition
";
if (isset($stud_id)) {
$sql .= ' AND user_id = '.intval($stud_id);
}
if (isset($stud_id)) {
$sql .= ' AND user_id = '.intval($stud_id);
}
// order by id, that way the student's first attempt is accessed first
$sql .= ' ORDER BY qualify_time DESC';
$scores = Database::query($sql);
// order by id, that way the student's first attempt is accessed first
$sql .= ' ORDER BY qualify_time DESC';
$scores = Database::query($sql);
// for 1 student
if (isset($stud_id)) {
// for 1 student
if (isset($stud_id)) {
if ($threadInfo['thread_peer_qualify'] == 0) {
// Classic way of calculate score
if ($data = Database::fetch_array($scores)) {
@ -209,176 +213,176 @@ class ForumThreadLink extends AbstractLink
}
return [$score/$counter, $assignment['thread_qualify_max']];
}
} else {
// All students -> get average
$students = array(); // user list, needed to make sure we only
// take first attempts into account
$counter = 0;
$sum = 0;
$bestResult = 0;
$weight = 0;
$sumResult = 0;
while ($data = Database::fetch_array($scores)) {
if (!(array_key_exists($data['user_id'], $students))) {
if ($assignment['thread_qualify_max'] != 0) {
$students[$data['user_id']] = $data['qualify'];
$counter++;
$sum += $data['qualify'] / $assignment['thread_qualify_max'];
$sumResult += $data['qualify'];
if ($data['qualify'] > $bestResult) {
$bestResult = $data['qualify'];
}
$weight = $assignment['thread_qualify_max'];
}
}
}
if ($counter == 0) {
return null;
} else {
switch ($type) {
case 'best':
return array($bestResult, $weight);
break;
case 'average':
return array($sumResult/$counter, $weight);
break;
case 'ranking':
return AbstractLink::getCurrentUserRanking($stud_id, $students);
break;
default:
return array($sum, $counter);
break;
}
}
}
}
} else {
// All students -> get average
$students = array(); // user list, needed to make sure we only
// take first attempts into account
$counter = 0;
$sum = 0;
$bestResult = 0;
$weight = 0;
$sumResult = 0;
while ($data = Database::fetch_array($scores)) {
if (!(array_key_exists($data['user_id'], $students))) {
if ($assignment['thread_qualify_max'] != 0) {
$students[$data['user_id']] = $data['qualify'];
$counter++;
$sum += $data['qualify'] / $assignment['thread_qualify_max'];
$sumResult += $data['qualify'];
if ($data['qualify'] > $bestResult) {
$bestResult = $data['qualify'];
}
$weight = $assignment['thread_qualify_max'];
}
}
}
/**
* Lazy load function to get the database table of the student publications
*/
private function get_forum_thread_table()
{
return $this->forum_thread_table = Database :: get_course_table(TABLE_FORUM_THREAD);
}
if ($counter == 0) {
return null;
} else {
switch ($type) {
case 'best':
return array($bestResult, $weight);
break;
case 'average':
return array($sumResult/$counter, $weight);
break;
case 'ranking':
return AbstractLink::getCurrentUserRanking($stud_id, $students);
break;
default:
return array($sum, $counter);
break;
}
}
}
}
public function needs_name_and_description()
{
return false;
}
/**
* Lazy load function to get the database table of the student publications
*/
private function get_forum_thread_table()
{
return $this->forum_thread_table = Database :: get_course_table(TABLE_FORUM_THREAD);
}
public function needs_max()
{
return false;
}
public function needs_name_and_description()
{
return false;
}
public function needs_results()
{
return false;
}
public function needs_max()
{
return false;
}
public function needs_results()
{
return false;
}
/**
* @return string
*/
public function get_name()
{
$this->get_exercise_data();
$thread_title=isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : '';
$thread_title_qualify=isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : '';
if ( isset($thread_title_qualify) && $thread_title_qualify!="") {
return $this->exercise_data['thread_title_qualify'];
} else {
return $thread_title;
}
}
public function get_name()
{
$this->get_exercise_data();
$thread_title=isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : '';
$thread_title_qualify=isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : '';
if (isset($thread_title_qualify) && $thread_title_qualify != '') {
return $this->exercise_data['thread_title_qualify'];
} else {
return $thread_title;
}
}
/**
* @return string
*/
public function get_description()
{
return '';//$this->exercise_data['description'];
}
public function get_description()
{
return '';//$this->exercise_data['description'];
}
/**
* Check if this still links to an exercise
*/
public function is_valid_link()
{
$sql = 'SELECT count(id) from '.$this->get_forum_thread_table().'
WHERE c_id = '.$this->course_id.' AND thread_id = '.$this->get_ref_id().' AND session_id='.api_get_session_id().'';
$result = Database::query($sql);
$number = Database::fetch_row($result);
return ($number[0] != 0);
}
public function get_test_id()
{
return 'DEBUG:ID';
}
/**
* Check if this still links to an exercise
*/
public function is_valid_link()
{
$sql = 'SELECT count(id) from '.$this->get_forum_thread_table().'
WHERE c_id = '.$this->course_id.' AND thread_id = '.$this->get_ref_id().' AND session_id='.api_get_session_id().'';
$result = Database::query($sql);
$number = Database::fetch_row($result);
return ($number[0] != 0);
}
public function get_link()
{
$sessionId = api_get_session_id();
//it was extracts the forum id
$sql = 'SELECT * FROM '.$this->get_forum_thread_table()."
WHERE c_id = '.$this->course_id.' AND thread_id = '".$this->get_ref_id()."' AND session_id = ".$sessionId."";
$result = Database::query($sql);
$row = Database::fetch_array($result,'ASSOC');
$forum_id=$row['forum_id'];
$url = api_get_path(WEB_PATH).'main/forum/viewthread.php?'.api_get_cidreq_params($this->get_course_code(), $sessionId).'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id;
return $url;
}
private function get_exercise_data()
{
$session_id = api_get_session_id();
if ($session_id) {
$session_condition = 'session_id='.api_get_session_id();
} else {
$session_condition = '(session_id = 0 OR session_id IS NULL)';
}
public function get_test_id()
{
return 'DEBUG:ID';
}
public function get_link()
{
$sessionId = api_get_session_id();
//it was extracts the forum id
$sql = 'SELECT * FROM '.$this->get_forum_thread_table()."
WHERE c_id = '.$this->course_id.' AND thread_id = '".$this->get_ref_id()."' AND session_id = ".$sessionId."";
$result = Database::query($sql);
$row = Database::fetch_array($result,'ASSOC');
$forum_id=$row['forum_id'];
if (!isset($this->exercise_data)) {
$sql = 'SELECT * FROM '.$this->get_forum_thread_table().'
$url = api_get_path(WEB_PATH).'main/forum/viewthread.php?'.api_get_cidreq_params($this->get_course_code(), $sessionId).'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id;
return $url;
}
private function get_exercise_data()
{
$session_id = api_get_session_id();
if ($session_id) {
$session_condition = 'session_id='.api_get_session_id();
} else {
$session_condition = '(session_id = 0 OR session_id IS NULL)';
}
if (!isset($this->exercise_data)) {
$sql = 'SELECT * FROM '.$this->get_forum_thread_table().'
WHERE c_id = '.$this->course_id.' AND thread_id = '.$this->get_ref_id().' AND '.$session_condition;
$query = Database::query($sql);
$this->exercise_data = Database::fetch_array($query);
}
return $this->exercise_data;
}
$query = Database::query($sql);
$this->exercise_data = Database::fetch_array($query);
}
return $this->exercise_data;
}
public function get_icon_name()
{
return 'forum';
}
public function get_icon_name()
{
return 'forum';
}
function save_linked_data()
{
$weight = $this->get_weight();
$ref_id = $this->get_ref_id();
function save_linked_data()
{
$weight = $this->get_weight();
$ref_id = $this->get_ref_id();
if (!empty($ref_id)) {
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET
thread_weight='.api_float_val($weight).'
if (!empty($ref_id)) {
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET
thread_weight='.api_float_val($weight).'
WHERE c_id = '.$this->course_id.' AND thread_id= '.$ref_id;
Database::query($sql);
}
}
Database::query($sql);
}
}
function delete_linked_data()
{
$ref_id = $this->get_ref_id();
if (!empty($ref_id)) {
//Cleans forum
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET
thread_qualify_max = 0,
thread_weight = 0,
thread_title_qualify = ""
function delete_linked_data()
{
$ref_id = $this->get_ref_id();
if (!empty($ref_id)) {
//Cleans forum
$sql = 'UPDATE '.$this->get_forum_thread_table().' SET
thread_qualify_max = 0,
thread_weight = 0,
thread_title_qualify = ""
WHERE c_id = '.$this->course_id.' AND thread_id= '.$ref_id;
Database::query($sql);
}
}
Database::query($sql);
}
}
}

@ -58,7 +58,7 @@ class LinkFactory
* @param string $name_mask search string
* @return array link objects matching the search criterium
*/
public function find_links($name_mask,$selectcat)
public function find_links($name_mask, $selectcat)
{
return AbstractLink::find_links($name_mask, $selectcat);
}
@ -98,7 +98,7 @@ class LinkFactory
public static function get_all_types()
{
//LINK_DROPBOX,
return array (
return array(
LINK_EXERCISE,
//LINK_DROPBOX,
LINK_HOTPOTATOES,

@ -254,10 +254,11 @@ class GradebookTable extends SortableTable
}
// Categories.
if (!empty($data_array))
foreach ($data_array as $data) {
if (!empty($data_array)) {
foreach ($data_array as $data) {
// list of items inside the gradebook (exercises, lps, forums, etc)
$row = array();
}
/** @var AbstractLink $item */
$item = $mainCategory = $data[0];

@ -87,8 +87,8 @@ class UserTable extends SortableTable
// generate the data to display
$sortable_data = array();
foreach ($data_array as $data) {
if ($data[2]!="") {//filter by course removed
$row = array ();
if ($data[2] != "") {//filter by course removed
$row = array();
$row[] = $this->build_type_column($data[0]);
$row[] = $this->build_name_link($data[0]);
$row[] = $data[2];
@ -124,15 +124,15 @@ class UserTable extends SortableTable
// evaluation
case 'E':
return '&nbsp;'
. '<a href="gradebook_view_result.php?selecteval=' . $item->get_id() . '">'
. '<a href="gradebook_view_result.php?selecteval='.$item->get_id().'">'
. $item->get_name()
. '</a>';
// link
case 'L':
return '&nbsp;<a href="' . $item->get_link() . '">'
return '&nbsp;<a href="'.$item->get_link().'">'
. $item->get_name()
. '</a>'
. '&nbsp;[' . $item->get_type_name() . ']';
. '&nbsp;['.$item->get_type_name().']';
}
}
}

@ -24,7 +24,7 @@ switch ($action) {
// set URL and other appropriate options
$defaults = array(
CURLOPT_URL => $url,
CURLOPT_FOLLOWLOCATION => true, // follow redirects accept youtube.com
CURLOPT_FOLLOWLOCATION => true, // follow redirects accept youtube.com
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 4

@ -15,7 +15,7 @@ switch ($action) {
$list_sessions = SessionManager::get_sessions_by_user($user_id, true);
if (!empty($list_sessions)) {
foreach ($list_sessions as $session_item) {
echo $session_item['session_name'] . '<br />';
echo $session_item['session_name'].'<br />';
}
} else {
echo get_lang('NoSessionsForThisUser');
@ -29,7 +29,7 @@ switch ($action) {
[
's.name' => [
'operator' => 'LIKE',
'value' => "%" . $_REQUEST['q'] . "%"
'value' => "%".$_REQUEST['q']."%"
]
]
);

@ -203,7 +203,7 @@ class AnnouncementEmail
*
* @return array
*/
public function sender($key = '', $userId = '')
public function sender($key = '', $userId = '')
{
$_user = api_get_user_info($userId);

@ -120,7 +120,7 @@ class AnnouncementManager
/**
* This functions switches the visibility a course resource
* using the visibility field in 'item_property'
* @param array $_course
* @param array $_course
* @param int $id ID of the element of the corresponding type
* @return bool False on failure, True on success
*/
@ -300,6 +300,8 @@ class AnnouncementManager
/**
* Displays one specific announcement
* @param int $announcement_id, the id of the announcement you want to display
*
* @return string
*/
public static function display_announcement($announcement_id)
{
@ -1475,7 +1477,7 @@ class AnnouncementManager
// No group
$cond_user_id = " AND (
ip.lastedit_user_id = '".$user_id."' OR (
ip.to_user_id='".$user_id."' OR
(ip.to_user_id='$user_id' OR ip.to_user_id IS NULL) OR
(ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))
)
) ";
@ -1487,11 +1489,11 @@ class AnnouncementManager
} else {
if ($group_id == 0) {
$cond_user_id = " AND (
ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))
(ip.to_user_id='$user_id' OR ip.to_user_id IS NULL) AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))
) ";
} else {
$cond_user_id = " AND (
ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".$group_id."))
(ip.to_user_id='$user_id' OR ip.to_user_id IS NULL) AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".$group_id."))
)";
}
}
@ -1514,10 +1516,10 @@ class AnnouncementManager
if ($allowUserEditSetting && !api_is_anonymous()) {
$cond_user_id = " AND (
ip.lastedit_user_id = '".api_get_user_id()."' OR
(ip.to_user_id='".$user_id."' AND (ip.to_group_id='0' OR ip.to_group_id IS NULL))
((ip.to_user_id='$user_id' OR ip.to_user_id IS NULL) AND (ip.to_group_id='0' OR ip.to_group_id IS NULL))
) ";
} else {
$cond_user_id = " AND (ip.to_user_id='".$user_id."' AND (ip.to_group_id='0' OR ip.to_group_id IS NULL) ) ";
$cond_user_id = " AND ((ip.to_user_id='$user_id' OR ip.to_user_id IS NULL) AND (ip.to_group_id='0' OR ip.to_group_id IS NULL) ) ";
}
$sql = "SELECT $select

@ -594,6 +594,15 @@ class TicketManager
WHERE id = $ticketId";
Database::query($sql);
$table = Database::get_main_table(TABLE_TICKET_ASSIGNED_LOG);
$params = [
'ticket_id' => $ticketId,
'user_id' => $userId,
'sys_insert_user_id' => api_get_user_id(),
'assigned_date' => api_get_utc_datetime()
];
Database::insert($table, $params);
return true;
} else {
return false;
@ -1567,7 +1576,6 @@ class TicketManager
WHERE ticket_id = $ticketId
ORDER BY assigned_date DESC";
$result = Database::query($sql);
echo $sql;
$history = [];
$webpath = api_get_path(WEB_PATH);
while ($row = Database::fetch_assoc($result)) {

@ -54,8 +54,12 @@ class Accessurleditcoursestourl
}
}
}
$xajax_response -> addAssign('ajax_list_courses','innerHTML',api_utf8_encode($return));
$xajax_response->addAssign(
'ajax_list_courses',
'innerHTML',
api_utf8_encode($return)
);
return $xajax_response;
}
}

@ -6,121 +6,119 @@
*/
class AddCourseToSession
{
/**
* Searches a course, given a search string and a type of search box
* @param string $needle Search string
* @param string $type Type of search box ('single' or anything else)
* @return xajaxResponse XajaxResponse
* @assert ('abc', 'single') !== null
* @assert ('abc', 'multiple') !== null
*/
public static function search_courses($needle, $type)
{
global $tbl_session_rel_course, $id_session;
/**
* Searches a course, given a search string and a type of search box
* @param string $needle Search string
* @param string $type Type of search box ('single' or anything else)
* @return xajaxResponse XajaxResponse
* @assert ('abc', 'single') !== null
* @assert ('abc', 'multiple') !== null
*/
public static function search_courses($needle, $type)
{
global $tbl_session_rel_course, $id_session;
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$course_title = null;
$xajax_response = new xajaxResponse();
$return = '';
if(!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$course_title = null;
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$cond_course_code = '';
if (!empty($id_session)) {
$id_session = intval($id_session);
// check course_code from session_rel_course table
$sql = 'SELECT c_id FROM '.$tbl_session_rel_course.'
WHERE session_id = '.$id_session;
$res = Database::query($sql);
$course_codes = '';
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_row($res)) {
$course_codes .= '\''.$row[0].'\',';
}
$course_codes = substr($course_codes,0,(strlen($course_codes)-1));
$cond_course_code = ' AND course.id NOT IN('.$course_codes.') ';
}
}
$cond_course_code = '';
if (!empty($id_session)) {
$id_session = intval($id_session);
// check course_code from session_rel_course table
$sql = 'SELECT c_id FROM '.$tbl_session_rel_course.'
WHERE session_id = '.$id_session;
$res = Database::query($sql);
$course_codes = '';
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_row($res)) {
$course_codes .= '\''.$row[0].'\',';
}
$course_codes = substr($course_codes, 0, (strlen($course_codes) - 1));
$cond_course_code = ' AND course.id NOT IN('.$course_codes.') ';
}
}
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT
course.id,
course.visual_code,
course.title,
session_rel_course.session_id
FROM '.$tbl_course.' course
LEFT JOIN '.$tbl_session_rel_course.' session_rel_course
ON course.id = session_rel_course.c_id
AND session_rel_course.session_id = '.intval($id_session).'
WHERE
course.visual_code LIKE "'.$needle.'%" OR
course.title LIKE "'.$needle.'%"';
} else {
course.visual_code,
course.title,
session_rel_course.session_id
FROM '.$tbl_course.' course
LEFT JOIN '.$tbl_session_rel_course.' session_rel_course
ON course.id = session_rel_course.c_id
AND session_rel_course.session_id = '.intval($id_session).'
WHERE
course.visual_code LIKE "'.$needle.'%" OR
course.title LIKE "'.$needle.'%"';
} else {
$sql = 'SELECT course.id, course.visual_code, course.title
FROM '.$tbl_course.' course
WHERE
course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.'
ORDER BY course.code ';
}
if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
FROM '.$tbl_course.' course
WHERE
course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.'
ORDER BY course.code ';
}
if ($type=='single') {
$sql = 'SELECT
if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if ($type == 'single') {
$sql = 'SELECT
course.id,
course.visual_code,
course.title,
session_rel_course.session_id
FROM '.$tbl_course.' course
LEFT JOIN '.$tbl_session_rel_course.' session_rel_course
ON course.id = session_rel_course.c_id
AND session_rel_course.session_id = '.intval($id_session).'
INNER JOIN '.$tbl_course_rel_access_url.' url_course
ON (url_course.c_id = course.id)
WHERE
access_url_id = '.$access_url_id.' AND
(course.visual_code LIKE "'.$needle.'%" OR
course.title LIKE "'.$needle.'%" )';
} else {
course.visual_code,
course.title,
session_rel_course.session_id
FROM '.$tbl_course.' course
LEFT JOIN '.$tbl_session_rel_course.' session_rel_course
ON course.id = session_rel_course.c_id
AND session_rel_course.session_id = '.intval($id_session).'
INNER JOIN '.$tbl_course_rel_access_url.' url_course
ON (url_course.c_id = course.id)
WHERE
access_url_id = '.$access_url_id.' AND
(course.visual_code LIKE "'.$needle.'%" OR
course.title LIKE "'.$needle.'%" )';
} else {
$sql = 'SELECT course.id, course.visual_code, course.title
FROM '.$tbl_course.' course, '.$tbl_course_rel_access_url.' url_course
WHERE
url_course.c_id = course.id AND
access_url_id = '.$access_url_id.' AND
course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.'
ORDER BY course.code ';
}
}
}
FROM '.$tbl_course.' course, '.$tbl_course_rel_access_url.' url_course
WHERE
url_course.c_id = course.id AND
access_url_id = '.$access_url_id.' AND
course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.'
ORDER BY course.code ';
}
}
}
$rs = Database::query($sql);
$course_list = array();
$rs = Database::query($sql);
$course_list = array();
if ($type == 'single') {
while ($course = Database :: fetch_array($rs)) {
$course_list[] = $course['code'];
$course_title=str_replace("'","\'",$course_title);
while ($course = Database :: fetch_array($rs)) {
$course_list[] = $course['code'];
$course_title = str_replace("'", "\'", $course_title);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['id'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />';
}
$xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return));
} else {
$return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
while($course = Database :: fetch_array($rs)) {
$course_list[] = $course['code'];
$course_title=str_replace("'","\'",$course_title);
$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
}
}
$_SESSION['course_list'] = $course_list;
}
$xajax_response -> addAssign('ajax_list_courses_single', 'innerHTML', api_utf8_encode($return));
} else {
$return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">';
while ($course = Database :: fetch_array($rs)) {
$course_list[] = $course['code'];
$course_title = str_replace("'", "\'", $course_title);
$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')', ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
}
}
$_SESSION['course_list'] = $course_list;
return $xajax_response;
}
return $xajax_response;
}
}

@ -25,29 +25,30 @@ class AddManySessionToCategoryFunctions
function search_courses($needle,$type)
{
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$xajax_response = new xajaxResponse();
$return = '';
if(!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
$sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id';
$rs = Database::query($sql);
$course_list = array();
$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
while ($course = Database :: fetch_array($rs)) {
$course_list[] = $course['id'];
$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>';
}
$return .= '</select>';
$xajax_response->addAssign(
'ajax_list_courses_multiple',
'innerHTML',
api_utf8_encode($return)
);
}
$_SESSION['course_list'] = $course_list;
$sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id';
$rs = Database::query($sql);
$course_list = array();
$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
while($course = Database :: fetch_array($rs)) {
$course_list[] = $course['id'];
$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
}
$_SESSION['course_list'] = $course_list;
return $xajax_response;
}
return $xajax_response;
}
}

@ -675,8 +675,9 @@ class Agenda
* @param string $color
* @param bool $addAnnouncement
* @param bool $updateContent
* @param int $authorId
*
* @return null|false
* @return bool
*/
public function editEvent(
$id,
@ -691,11 +692,13 @@ class Agenda
$comment = null,
$color = '',
$addAnnouncement = false,
$updateContent = true
$updateContent = true,
$authorId = 0
) {
$start = api_get_utc_datetime($start);
$end = api_get_utc_datetime($end);
$allDay = isset($allDay) && $allDay == 'true' ? 1 : 0;
$authorId = empty($authorId) ? api_get_user_id() : (int) $authorId;
switch ($this->type) {
case 'personal':
@ -846,7 +849,7 @@ class Agenda
TOOL_CALENDAR_EVENT,
$id,
'visible',
api_get_user_id(),
$authorId,
$groupIid,
null,
$start,
@ -882,7 +885,7 @@ class Agenda
TOOL_CALENDAR_EVENT,
$id,
'visible',
api_get_user_id(),
$authorId,
$groupIidItem,
0,
$start,
@ -924,7 +927,7 @@ class Agenda
TOOL_CALENDAR_EVENT,
$id,
'visible',
api_get_user_id(),
$authorId,
$groupIid,
$userId,
$start,
@ -1376,7 +1379,7 @@ class Agenda
/**
* Gets a single event
*
* @param int event id
* @param int $id event id
* @return array
*/
public function get_event($id)

@ -13,10 +13,10 @@ class View
/**
* Constructor, init tool path for rendering
* @param string tool name (optional)
* @param string $toolname tool name (optional)
* @param string $template_path
*/
public function __construct($toolname = '', $template_path=null)
public function __construct($toolname = '', $template_path = null)
{
if (!empty($toolname)) {
if (isset($template_path)) {

@ -36,9 +36,7 @@ function get_tabs($courseId = null)
$navigation[SECTION_CATALOG]['key'] = 'catalog';
$navigation[SECTION_CATALOG]['icon'] = 'catalog.png';
// My Courses
if (api_is_allowed_to_create_course()) {
// Link to my courses for teachers
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
@ -50,7 +48,6 @@ function get_tabs($courseId = null)
$navigation['mycourses']['key'] = 'my-course';
$navigation['mycourses']['icon'] = 'my-course.png';
// My Profile
$navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
@ -71,7 +68,7 @@ function get_tabs($courseId = null)
}
// Reporting
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
if (api_is_teacher() || api_is_drh() || api_is_session_admin()) {
// Link to my space
$navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':'');
$navigation['session_my_space']['title'] = get_lang('MySpace');
@ -292,13 +289,13 @@ function return_navigation_array()
// Reporting
if (api_get_setting('show_tabs', 'reporting') == 'true') {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin() || api_is_student_boss()) {
if (api_is_teacher() || api_is_drh() || api_is_session_admin() || api_is_student_boss()) {
$navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
} else {
if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin() || api_is_student_boss()) {
if (api_is_teacher() || api_is_drh() || api_is_session_admin() || api_is_student_boss()) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];

@ -114,6 +114,7 @@ class CourseManager
* Returns all the information of a given course code
* @param string $course_code , the course code
* @return array with all the fields of the course table
* @deprecated Use api_get_course_info() instead
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @assert ('') === false
*/
@ -2678,17 +2679,22 @@ class CourseManager
/**
* Get list of courses for a given user
*
* @param int $user_id
* @param boolean $include_sessions Whether to include courses from session or not
* @param boolean $adminGetsAllCourses If the user is platform admin,
* whether he gets all the courses or just his. Note: This does *not* include all sessions
* @return array List of codes and db name
* @param bool $loadSpecialCourses
* @param array $skipCourseList List of course ids to skip
* @return array List of codes and db name
* @author isaac flores paz
*/
public static function get_courses_list_by_user_id(
$user_id,
$include_sessions = false,
$adminGetsAllCourses = false
$adminGetsAllCourses = false,
$loadSpecialCourses = true,
$skipCourseList = []
) {
$user_id = intval($user_id);
$urlId = api_get_current_access_url_id();
@ -2699,7 +2705,7 @@ class CourseManager
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_user_course_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
$tableCourseUrl = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$special_course_list = self::get_special_course_list();
if ($adminGetsAllCourses && UserManager::is_admin($user_id)) {
// get the whole courses list
$sql = "SELECT DISTINCT(course.code), course.id as real_id
@ -2709,32 +2715,41 @@ class CourseManager
WHERE url.access_url_id = $urlId
";
} else {
$with_special_courses = $without_special_courses = '';
if (!empty($special_course_list)) {
$sc_string = '"' . implode('","', $special_course_list) . '"';
$with_special_courses = ' AND course.id IN (' . $sc_string . ')';
$without_special_courses = ' AND course.id NOT IN (' . $sc_string . ')';
}
if (!empty($with_special_courses)) {
$sql = "SELECT DISTINCT(course.code), course.id as real_id
FROM $tbl_course_user course_rel_user
LEFT JOIN $tbl_course course
ON course.id = course_rel_user.c_id
LEFT JOIN $tbl_user_course_category user_course_category
ON course_rel_user.user_course_cat = user_course_category.id
INNER JOIN $tableCourseUrl url
ON (course.id = url.c_id)
WHERE url.access_url_id = $urlId $with_special_courses
GROUP BY course.code
ORDER BY user_course_category.sort, course.title, course_rel_user.sort ASC
";
$rs_special_course = Database::query($sql);
if (Database::num_rows($rs_special_course) > 0) {
while ($result_row = Database::fetch_array($rs_special_course)) {
$result_row['special_course'] = 1;
$course_list[] = $result_row;
$codes[] = $result_row['real_id'];
$withSpecialCourses = $withoutSpecialCourses = '';
if ($loadSpecialCourses) {
$specialCourseList = self::get_special_course_list();
if (!empty($specialCourseList)) {
$specialCourseToString = '"'.implode(
'","',
$specialCourseList
).'"';
$withSpecialCourses = ' AND course.id IN ('.$specialCourseToString.')';
$withoutSpecialCourses = ' AND course.id NOT IN ('.$specialCourseToString.')';
}
if (!empty($withSpecialCourses)) {
$sql = "SELECT DISTINCT(course.code), course.id as real_id
FROM $tbl_course_user course_rel_user
LEFT JOIN $tbl_course course
ON course.id = course_rel_user.c_id
LEFT JOIN $tbl_user_course_category user_course_category
ON course_rel_user.user_course_cat = user_course_category.id
INNER JOIN $tableCourseUrl url
ON (course.id = url.c_id)
WHERE url.access_url_id = $urlId $withSpecialCourses
GROUP BY course.code
ORDER BY user_course_category.sort, course.title, course_rel_user.sort ASC
";
$rs_special_course = Database::query($sql);
if (Database::num_rows($rs_special_course) > 0) {
while ($result_row = Database::fetch_array(
$rs_special_course
)) {
$result_row['special_course'] = 1;
$course_list[] = $result_row;
$codes[] = $result_row['real_id'];
}
}
}
}
@ -2750,12 +2765,19 @@ class CourseManager
WHERE
url.access_url_id = $urlId AND
cru.user_id = '$user_id'
$without_special_courses";
$withoutSpecialCourses
ORDER BY course.title
";
}
$result = Database::query($sql);
if (Database::num_rows($result)) {
while ($row = Database::fetch_array($result, 'ASSOC')) {
if (!empty($skipCourseList)) {
if (in_array($row['real_id'], $skipCourseList)) {
continue;
}
}
$course_list[] = $row;
$codes[] = $row['real_id'];
}
@ -2768,6 +2790,11 @@ class CourseManager
WHERE user_id = $user_id AND s.c_id = c.id";
$r = Database::query($sql);
while ($row = Database::fetch_array($r, 'ASSOC')) {
if (!empty($skipCourseList)) {
if (in_array($row['real_id'], $skipCourseList)) {
continue;
}
}
if (!in_array($row['real_id'], $codes)) {
$course_list[] = $row;
}
@ -3648,6 +3675,8 @@ class CourseManager
public static function returnCoursesCategories($user_category_id, $load_dirs = false)
{
$user_id = api_get_user_id();
$user_category_id = (int) $user_category_id;
// Table definitions
$TABLECOURS = Database:: get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
@ -3656,13 +3685,17 @@ class CourseManager
// Get course list auto-register
$special_course_list = self::get_special_course_list();
$without_special_courses = '';
if (!empty($special_course_list)) {
$without_special_courses = ' AND course.id NOT IN ("' . implode('","', $special_course_list) . '")';
}
$sql = "SELECT
$userCategoryCondition = " (course_rel_user.user_course_cat = $user_category_id) ";
if (empty($user_category_id)) {
$userCategoryCondition = ' (course_rel_user.user_course_cat = 0 OR course_rel_user.user_course_cat IS NULL) ';
}
$sql = "SELECT DISTINCT
course.id,
course_rel_user.status status
FROM $TABLECOURS course
@ -3672,22 +3705,22 @@ class CourseManager
ON (url.c_id = course.id)
WHERE
course_rel_user.user_id = '" . $user_id . "' AND
course_rel_user.user_course_cat = '" . $user_category_id . "'
$userCategoryCondition
$without_special_courses ";
// If multiple URL access mode is enabled, only fetch courses
// corresponding to the current URL.
if (api_get_multiple_access_url() && $current_url_id != -1) {
$sql .= " AND url.c_id = course.id AND access_url_id='" . $current_url_id . "'";
$sql .= " AND access_url_id='" . $current_url_id . "'";
}
// Use user's classification for courses (if any).
$sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
$result = Database::query($sql);
$courseList = array();
$showCustomIcon = api_get_setting('course_images_in_courses_list');
// Browse through all courses.
$courseAdded = [];
while ($row = Database::fetch_array($result)) {
$course_info = api_get_course_info_by_id($row['id']);
if (isset($course_info['visibility']) &&
@ -3695,6 +3728,11 @@ class CourseManager
) {
continue;
}
// Skip if already in list
if (in_array($course_info['real_id'], $courseAdded)) {
continue;
}
$course_info['id_session'] = null;
$course_info['status'] = $row['status'];
// For each course, get if there is any notification icon to show
@ -3757,7 +3795,7 @@ class CourseManager
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
$params['notifications'] = $showNotification;
}
$courseAdded[] = $course_info['real_id'];
$courseList[] = $params;
}
@ -5182,15 +5220,21 @@ class CourseManager
if ($editTeacherInSessions) {
$sessions = SessionManager::get_session_by_course($courseId);
if (!empty($sessions)) {
if ($logger) {
$logger->addInfo("Edit teachers in sessions");
}
foreach ($sessions as $session) {
$sessionId = $session['id'];
// Remove old and add new
if ($deleteSessionTeacherNotInList) {
foreach ($teachers as $userId) {
if ($logger) {
$logger->addInfo("Set coach #$userId in session #$sessionId of course #$courseId ");
}
SessionManager::set_coach_to_course_session(
$userId,
$session['id'],
$sessionId,
$courseId
);
}
@ -5202,9 +5246,12 @@ class CourseManager
if (!empty($teachersToDelete)) {
foreach ($teachersToDelete as $userId) {
if ($logger) {
$logger->addInfo("Delete coach #$userId in session #$sessionId of course #$courseId ");
}
SessionManager::set_coach_to_course_session(
$userId,
$session['id'],
$sessionId,
$courseId,
true
);
@ -5213,9 +5260,12 @@ class CourseManager
} else {
// Add new teachers only
foreach ($teachers as $userId) {
if ($logger) {
$logger->addInfo("Add coach #$userId in session #$sessionId of course #$courseId ");
}
SessionManager::set_coach_to_course_session(
$userId,
$session['id'],
$sessionId,
$courseId
);
}

@ -2032,14 +2032,18 @@ class Display
/**
* @todo use twig
* @param string $title
* @param array $elements
* @param bool $alignToRight
* @return string
*/
public static function groupButtonWithDropDown($title, $elements)
public static function groupButtonWithDropDown($title, $elements, $alignToRight = false)
{
$html = '<div class="btn-group">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
'.$title.'
<span class="caret"></span></button>
<ul class="dropdown-menu">';
<ul class="dropdown-menu ' . ($alignToRight ? 'dropdown-menu-right' : '') . '">';
foreach ($elements as $item) {
$html .= Display::tag('li', Display::url($item['title'], $item['href']));
}

@ -37,7 +37,7 @@ class ExerciseShowFunctions
$originalStudentAnswer = '',
$showTotalScoreAndUserChoices
) {
$answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $resultsDisabled, $showTotalScoreAndUserChoices);
$answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $feedbackType, $resultsDisabled, $showTotalScoreAndUserChoices);
if (strpos($originalStudentAnswer, 'font color') !== false) {
$answerHTML = $originalStudentAnswer;
}

@ -216,7 +216,7 @@ class ExtraFieldOption extends Model
foreach ($sub_options as $sub_option) {
if (!empty($sub_option)) {
$new_params = array(
$new_params = array(
'field_id' => $field_id,
'option_value' => $sub_id,
'display_text' => $sub_option,
@ -660,7 +660,7 @@ class ExtraFieldOption extends Model
$form->addElement('hidden', 'field_id', $this->field_id);
if ($action == 'edit') {
$translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([
$translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([
'extra_field_option' => $id
]);
$translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link');

@ -233,8 +233,8 @@ EOT;
}
/**
* @param $name
* @param $label
* @param string $name
* @param string $label
* @param array $options
* @param array $attributes
* @throws
@ -1063,7 +1063,7 @@ EOT;
/**
* This function has been created for avoiding changes directly within QuickForm class.
* When we use it, the element is threated as 'required' to be dealt during validation.
* @param array $element The array of elements
* @param array $elements The array of elements
* @param string $message The message displayed
*/
public function add_multiple_required_rule($elements, $message)
@ -1339,12 +1339,12 @@ EOT;
}
/**
* @param $name
* @param string $name
* @param $label
* @param bool $required
* @param array $attributes
* @param bool $allowNegative
* @param null $minValue
* @param integer $minValue
* @param null $maxValue
*/
public function addFloat(

@ -115,7 +115,7 @@ class GradeModel extends Model
}
$form->addElement('hidden', 'maxvalue', '100');
$form->addElement('hidden', 'minvalue', '0');
$form->addElement('hidden', 'minvalue', '0');
$renderer = & $form->defaultRenderer();
$component_array = array();
@ -191,7 +191,7 @@ class GradeModel extends Model
// Setting the rules
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
return $form;
return $form;
}
/**

@ -138,7 +138,7 @@ class HookManagement implements HookManagementInterface
/**
* Return a list an associative array where keys are the active hook observer class name
* @param $eventName
* @param string $eventName
*
* @return array
*/

@ -678,7 +678,16 @@ function date_to_str_ago($date, $timeZone = 'UTC')
}
$getOldTimezone = api_get_timezone();
$timeAgo = new TimeAgo($timeZone, api_get_language_isocode());
$isoCode = api_get_language_isocode();
if ($isoCode == 'pt') {
$isoCode = 'pt-BR';
}
$checkFile = api_get_path(SYS_PATH).'vendor/jimmiw/php-time-ago/translations/'.$isoCode.'.php';
if (!file_exists($checkFile)) {
$isoCode = 'en';
}
$timeAgo = new TimeAgo($timeZone, $isoCode);
$value = $timeAgo->inWords($date);
date_default_timezone_set($getOldTimezone);

@ -470,6 +470,7 @@ class Link extends Model
*
* Get link info
* @param int link id
* @param integer $id
* @return array link info
*
**/
@ -854,7 +855,7 @@ class Link extends Model
}
/**
* @param $categoryId
* @param integer $categoryId
* @param $courseId
* @param $sessionId
* @param bool $withBaseContent
@ -941,8 +942,8 @@ class Link extends Model
* @author Julio Montoya
*
* @param $catid
* @param $courseId
* @param $session_id
* @param integer $courseId
* @param integer $session_id
* @return string
*/
public static function showLinksPerCategory($catid, $courseId, $session_id)
@ -1150,6 +1151,8 @@ class Link extends Model
/**
* Displays the edit, delete and move icons
* @param int Category ID
* @param integer $currentCategory
* @param integer $countCategories
* @return string
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@ -1290,6 +1293,7 @@ class Link extends Model
/**
* CSV file import functions
* @author René Haentjens , Ghent University
* @param string $catname
*/
public static function get_cat($catname)
{
@ -1324,6 +1328,11 @@ class Link extends Model
/**
* CSV file import functions
* @author René Haentjens , Ghent University
* @param string $url
* @param string $title
* @param string $description
* @param string $on_homepage
* @param string $hidden
*/
public static function put_link($url, $cat, $title, $description, $on_homepage, $hidden)
{

@ -276,6 +276,7 @@ class Login
* @global bool $is_platformAdmin
* @global bool $is_allowedCreateCourse
* @global object $_user
* @param boolean $reset
*/
public static function init_user($user_id, $reset)
{
@ -366,7 +367,7 @@ class Login
* @global type $is_allowed_in_course
*
* @param type $course_id
* @param type $reset
* @param boolean $reset
*/
static function init_course($course_id, $reset)
{

@ -36,7 +36,7 @@ class LpItem
public function __construct($in_c_id = 0, $in_id = 0)
{
if ($in_c_id > 0 && $in_id >0) {
if ($in_c_id > 0 && $in_id > 0) {
$item_view_table = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT * FROM $item_view_table
WHERE

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

Loading…
Cancel
Save