Merging from branch 1.9.x

skala
Julio Montoya 14 years ago
commit f9fd66634b
  1. 113
      documentation/changelog.html
  2. 8
      documentation/credits.html
  3. 2
      documentation/installation_guide.html
  4. 2
      documentation/optimization.html
  5. 6
      main/admin/add_courses_to_usergroup.php
  6. 9
      main/admin/configure_homepage.php
  7. 582
      main/admin/course_category.php
  8. 4
      main/admin/index.php
  9. 11
      main/admin/settings.lib.php
  10. 1
      main/admin/sub_language.class.php
  11. 4
      main/admin/usergroup_export.php
  12. 139
      main/admin/usergroup_user_import.php
  13. 6
      main/announcements/announcements.inc.php
  14. 9
      main/announcements/announcements.php
  15. 4
      main/auth/external_login/functions.inc.php
  16. 3
      main/auth/external_login/login.ldap.php
  17. 3
      main/auth/external_login/newUser.ldap.php
  18. 23
      main/auth/profile.php
  19. 693
      main/course_progress/thematic_controller.php
  20. 2
      main/coursecopy/classes/Course.class.php
  21. 5
      main/coursecopy/classes/CourseBuilder.class.php
  22. 18
      main/coursecopy/classes/CourseRestorer.class.php
  23. 17
      main/coursecopy/classes/CourseSelectForm.class.php
  24. 7
      main/css/base.css
  25. 35
      main/document/document.inc.php
  26. 12
      main/document/document.php
  27. 2
      main/exercice/exercice.php
  28. 21
      main/exercice/exercise.class.php
  29. 51
      main/exercice/exercise.lib.php
  30. 22
      main/exercice/exercise_admin.php
  31. 62
      main/exercice/exercise_report.php
  32. 14
      main/exercice/exercise_show.php
  33. 2
      main/exercice/exercise_submit.php
  34. 4
      main/exercice/fill_blanks.class.php
  35. 83
      main/exercice/hotpotatoes_exercise_report.php
  36. 381
      main/exercice/hotpotatoes_exercise_result.class.php
  37. 1807
      main/exercice/hotspot_admin.inc.php
  38. 5
      main/exercice/overview.php
  39. 13
      main/exercice/question.class.php
  40. 162
      main/forum/forumfunction.inc.php
  41. 5
      main/forum/index.php
  42. 2
      main/gradebook/index.php
  43. 3
      main/gradebook/lib/fe/flatviewtable.class.php
  44. 47
      main/gradebook/lib/flatview_data_generator.class.php
  45. 10
      main/gradebook/lib/gradebook_functions.inc.php
  46. 16
      main/group/group.php
  47. 2
      main/group/group_category.php
  48. 6
      main/group/group_creation.php
  49. 57
      main/group/group_edit.php
  50. 118
      main/group/group_space.php
  51. 27
      main/inc/ajax/model.ajax.php
  52. 2
      main/inc/lib/attendance.lib.php
  53. 48
      main/inc/lib/course.lib.php
  54. 7
      main/inc/lib/course_home.lib.php
  55. 2
      main/inc/lib/database.lib.php
  56. 9
      main/inc/lib/display.lib.php
  57. 89
      main/inc/lib/document.lib.php
  58. 23
      main/inc/lib/fckeditor/editor/plugins/Abbr/lang/de.js
  59. 244
      main/inc/lib/fckeditor/editor/plugins/ImageManager/lang/de.js
  60. 14
      main/inc/lib/fckeditor/editor/plugins/MP3/lang/de.js
  61. 16
      main/inc/lib/fckeditor/editor/plugins/audio/lang/de.js
  62. 78
      main/inc/lib/fckeditor/editor/plugins/customizations/lang/de.js
  63. 28
      main/inc/lib/fckeditor/editor/plugins/fckEmbedMovies/lang/de.js
  64. 94
      main/inc/lib/fckeditor/editor/plugins/flvPlayer/lang/de.js
  65. 90
      main/inc/lib/fckeditor/editor/plugins/googlemaps/lang/de.js
  66. 6
      main/inc/lib/fckeditor/editor/plugins/insertHtml/lang/de.js
  67. 20
      main/inc/lib/fckeditor/editor/plugins/media/lang/de.js
  68. 56
      main/inc/lib/fckeditor/editor/plugins/wikilink/lang/de.js
  69. 40
      main/inc/lib/fckeditor/editor/plugins/youtube/lang/de.js
  70. 28
      main/inc/lib/fileUpload.lib.php
  71. 139
      main/inc/lib/groupmanager.lib.php
  72. 25
      main/inc/lib/internationalization.lib.php
  73. 12
      main/inc/lib/link.lib.php
  74. 58
      main/inc/lib/main_api.lib.php
  75. 17
      main/inc/lib/pdf.lib.php
  76. 2
      main/inc/lib/pear/HTML/QuickForm.php
  77. 142
      main/inc/lib/search/ChamiloIndexer.class.php
  78. 74
      main/inc/lib/search/IndexableChunk.class.php
  79. 16
      main/inc/lib/search/get_terms.php
  80. 1
      main/inc/lib/search/search_widget.php
  81. 87
      main/inc/lib/search/tool_processors/document_processor.class.php
  82. 121
      main/inc/lib/search/tool_processors/learnpath_processor.class.php
  83. 66
      main/inc/lib/search/tool_processors/link_processor.class.php
  84. 63
      main/inc/lib/search/tool_processors/quiz_processor.class.php
  85. 3
      main/inc/lib/search/tool_processors/search_processor.class.php
  86. 209
      main/inc/lib/search/xapian/XapianIndexer.class.php
  87. 263
      main/inc/lib/search/xapian/XapianQuery.php
  88. 3
      main/inc/lib/social.lib.php
  89. 20
      main/inc/lib/thematic.lib.php
  90. 42
      main/inc/lib/tracking.lib.php
  91. 49
      main/inc/lib/usergroup.lib.php
  92. 10
      main/inc/lib/usermanager.lib.php
  93. 7
      main/inc/lib/userportal.lib.php
  94. 51
      main/inc/local.inc.php
  95. 2
      main/install/index.php
  96. 2
      main/install/install.lib.php
  97. 18
      main/lang/english/trad4all.inc.php
  98. 1
      main/lang/french/index.inc.php
  99. 7
      main/lang/french/trad4all.inc.php
  100. 2
      main/lang/slovenian/admin.inc.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -61,6 +61,119 @@
<li></li>
</ul>
<h1>Chamilo 1.9.4 - , 15th of November, 2012</h1>
<h3>Release notes - summary</h3>
<p>Chamilo 1.9.4 is a minor stable version with a series of improvements on top of 1.9.2.</p>
<h3>Release name</h3>
<h3>New Features</h3>
<ul>
<li></li>
</ul>
<h3>Improvements</h3>
<ul>
<li></li>
</ul>
<h3>Debugging</h3>
<ul>
<li></li>
</ul>
<h1>Chamilo 1.9.2 - Hanga Roa, 27th of September, 2012</h1>
<h3>Release notes - summary</h3>
<p>Chamilo 1.9.2 is a minor stable version with a series of improvements on top of 1.9.0.</p>
<h3>Release name</h3>
<p><a href="http://en.wikipedia.org/wiki/Hanga_Roa">Hanga Roa</a> is the capital city of Rapa Nui, the Easter Island. The entire Rapa Nui culture is filled with mystery and assumptions about where and how the first Rapa Nui people came to be on the island, but it is accepted by many that the main strain came from Polynesia a long time ago. The population there is around 3,300 but warmly welcomes tons of tourists every year, a bit in the image of the small team of Chamilo now serving more than 1.4M users worldwide, with a welcoming 1.9.2 version that will help you get more time to yourself...</p>
<h3>New Features</h3>
<ul>
<li>Course home: Allow for the publication of direct links to learning paths in the sessions (#3367)</li>
<li>Global: We now show th teacher's professional "card" when clicking on the teacher's name in the courses list (#3388)</li>
<li>Global: Added option to send the student to the courses catalog the first time he logs in (#3898)</li>
<li>Exercises: Added "success score" to exercises (#4541)</li>
<li>Exercises: Added automated distribution of score in specific question type (#4656)</li>
<li>Attendances: Added PDF + print button to attendance sheets (#5069)</li>
<li>Assignments: Users can now see if they have already uploaded their assignment (#5145)</li>
<li>Global: Added a course-specific registration link to increase speed of auto-registration (#5299)</li>
<li>Exercises: Success score for an exercise can now be set manually to allow for specific percentages (#5330)</li>
<li>Documents: The images and audio integrated apps now check available space left on disk before saving (#5346)</li>
<li>Sessions: Added an "official" start and end date to the sessions</li>
<li>Forum: Forum categories, fora and forum threads (but not forum posts to avoid inconsistencies in users property) can now be copied from one course to another (#5462)</li>
<li>Users: Added the possibility for teachers to add students to their course through users classes (#5514)</li>
</ul>
<h3>Improvements</h3>
<ul>
<li>Exercises: Exercises and questions can now be copied inside or between courses, and be better included into learning paths (#651)</li>
<li>Global: Improved WYSIWYG behaviour, now more natural (#1780)</li>
<li>Interface: The action icons bar was improved (#2810)</li>
<li>Social network: Added an icon to show whether users are on- or offline (#3316)</li>
<li>Exercises: Improved interface in true/false/don't know question type (#3370)</li>
<li>Learning paths: Fixed a series of small issues with the learning paths edition page (#3533)</li>
<li>Global: Improvements on various timezone issues (#3747)</li>
<li>Exercises: The test description now only shows on the test start page (#3845)</li>
<li>Global: Fixed CSS positionning problem (#4075)</li>
<li>Learning paths: Improved error message for too large SCORM files (#4142)</li>
<li>Attendances: Reduced steps to create attendance sheets (#4484)</li>
<li>Forum: E-mail notifications can now be sent daily only (#4761)</li>
<li>Plugins: Improved the BBB 0.8 plugin (#4840 &amp; #5312)</li>
<li>Global: Enabled custom pages feature, which allows the system to server specific pages after login to specific user roles (#4850)</li>
<li>Survey: Added surveys in item_property tracking (#4923)</li>
<li>Global: Disable auto-capitalize when using mobile phones (#5116)</li>
<li>Agenda: Improved the personal agenda items system (#5201)</li>
<li>Global: Added a link for portal admins to hide the "Popular courses" block (#5268)</li>
<li>Social network: Deleting private messages now requires confirmation (#5269)</li>
<li>Global: Invalid address errors are now saved to the default error log (#5306)</li>
<li>Exercises: Exercises with a pass % of 0 disable the pass % feature (#5383)</li>
<li>Exercises: Small aesthetics improvements for true/false/dunno answer type (#5385)</li>
<li>Users: Added the registration date in the users lists tables (#5473)</li>
<li>Course copy: Improved error message on missing file (#5515)</li>
<li>Exercises: Added grey icon for audio questions when exercise is bloqued (#5516)</li>
</ul>
<h3>Debugging</h3>
<ul>
<li>Global: Fixed a bug with XLS export encoding (#1831)</li>
<li>Documents: Fixed bug editing jpg/png with SVGedit (#3261)</li>
<li>Exercises: Fixed missing reports on some questions in test feedback (#3347)</li>
<li>Learning paths: Fixed tab-switching issue in LP edition (#3352)</li>
<li>Assignments: Fixed issue by which students could send assignments passed the end date (#3918)</li>
<li>Global: Fixed issue by which password reminder stopped working in some cases (#4032)</li>
<li>Global: Fixed bug by which users lost their sessions when the Wiris plugin was enabled (#4468)</li>
<li>Assessments: Fixed issue with the QR code generation in certificates (#5015)</li>
<li>Plugins: Fixed issue when installing the BBB plugin when using subdirectories (#5103)</li>
<li>Learning paths: Fixed the learning path tracking reset buttong (#5239)</li>
<li>Learning paths: Fixed issue with HotPotatoes files paths being shown (#5253)</li>
<li>Learning paths: Fixed blanck page when editing a document without title (#5265)</li>
<li>Learning paths: Fixed issues in learning paths export (#5286)</li>
<li>Social network: Fixed chat box remaining enabled when social network is not (#5295)</li>
<li>Exercises: Fixed issue with exercise's start time not being saved (#5301)</li>
<li>Migration: Fixed courses disappearing when migrating from 1.8 to 1.9 (#5302)</li>
<li>Global: Fixed font preview being different from the final result (#5303)</li>
<li>Exercises: Fixed very rare case where the expiration of time when reviewing questions with delete results (#5304)</li>
<li>Exercises: Fixed display bug in modal results window (#5311)</li>
<li>Social network: Fixed wrong extra text field in reply form in social messaging (#5327)</li>
<li>Learning paths: Fixed a fatal error in learner reporting (#5347)</li>
<li>Agenda: Fixed wrong month in calendar event popup (#5348)</li>
<li>Global: Fixed issue by which profile fields of type select did not unfold (#5351)</li>
<li>Sessions: Fixed issue by which access delays did not influence the visibility in courses list (#5353)</li>
<li>Global: Fixed online e-mail editor setting (#5356)</li>
<li>Exercises: Fixed but in exercises scenario (#5375)</li>
<li>Exercixes: Fixed issue with open questions (#5434)</li>
<li>Global: Fixed issue when enabling openid without the right config in the right place (#5463)</li>
<li>Assignments: Fixed SQL error when adding an assignment (#5484)</li>
<li>Global: Fixed FCKEditor error in assessments model creation (#5490)</li>
<li>Global: Fixed courses backup (broken by the implementation of forum backup) (#5499)</li>
<li>Assessments: Qualification's icon did not appear on tasks (#5517)</li>
<li>Exercises: Fixed issue with reviewed question and 0 score (#5517)</li>
<li>Global: Fixed missing student view button (#5528)</li>
<li>Survey: Fixed issue sending survey invitations by e-mail (#5529)</li>
<li>Admin: Fixed name clash between home-made function http_request() and a pre-defined http_request() function (#5531)</li>
<li>Users: Problem accessing the course groups (#5537)</li>
<li>Social network: An user could not modify its own official code, even if configured to be possible (#5538)</li>
</ul>
<h1>Chamilo 1.9.0 - Vogüé, 31st of July, 2012</h1>
<h3>Release notes - summary</h3>

@ -124,6 +124,9 @@ In the following credits, when possible, we tried to put the latest contributors
<h1>Quality Assurance</h1>
<ul>
<li>Yannick Warnier as QA coordinator</li>
<li>Yoselyn Castillo</li>
<li>Jeremy Saavedra</li>
<li>Coursenligne on the forum</li>
<li>Noa Orizales, through numerous implementations in Spain</li>
<li>Hector Lacherre and colleagues from USIL, Lima</li>
<li>Carlos Vargas</li>
@ -136,6 +139,7 @@ In the following credits, when possible, we tried to put the latest contributors
<ul>
<li>Yannick Warnier - implementation of CDN, SQL improvements, memcached and documentation in the optimization guide</li>
<li>Ivan Tcholakov - language loading performances improvements in 1.8</li>
<li>Julio Montoya</li>
<li>Arnaud Ligot</li>
<li>Jérôme Warnier</li>
<li>Ludwig Chauvin</li>
@ -655,6 +659,8 @@ There are too much translators to list them all. Please check http://translate.c
<li>Henri Hedman, for bug reports in LMS 1.9</li>
<li>Ludovic Gasc, France, for optimization patch in LMS 1.9</li>
<li>Juho Paranko, Finland, for bug reports in LMS 1.9</li>
<li>Jeremy Saavedra, for bug reports in LMS 1.9.2</li>
<li>Ricel Leite, for bug reports and fixes in LMS 1.9.4</li>
<li>All the supporting parents, partners, children, friends, colleagues and sometimes students, of the very special geeks that we are, for their continous support and inspiration</li>
</ul>
@ -679,6 +685,8 @@ These institutions and companies have either contributed to the Chamilo project
<li>Commission Scolaire des Hautes-Rivières, project TIC-FP, Canada</li>
<li>ACTA VZW, Belgium</li>
<li>NoSoloRed, Spain</li>
<li>ICPNA, Peru</li>
<li>Universidad Autónoma, Chile</li>
</ul>

@ -299,7 +299,7 @@ date.timezone = 'America/New_York'
<hr />
<h2><a name="3._Upgrade_from_a_previous_version_of"></a>3. Upgrade from a
previous version of Chamilo LMS (1.*) or Dok€os (<2.0)</h2>
previous version of Chamilo LMS (1.*) or Dok€os (&lt;2.0)</h2>
Before upgrading, we <b>heavily</b> recommend you do a full backup of the previous
Chamilo or Dok€os directories and databases. If you are unsure how to achieve this
please ask your hosting provider for advice.<br />

@ -9,7 +9,7 @@
<body>
<div class="container">
<h1>Chamilo 1.8.8.4 : Optimization Guide</h1>
<h1>Chamilo : Optimization Guide</h1>
<a href="index.html">Documentation</a> &gt; Optimization Guide

@ -102,9 +102,9 @@ $elements_not_in = $elements_in= array();
if (!empty($course_list)) {
foreach($course_list as $item) {
if (in_array($item['id'], $course_list_in)) {
$elements_in[$item['id']] = $item['title']." (".$item['code'].")";
$elements_in[$item['id']] = $item['title']." (".$item['visual_code'].")";
} else {
$elements_not_in[$item['id']] = $item['title']." (".$item['code'].")";
$elements_not_in[$item['id']] = $item['title']." (".$item['visual_code'].")";
}
}
}
@ -152,7 +152,7 @@ function search($needle,$type) {
foreach ($list as $row ) {
if (!in_array($row['id'], array_keys($elements_in))) {
$return .= '<option value="'.$row['id'].'">'.$row['title'].' ('.$row['code'].')</option>';
$return .= '<option value="'.$row['id'].'">'.$row['title'].' ('.$row['visual_code'].')</option>';
}
}
$return .= '</select>';

@ -176,8 +176,8 @@ if (!empty($action)) {
if (EventsMail::check_if_using_class('portal_homepage_edited')) {
EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id()));
}
}
event_system(LOG_HOMEPAGE_CHANGED, 'edit_top', cut(strip_tags($home_top), 254), api_get_utc_datetime(), api_get_user_id());
break;
case 'edit_notice':
// Filter
@ -205,6 +205,7 @@ if (!empty($action)) {
fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
fclose($fp);
}
event_system(LOG_HOMEPAGE_CHANGED, 'edit_notice', cut(strip_tags($notice_title), 254), api_get_utc_datetime(), api_get_user_id());
break;
case 'edit_news':
//Filter
@ -251,6 +252,7 @@ if (!empty($action)) {
}
}
}
event_system(LOG_HOMEPAGE_CHANGED, 'edit_news', strip_tags(cut($home_news, 254)), api_get_utc_datetime(), api_get_user_id());
break;
case 'insert_tabs':
case 'edit_tabs':
@ -388,6 +390,7 @@ if (!empty($action)) {
fclose($fp);
}
}
event_system(LOG_HOMEPAGE_CHANGED, $action, cut($link_name.':'.$link_url, 254), api_get_utc_datetime(), api_get_user_id());
break;
} //end of switch($action)
@ -615,8 +618,6 @@ if (!empty($action)) {
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
switch ($action) {
case 'open_link':
if (!empty($link)) {

@ -1,19 +1,19 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @todo use formvalidator for the form
*/
* @package chamilo.admin
* @todo use formvalidator for the form
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file='admin';
$language_file = 'admin';
$cidReset=true;
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section=SECTION_PLATFORM_ADMIN;
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$category = $_GET['category'];
@ -21,355 +21,321 @@ $category = Database::escape_string($category);
$action = $_GET['action'];
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
$errorMsg='';
if(!empty($action)) {
if($action == 'delete')
{
deleteNode($_GET['id']);
header('Location: '.api_get_self().'?category='.Security::remove_XSS($category));
exit();
}
elseif(($action == 'add' || $action == 'edit') && $_POST['formSent'])
{
$_POST['categoryCode']=trim($_POST['categoryCode']);
$_POST['categoryName']=trim($_POST['categoryName']);
if(!empty($_POST['categoryCode']) && !empty($_POST['categoryName']))
{
if($action == 'add')
{
$ret=addNode($_POST['categoryCode'],$_POST['categoryName'],$_POST['canHaveCourses'],$category);
}
else
{
$ret=editNode($_POST['categoryCode'],$_POST['categoryName'],$_POST['canHaveCourses'],$_GET['id']);
}
if($ret)
{
$action='';
}
else
{
$errorMsg=get_lang('CatCodeAlreadyUsed');
}
}
else
{
$errorMsg=get_lang('PleaseEnterCategoryInfo');
}
}
elseif($action == 'edit')
{
$categoryCode=Database::escape_string($_GET['id']);
$result=Database::query("SELECT name,auth_course_child FROM $tbl_category WHERE code='$categoryCode'");
list($categoryName,$canHaveCourses)=Database::fetch_row($result);
$canHaveCourses=($canHaveCourses == 'FALSE')?0:1;
}
elseif($action == 'moveUp')
{
moveNodeUp($_GET['id'],$_GET['tree_pos'],$category);
header('Location: '.api_get_self().'?category='.Security::remove_XSS($category));
exit();
}
$errorMsg = '';
if (!empty($action)) {
if ($action == 'delete') {
deleteNode($_GET['id']);
header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
exit();
} elseif (($action == 'add' || $action == 'edit') && $_POST['formSent']) {
$_POST['categoryCode'] = trim($_POST['categoryCode']);
$_POST['categoryName'] = trim($_POST['categoryName']);
if (!empty($_POST['categoryCode']) && !empty($_POST['categoryName'])) {
if ($action == 'add') {
$ret = addNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $category);
} else {
$ret = editNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $_GET['id']);
}
if ($ret) {
$action = '';
} else {
$errorMsg = get_lang('CatCodeAlreadyUsed');
}
} else {
$errorMsg = get_lang('PleaseEnterCategoryInfo');
}
} elseif ($action == 'edit') {
$categoryCode = Database::escape_string($_GET['id']);
$result = Database::query("SELECT name,auth_course_child FROM $tbl_category WHERE code='$categoryCode'");
list($categoryName, $canHaveCourses) = Database::fetch_row($result);
$canHaveCourses = ($canHaveCourses == 'FALSE') ? 0 : 1;
} elseif ($action == 'moveUp') {
moveNodeUp($_GET['id'], $_GET['tree_pos'], $category);
header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
exit();
}
}
$tool_name=get_lang('AdminCategories');
$tool_name = get_lang('AdminCategories');
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
//$interbreadcrumb[]=array('url' => 'configure_homepage.php',"name" => get_lang('ConfigureHomePage'));
Display::display_header($tool_name);
if(!empty($category)) {
$myquery = "SELECT * FROM $tbl_category WHERE code ='$category'";
$result = Database::query($myquery);
if(Database::num_rows($result)==0) {
$category = '';
}
if (!empty($category)) {
$myquery = "SELECT * FROM $tbl_category WHERE code ='$category'";
$result = Database::query($myquery);
if (Database::num_rows($result) == 0) {
$category = '';
}
}
if(empty($action)) {
$myquery = "SELECT t1.name,t1.code,t1.parent_id,t1.tree_pos,t1.children_count,COUNT(DISTINCT t3.code) AS nbr_courses
if (empty($action)) {
$myquery = "SELECT t1.name,t1.code,t1.parent_id,t1.tree_pos,t1.children_count,COUNT(DISTINCT t3.code) AS nbr_courses
FROM $tbl_category t1 LEFT JOIN $tbl_category t2 ON t1.code=t2.parent_id LEFT JOIN $tbl_course t3 ON t3.category_code=t1.code
WHERE t1.parent_id ".(empty($category)?"IS NULL":"='$category'")."
WHERE t1.parent_id " . (empty($category) ? "IS NULL" : "='$category'") . "
GROUP BY t1.name,t1.code,t1.parent_id,t1.tree_pos,t1.children_count ORDER BY t1.tree_pos";
$result = Database::query($myquery);
$Categories=Database::store_result($result);
$result = Database::query($myquery);
$Categories = Database::store_result($result);
}
if($action == 'add' || $action == 'edit') {
?>
<div class="actions">
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>"><?php echo Display::return_icon('folder_up.png',get_lang("Back"),'',ICON_SIZE_MEDIUM); if(!empty($category)) echo ' ('.Security::remove_XSS($category).')'; ?></a>
</div>
<?php
$form_title = ($action == 'add')?get_lang('AddACategory'):get_lang('EditNode');
if(!empty($category)) {
$form_title .= ' '.get_lang('Into').' '.Security::remove_XSS($category);
}
$form = new FormValidator('course_category');
$form->addElement('header', '', $form_title);
$form->display();
?>
<form method="post" action="<?php echo api_get_self(); ?>?action=<?php echo Security::remove_XSS($action); ?>&category=<?php echo Security::remove_XSS($category); ?>&amp;id=<?php echo Security::remove_XSS($_GET['id']); ?>">
<input type="hidden" name="formSent" value="1" />
<table border="0" cellpadding="5" cellspacing="0">
<?php
if(!empty($errorMsg)) {
?>
<tr>
<td colspan="2">
<?php
Display::display_normal_message($errorMsg); //main API
?>
</td>
</tr>
<?php
}
?>
<tr>
<td nowrap="nowrap"><?php echo get_lang("CategoryCode"); ?> :</td>
<td><input type="text" name="categoryCode" size="20" maxlength="20" value="<?php echo api_htmlentities(stripslashes($categoryCode),ENT_QUOTES,$charset); ?>" /></td>
</tr>
<tr>
<td nowrap="nowrap"><?php echo get_lang("CategoryName"); ?> :</td>
<td><input type="text" name="categoryName" size="20" maxlength="100" value="<?php echo api_htmlentities(stripslashes($categoryName),ENT_QUOTES,$charset); ?>" /></td>
</tr>
<tr>
<td nowrap="nowrap"><?php echo get_lang("AllowCoursesInCategory"); ?></td>
<td>
<input class="checkbox" type="radio" name="canHaveCourses" value="0" <?php if(($action == 'edit' && !$canHaveCourses) || ($action == 'add' && $formSent && !$canHaveCourses)) echo 'checked="checked"'; ?> /><?php echo get_lang("No"); ?>
<input class="checkbox" type="radio" name="canHaveCourses" value="1" <?php if(($action == 'edit' && $canHaveCourses) || ($action == 'add' && !$formSent || $canHaveCourses)) echo 'checked="checked"'; ?> /><?php echo get_lang("Yes"); ?>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<?php
if(isset($_GET['id']) && !empty($_GET['id'])) {
$class="save";
$text=get_lang('CategoryMod');
} else {
$class="add";
$text=get_lang('AddCategory');
}
?>
<td><button type="submit" class="<?php echo $class; ?>" value="<?php echo $text; ?>" ><?php echo $text; ?></button></td>
</tr>
</table>
</form>
<?php
} else {
?>
<div class="actions">
<?php
if(!empty($category) && empty($action)) {
$myquery = "SELECT parent_id FROM $tbl_category WHERE code='$category'";
$result=Database::query($myquery);
$parent_id = 0;
if(Database::num_rows($result)>0){
$parent_id=Database::fetch_array($result);
}
if ($action == 'add' || $action == 'edit') {
?>
<div class="actions">
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>"><?php echo Display::return_icon('folder_up.png', get_lang("Back"), '', ICON_SIZE_MEDIUM);
if (!empty($category)) echo ' (' . Security::remove_XSS($category) . ')'; ?></a>
</div>
<?php
$form_title = ($action == 'add') ? get_lang('AddACategory') : get_lang('EditNode');
if (!empty($category)) {
$form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category);
}
$form = new FormValidator('course_category');
$form->addElement('header', '', $form_title);
$form->display();
?>
<form method="post" action="<?php echo api_get_self(); ?>?action=<?php echo Security::remove_XSS($action); ?>&category=<?php echo Security::remove_XSS($category); ?>&amp;id=<?php echo Security::remove_XSS($_GET['id']); ?>">
<input type="hidden" name="formSent" value="1" />
<table border="0" cellpadding="5" cellspacing="0">
<?php
if (!empty($errorMsg)) {
?>
<tr>
<td colspan="2">
<?php
Display::display_normal_message($errorMsg); //main API
?>
</td>
</tr>
<?php
}
?>
<tr>
<td nowrap="nowrap"><?php echo get_lang("CategoryCode"); ?> :</td>
<td><input type="text" name="categoryCode" size="20" maxlength="20" value="<?php echo api_htmlentities(stripslashes($categoryCode), ENT_QUOTES, $charset); ?>" /></td>
</tr>
<tr>
<td nowrap="nowrap"><?php echo get_lang("CategoryName"); ?> :</td>
<td><input type="text" name="categoryName" size="20" maxlength="100" value="<?php echo api_htmlentities(stripslashes($categoryName), ENT_QUOTES, $charset); ?>" /></td>
</tr>
<tr>
<td nowrap="nowrap"><?php echo get_lang("AllowCoursesInCategory"); ?></td>
<td>
<input class="checkbox" type="radio" name="canHaveCourses" value="0" <?php if (($action == 'edit' && !$canHaveCourses) || ($action == 'add' && $formSent && !$canHaveCourses)) echo 'checked="checked"'; ?> /><?php echo get_lang("No"); ?>
<input class="checkbox" type="radio" name="canHaveCourses" value="1" <?php if (($action == 'edit' && $canHaveCourses) || ($action == 'add' && !$formSent || $canHaveCourses)) echo 'checked="checked"'; ?> /><?php echo get_lang("Yes"); ?>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<?php
if (isset($_GET['id']) && !empty($_GET['id'])) {
$class = "save";
$text = get_lang('CategoryMod');
} else {
$class = "add";
$text = get_lang('AddCategory');
}
?>
<td><button type="submit" class="<?php echo $class; ?>" value="<?php echo $text; ?>" ><?php echo $text; ?></button></td>
</tr>
</table>
</form>
<?php
} else {
?>
<div class="actions">
<?php
if (!empty($category) && empty($action)) {
$myquery = "SELECT parent_id FROM $tbl_category WHERE code='$category'";
$result = Database::query($myquery);
$parent_id = 0;
if (Database::num_rows($result) > 0) {
$parent_id = Database::fetch_array($result);
}
$parent_id['parent_id'] ? $link = ' (' . $parent_id['parent_id'] . ')' : $link = '';
?>
<a href="<?php echo api_get_self(); ?>?category=<?php echo $parent_id['parent_id']; ?>"><?php echo Display::return_icon('folder_up.png', get_lang("Back"), '', ICON_SIZE_MEDIUM);
if (!empty($parent_id)) echo $link ?></a>
<?php
}
?>
<?php
if (!empty($category)) {
$CategoryInto = ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category);
} else {
$CategoryInto = '';
}
?>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=add"><?php echo Display::return_icon('new_folder.png', get_lang("AddACategory") . $CategoryInto, '', ICON_SIZE_MEDIUM); ?></a>
</div>
<ul>
<?php
if (count($Categories) > 0) {
foreach ($Categories as $enreg) {
?>
<li>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($enreg['code']); ?>"><?php Display::display_icon('folder_document.gif', get_lang('OpenNode')); ?></a>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=edit&amp;id=<?php echo Security::remove_XSS($enreg['code']); ?>"><?php Display::display_icon('edit.gif', get_lang('EditNode')); ?></a>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=delete&amp;id=<?php echo Security::remove_XSS($enreg['code']); ?>" onclick="javascript:if (!confirm('<?php echo addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)); ?>'))
return false;"><?php Display::display_icon('delete.gif', get_lang('DeleteNode')); ?></a>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=moveUp&amp;id=<?php echo Security::remove_XSS($enreg['code']); ?>&amp;tree_pos=<?php echo $enreg['tree_pos']; ?>"><?php Display::display_icon('up.gif', get_lang('UpInSameLevel')); ?></a>
<?php echo $enreg['name']; ?>
(<?php echo $enreg['children_count']; ?> <?php echo get_lang('CategoriesNumber'); ?> - <?php echo $enreg['nbr_courses']; ?> <?php echo get_lang('Courses'); ?>)
</li>
<?php
}
unset($Categories);
} else {
echo get_lang("NoCategories");
}
?>
</ul>
<?php
}
$parent_id['parent_id']?$link=' ('.$parent_id['parent_id'].')':$link='';
?>
Display::display_footer();
<a href="<?php echo api_get_self(); ?>?category=<?php echo $parent_id['parent_id']; ?>"><?php echo Display::return_icon('folder_up.png',get_lang("Back"),'',ICON_SIZE_MEDIUM); if(!empty($parent_id)) echo $link ?></a>
/* * ****** Functions ******* */
<?php
}
?>
<?php
if(!empty($category)){
$CategoryInto=' '.get_lang('Into').' '.Security::remove_XSS($category);
}
else{
$CategoryInto='';
}
?>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=add"><?php echo Display::return_icon('new_folder.png',get_lang("AddACategory").$CategoryInto,'',ICON_SIZE_MEDIUM); ?></a>
</div>
<ul>
function deleteNode($node) {
global $tbl_category, $tbl_course;
$node = Database::escape_string($node);
<?php
if(count($Categories)>0)
{
foreach($Categories as $enreg)
{
?>
<li>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($enreg['code']); ?>"><?php Display::display_icon('folder_document.gif', get_lang('OpenNode')); ?></a>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=edit&amp;id=<?php echo Security::remove_XSS($enreg['code']); ?>"><?php Display::display_icon('edit.gif', get_lang('EditNode')); ?></a>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=delete&amp;id=<?php echo Security::remove_XSS($enreg['code']); ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)); ?>')) return false;"><?php Display::display_icon('delete.gif', get_lang('DeleteNode'));?></a>
<a href="<?php echo api_get_self(); ?>?category=<?php echo Security::remove_XSS($category); ?>&amp;action=moveUp&amp;id=<?php echo Security::remove_XSS($enreg['code']); ?>&amp;tree_pos=<?php echo $enreg['tree_pos']; ?>"><?php Display::display_icon('up.gif', get_lang('UpInSameLevel'));?></a>
<?php echo $enreg['name']; ?>
(<?php echo $enreg['children_count']; ?> <?php echo get_lang('CategoriesNumber'); ?> - <?php echo $enreg['nbr_courses']; ?> <?php echo get_lang('Courses'); ?>)
</li>
<?php
}
unset($Categories);
}
else
{
echo get_lang("NoCategories");
}
?>
</ul>
$result = Database::query("SELECT parent_id,tree_pos FROM $tbl_category WHERE code='$node'");
if ($row = Database::fetch_array($result)) {
if (!empty($row['parent_id'])) {
Database::query("UPDATE $tbl_course SET category_code='" . $row['parent_id'] . "' WHERE category_code='$node'");
Database::query("UPDATE $tbl_category SET parent_id='" . $row['parent_id'] . "' WHERE parent_id='$node'");
} else {
Database::query("UPDATE $tbl_course SET category_code='' WHERE category_code='$node'");
Database::query("UPDATE $tbl_category SET parent_id=NULL WHERE parent_id='$node'");
}
Database::query("UPDATE $tbl_category SET tree_pos=tree_pos-1 WHERE tree_pos > '" . $row['tree_pos'] . "'");
Database::query("DELETE FROM $tbl_category WHERE code='$node'");
<?php
if (!empty($row['parent_id'])) {
updateFils($row['parent_id']);
}
}
}
Display::display_footer();
/******** Functions ********/
function deleteNode($node)
{
global $tbl_category, $tbl_course;
$node = Database::escape_string($node);
$result=Database::query("SELECT parent_id,tree_pos FROM $tbl_category WHERE code='$node'");
if($row=Database::fetch_array($result))
{
if(!empty($row['parent_id']))
{
Database::query("UPDATE $tbl_course SET category_code='".$row['parent_id']."' WHERE category_code='$node'");
Database::query("UPDATE $tbl_category SET parent_id='".$row['parent_id']."' WHERE parent_id='$node'");
}
else
{
Database::query("UPDATE $tbl_course SET category_code='' WHERE category_code='$node'");
Database::query("UPDATE $tbl_category SET parent_id=NULL WHERE parent_id='$node'");
}
Database::query("UPDATE $tbl_category SET tree_pos=tree_pos-1 WHERE tree_pos > '".$row['tree_pos']."'");
Database::query("DELETE FROM $tbl_category WHERE code='$node'");
if(!empty($row['parent_id']))
{
updateFils($row['parent_id']);
}
}
}
function addNode($code, $name, $canHaveCourses, $parent_id) {
global $tbl_category;
function addNode($code,$name,$canHaveCourses,$parent_id)
{
global $tbl_category;
$canHaveCourses = $canHaveCourses ? 'TRUE' : 'FALSE';
$code = Database::escape_string($code);
$name = Database::escape_string($name);
$parent_id = Database::escape_string($parent_id);
$canHaveCourses=$canHaveCourses?'TRUE':'FALSE';
$code = Database::escape_string($code);
$name = Database::escape_string($name);
$parent_id = Database::escape_string($parent_id);
$result = Database::query("SELECT 1 FROM $tbl_category WHERE code='$code'");
$result=Database::query("SELECT 1 FROM $tbl_category WHERE code='$code'");
if (Database::num_rows($result)) {
return false;
}
if (Database::num_rows($result)) {
return false;
}
$result = Database::query("SELECT MAX(tree_pos) AS maxTreePos FROM $tbl_category");
$result=Database::query("SELECT MAX(tree_pos) AS maxTreePos FROM $tbl_category");
$row = Database::fetch_array($result);
$row=Database::fetch_array($result);
$tree_pos = $row['maxTreePos'] + 1;
$tree_pos=$row['maxTreePos']+1;
$code = CourseManager::generate_course_code($code);
Database::query("INSERT INTO $tbl_category(name,code,parent_id,tree_pos,children_count,auth_course_child) VALUES('$name','$code',".(empty($parent_id)?"NULL":"'$parent_id'").",'$tree_pos','0','$canHaveCourses')");
$code = generate_course_code($code);
Database::query("INSERT INTO $tbl_category(name,code,parent_id,tree_pos,children_count,auth_course_child) VALUES('$name','$code'," . (empty($parent_id) ? "NULL" : "'$parent_id'") . ",'$tree_pos','0','$canHaveCourses')");
updateFils($parent_id);
updateFils($parent_id);
return true;
return true;
}
function editNode($code,$name,$canHaveCourses,$old_code)
{
global $tbl_category, $tbl_course;
$canHaveCourses=$canHaveCourses?'TRUE':'FALSE';
$code = Database::escape_string($code);
$name = Database::escape_string($name);
$old_code = Database::escape_string($old_code);
if($code != $old_code) {
$result=Database::query("SELECT 1 FROM $tbl_category WHERE code='$code'");
if(Database::num_rows($result)) {
return false;
}
}
$code = CourseManager::generate_course_code($code);
Database::query("UPDATE $tbl_category SET name='$name', code='$code',auth_course_child='$canHaveCourses' WHERE code='$old_code'");
$sql = "UPDATE $tbl_course SET category_code = '$code' WHERE category_code = '$old_code' ";
Database::query($sql);
return true;
function editNode($code, $name, $canHaveCourses, $old_code) {
global $tbl_category, $tbl_course;
$canHaveCourses = $canHaveCourses ? 'TRUE' : 'FALSE';
$code = Database::escape_string($code);
$name = Database::escape_string($name);
$old_code = Database::escape_string($old_code);
if ($code != $old_code) {
$result = Database::query("SELECT 1 FROM $tbl_category WHERE code='$code'");
if (Database::num_rows($result)) {
return false;
}
}
$code = generate_course_code($code);
Database::query("UPDATE $tbl_category SET name='$name', code='$code',auth_course_child='$canHaveCourses' WHERE code='$old_code'");
$sql = "UPDATE $tbl_course SET category_code = '$code' WHERE category_code = '$old_code' ";
Database::query($sql);
return true;
}
function moveNodeUp($code,$tree_pos,$parent_id)
{
global $tbl_category;
$code = Database::escape_string($code);
$tree_pos = Database::escape_string($tree_pos);
$parent_id = Database::escape_string($parent_id);
function moveNodeUp($code, $tree_pos, $parent_id) {
global $tbl_category;
$code = Database::escape_string($code);
$tree_pos = Database::escape_string($tree_pos);
$parent_id = Database::escape_string($parent_id);
$result=Database::query("SELECT code,tree_pos FROM $tbl_category WHERE parent_id ".(empty($parent_id)?"IS NULL":"='$parent_id'")." AND tree_pos<'$tree_pos' ORDER BY tree_pos DESC LIMIT 0,1");
$result = Database::query("SELECT code,tree_pos FROM $tbl_category WHERE parent_id " . (empty($parent_id) ? "IS NULL" : "='$parent_id'") . " AND tree_pos<'$tree_pos' ORDER BY tree_pos DESC LIMIT 0,1");
if(!$row=Database::fetch_array($result))
{
$result=Database::query("SELECT code,tree_pos FROM $tbl_category WHERE parent_id ".(empty($parent_id)?"IS NULL":"='$parent_id'")." AND tree_pos>'$tree_pos' ORDER BY tree_pos DESC LIMIT 0,1");
if (!$row = Database::fetch_array($result)) {
$result = Database::query("SELECT code,tree_pos FROM $tbl_category WHERE parent_id " . (empty($parent_id) ? "IS NULL" : "='$parent_id'") . " AND tree_pos>'$tree_pos' ORDER BY tree_pos DESC LIMIT 0,1");
if(!$row=Database::fetch_array($result))
{
return false;
}
}
if (!$row = Database::fetch_array($result)) {
return false;
}
}
Database::query("UPDATE $tbl_category SET tree_pos='".$row['tree_pos']."' WHERE code='$code'");
Database::query("UPDATE $tbl_category SET tree_pos='$tree_pos' WHERE code='$row[code]'");
Database::query("UPDATE $tbl_category SET tree_pos='" . $row['tree_pos'] . "' WHERE code='$code'");
Database::query("UPDATE $tbl_category SET tree_pos='$tree_pos' WHERE code='$row[code]'");
}
function updateFils($category)
{
global $tbl_category;
$category = Database::escape_string($category);
$result=Database::query("SELECT parent_id FROM $tbl_category WHERE code='$category'");
if($row=Database::fetch_array($result))
{
updateFils($row['parent_id']);
}
function updateFils($category) {
global $tbl_category;
$category = Database::escape_string($category);
$result = Database::query("SELECT parent_id FROM $tbl_category WHERE code='$category'");
$children_count=compterFils($category,0)-1;
if ($row = Database::fetch_array($result)) {
updateFils($row['parent_id']);
}
Database::query("UPDATE $tbl_category SET children_count='$children_count' WHERE code='$category'");
$children_count = compterFils($category, 0) - 1;
Database::query("UPDATE $tbl_category SET children_count='$children_count' WHERE code='$category'");
}
function compterFils($pere,$cpt)
{
global $tbl_category;
$pere = Database::escape_string($pere);
$result=Database::query("SELECT code FROM $tbl_category WHERE parent_id='$pere'");
function compterFils($pere, $cpt) {
global $tbl_category;
$pere = Database::escape_string($pere);
$result = Database::query("SELECT code FROM $tbl_category WHERE parent_id='$pere'");
while($row=Database::fetch_array($result))
{
$cpt=compterFils($row['code'],$cpt);
}
while ($row = Database::fetch_array($result)) {
$cpt = compterFils($row['code'], $cpt);
}
return ($cpt+1);
return ($cpt + 1);
}

@ -397,7 +397,7 @@ function check_system_version() {
'adminname' => api_get_setting('administratorName').' '.api_get_setting('administratorSurname'),
);
$res = http_request('version.chamilo.org', 80, '/version.php', $data);
$res = _http_request('version.chamilo.org', 80, '/version.php', $data);
if ($res !== false) {
$version_info = $res;
@ -427,7 +427,7 @@ function check_system_version() {
* @param bool Include HTTP Request headers?
* @param bool Include HTTP Response headers?
*/
function http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 1, $req_hdr = false, $res_hdr = false) {
function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 1, $req_hdr = false, $res_hdr = false) {
$verb = 'GET';
$ret = '';
$getdata_str = count($getdata) ? '?' : '';

@ -210,19 +210,20 @@ function handle_stylesheets() {
echo '</div>';
}
$form = new FormValidator('stylesheet_upload', 'post', 'settings.php?category=stylesheets&showuploadform=true');
$form = new FormValidator('stylesheet_upload', 'post', 'settings.php?category=Stylesheets&showuploadform=true');
$form->addElement('text', 'name_stylesheet', get_lang('NameStylesheet'), array('size' => '40', 'maxlength' => '40'));
$form->addRule('name_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('file', 'new_stylesheet', get_lang('UploadNewStylesheet'));
$allowed_file_types = array('css', 'zip', 'jpeg', 'jpg', 'png', 'gif');
$allowed_file_types = array('css', 'zip', 'jpeg', 'jpg', 'png', 'gif', 'ico');
$form->addRule('new_stylesheet', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')', 'filetype', $allowed_file_types);
$form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('style_submit_button', 'stylesheet_upload', get_lang('Ok'), array('class'=>'save'));
if ($form->validate() && is_writable(api_get_path(SYS_CODE_PATH).'css/')) {
$values = $form->exportValues();
$picture_element = & $form->getElement('new_stylesheet');
$picture_element = $form->getElement('new_stylesheet');
$picture = $picture_element->getValue();
$result = upload_stylesheet($values, $picture);
$result = upload_stylesheet($values, $picture);
// Add event to the system log.
$user_id = api_get_user_id();
@ -351,7 +352,7 @@ function upload_stylesheet($values, $picture) {
$file = $zip->statIndex($i);
if (substr($file['name'], -1) != '/') {
$path_parts = pathinfo($file['name']);
if (!in_array($path_parts['extension'], array('jpg', 'jpeg', 'png', 'gif', 'css'))) {
if (!in_array($path_parts['extension'], array('jpg', 'jpeg', 'png', 'gif', 'css', 'ico'))) {
$valid = false;
$invalid_files[] = $file['name'];
}

@ -282,6 +282,7 @@ class SubLanguageManager {
$lang=Database::fetch_array($result);
$sql_update_2 = "UPDATE ".$tbl_settings_current." SET selected_value='".$lang['english_name']."' WHERE variable='platformLanguage'";
$result_2 = Database::query($sql_update_2);
event_system(LOG_PLATFORM_LANGUAGE_CHANGE, LOG_PLATFORM_LANGUAGE, $lang['english_name']);
return $result_2 !== false;
}
/**

@ -33,9 +33,9 @@ if ($form->validate()) {
$header = array(array('name', 'description'));
$data = $user_group->get_all_for_export();
$data = array_merge($header, $data);
$filename = 'export_classes_'.date('Y-m-d_H-i-s');
$filename = 'export_classes_'.api_get_local_time();
Export::export_table_csv($data,$filename);
exit;
}
Display :: display_header($tool_name);
$form->display();

@ -1,69 +1,69 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
* @package chamilo.admin
*/
/**
* Code
* This tool allows platform admins to update class-user relations by uploading
* a CSVfile
*/
* This tool allows platform admins to update class-user relations by uploading
* a CSVfile
*/
/**
* Validates imported data.
*/
function validate_data($user_classes) {
global $purification_option_for_usernames;
$errors = array ();
$classcodes = array ();
/*if (!isset($_POST['subscribe']) && !isset($_POST['subscribe'])) {
$user_class['error'] = get_lang('SelectAnAction');
$errors[] = $user_class;
return $errors;
}*/
$errors = array();
$classcodes = array();
/* if (!isset($_POST['subscribe']) && !isset($_POST['subscribe'])) {
$user_class['error'] = get_lang('SelectAnAction');
$errors[] = $user_class;
return $errors;
} */
$usergroup = new UserGroup();
foreach ($user_classes as $index => $user_class) {
$user_class['line'] = $index + 1;
// 1. Check whether mandatory fields are set.
$mandatory_fields = array ('UserName', 'ClassName');
foreach ($mandatory_fields as $key => $field) {
if (!isset ($user_class[$field]) || strlen($user_class[$field]) == 0) {
$user_class['error'] = get_lang($field.'Mandatory');
$mandatory_fields = array('UserName', 'ClassName');
foreach ($mandatory_fields as $key => $field) {
if (!isset($user_class[$field]) || strlen($user_class[$field]) == 0) {
$user_class['error'] = get_lang($field . 'Mandatory');
$errors[] = $user_class;
}
}
// 2. Check whether classcode exists.
if (isset ($user_class['ClassName']) && strlen($user_class['ClassName']) != 0) {
if (isset($user_class['ClassName']) && strlen($user_class['ClassName']) != 0) {
// 2.1 Check whether code has been allready used in this CVS-file.
if (!isset ($classcodes[$user_class['ClassName']])) {
if (!isset($classcodes[$user_class['ClassName']])) {
// 2.1.1 Check whether code exists in DB
$exists = $usergroup->usergroup_exists($user_class['ClassName']);
$exists = $usergroup->usergroup_exists($user_class['ClassName']);
if (!$exists) {
$user_class['error'] = get_lang('CodeDoesNotExists').': '.$user_class['ClassName'];
$user_class['error'] = get_lang('CodeDoesNotExists') . ': ' . $user_class['ClassName'];
$errors[] = $user_class;
} else {
$classcodes[$user_class['CourseCode']] = 1;
}
}
}
// 3. Check username, first, check whether it is empty.
if (!UserManager::is_username_empty($user_class['UserName'])) {
// 3.1. Check whether username is too long.
if (UserManager::is_username_too_long($user_class['UserName'])) {
$user_class['error'] = get_lang('UserNameTooLong').': '.$user_class['UserName'];
$user_class['error'] = get_lang('UserNameTooLong') . ': ' . $user_class['UserName'];
$errors[] = $user_class;
}
$username = UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames);
$username = UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames);
// 3.2. Check whether username exists.
if (UserManager::is_username_available($username)) {
$user_class['error'] = get_lang('UnknownUser').': '.$username;
$user_class['error'] = get_lang('UnknownUser') . ': ' . $username;
$errors[] = $user_class;
}
}
@ -79,21 +79,22 @@ function save_data($users_classes) {
global $purification_option_for_usernames;
// Table definitions.
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$usergroup = new UserGroup();
// Data parsing: purification + conversion (UserName, ClassName) --> (user_is, class_id)
$csv_data = array ();
$csv_data = array();
if (!empty($users_classes)) {
foreach ($users_classes as $user_class) {
$sql1 = "SELECT user_id FROM $user_table WHERE username = '".Database::escape_string(UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames))."'";
$sql1 = "SELECT user_id FROM $user_table WHERE username = '" . Database::escape_string(UserManager::purify_username($user_class['UserName'], $purification_option_for_usernames)) . "'";
$res1 = Database::query($sql1);
$obj1 = Database::fetch_object($res1);
$usergroup = new UserGroup();
$id = $usergroup->get_id_by_name($user_class['ClassName']);
$id = $usergroup->get_id_by_name($user_class['ClassName']);
if ($obj1 && $id) {
$csv_data[$id]['user_list'][] = $obj1->user_id;
$csv_data[$id]['user_list_name'][] = $user_class['UserName'];
@ -101,51 +102,20 @@ function save_data($users_classes) {
}
}
}
// Logic for processing the request (data + UI options).
if (!empty($csv_data)) {
$message = null;
if (!empty($csv_data)) {
foreach ($csv_data as $class_id => $user_data) {
$user_list = $user_data['user_list'];
$class_name = $user_data['class_name'];
$user_list_name = $user_data['user_list_name'];
$usergroup->subscribe_users_to_usergroup($class_id, $user_list);
/*
$sql = "SELECT class_id FROM $class_user_table cu WHERE cu.user_id = $user_id";
$res = Database::query($sql);
while ($obj = Database::fetch_object($res)) {
$db_subscriptions[$obj->class_id] = 1;
}
$to_subscribe = array_diff(array_keys($csv_subscriptions), array_keys($db_subscriptions));
$to_unsubscribe = array_diff(array_keys($db_subscriptions), array_keys($csv_subscriptions));
// Subscriptions for new classes.
if ($_POST['subscribe']) {
foreach ($to_subscribe as $class_id) {
ClassManager::add_user($user_id, $class_id);
}
}
// Unsubscription from previous classes.
if ($_POST['unsubscribe']) {
foreach ($to_unsubscribe as $class_id) {
ClassManager::unsubscribe_user($user_id, $class_id);
}
}*/
$message = Display::return_message(get_lang('Class').': '.$class_name.'<br />', 'normal', false);
$message .= Display::return_message(get_lang('Users').': '.implode(', ', $user_list_name));
return $message;
$message .= Display::return_message(get_lang('Class') . ': ' . $class_name . '<br />', 'normal', false);
$message .= Display::return_message(get_lang('Users') . ': ' . implode(', ', $user_list_name));
}
}
}
return $message;
}
/**
@ -166,10 +136,13 @@ require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
$tool_name = get_lang('AddUsersToAClass').' CSV';
require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'import.lib.php';
$tool_name = get_lang('AddUsersToAClass') . ' CSV';
$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 this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
@ -185,9 +158,9 @@ $form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="s
if ($form->validate()) {
$users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users_classes);
if (count($errors) == 0) {
$return = save_data($users_classes);
$errors = validate_data($users_classes);
if (count($errors) == 0) {
$return = save_data($users_classes);
}
}
@ -200,7 +173,7 @@ if (isset($return) && $return) {
if (count($errors) != 0) {
$error_message = "\n";
foreach ($errors as $index => $error_class_user) {
$error_message .= get_lang('Line').' '.$error_class_user['line'].': '.$error_class_user['error'].'</b>';
$error_message .= get_lang('Line') . ' ' . $error_class_user['line'] . ': ' . $error_class_user['error'] . '</b>';
$error_message .= "<br />";
}
$error_message .= "\n";
@ -208,7 +181,7 @@ if (count($errors) != 0) {
}
$form->display();
?>
<p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
<p><?php echo get_lang('CSVMustLookLike') . ' (' . get_lang('MandatoryFields') . ')'; ?> :</p>
<pre>
<b>UserName</b>;<b>ClassName</b>
jdoe;class01

@ -604,7 +604,7 @@ class AnnouncementManager {
*/
public static function construct_not_selected_select_form($group_list = null, $user_list = null, $to_already_selected) {
echo "<select name=\"not_selected_form[]\" size=5 style=\"width:200px\" multiple>";
echo '<select name="not_selected_form[]" size="7" class="span4" multiple>';
// adding the groups to the select form
if ($group_list) {
foreach ($group_list as $this_group) {
@ -656,7 +656,7 @@ class AnnouncementManager {
$ref_array_users = self::get_course_users();
// we construct the form of the already selected groups / users
echo "<select id=\"selectedform\" name=\"selectedform[]\" size=\"5\" multiple style=\"width:200px\" width=\"200px\">";
echo '<select id="selectedform" name="selectedform[]" size="7" multiple class="span4">';
if (is_array($to_already_selected)) {
foreach ($to_already_selected as $groupuser) {
list($type, $id) = explode(":", $groupuser);
@ -754,7 +754,7 @@ class AnnouncementManager {
public static function get_course_groups() {
$session_id = api_get_session_id();
if ($session_id != 0) {
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($session_id));
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), $session_id);
} else {
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), 0);
}

@ -37,7 +37,7 @@ if(isset($_GET['id_session'])) {
}
/* ACCESS RIGHTS */
api_protect_course_script();
api_protect_course_script(true);
// Configuration settings
$display_announcement_list = true;
@ -72,7 +72,6 @@ $course_id = api_get_course_int_id();
/* Tracking */
event_access_tool(TOOL_ANNOUNCEMENT);
/* POST TO */
$safe_emailTitle = $_POST['emailTitle'];
$safe_newContent = $_POST['newContent'];
@ -81,7 +80,7 @@ $content_to_modify = $title_to_modify = '';
if (!empty($_POST['To'])) {
if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
api_not_allowed();
api_not_allowed(true);
}
$display_form = true;
@ -115,7 +114,7 @@ if (!empty($_POST['To']) and ($select_groupusers_status=="show")) {
// display the form
if (((!empty($_GET['action']) && $_GET['action'] == 'add') && $_GET['origin'] == "") || (!empty($_GET['action']) && $_GET['action'] == 'edit') || !empty($_POST['To'])) {
if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
api_not_allowed();
api_not_allowed(true);
}
$display_form = true;
}
@ -1063,4 +1062,4 @@ if (isset($_GET['action']) && $_GET['action'] == 'view') {
if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
//we are not in learnpath tool
Display::display_footer();
}
}

@ -97,6 +97,10 @@ function external_get_user_info($login, $password){
**/
function external_add_user($u){
//Setting default
if (empty($u['password']) )
$u['password'] = null;
if (empty($u['status']) )
$u['status'] = 5;
if (! isset($u['official_code']) )
$u['official_code'] = '';
if (! isset($u['language']) )

@ -55,6 +55,7 @@ if ($ldap_user !== false) {
$loginFailed = false;
$_user['user_id'] = $chamilo_user['user_id'];
$_user['status'] = (isset($chamilo_user['status'])?$chamilo_user['status']:5);
$_user['uidReset'] = true;
Session::write('_user',$_user);
$uidReset=true;
@ -64,4 +65,4 @@ if ($ldap_user !== false) {
$loginFailed = true;
$uidReset = false;
unset($_user['user_id']);
}
}

@ -50,6 +50,7 @@ if ($ldap_user !== false) {
if ($chamilo_uid !==false) {
$loginFailed = false;
$_user['user_id'] = $chamilo_uid;
$_user['status'] = (isset($chamilo_user['status'])?$chamilo_user['status']:5);
$_user['uidReset'] = true;
Session::write('_user',$_user);
$uidReset=true;
@ -64,4 +65,4 @@ if ($ldap_user !== false) {
$loginFailed = true;
$uidReset = false;
unset($_user['user_id']);
}
}

@ -18,9 +18,9 @@ $cidReset = true;
require_once '../inc/global.inc.php';
if (api_get_setting('allow_social_tool') == 'true') {
$this_section = SECTION_SOCIAL;
$this_section = SECTION_SOCIAL;
} else {
$this_section = SECTION_MYPROFILE;
$this_section = SECTION_MYPROFILE;
}
$_SESSION['this_section'] = $this_section;
@ -34,11 +34,11 @@ $htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/
$htmlHeadXtra[] = '<script>
function confirmation(name) {
if (confirm("'.get_lang('AreYouSureToDelete', '').' " + name + " ?")) {
document.forms["profile"].submit();
} else {
return false;
}
if (confirm("'.get_lang('AreYouSureToDelete', '').' " + name + " ?")) {
document.forms["profile"].submit();
} else {
return false;
}
}
function show_image(image,width,height) {
width = parseInt(width) + 20;
@ -578,7 +578,7 @@ if ($form->validate()) {
//change email
if ($allow_users_to_change_email_with_no_password) {
if (!empty($changeemail) && in_array('email', $available_values_to_modify)) {
if (in_array('email', $available_values_to_modify)) {
$sql .= " email = '".Database::escape_string($changeemail)."',";
}
if (isset($password) && in_array('password', $available_values_to_modify)) {
@ -593,9 +593,7 @@ if ($form->validate()) {
if (!empty($changeemail) && !isset($password) && in_array('email', $available_values_to_modify)) {
$sql .= " email = '".Database::escape_string($changeemail)."'";
} elseif (isset($password) && isset($changeemail) && in_array('email', $available_values_to_modify) && in_array('password', $available_values_to_modify)) {
if (!empty($changeemail)) {
$sql .= " email = '".Database::escape_string($changeemail)."',";
}
$sql .= " email = '".Database::escape_string($changeemail)."',";
$password = api_get_encrypted_password($password);
$sql .= " password = '".Database::escape_string($password)."'";
} elseif (isset($password) && in_array('password', $available_values_to_modify)) {
@ -605,6 +603,9 @@ if ($form->validate()) {
// remove trailing , from the query we have so far
$sql = rtrim($sql, ',');
}
}
if (api_get_setting('profile', 'officialcode') == 'true' && isset($user_data['official_code'])) {
$sql .= ", official_code = '".Database::escape_string($user_data['official_code'])."'";
}
$sql .= " WHERE user_id = '".api_get_user_id()."'";
Database::query($sql);

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -16,118 +17,116 @@
* the requested action
* @package chamilo.course_progress
*/
class ThematicController {
/**
* Constructor
*/
public function __construct() {
$this->toolname = 'course_progress';
$this->view = new View($this->toolname);
}
/**
* This method is used for thematic control (update, insert or listing)
* @param string Action
* render to thematic.php
*/
public function thematic($action) {
$thematic = new Thematic();
$data = array();
$error = false;
$msg_add = false;
$check = Security::check_token('request');
$thematic_id = isset($_REQUEST['thematic_id']) ? intval($_REQUEST['thematic_id']) : null;
if ($check) {
switch ($action) {
case 'thematic_add':
case 'thematic_edit':
// insert or update a thematic
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (trim($_POST['title']) !== '') {
if (api_is_allowed_to_edit(null, true)) {
class ThematicController
{
/**
* Constructor
*/
public function __construct() {
$this->toolname = 'course_progress';
$this->view = new View($this->toolname);
}
/**
* This method is used for thematic control (update, insert or listing)
* @param string Action
* render to thematic.php
*/
public function thematic($action) {
$thematic = new Thematic();
$data = array();
$error = false;
$msg_add = false;
$check = Security::check_token('request');
$thematic_id = isset($_REQUEST['thematic_id'])?intval($_REQUEST['thematic_id']):null;
if ($check) {
switch ($action) {
case 'thematic_add':
case 'thematic_edit':
// insert or update a thematic
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (trim($_POST['title']) !== '') {
if (api_is_allowed_to_edit(null, true)) {
$id = $_POST['thematic_id'];
$title = $_POST['title'];
$content = $_POST['content'];
$session_id = api_get_session_id();
$thematic->set_thematic_attributes($id, $title, $content, $session_id);
$last_id = $thematic->thematic_save();
if ($_POST['action'] == 'thematic_add') {
$action = 'thematic_details';
$thematic_id = null;
if ($last_id) {
$data['last_id'] = $last_id;
}
} else {
$action = 'thematic_details';
$thematic_id = null;
}
}
} else {
$error = true;
$data['error'] = $error;
$data['action'] = $_POST['action'];
$data['thematic_id'] = $_POST['thematic_id'];
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic');
$this->view->render();
}
}
break;
case 'thematic_copy':
$id = $_POST['thematic_id'];
$title = $_POST['title'];
$content = $_POST['content'];
$session_id = api_get_session_id();
$thematic->set_thematic_attributes($id, $title, $content, $session_id);
$last_id = $thematic->thematic_save();
if ($_POST['action'] == 'thematic_add') {
$action = 'thematic_details';
$thematic_id = null;
if ($last_id) {
$data['last_id'] = $last_id;
}
} else {
$action = 'thematic_details';
$thematic_id = null;
}
}
} else {
$error = true;
$data['error'] = $error;
$data['action'] = $_POST['action'];
$data['thematic_id'] = $_POST['thematic_id'];
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic');
$this->view->render();
}
}
break;
case 'thematic_copy':
//Copy a thematic to a session
$thematic->copy($thematic_id);
$thematic_id = null;
$action = 'thematic_details';
break;
case 'thematic_delete_select':
//Delete many thematics
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (api_is_allowed_to_edit(null, true)) {
$thematic_ids = $_POST['id'];
$affected_rows = $thematic->thematic_destroy($thematic_ids);
}
$action = 'thematic_details';
}
break;
$thematic->copy($thematic_id);
$thematic_id = null;
$action = 'thematic_details';
break;
case 'thematic_delete_select':
//Delete many thematics
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (api_is_allowed_to_edit(null, true)) {
$thematic_ids = $_POST['id'];
$affected_rows = $thematic->thematic_destroy($thematic_ids);
}
$action = 'thematic_details';
}
break;
case 'thematic_delete':
// Delete a thematic
if (isset($thematic_id)) {
if (isset($thematic_id)) {
if (api_is_allowed_to_edit(null, true)) {
$affected_rows = $thematic->thematic_destroy($thematic_id);
$affected_rows = $thematic->thematic_destroy($thematic_id);
}
$thematic_id = null;
$action = 'thematic_details';
$action = 'thematic_details';
}
break;
case 'thematic_import_select':
break;
case 'thematic_import':
$csv_import_array = Import::csv_to_array($_FILES['file']['tmp_name'], 'horizontal');
if (isset($_POST['replace']) && $_POST['replace']) {
// Remove current thematic.
$list = $thematic->get_thematic_list();
foreach ($list as $i) {
$thematic->thematic_destroy($i);
}
}
}
// Import the progress.
$current_thematic = null;
foreach ($csv_import_array as $data) {
foreach ($data as $key => $item) {
foreach ($data as $key => $item) {
if ($key == 'title') {
$thematic->set_thematic_attributes(null, $item[0], $item[1], api_get_session_id ());
$current_thematic = $thematic->thematic_save ();
$thematic->set_thematic_attributes(null, $item[0], $item[1], api_get_session_id());
$current_thematic = $thematic->thematic_save();
$description_type = 0;
}
if ($key == 'plan') {
@ -136,9 +135,9 @@ class ThematicController
$description_type++;
}
if ($key == 'progress') {
$thematic->set_thematic_advance_attributes (null, $current_thematic, 0, $item[2], $item[0], $item[1]);
$thematic->thematic_advance_save ();
}
$thematic->set_thematic_advance_attributes(null, $current_thematic, 0, $item[2], $item[0], $item[1]);
$thematic->thematic_advance_save();
}
}
}
$action = 'thematic_details';
@ -147,14 +146,14 @@ class ThematicController
$list = $thematic->get_thematic_list();
$csv = array();
foreach ($list as $theme) {
$csv[] = array ('title', $theme['title'], $theme['content']);
$data = $thematic->get_thematic_plan_data ($theme['id']);
$csv[] = array('title', $theme['title'], $theme['content']);
$data = $thematic->get_thematic_plan_data($theme['id']);
if (!empty($data)) {
foreach ($data as $plan) {
$csv[] = array ('plan', $plan['title'], $plan['description']);
$csv[] = array('plan', $plan['title'], $plan['description']);
}
}
$data = $thematic->get_thematic_advance_by_thematic_id ($theme['id']);
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
if (!empty($data)) {
foreach ($data as $advance) {
$csv[] = array('progress', $advance['start_date'], $advance['duration'], $advance['content']);
@ -166,306 +165,306 @@ class ThematicController
// Don't continue building a normal page.
return;
case 'thematic_export_pdf':
$list = $thematic->get_thematic_list();
$list = $thematic->get_thematic_list();
$table = array();
$table[] = array (get_lang('Thematic'), get_lang('ThematicPlan'), get_lang('ThematicAdvance'));
foreach ($list as $theme) {
$table[] = array(get_lang('Thematic'), get_lang('ThematicPlan'), get_lang('ThematicAdvance'));
foreach ($list as $theme) {
$data = $thematic->get_thematic_plan_data($theme['id']);
$plan_html = null;
if (!empty($data)) {
foreach ($data as $plan) {
$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']);
$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_TIME_FORMAT_LONG).' '.$advance['duration'].'<br />'.$advance['content'].'<br />';
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(),
'filename' => get_lang('Thematic') . '-' . api_get_local_time(),
'pdf_title' => get_lang('Thematic'),
'add_signatures' => true,
'format' => 'A4-L',
'orientation' => 'L'
);
'orientation' => 'L'
);
Export::export_table_pdf($table, $params);
break;
case 'moveup':
$thematic->move_thematic('up', $thematic_id);
$action = 'thematic_details';
$thematic_id = null;
$action = 'thematic_details';
$thematic_id = null;
break;
case 'movedown':
$thematic->move_thematic('down', $thematic_id);
$action = 'thematic_details';
$thematic_id = null;
break;
}
Security::clear_token();
} else {
$action = 'thematic_details';
$thematic_id = null;
}
if (isset($thematic_id)) {
$data['thematic_data'] = $thematic->get_thematic_list($thematic_id);
$data['thematic_id'] = $thematic_id;
}
if ($action == 'thematic_details') {
if (isset($thematic_id)) {
$thematic_data_result = $thematic->get_thematic_list($thematic_id);
if (!empty($thematic_data_result)) {
$thematic_data[$thematic_id] = $thematic_data_result;
}
$data['total_average_of_advances'] = $thematic->get_average_of_advances_by_thematic($thematic_id);
} else {
$thematic_data = $thematic->get_thematic_list(null, api_get_course_id(), api_get_session_id());
$data['max_thematic_item'] = $thematic->get_max_thematic_item();
$data['last_done_thematic_advance'] = $thematic->get_last_done_thematic_advance();
$data['total_average_of_advances'] = $thematic->get_total_average_of_thematic_advances();
}
$action = 'thematic_details';
$thematic_id = null;
break;
}
Security::clear_token();
} else {
$action = 'thematic_details';
$thematic_id = null;
}
if (isset($thematic_id)) {
$data['thematic_data'] = $thematic->get_thematic_list($thematic_id);
$data['thematic_id'] = $thematic_id;
}
if ($action == 'thematic_details') {
if (isset($thematic_id)) {
$thematic_data_result = $thematic->get_thematic_list($thematic_id);
if (!empty($thematic_data_result)) {
$thematic_data[$thematic_id] = $thematic_data_result;
}
$data['total_average_of_advances'] = $thematic->get_average_of_advances_by_thematic($thematic_id);
} else {
$thematic_data = $thematic->get_thematic_list(null, api_get_course_id(), api_get_session_id());
$data['max_thematic_item'] = $thematic->get_max_thematic_item();
$data['last_done_thematic_advance'] = $thematic->get_last_done_thematic_advance();
$data['total_average_of_advances'] = $thematic->get_total_average_of_thematic_advances();
}
//Second column
$thematic_plan_data = $thematic->get_thematic_plan_data();
$thematic_plan_data = $thematic->get_thematic_plan_data();
//Third column
$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
$data['thematic_plan_div'] = $thematic->get_thematic_plan_div($thematic_plan_data);
$data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data);
$data['thematic_plan_data'] = $thematic_plan_data;
$data['thematic_advance_data'] = $thematic_advance_data;
$data['thematic_data'] = $thematic_data;
}
$data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
$data['action'] = $action;
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic');
$this->view->render();
}
/**
* This method is used for thematic plan control (update, insert or listing)
* @param string Action
* render to thematic_plan.php
*/
public function thematic_plan($action) {
$thematic= new Thematic();
$data = array();
$error = false;
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (isset($_POST['action']) && ($_POST['action'] == 'thematic_plan_add' || $_POST['action'] == 'thematic_plan_edit')) {
$thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
$data['thematic_plan_div'] = $thematic->get_thematic_plan_div($thematic_plan_data);
$data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data);
$data['thematic_plan_data'] = $thematic_plan_data;
$data['thematic_advance_data'] = $thematic_advance_data;
$data['thematic_data'] = $thematic_data;
}
$data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
$data['action'] = $action;
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic');
$this->view->render();
}
/**
* This method is used for thematic plan control (update, insert or listing)
* @param string Action
* render to thematic_plan.php
*/
public function thematic_plan($action) {
$thematic = new Thematic();
$data = array();
$error = false;
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (isset($_POST['action']) && ($_POST['action'] == 'thematic_plan_add' || $_POST['action'] == 'thematic_plan_edit')) {
if (isset($_POST['title'])) {
if ($_POST['thematic_plan_token'] == $_SESSION['thematic_plan_token']) {
if (api_is_allowed_to_edit(null, true)) {
$title_list = $_REQUEST['title'];
if (api_is_allowed_to_edit(null, true)) {
$title_list = $_REQUEST['title'];
//$description_list = $_REQUEST['desc'];
$description_list = $_REQUEST['description'];
$description_type = $_REQUEST['description_type'];
for($i=1;$i<count($title_list)+1; $i++) {
$description_list = $_REQUEST['description'];
$description_type = $_REQUEST['description_type'];
for ($i = 1; $i < count($title_list) + 1; $i++) {
$thematic->set_thematic_plan_attributes($_REQUEST['thematic_id'], $title_list[$i], $description_list[$i], $description_type[$i]);
$affected_rows = $thematic->thematic_plan_save();
}
unset($_SESSION['thematic_plan_token']);
}
unset($_SESSION['thematic_plan_token']);
$data['message'] = 'ok';
}
$data['action'] = 'thematic_plan_list';
}
} else {
$error = true;
$action = $_POST['action'];
$data['error'] = $error;
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($_POST['thematic_id'], $_POST['description_type']);
$data['thematic_id'] = $_POST['thematic_id'];
$data['description_type'] = $_POST['description_type'];
$data['action'] = $action;
$data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
$data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
$data['default_thematic_plan_question'] = $thematic->get_default_question();
$data['next_description_type'] = $thematic->get_next_description_type($_POST['thematic_id']);
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_plan');
$this->view->render();
}
}
} else {
$error = true;
$action = $_POST['action'];
$data['error'] = $error;
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($_POST['thematic_id'], $_POST['description_type']);
$data['thematic_id'] = $_POST['thematic_id'];
$data['description_type'] = $_POST['description_type'];
$data['action'] = $action;
$data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
$data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
$data['default_thematic_plan_question'] = $thematic->get_default_question();
$data['next_description_type'] = $thematic->get_next_description_type($_POST['thematic_id']);
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_plan');
$this->view->render();
}
}
}
if ($action == 'thematic_plan_list') {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
}
$thematic_id = intval($_GET['thematic_id']);
$description_type = intval($_GET['description_type']);
if (!empty($thematic_id) && !empty($description_type)) {
if ($action == 'thematic_plan_delete') {
}
if ($action == 'thematic_plan_list') {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
}
$thematic_id = intval($_GET['thematic_id']);
$description_type = intval($_GET['description_type']);
if (!empty($thematic_id) && !empty($description_type)) {
if ($action == 'thematic_plan_delete') {
if (api_is_allowed_to_edit(null, true)) {
$affected_rows = $thematic->thematic_plan_destroy($thematic_id, $description_type);
}
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
$action = 'thematic_plan_list';
} else {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id, $description_type);
}
$data['thematic_id'] = $thematic_id;
$data['description_type'] = $description_type;
} else if (!empty($thematic_id) && $action == 'thematic_plan_list') {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
$data['thematic_id'] = $thematic_id;
}
$data['thematic_id'] = $thematic_id;
$data['action'] = $action;
$data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
$data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
$data['next_description_type'] = $thematic->get_next_description_type($thematic_id);
$data['default_thematic_plan_question'] = $thematic->get_default_question();
$data['thematic_data'] = $thematic->get_thematic_list($thematic_id);
//render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_plan');
$this->view->render();
}
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
$action = 'thematic_plan_list';
} else {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id, $description_type);
}
$data['thematic_id'] = $thematic_id;
$data['description_type'] = $description_type;
} else if (!empty($thematic_id) && $action == 'thematic_plan_list') {
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
$data['thematic_id'] = $thematic_id;
}
$data['thematic_id'] = $thematic_id;
$data['action'] = $action;
$data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
$data['default_thematic_plan_icon'] = $thematic->get_default_thematic_plan_icon();
$data['next_description_type'] = $thematic->get_next_description_type($thematic_id);
$data['default_thematic_plan_question'] = $thematic->get_default_question();
$data['thematic_data'] = $thematic->get_thematic_list($thematic_id);
//render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_plan');
$this->view->render();
exit;
}
/**
* This method is used for thematic advance control (update, insert or listing)
* @param string Action
* render to thematic_advance.php
*/
*/
public function thematic_advance($action) {
$thematic= new Thematic();
$attendance = new Attendance();
$data = array();
// get data for attendance input select
$attendance_list = $attendance->get_attendances_list();
$attendance_select = array();
$attendance_select[0] = get_lang('SelectAnAttendance');
foreach ($attendance_list as $attendance_id => $attendance_data) {
$attendance_select[$attendance_id] = $attendance_data['name'];
}
$thematic_id = intval($_REQUEST['thematic_id']);
$thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
$thematic_advance_data = array();
switch ($action) {
case 'thematic_advance_delete':
if (!empty($thematic_advance_id)) {
if (api_is_allowed_to_edit(null, true)) {
$affected_rows = $thematic->thematic_advance_destroy($thematic_advance_id);
}
$action = 'thematic_list';
header('Location: index.php');
exit;
$thematic = new Thematic();
$attendance = new Attendance();
$data = array();
// get data for attendance input select
$attendance_list = $attendance->get_attendances_list();
$attendance_select = array();
$attendance_select[0] = get_lang('SelectAnAttendance');
foreach ($attendance_list as $attendance_id => $attendance_data) {
$attendance_select[$attendance_id] = $attendance_data['name'];
}
$thematic_id = intval($_REQUEST['thematic_id']);
$thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
$thematic_advance_data = array();
switch ($action) {
case 'thematic_advance_delete':
if (!empty($thematic_advance_id)) {
if (api_is_allowed_to_edit(null, true)) {
$affected_rows = $thematic->thematic_advance_destroy($thematic_advance_id);
}
break;
case 'thematic_advance_list':
if (!api_is_allowed_to_edit(null, true)) {
echo '';
exit;
$action = 'thematic_list';
header('Location: index.php');
exit;
}
break;
case 'thematic_advance_list':
if (!api_is_allowed_to_edit(null, true)) {
echo '';
exit;
}
if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours']))) {
if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) {
$start_date_error = true;
$data['start_date_error'] = $start_date_error;
}
if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) {
if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) {
$start_date_error = true;
$data['start_date_error'] = $start_date_error;
}
if (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) {
$duration_error = true;
$data['duration_error'] = $duration_error;
}
if (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) {
$duration_error = true;
$data['duration_error'] = $duration_error;
}
$data['action'] = $_REQUEST['action'];
$data['thematic_id'] = $_REQUEST['thematic_id'];
$data['attendance_select'] = $attendance_select;
if (isset($_REQUEST['thematic_advance_id'])) {
$data['thematic_advance_id'] = $_REQUEST['thematic_advance_id'];
$thematic_advance_data = $thematic->get_thematic_advance_list($_REQUEST['thematic_advance_id']);
$data['thematic_advance_data'] = $thematic_advance_data;
}
} else {
if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) {
$data['action'] = $_REQUEST['action'];
$data['thematic_id'] = $_REQUEST['thematic_id'];
$data['attendance_select'] = $attendance_select;
if (isset($_REQUEST['thematic_advance_id'])) {
$data['thematic_advance_id'] = $_REQUEST['thematic_advance_id'];
$thematic_advance_data = $thematic->get_thematic_advance_list($_REQUEST['thematic_advance_id']);
$data['thematic_advance_data'] = $thematic_advance_data;
}
} else {
if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) {
$thematic_advance_id = $_REQUEST['thematic_advance_id'];
$thematic_id = $_REQUEST['thematic_id'];
$content = $_REQUEST['content'];
$duration = $_REQUEST['duration_in_hours'];
if (isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 2) {
$start_date = $thematic->build_datetime_from_array($_REQUEST['custom_start_date']);
$attendance_id = 0;
} else {
$start_date = $_REQUEST['start_date_by_attendance'];
$attendance_id = $_REQUEST['attendance_select'];
}
$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id, $attendance_id, $content, $start_date, $duration);
$affected_rows = $thematic->thematic_advance_save();
if ($affected_rows) {
// get last done thematic advance before move thematic list
$last_done_thematic_advance = $thematic->get_last_done_thematic_advance();
// update done advances with de current thematic list
if (!empty($last_done_thematic_advance)) {
$update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance);
}
$thematic_advance_id = $_REQUEST['thematic_advance_id'];
$thematic_id = $_REQUEST['thematic_id'];
$content = $_REQUEST['content'];
$duration = $_REQUEST['duration_in_hours'];
if (isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 2) {
$start_date = $thematic->build_datetime_from_array($_REQUEST['custom_start_date']);
$attendance_id = 0;
} else {
$start_date = $_REQUEST['start_date_by_attendance'];
$attendance_id = $_REQUEST['attendance_select'];
}
$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id, $attendance_id, $content, $start_date, $duration);
$affected_rows = $thematic->thematic_advance_save();
if ($affected_rows) {
// get last done thematic advance before move thematic list
$last_done_thematic_advance = $thematic->get_last_done_thematic_advance();
// update done advances with de current thematic list
if (!empty($last_done_thematic_advance)) {
$update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance);
}
}
}
break;
default:
$thematic_advance_data = $thematic->get_thematic_advance_list($thematic_advance_id);
break;
}
break;
default:
$thematic_advance_data = $thematic->get_thematic_advance_list($thematic_advance_id);
break;
}
// get calendar select by attendance id
$calendar_select = array();
if (!empty($thematic_advance_data)) {
if (!empty($thematic_advance_data['attendance_id'])) {
$attendance_calendar = $attendance->get_attendance_calendar($thematic_advance_data['attendance_id']);
if (!empty($attendance_calendar)) {
foreach ($attendance_calendar as $calendar) {
$calendar_select[$calendar['date_time']] = $calendar['date_time'];
}
}
}
// get calendar select by attendance id
$calendar_select = array();
if (!empty($thematic_advance_data)) {
if (!empty($thematic_advance_data['attendance_id'])) {
$attendance_calendar = $attendance->get_attendance_calendar($thematic_advance_data['attendance_id']);
if (!empty($attendance_calendar)) {
foreach ($attendance_calendar as $calendar) {
$calendar_select[$calendar['date_time']] = $calendar['date_time'];
}
}
}
}
$data['action'] = $action;
$data['thematic_id'] = $thematic_id;
$data['thematic_advance_id'] = $thematic_advance_id;
$data['attendance_select'] = $attendance_select;
$data['thematic_advance_data'] = $thematic_advance_data;
$data['calendar_select'] = $calendar_select;
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_advance');
$this->view->render();
}
}
$data['action'] = $action;
$data['thematic_id'] = $thematic_id;
$data['thematic_advance_id'] = $thematic_advance_id;
$data['attendance_select'] = $attendance_select;
$data['thematic_advance_data'] = $thematic_advance_data;
$data['calendar_select'] = $calendar_select;
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_advance');
$this->view->render();
}
}

@ -23,7 +23,7 @@ class Course
* Create a new Course-object
*/
function __construct() {
$this->resources = array ();
$this->resources = array();
$this->code = '';
$this->path = '';
$this->backup_path = '';

@ -309,7 +309,7 @@ class CourseBuilder {
while ($obj = Database::fetch_object($db_result)) {
$forum_topic = new ForumTopic($obj);
$this->course->add_resource($forum_topic);
$this->build_forum_posts($obj->thread_id, $obj->forum_id);
$this->build_forum_posts($obj->thread_id, $obj->forum_id, true);
}
}
@ -317,7 +317,7 @@ class CourseBuilder {
* Build the forum-posts
* TODO: All tree structure of posts should be built, attachments for example.
*/
function build_forum_posts($thread_id = null, $forum_id = null) {
function build_forum_posts($thread_id = null, $forum_id = null, $only_first_post = false) {
$table = Database :: get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id();
$sql = "SELECT * FROM $table WHERE c_id = $course_id ";
@ -326,6 +326,7 @@ class CourseBuilder {
$thread_id = intval($thread_id);
$sql .= " AND thread_id = $thread_id AND forum_id = $forum_id ";
}
$sql .= " ORDER BY post_id ASC LIMIT 1";
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$forum_post = new ForumPost($obj);

@ -56,7 +56,6 @@ class CourseRestorer
var $file_option;
var $set_tools_invisible_by_default;
var $skip_content;
var $tools_to_restore = array(
'announcements',
'attendance',
@ -715,11 +714,10 @@ class CourseRestorer
*/
function restore_forums() {
if ($this->course->has_resources(RESOURCE_FORUM)) {
$table_forum = Database::get_course_table(TABLE_FORUM);
$resources = $this->course->resources;
$table_forum = Database::get_course_table(TABLE_FORUM);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_FORUM] as $id => $forum) {
$params = (array)$forum->obj;
$params = (array)$forum->obj;
if ($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']]->destination_id == -1) {
$cat_id = $this->restore_forum_category($params['forum_category']);
} else {
@ -731,7 +729,15 @@ class CourseRestorer
$params['forum_category'] = $cat_id;
unset($params['forum_id']);
$params['forum_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course($params['forum_comment'], $this->course->code, $this->course->destination_path);
$params['forum_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course($params['forum_comment'], $this->course->code, $this->course->destination_path);
if (!empty($params['forum_image'])) {
$original_forum_image = $this->course->path.'upload/forum/images/'.$params['forum_image'];
if (file_exists($original_forum_image)) {
$new_forum_image = api_get_path(SYS_COURSE_PATH).$this->destination_course_info['path'].'/upload/forum/images/'.$params['forum_image'];
@copy($original_forum_image, $new_forum_image);
}
}
$new_id = Database::insert($table_forum, $params);

@ -140,14 +140,7 @@ class CourseSelectForm
echo get_lang('DestinationCourse').' : '.$course_infos['title'];
echo '</h3>';
}
echo '<p>';
echo get_lang('SelectResources');
echo '</p>';
Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt'));
echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">';
echo '<input type="hidden" name="action" value="course_select_form"/>';
@ -164,6 +157,12 @@ class CourseSelectForm
$forums = array();
$forum_topics = array();
echo '<p>';
echo get_lang('SelectResources');
echo '</p>';
Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt'));
foreach ($course->resources as $type => $resources) {
if (count($resources) > 0) {
switch ($type) {
@ -609,4 +608,4 @@ class CourseSelectForm
echo '</form>';
echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
}
}
}

@ -2660,11 +2660,10 @@ div.admin_section h4 {
.ribbon h5 {
display: block;
height: 30px;
line-height: 1.3;
width: 120px;
height: 30px;
width: 150px;
margin: 0;
padding: 15px 10px;
padding: 15px 0px;
position: absolute;
right: 0px;
top: 0px;

@ -67,20 +67,22 @@ function build_directory_selector($folders, $document_id, $group_dir = '', $chan
}
}
}
} else {
foreach ($folders as $folder_id => & $folder) {
$selected = ($document_id == $folder_id) ? ' selected="selected"' : '';
$label = $folder_titles[$folder];
if ($folder == $group_dir) {
$label = get_lang('Documents');
} else {
$path_parts = explode('/', str_replace($group_dir, '', $folder));
$label = cut($label, 80);
$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
}
$parent_select -> addOption($label, $folder_id);
if ($selected != '') {
$parent_select->setSelected($folder_id);
} else {
if (!empty($folders)) {
foreach ($folders as $folder_id => & $folder) {
$selected = ($document_id == $folder_id) ? ' selected="selected"' : '';
$label = $folder_titles[$folder];
if ($folder == $group_dir) {
$label = get_lang('Documents');
} else {
$path_parts = explode('/', str_replace($group_dir, '', $folder));
$label = cut($label, 80);
$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
}
$parent_select -> addOption($label, $folder_id);
if ($selected != '') {
$parent_select->setSelected($folder_id);
}
}
}
}
@ -224,9 +226,8 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
$force_download_html = ($size==0)?'':'<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.Display::return_icon($forcedownload_icon, get_lang('Download'), array(),ICON_SIZE_SMALL).'</a>';
}
//copy files to users myfiles
if (api_get_setting('users_copy_files') == 'true' && !api_is_anonymous()){
//Copy files to users myfiles
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('users_copy_files') == 'true' && !api_is_anonymous()){
$copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$document_data['id'].$req_gid :api_get_self().'?'.api_get_cidreq();
if ($filetype == 'file') {

@ -90,7 +90,7 @@ $dbl_click_id = 0; // Used for avoiding double-click
$selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : null;
/* Constants and variables */
$session_id = api_get_session_id();
$session_id = api_get_session_id();
$course_code = api_get_course_id();
$to_group_id = api_get_group_id();
@ -200,8 +200,8 @@ switch ($action) {
}
break;
case 'copytomyfiles':
// Copy a file to general my files user's
if (api_get_setting('users_copy_files') == 'true' && api_get_user_id() != 0 && !api_is_anonymous()) {
// Copy a file to general my files user's
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('users_copy_files') == 'true' && api_get_user_id() != 0 && !api_is_anonymous()) {
$document_info = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id(), true);
$parent_id = $document_info['parent_id'];
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system');
@ -1114,8 +1114,8 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
// Last edit date
$last_edit_date = api_get_local_time($document_data['lastedit_date']);
$display_date = date_to_str_ago($last_edit_date);
$last_edit_date = api_get_local_time($document_data['lastedit_date']);
$display_date = date_to_str_ago($last_edit_date).' <div class="muted"><small>'.$last_edit_date."</small></div>";
$row[] = $invisibility_span_open.$display_date.$invisibility_span_close;
// Admins get an edit column
@ -1232,7 +1232,7 @@ if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($docs_and
$table->set_header($column++, get_lang('Type'), true, array('style' => 'width:30px;'));
$table->set_header($column++, get_lang('Name'));
$table->set_header($column++, get_lang('Size'), true, array('style' => 'width:50px;'));
$table->set_header($column++, get_lang('Date'), true, array('style' => 'width:105px;'));
$table->set_header($column++, get_lang('Date'), true, array('style' => 'width:150px;'));
// Admins get an edit column
if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $session_id)) {
$table->set_header($column++, get_lang('Actions'), false, array('class' => 'td_actions'));

@ -870,7 +870,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
if ($active == 1) {
$nbrActiveTests = $nbrActiveTests +1;
$item .= Display::tag('td', '<a href="showinframes.php?'.api_get_cidreq().'&file='.$path.'&cid='.api_get_course_id().'&uid='.api_get_user_id().'"'.(!$active?'class="invisible"':'').'">'.$title.'</a>');
$item .= Display::tag('td', '');
//$item .= Display::tag('td', '');
$actions ='<a href="exercise_report.php?' . api_get_cidreq() . '&path='.$path.'">' . Display :: return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_SMALL).'</a>';
$item .= Display::tag('td', $actions);
echo Display::tag('tr',$item, array('class'=>$class));

@ -745,6 +745,7 @@ class Exercise {
// insert into the item_property table
api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizAdded', api_get_user_id());
api_set_default_visibility($this->id, TOOL_QUIZ);
if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
$this->search_engine_save();
}
@ -1244,7 +1245,7 @@ class Exercise {
}
$course_id = api_get_course_id();
require_once api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php';
require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
@ -1280,7 +1281,7 @@ class Exercise {
$exercise_description = $all_specific_terms .' '. $this->description;
$ic_slide->addValue("content", $exercise_description);
$di = new DokeosIndexer();
$di = new ChamiloIndexer();
isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
$di->connectDb(NULL, NULL, $lang);
$di->addChunk($ic_slide);
@ -1310,7 +1311,7 @@ class Exercise {
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
require_once(api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php');
require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
@ -1346,7 +1347,7 @@ class Exercise {
$exercise_description = $all_specific_terms .' '. $this->description;
$ic_slide->addValue("content", $exercise_description);
$di = new DokeosIndexer();
$di = new ChamiloIndexer();
isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
$di->connectDb(NULL, NULL, $lang);
$di->remove_document((int)$se_ref['search_did']);
@ -1381,8 +1382,8 @@ class Exercise {
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$row = Database::fetch_array($res);
require_once(api_get_path(LIBRARY_PATH) .'search/DokeosIndexer.class.php');
$di = new DokeosIndexer();
require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php');
$di = new ChamiloIndexer();
$di->remove_document((int)$row['search_did']);
unset($di);
$tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
@ -3396,7 +3397,7 @@ class Exercise {
//Checking visibility in the item_property table
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_QUIZ, $this->id, api_get_session_id());
if ($visibility == 0) {
$this->active = 0;
}
@ -3457,11 +3458,7 @@ class Exercise {
}
return array('value' => $is_visible, 'message' => $message);
}
function save_attempt() {
}
function added_in_lp() {
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT max_score FROM $TBL_LP_ITEM WHERE c_id = ".$this->course_id." AND item_type = '".TOOL_QUIZ."' AND path = '".$this->id."'";

@ -46,7 +46,6 @@ function showQuestion($questionId, $only_questions = false, $origin = false, $cu
$answerType = $objQuestionTmp->selectType();
$pictureName = $objQuestionTmp->selectPicture();
$html = '';
if ($answerType != HOT_SPOT && $answerType != HOT_SPOT_DELINEATION) {
// Question is not a hotspot
@ -388,39 +387,45 @@ function showQuestion($questionId, $only_questions = false, $origin = false, $cu
} elseif ($answerType == FILL_IN_BLANKS) {
list($answer) = explode('::', $answer);
api_preg_match_all('/\[[^]]+\]/', $answer, $teacher_answer_list);
//Correct answer
api_preg_match_all('/\[[^]]+\]/', $answer, $correct_answer_list);
//Student's answezr
if (isset($user_choice[0]['answer'])) {
api_preg_match_all('/\[[^]]+\]/', $user_choice[0]['answer'], $student_answer_list);
$student_answer_list = $student_answer_list[0];
}
if ($debug_mark_answer) {
$student_answer_list = $teacher_answer_list[0];
//If debug
if ($debug_mark_answer) {
$student_answer_list = $correct_answer_list[0];
}
if (!empty($teacher_answer_list) && !empty($student_answer_list)) {
$teacher_answer_list = $teacher_answer_list[0];
if (!empty($correct_answer_list) && !empty($student_answer_list)) {
$correct_answer_list = $correct_answer_list[0];
$i = 0;
foreach ($teacher_answer_list as $teacher_item) {
foreach ($correct_answer_list as $correct_item) {
$value = null;
if (isset($student_answer_list[$i]) && !empty($student_answer_list[$i])) {
//Cleaning student answer list
$value = strip_tags($student_answer_list[$i]);
$value = api_substr($value,1, api_strlen($value)-2);
$value = strip_tags($student_answer_list[$i]);
$value = api_substr($value, 1, api_strlen($value)-2);
$value = explode('/', $value);
if (!empty($value[0])) {
$value = trim($value[0]);
$value = str_replace('&nbsp;', '', $value);
}
$answer = api_preg_replace('/\['.$teacher_item.'+\]/', Display::input('text', "choice[$questionId][]", $value), $answer);
}
if (!empty($value[0])) {
$value = str_replace('&nbsp;', '', trim($value[0]));
}
$correct_item = preg_quote($correct_item);
$answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer);
//$answer = api_preg_replace('/\['.$correct_item.'+\]/', Display::input('text', "choice[$questionId][]", $value), $answer);
}
$i++;
}
} else {
} else {
$answer = api_preg_replace('/\[[^]]+\]/', Display::input('text', "choice[$questionId][]", '', $attributes), $answer);
}
}
$s .= '<tr><td>'.$answer.'</td></tr>';
} elseif ($answerType == MATCHING) {
// matching type, showing suggestions and answers
@ -2089,7 +2094,7 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
$total_score += $result['score'];
$total_weight += $result['weight'];
$question_list_answers[] = array('question' => $result['open_question'], 'answer' => $result['open_answer']);
$question_list_answers[] = array('question' => $result['open_question'], 'answer' => $result['open_answer']);
$my_total_score = $result['score'];
$my_total_weight = $result['weight'];
@ -2172,10 +2177,8 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
}
}
echo $total_score_text;
echo $exercise_content;
echo $total_score_text;
echo $exercise_content;
if (!$show_only_score) {
echo $total_score_text;
}

@ -27,7 +27,7 @@ if(!api_is_allowed_to_edit(null,true)) {
api_not_allowed(true);
}
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if(document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
@ -132,15 +132,15 @@ $htmlHeadXtra[] = '<script type="text/javascript">
}
</script>';
// to correct #4029 Random and number of attempt menu empty added window.onload=advanced_parameters;
$htmlHeadXtra[] = '<script type="text/javascript">
// to correct #4029 Random and number of attempt menu empty added window.onload=advanced_parameters;
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#exercise_title").focus();
}
$(document).ready(function () {
setFocus();
});
window.onload=advanced_parameters;
window.onload=advanced_parameters;
</script>';
// INIT EXERCISE
@ -194,16 +194,12 @@ if ($form->validate()) {
} else {
if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){
if (!empty($_POST['lp_id'])){
$lp_id=Security::remove_XSS($_POST['lp_id']);//TODO:this remains to be implemented after press the first post
}
else{
$lp_id=Security::remove_XSS($_GET['lp_id']);
}
$lp_id = Security::remove_XSS($_POST['lp_id']);//TODO:this remains to be implemented after press the first post
} else {
$lp_id = Security::remove_XSS($_GET['lp_id']);
}
echo "<a href=\"../newscorm/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-2\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM)."</a>";
}
else{
} else {
echo '<a href="exercice.php">' . Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
}
}

@ -27,7 +27,6 @@ $htmlHeadXtra[] = api_get_jqgrid_js();
// Access control
api_protect_course_script(true, false, true);
// including additional libraries
require_once 'exercise.class.php';
require_once 'exercise.lib.php';
@ -59,11 +58,11 @@ $filter_user = isset($_REQUEST['filter_by_user']) ? intval($_REQUEST['filter_
$locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE);
if (empty($exercise_id)) {
api_not_allowed();
api_not_allowed(true);
}
if (!$is_allowedToEdit) {
api_not_allowed();
api_not_allowed(true);
}
if (!empty($exercise_id))
@ -108,17 +107,15 @@ if ($_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_G
}
$test = $track_exercise_info['title'];
$student_id = $track_exercise_info['exe_user_id'];
$session_id = $track_exercise_info['session_id'];
$lp_id = $track_exercise_info['orig_lp_id'];
//$lp_item_id = $track_exercise_info['orig_lp_item_id'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
$course_info = api_get_course_info();
// Teacher data
$teacher_info = api_get_user_info(api_get_user_id());
$user_info = api_get_user_info($student_id);
$student_email = $user_info['mail'];
$from = $teacher_info['mail'];
$teacher_info = api_get_user_info(api_get_user_id());
$from_name = api_get_person_name($teacher_info['firstname'], $teacher_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$url = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_report.php?' . api_get_cidreq() . '&id_session='.$session_id.'&exerciseId='.$exercise_id;
@ -157,7 +154,7 @@ if ($_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_G
$result =Database::query($sql);
Database::result($result,0,"question");
$query = "UPDATE $TBL_TRACK_ATTEMPT SET marks = '$my_marks',teacher_comment = '$my_comments' WHERE question_id = ".$my_questionid." AND exe_id=".$id;
$query = "UPDATE $TBL_TRACK_ATTEMPT SET marks = '$my_marks', teacher_comment = '$my_comments' WHERE question_id = ".$my_questionid." AND exe_id=".$id;
Database::query($query);
//Saving results in the track recording table
@ -175,26 +172,27 @@ if ($_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_G
$totquery = "UPDATE $TBL_TRACK_EXERCICES SET exe_result = '".floatval($tot)."' WHERE exe_id = ".$id;
Database::query($totquery);
if (isset($_POST['send_notification'])) {
//@todo move this somewhere else
$subject = get_lang('ExamSheetVCC');
$message = '<p>'.get_lang('DearStudentEmailIntroduction') . '</p><p>'.get_lang('AttemptVCC');
$message .= '<h3>'.get_lang('CourseName'). '</h3><p>'.Security::remove_XSS($course_info['name']).'';
$message .= '<h3>'.get_lang('Exercise') . '</h3><p>'.Security::remove_XSS($test);
//Only for exercises not in a LP
if ($lp_id == 0) {
$message .= '<p>'.get_lang('ClickLinkToViewComment') . ' <a href="#url#">#url#</a><br />';
}
//@todo move this somewhere else
$subject = get_lang('ExamSheetVCC');
$message = '<p>'.get_lang('DearStudentEmailIntroduction') . '</p><p>'.get_lang('AttemptVCC');
$message .= '<h3>'.get_lang('CourseName'). '</h3><p>'.Security::remove_XSS($course_info['name']).'';
$message .= '<h3>'.get_lang('Exercise') . '</h3><p>'.Security::remove_XSS($test);
//Only for exercises not in a LP
if ($lp_id == 0) {
$message .= '<p>'.get_lang('ClickLinkToViewComment') . ' <a href="#url#">#url#</a><br />';
$message .= '<p>'.get_lang('Regards').'</p>';
$message .= $from_name;
$message = str_replace("#test#", Security::remove_XSS($test), $message);
$message = str_replace("#url#", $url, $message);
MessageManager::send_message_simple($student_id, $subject, $message, api_get_user_id());
}
$message .= '<p>'.get_lang('Regards').'</p>';
$message .= $from_name;
$message = str_replace("#test#", Security::remove_XSS($test), $message);
$message = str_replace("#url#", $url, $message);
@api_mail_html($student_email, $student_email, $subject, $message, $from_name, $from, array('charset'=>api_get_system_encoding()));
//Updating LP score here
if (in_array($origin, array ('tracking_course','user_course','correct_exercise_in_lp'))) {
@ -258,7 +256,7 @@ Display :: display_header($nameTools);
$actions = Display::div($actions, array('class'=> 'actions'));
$extra = '<script type="text/javascript">
$extra = '<script>
$(document).ready(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
@ -304,17 +302,9 @@ if ($is_allowedToEdit)
echo $extra;
echo $actions;
//echo $content;
/*
$tpl = new Template($nameTools);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
*/
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_results&exerciseId='.$exercise_id.'&filter_by_user='.$filter_user;
//$activeurl = '?sidx=session_active';
$action_links = '';
//Generating group list

@ -30,7 +30,6 @@ if (empty($origin) ) {
$origin = $_REQUEST['origin'];
}
if ($origin == 'learnpath')
api_protect_course_script(false, false, true);
else
@ -74,7 +73,6 @@ if (api_is_course_session_coach(api_get_user_id(), api_get_course_id(), api_get_
//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id);
//No track info
if (empty($track_exercise_info)) {
api_not_allowed(true);
@ -123,9 +121,9 @@ if (!empty($gradebook) && $gradebook=='view') {
$fromlink = '';
$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$interbreadcrumb[]=array("url" => "overview.php?exerciseId=".$exercise_id.'&id_session='.api_get_session_id(),"name" => $objExercise->name);
$interbreadcrumb[]=array("url" => "#","name" => get_lang('Result'));
$interbreadcrumb[]= array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$interbreadcrumb[]= array("url" => "overview.php?exerciseId=".$exercise_id.'&id_session='.api_get_session_id(),"name" => $objExercise->name);
$interbreadcrumb[]= array("url" => "#","name" => get_lang('Result'));
$this_section = SECTION_COURSES;
@ -650,7 +648,7 @@ if ($is_allowedToEdit && $locked == false && !api_is_drh()) {
if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) {
echo ' <form name="myform" id="myform" action="exercise_report.php?exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">';
//echo ' <input type = "hidden" name="totalWeighting" value="'.$totalWeighting.'">';
echo '<input type = "hidden" name="lp_item_id" value="'.$lp_id.'">';
echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">';
echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">';
echo '<input type = "hidden" name="student_id" value="'.$student_id.'">';
echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> ';
@ -659,8 +657,10 @@ if ($is_allowedToEdit && $locked == false && !api_is_drh()) {
echo ' <form name="myform" id="myform" action="exercise_report.php?exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">';
}
if ($origin !='learnpath' && $origin!='student_progress') {
echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>';
?>
<button type="submit" class="save" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');">
<button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');">
<?php echo get_lang('CorrectTest'); ?>
</button>
</form>

@ -673,7 +673,6 @@ if ($time_control) {
echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciceExpiredTimeMessage').'</div>';
}
//echo Display::div($objExercise->description, array('id'=> 'exercise_description', 'class'=>'exercise_description'));
if (!empty($objExercise->description)) {
echo Display::generate_accordion(array( array('title' => get_lang('ExerciseDescriptionLabel'), 'content' => $objExercise->description)));
}
@ -1022,7 +1021,6 @@ if (!empty($error)) {
$remind_question_div = Display::tag('label', Display::input('checkbox', 'remind_list['.$questionId.']', '', $attributes).get_lang('ReviewQuestionLater'), array('class' => 'checkbox', 'for' =>'remind_list['.$questionId.']'));
$exercise_actions .= Display::div($remind_question_div, array('class'=>'exercise_save_now_button'));
}
echo Display::div($exercise_actions, array('class'=>'form-actions'));
echo '</div>';

@ -68,10 +68,10 @@ class FillBlanks extends Question
//take the complete string except after the last '::'
$defaults['answer'] = '';
for($i=0;$i<($sz-1);$i++) {
for ($i=0;$i<($sz-1);$i++) {
$defaults['answer'] .= $pre_array[$i];
}
$a_weightings = explode(',',$is_set_switchable[0]);
$a_weightings = explode(',', $is_set_switchable[0]);
} else {
$defaults['answer'] = get_lang('DefaultTextInBlanks');
}

@ -50,12 +50,13 @@ $TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TR
$TBL_TRACK_HOTPOTATOES_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = api_get_course_int_id();
$hotpotatoes_path = isset($_REQUEST['path']) ? $_REQUEST['path'] : null;
$filter_user = isset($_REQUEST['filter_by_user']) ? intval($_REQUEST['filter_by_user']) : null;
$course_id = api_get_course_int_id();
$hotpotatoes_path = isset($_REQUEST['path']) ? $_REQUEST['path'] : null;
$filter_user = isset($_REQUEST['filter_by_user']) ? intval($_REQUEST['filter_by_user']) : null;
$locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE);
if (empty($hotpotatoes_path)) {
api_not_allowed();
}
@ -64,34 +65,35 @@ if (!$is_allowedToEdit) {
api_not_allowed();
}
if (!empty($exercise_id))
$parameters['exerciseId'] = $exercise_id;
if (!empty($_GET['path'])) {
$parameters['path'] = Security::remove_XSS($_GET['path']);
if (!empty($_REQUEST['path'])) {
$parameters['path'] = Security::remove_XSS($_REQUEST['path']);
}
if (!empty($_REQUEST['export_report']) && $_REQUEST['export_report'] == '1') {
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
$load_extra_data = false;
if (isset($_REQUEST['extra_data']) && $_REQUEST['extra_data'] == 1) {
$load_extra_data = true;
}
require_once 'exercise_result.class.php';
switch ($_GET['export_format']) {
case 'xls' :
$export = new ExerciseResult();
$export->exportCompleteReportXLS($documentPath, null, $load_extra_data, null, $_GET['exerciseId'], $_GET['hotpotato_name']);
require_once 'hotpotatoes_exercise_result.class.php';
// @todo make xls export work
// switch ($_GET['export_format']) {
// case 'xls' :
// $export = new ExerciseResult();
// $export->exportCompleteReportXLS($documentPath, null, $load_extra_data, null, $_GET['exerciseId'], $_GET['hotpotato_name']);
// exit;
// break;
// case 'csv' :
// default :
$export = new HotpotatoesExerciseResult();
$export->exportCompleteReportCSV($documentPath, $hotpotatoes_path);
exit;
break;
case 'csv' :
default :
$export = new ExerciseResult();
$export->exportCompleteReportCSV($documentPath, null, $load_extra_data, null, $_GET['exerciseId'], $_GET['hotpotato_name']);
exit;
break;
}
// break;
// }
} else {
api_not_allowed(true);
}
@ -215,10 +217,7 @@ if ($is_allowedToEdit && $origin != 'learnpath') {
// the form
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
$actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
$actions .='<a href="live_stats.php?' . api_get_cidreq() . '&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'),'',ICON_SIZE_MEDIUM).'</a>';
$actions .='<a href="stats.php?' . api_get_cidreq() . '&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'),'', ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&hotpotato_name='.Security::remove_XSS($_GET['path']).'&exerciseId='.intval($_GET['exerciseId']).'" >'.
Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.Security::remove_XSS($hotpotatoes_path).' ">'.Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>';
}
} else {
$actions .= '<a href="exercice.php">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
@ -292,8 +291,8 @@ $extra = '<script type="text/javascript">
$extra .= '<div id="dialog-confirm" title="'.get_lang("ConfirmYourChoice").'">';
$form = new FormValidator('report', 'post', null, null, array('class' => 'form-vertical'));
$form->addElement('radio', 'export_format', null, get_lang('ExportAsCSV'), 'csv', array('id' => 'export_format_csv_label'));
$form->addElement('radio', 'export_format', null, get_lang('ExportAsXLS'), 'xls', array('id' => 'export_format_xls_label'));
$form->addElement('checkbox', 'load_extra_data', null, get_lang('LoadExtraData'), '0', array('id' => 'export_format_xls_label'));
//$form->addElement('radio', 'export_format', null, get_lang('ExportAsXLS'), 'xls', array('id' => 'export_format_xls_label'));
//$form->addElement('checkbox', 'load_extra_data', null, get_lang('LoadExtraData'), '0', array('id' => 'export_format_xls_label'));
$form->setDefaults(array('export_format' => 'csv'));
$extra .= $form->return_form();
$extra .= '</div>';
@ -302,13 +301,6 @@ if ($is_allowedToEdit)
echo $extra;
echo $actions;
//echo $content;
/*
$tpl = new Template($nameTools);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
*/
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_hotpotatoes_exercise_results&path='.$hotpotatoes_path.'&filter_by_user='.$filter_user;
@ -333,15 +325,16 @@ if ($is_allowedToEdit || $is_tutor) {
$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'),
get_lang('Group'), get_lang('StartDate'), get_lang('Score'), get_lang('Actions'));
//Column config
//Column config
// @todo fix search firstname/lastname that doesn't work. rmove search for the moment
$column_model = array(
array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'true'),
array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'true'),
array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'true'),
array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'),
array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false')
array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'),
array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'),
array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'),
array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false')
);
$action_links = '
@ -362,7 +355,7 @@ $extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';
//$extra_params['excel'] = 'excel';
$extra_params['rowList'] = array(10, 20 ,30);
$extra_params['rowList'] = array(20, 50, 100, 500, 1000, 2000, 5000, 10000);
?>
<script>
@ -436,10 +429,10 @@ $(function() {
<?php } ?>
});
</script>
<form id="export_report_form" method="post" action="exercise_report.php">
<form id="export_report_form" method="post" action="hotpotatoes_exercise_report.php">
<input type="hidden" name="csvBuffer" id="csvBuffer" value="" />
<input type="hidden" name="export_report" id="export_report" value="1" />
<input type="hidden" name="exerciseId" id="exerciseId" value="<?php echo $exercise_id ?>" />
<input type="hidden" name="path" id="path" value="<?php echo $hotpotatoes_path ?>" />
</form>
<?php

@ -0,0 +1,381 @@
<?php
/* For licensing terms, see /license.txt */
/**
* HotpotatoesExerciseResult class: This class allows to instantiate an object
* of type HotpotatoesExerciseResult
* which allows you to export exercises results in multiple presentation forms
* @package chamilo.exercise
* @author
* @version $Id: $
*/
/**
* Code
*/
if(!class_exists('HotpotatoesExerciseResult')):
/**
* Exercise results class
* @package chamilo.exercise
*/
class HotpotatoesExerciseResult
{
private $exercises_list = array(); //stores the list of exercises
private $results = array(); //stores the results
/**
* constructor of the class
*/
public function ExerciseResult($get_questions=false,$get_answers=false) {
}
/**
* Reads exercises information (minimal) from the data base
* @param boolean Whether to get only visible exercises (true) or all of them (false). Defaults to false.
* @return array A list of exercises available
*/
private function _readExercisesList($only_visible = false)
{
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$sql="SELECT id,title,type,random,active FROM $TBL_EXERCISES";
if($only_visible)
{
$sql.= ' WHERE active=1';
}
$sql .= ' ORDER BY title';
$result=Database::query($sql);
// if the exercise has been found
while($row=Database::fetch_array($result,'ASSOC'))
{
$return[] = $row;
}
// exercise not found
return $return;
}
/**
* 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
*/
// function _getExercisesReporting($document_path, $user_id = null, $filter = 0, $hotpotato_name = null) {
function _getExercisesReporting($document_path, $hotpotato_name) {
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT_RECORDING= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$cid = api_get_course_id();
$course_id = api_get_course_int_id();
$user_id = intval($user_id);
$session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
$hotpotato_name = Database::escape_string($hotpotato_name);
if (!empty($exercise_id)) {
$session_id_and .= " AND exe_exo_id = $exercise_id ";
}
if (empty($user_id)) {
$sql="SELECT firstname as userpart1, lastname as userpart2 ,
email,
tth.exe_name,
tth.exe_result,
tth.exe_weighting,
tth.exe_date
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND
tth.exe_cours_id = '" . Database :: escape_string($cid) . "' AND
tth.exe_name = '$hotpotato_name'
ORDER BY tth.exe_cours_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 exe_user_id = '" . $user_id . "' AND
exe_cours_id = '" . Database :: escape_string($cid) . "' AND
tth.exe_name = '$hotpotato_name'
ORDER BY exe_cours_id ASC, exe_date ASC";
}
$results = array();
$resx = Database::query($sql);
while ($rowx = Database::fetch_array($resx,'ASSOC')) {
$results[] = $rowx;
}
$hpresults = array();
$resx = Database::query($sql);
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++) {
$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'];
$return[$i]['first_name'] = $hpresults[$i]['userpart1'];
$return[$i]['last_name'] = $hpresults[$i]['userpart2'];
}
$return[$i]['title'] = $title;
$return[$i]['exe_date'] = $hpresults[$i]['exe_date'];
$return[$i]['result'] = $hpresults[$i]['exe_result'];
$return[$i]['max'] = $hpresults[$i]['exe_weighting'];
}
}
$this->results = $return;
return true;
}
/**
* 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) {
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'])) {
$data .= get_lang('FirstName').';';
}
if(!empty($this->results[0]['last_name'])) {
$data .= get_lang('LastName').';';
}
} else {
if(!empty($this->results[0]['last_name'])) {
$data .= get_lang('LastName').';';
}
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) {
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)).';';
} else {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
$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['email']), ENT_QUOTES, $charset)).';';
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
*/
public function exportCompleteReportXLS($document_path='',$user_id = null, $export_user_fields= false, $export_filter = 0, $exercise_id=0, $hotpotato_name = null) {
global $charset;
$this->_getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
$filename = 'exercise_results_'.date('YmdGis').'.xls';
if (!empty($user_id)) {
$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.xls';
}
$workbook = new Spreadsheet_Excel_Writer();
$workbook->setTempDir(api_get_path(SYS_ARCHIVE_PATH));
$workbook->setVersion(8); // BIFF8
$workbook->send($filename);
$worksheet =& $workbook->addWorksheet('Report '.date('YmdGis'));
$worksheet->setInputEncoding(api_get_system_encoding());
$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;
}
}
if ($with_column_user) {
$worksheet->write($line,$column,get_lang('Email'));
$column++;
if (api_is_western_name_order()) {
$worksheet->write($line,$column,get_lang('FirstName'));
$column++;
$worksheet->write($line,$column,get_lang('LastName'));
$column++;
} else {
$worksheet->write($line,$column,get_lang('LastName'));
$column++;
$worksheet->write($line,$column,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) {
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
$column++;
}
}
$worksheet->write($line,$column, get_lang('Title'));
$column++;
$worksheet->write($line,$column, get_lang('StartDate'));
$column++;
$worksheet->write($line,$column, get_lang('EndDate'));
$column++;
$worksheet->write($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')');
$column++;
$worksheet->write($line,$column, get_lang('Score'));
$column++;
$worksheet->write($line,$column, get_lang('Total'));
$column++;
$worksheet->write($line,$column, get_lang('Status'));
$line++;
foreach ($this->results as $row) {
$column = 0;
if ($with_column_user) {
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
$column++;
if (api_is_western_name_order()) {
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$column++;
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$column++;
} else {
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$column++;
$worksheet->write($line,$column,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->write($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
$column++;
}
}
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$column++;
$worksheet->write($line,$column,$row['start_date']);
$column++;
$worksheet->write($line,$column,$row['end_date']);
$column++;
$worksheet->write($line,$column,$row['duration']);
$column++;
$worksheet->write($line,$column,$row['result']);
$column++;
$worksheet->write($line,$column,$row['max']);
$column++;
$worksheet->write($line,$column,$row['status']);
$line++;
}
//output the results
$workbook->close();
return true;
}
}
endif;

File diff suppressed because it is too large Load Diff

@ -174,11 +174,10 @@ if (!empty($attempts)) {
case EXERCISE_FEEDBACK_TYPE_EXAM:
$header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('Score'));
break;
}
$row = 0;
}
$column = 0;
foreach ($header_names as $item) {
$table->setHeaderContents($row, $column, $item);
$table->setHeaderContents(0, $column, $item);
$column++;
}
$row = 1;

@ -781,10 +781,10 @@ abstract class Question
$res = Database::query($sql);
if (Database::num_rows($res) > 0 || $addQs) {
require_once(api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php');
require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
$di = new DokeosIndexer();
$di = new ChamiloIndexer();
if ($addQs) {
$question_exercises = array((int)$exerciseId);
} else {
@ -1311,8 +1311,8 @@ abstract class Question
//echo '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.$explanation.'</a>';
} else {
$img = pathinfo($img);
$img = $img['filename'];
echo ''.Display::return_icon($img.'_na.gif',$explanation).'';
$img = $img['filename'].'_na.'.$img['extension'];
echo ''.Display::return_icon($img,$explanation).'';
//echo '<br>';
//echo ''.$explanation.'';
}
@ -1395,8 +1395,9 @@ abstract class Question
}
}
$question_title = get_lang("Question").' '.($counter_label).' : '.$this->question;
$header = Display::div('<div class="rib rib-'.$class.'"><h3>'.$score_label.'</h3></div><h4>'.$question_title.'</h4><h5 class="'.$class.'">'.$score['result'].' </h5>', array('class'=>'ribbon'));
$question_title = $this->question;
$header = Display::div('<div class="rib rib-'.$class.'"><h3>'.$score_label.'</h3></div> <h4>'.get_lang("Question").' '.($counter_label).' </h4><h5 class="'.$class.'">'.$score['result'].' </h5>', array('class'=>'ribbon'));
$header .= '<div class="page-header"><h4>'.$question_title.'</h4></div>';
$header .= Display::div($this->description, array('id'=>'question_description'));
return $header;
}

@ -199,11 +199,9 @@ function show_add_forum_form($inputvalues = array(), $lp_id) {
// The title of the forum
$form->addElement('text', 'forum_title', get_lang('Title'),'class="input_titles" id="forum_title"');
//$form->applyFilter('forum_title', 'html_filter');
// The comment of the forum.
$form->addElement('html_editor', 'forum_comment', get_lang('Description'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
//$form->applyFilter('forum_comment', 'html_filter');
// Dropdown list: Forum categories
$forum_categories = get_forum_categories();
foreach ($forum_categories as $key => $value) {
@ -212,74 +210,42 @@ function show_add_forum_form($inputvalues = array(), $lp_id) {
$form->addElement('select', 'forum_category', get_lang('InForumCategory'), $forum_categories_titles);
$form->applyFilter('forum_category', 'html_filter');
if ($_course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) {
// This is for vertical
//$form->addElement('radio', 'allow_anonymous', get_lang('AllowAnonymousPosts'), get_lang('Yes'), 1);
//$form->addElement('radio', 'allow_anonymous', '', get_lang('No'), 0);
if ($_course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) {
// This is for horizontal
$group = '';
$group = array();
$group[] =$form->createElement('radio', 'allow_anonymous', null, get_lang('Yes'), 1);
$group[] =$form->createElement('radio', 'allow_anonymous', null, get_lang('No'), 0);
$form->addGroup($group, 'allow_anonymous_group', get_lang('AllowAnonymousPosts'), '&nbsp;');
}
// This is for vertical.
//$form->addElement('radio', 'students_can_edit', get_lang('StudentsCanEdit'), get_lang('Yes'), 1);
//$form->addElement('radio', 'students_can_edit', '', get_lang('No'), 0);
// This is for horizontal.
/* if (document.getElementById('id_qualify').style.display == 'none') {
document.getElementById('id_qualify').style.display = 'block';
document.getElementById('plus').innerHTML='&nbsp;'.Display::return_icon('div_hide.gif').'&nbsp;".get_lang('AddAnAttachment')."';
} else {
document.getElementById('options').style.display = 'none';
document.getElementById('plus').innerHTML='&nbsp;'.Display::return_icon('div_show.gif').'&nbsp;".get_lang('AddAnAttachment')."';
}*/
$form->addElement('advanced_settings', '<a href="javascript://" onclick="advanced_parameters()" ><span id="plus_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'</span></a>','');
$form->addElement('html', '<div id="options" style="display:none">');
$group = '';
$group[] = $form->createElement('radio', 'students_can_edit', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'students_can_edit', null, get_lang('No'), 0);
$group = array();
$group[]= $form->createElement('radio', 'students_can_edit', null, get_lang('Yes'), 1);
$group[]= $form->createElement('radio', 'students_can_edit', null, get_lang('No'), 0);
$form->addGroup($group, 'students_can_edit_group', get_lang('StudentsCanEdit'), '&nbsp;');
// This is for vertical.
//$form->addElement('radio', 'approval_direct', get_lang('ApprovalDirect'), get_lang('Approval'), 1);
//$form->addElement('radio', 'approval_direct', '', get_lang('Direct'), 0);
// This is for horizontal.
$group = '';
$group = array();
$group[] = $form->createElement('radio', 'approval_direct', null, get_lang('Approval'), 1);
$group[] = $form->createElement('radio', 'approval_direct', null, get_lang('Direct'), 0);
//$form->addGroup($group, 'approval_direct_group', get_lang('ApprovalDirect'), '&nbsp;');
// This is for vertical.
//$form->addElement('radio', 'allow_attachments', get_lang('AllowAttachments'), get_lang('Yes'), 1);
//$form->addElement('radio', 'allow_attachments', '', get_lang('No'), 0);
// This is for horizontal.
$group = '';
$group = array();
$group[] = $form->createElement('radio', 'allow_attachments', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'allow_attachments', null, get_lang('No'), 0);
//$form->addGroup($group, 'allow_attachments_group', get_lang('AllowAttachments'), '&nbsp;');
// This is for vertical.
//$form->addElement('radio', 'allow_new_threads', get_lang('AllowNewThreads'), 1, get_lang('Yes'));
//$form->addElement('radio', 'allow_new_threads', '', 0, get_lang('No'));
// This is for horizontal.
$group = '';
$group = array();
$group[] = $form->createElement('radio', 'allow_new_threads', null, get_lang('Yes'),1 );
$group[] = $form->createElement('radio', 'allow_new_threads', null, get_lang('No'), 0);
$form->addGroup($group, 'allow_new_threads_group', get_lang('AllowNewThreads'), '&nbsp;');
$group = '';
$group = array();
$group[] = $form->createElement('radio', 'default_view_type', null, get_lang('Flat'), 'flat');
$group[] = $form->createElement('radio', 'default_view_type', null, get_lang('Threaded'), 'threaded');
$group[] = $form->createElement('radio', 'default_view_type', null, get_lang('Nested'), 'nested');
$form->addGroup($group, 'default_view_type_group', get_lang('DefaultViewType'), '&nbsp;');
//$form->addElement('static','Group', '<br /><strong>'.get_lang('GroupSettings').'</strong>');
// Dropdown list: Groups.
// Dropdown list: Groups
$groups = GroupManager::get_group_list();
$groups_titles[0] = get_lang('NotAGroupForum');
foreach ($groups as $key => $value) {
@ -288,7 +254,7 @@ function show_add_forum_form($inputvalues = array(), $lp_id) {
$form->addElement('select', 'group_forum', get_lang('ForGroup'), $groups_titles);
// Public or private group forum
$group='';
$group = array();
$group[] = $form->createElement('radio', 'public_private_group_forum', null, get_lang('Public'), 'public');
$group[] = $form->createElement('radio', 'public_private_group_forum', null, get_lang('Private'), 'private');
$form->addGroup($group, 'public_private_group_forum_group', get_lang('PublicPrivateGroupForum'), '&nbsp;');
@ -329,7 +295,7 @@ function show_add_forum_form($inputvalues = array(), $lp_id) {
$form->addRule('forum_title', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('forum_category', get_lang('ThisFieldIsRequired'), 'required');
// Settings the defaults.
// Settings the defaults
if (empty($inputvalues) || !is_array($inputvalues)) {
$defaults['allow_anonymous_group']['allow_anonymous'] = 0;
$defaults['students_can_edit_group']['students_can_edit'] = 0;
@ -507,23 +473,33 @@ function store_forumcategory($values) {
* @version february 2006, dokeos 1.8
*/
function store_forum($values) {
global $_course;
global $_user;
global $_course;
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
if (isset($values['group_id']) && !empty($values['group_id'])) {
$group_id = $values['group_id'];
} else {
$group_id = api_get_group_id();
}
$table_forums = Database::get_course_table(TABLE_FORUM);
// Find the max forum_order for the given category. The new forum is added at the end => max cat_order + &
if (is_null($values['forum_category'])) {
$new_max = null;
} else {
$sql = "SELECT MAX(forum_order) as sort_max FROM ".$table_forums."
WHERE c_id = $course_id AND forum_category='".Database::escape_string($values['forum_category'])."'";
$sql = "SELECT MAX(forum_order) as sort_max
FROM ".$table_forums."
WHERE c_id = $course_id AND
forum_category='".Database::escape_string($values['forum_category'])."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$new_max = $row['sort_max'] + 1;
}
$session_id = api_get_session_id();
$clean_title = Database::escape_string($values['forum_title']);
// Forum images
@ -595,8 +571,10 @@ function store_forum($values) {
forum_of_group='". Database::escape_string($values['group_forum'])."'
WHERE c_id = $course_id AND forum_id='".Database::escape_string($values['forum_id'])."'";
Database::query($sql);
api_item_property_update($_course, TOOL_FORUM, Database::escape_string($values['forum_id']), 'ForumUpdated', api_get_user_id());
api_item_property_update($_course, TOOL_FORUM, Database::escape_string($values['forum_id']), 'ForumUpdated', api_get_user_id(), $group_id);
$return_message = get_lang('ForumEdited');
} else {
$sql_image = '';
@ -626,8 +604,8 @@ function store_forum($values) {
Database::query($sql);
$last_id = Database::insert_id();
if ($last_id > 0) {
api_item_property_update($_course, TOOL_FORUM, $last_id, 'ForumAdded', api_get_user_id());
api_set_default_visibility($last_id, TOOL_FORUM);
api_item_property_update($_course, TOOL_FORUM, $last_id, 'ForumAdded', api_get_user_id(), $group_id);
api_set_default_visibility($last_id, TOOL_FORUM, $group_id);
}
$return_message = get_lang('ForumAdded');
}
@ -2052,7 +2030,7 @@ function show_add_post_form($action = '', $id = '', $form_values = '') {
global $current_forum;
global $_user;
global $origin;
$gradebook = Security::remove_XSS($_GET['gradebook']);
// Setting the class and text of the form title and submit button.
if ($_GET['action'] == 'quote') {
@ -2064,7 +2042,7 @@ function show_add_post_form($action = '', $id = '', $form_values = '') {
} elseif ($_GET['action'] == 'replymessage') {
$class = 'save';
$text = get_lang('ReplyToMessage');
}else {
} else {
$class = 'add';
$text = get_lang('CreateThread');
}
@ -2078,11 +2056,11 @@ function show_add_post_form($action = '', $id = '', $form_values = '') {
$form = new FormValidator('thread', 'post', api_get_self().'?forum='.Security::remove_XSS($my_forum).'&gradebook='.$gradebook.'&thread='.Security::remove_XSS($my_thread).'&post='.Security::remove_XSS($my_post).'&action='.Security::remove_XSS($my_action).'&origin='.$origin);
$form->setConstants(array('forum' => '5'));
$form->addElement('header', '', $text);
$form->addElement('header', $text);
// Settting the form elements.
$form->addElement('hidden', 'forum_id', strval(intval($my_forum)));
$form->addElement('hidden', 'thread_id', strval(intval($my_thread)));
$form->addElement('hidden', 'forum_id', intval($my_forum));
$form->addElement('hidden', 'thread_id', intval($my_thread));
$form->addElement('hidden', 'gradebook', $my_gradebook);
// If anonymous posts are allowed we also display a form to allow the user to put his name or username in.
@ -2091,8 +2069,8 @@ function show_add_post_form($action = '', $id = '', $form_values = '') {
$form->applyFilter('poster_name', 'html_filter');
}
$form->addElement('text', 'post_title', get_lang('Title'),'class="input_titles"');
//$form->applyFilter('post_title', 'html_filter');
$form->addElement('text', 'post_title', get_lang('Title'));
$form->addElement('html_editor', 'post_text', get_lang('Text'), true,
api_is_allowed_to_edit(null, true)
? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '300')
@ -2100,32 +2078,33 @@ function show_add_post_form($action = '', $id = '', $form_values = '') {
);
$form->addRule('post_text', get_lang('ThisFieldIsRequired'), 'required');
//$form->applyFilter('post_text', 'html_filter');
$form->addElement('advanced_settings', '<a href="javascript://" onclick="return advanced_parameters()">
<span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a>');
$form->addElement('html', '<div id="id_qualify" style="display:none">');
if ((api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && !($my_thread) ) {
if( (api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && !($my_thread) ) {
//Loading gradebook select
load_gradebook_select_in_tool($form);
// Thread qualify
$form->applyFilter('numeric_calification', 'html_filter');
if(Gradebook::is_active()){
// Thread qualify
if (Gradebook::is_active()){
//Loading gradebook select
load_gradebook_select_in_tool($form);
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'), 'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
}else{
} else{
$form->addElement('hidden', 'thread_qualify_gradebook', false);
}
$form -> addElement('html', '<div id="options_field" style="display:none">');
$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'),'Style="width:40px"');
$form->addElement('html', '<div id="options_field" style="display:none">');
$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'));
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->applyFilter('weight_calification', 'html_filter');
$form->addElement('html', '</div>');
}
@ -2137,8 +2116,7 @@ function show_add_post_form($action = '', $id = '', $form_values = '') {
$form->addElement('checkbox', 'thread_sticky', '', get_lang('StickyPost'));
}
if ($current_forum['allow_attachments'] == '1' || api_is_allowed_to_edit(null, true)) {
//$form->add_resource_button();
if ($current_forum['allow_attachments'] == '1' || api_is_allowed_to_edit(null, true)) {
$values = $form->exportValues();
}
@ -2171,7 +2149,7 @@ function show_add_post_form($action = '', $id = '', $form_values = '') {
// When we are quoting a message then we have to put that message into the wysiwyg editor.
// Note: The style has to be hardcoded here because using class="quote" didn't work.
if ($action == 'quote') {
$defaults['post_text'] = '<div>&nbsp;</div><div style="margin: 5px;"><div style="font-size: 90%; font-style: italic;">'.get_lang('Quoting').' '.api_get_person_name($values['firstname'], $values['lastname']).':</div><div style="color: #006600; font-size: 90%; font-style: italic; background-color: #FAFAFA; border: #D1D7DC 1px solid; padding: 3px;">'.prepare4display($values['post_text']).'</div></div><div>&nbsp;</div><div>&nbsp;</div>';
$defaults['post_text'] = '<div>&nbsp;</div><div style="margin: 5px;"><div style="font-size: 90%; font-style: italic;">'.get_lang('Quoting').' '.api_get_person_name($values['firstname'], $values['lastname']).':</div><div style="color: #006600; font-size: 90%; font-style: italic; background-color: #FAFAFA; border: #D1D7DC 1px solid; padding: 3px;">'.prepare4display($values['post_text']).'</div></div><div>&nbsp;</div><div>&nbsp;</div>';
}
}
$form->setDefaults(isset($defaults) ? $defaults : null);
@ -2534,18 +2512,15 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
api_is_allowed_to_edit(null, true)
? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '400')
: array('ToolbarSet' => 'ForumStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student')
);
//$form->applyFilter('post_text', 'html_filter');
);
$form->addRule('post_text', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('advanced_settings', '<a href="javascript://" onclick="return advanced_parameters()"><span id="img_plus_and_minus">'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).''.get_lang('AdvancedParameters').'</span></a>');
$form->addElement('html', '<div id="id_qualify" style="display:none">');
if (!isset($_GET['edit'])) {
$form->addElement('label', '<strong>'.get_lang('AlterQualifyThread').'</strong>');
$form->applyFilter('numeric_calification', 'html_filter');
if(Gradebook::is_active()){
if (!isset($_GET['edit'])) {
if (Gradebook::is_active()) {
$form->addElement('label', '<strong>'.get_lang('AlterQualifyThread').'</strong>');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'), 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$link_info = is_resource_in_course_gradebook(api_get_course_id(), 5, $_GET['thread'], api_get_session_id());
@ -2571,10 +2546,14 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
load_gradebook_select_in_tool($form);
$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'), 'value="'.$current_thread['thread_qualify_max'].'" style="width:40px"');
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'), 'value="'.$current_thread['thread_title_qualify'].'"');
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', array(get_lang('QualifyWeight'), null, '') , 'value="'.$current_thread['thread_weight'].'" style="width:40px"');
$form->addElement('text', 'weight_calification', array(get_lang('QualifyWeight'), null, '') , 'value="'.$current_thread['thread_weight'].'" style="width:40px"');
$form->applyFilter('weight_calification', 'html_filter');
$form->addElement('html', '</div>');
}
@ -2605,13 +2584,10 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
if ($current_forum['allow_attachments'] == '1' || api_is_allowed_to_edit(null, true)) {
if (empty($form_values) && !isset($_POST['SubmitPost'])) {
//edit_added_resources('forum_post', $current_post['post_id']);
}
//$form->add_resource_button();
}
}
$form->addElement('html', '</div>');
$form->addElement('style_submit_button', 'SubmitPost', get_lang('ModifyThread'), 'class="save"');
// Setting the default values for the form elements.

@ -291,7 +291,7 @@ if (is_array($forum_categories_list)) {
$forum_image = '';
echo '<td width="20">';
echo '<td width="20px">';
// Showing the image
if (!empty($forum['forum_image'])) {
@ -303,14 +303,13 @@ if (is_array($forum_categories_list)) {
if (!empty($image_size)) {
if ($image_size['width'] > 100 || $image_size['height'] > 100) {
//limit display width and height to 100px
$img_attributes = 'width="100" height="100"';
$img_attributes = ' style="width:100px" width="100px" height="100px"';
}
$forum_image = "<img src=\"$image_path\" $img_attributes>";
} else {
$forum_image = '';
}
echo $forum_image;
} else {
if ($forum['forum_of_group'] !== '0') {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {

@ -386,7 +386,7 @@ $course_id = api_get_course_int_id();
if (isset ($_GET['deletelink'])) {
block_students();
$get_delete_link=Security::remove_XSS($_GET['deletelink']);
$get_delete_link = intval($_GET['deletelink']);
//fixing #5229
if (!empty($get_delete_link)) {
$link= LinkFactory :: load($get_delete_link);

@ -403,7 +403,7 @@ class FlatViewTable extends SortableTable
/**
* Function used by SortableTable to get total number of items in the table
*/
function get_total_number_of_items () {
function get_total_number_of_items() {
return $this->datagen->get_total_users_count();
}
@ -488,7 +488,6 @@ class FlatViewTable extends SortableTable
$column++;
}
//$this->set_header($column++, get_lang('Total'));
$data_array = $this->datagen->get_data($users_sorting, $from, $this->per_page, $this->offset, $selectlimit);
$table_data = array();

@ -322,15 +322,21 @@ class FlatViewDataGenerator
$item_value = $percentage*$item_value;
$item_total += $sub_cat->get_weight();
if ($convert_using_the_global_weight) {
//$score[0] = $main_weight*$score[0]/$sub_cat->get_weight();
if ($convert_using_the_global_weight) {
$score[0] = $score[0]/$main_weight*$sub_cat->get_weight();
$score[1] = $main_weight ;
}
$real_score = $scoredisplay->display_score($real_score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $real_score);
}
if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
//if (true) {
$real_score = $scoredisplay->display_score($real_score, SCORE_SIMPLE);
$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($real_score, $temp_score);
} else {
$real_score = $scoredisplay->display_score($real_score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $real_score);
}
if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) {
if (!$show_all) {
@ -348,6 +354,7 @@ class FlatViewDataGenerator
for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) {
$item = $this->evals_links[$count + $items_start];
$score = $item->calc_score($user_id);
$real_score = $score;
$divide = ( ($score[1])==0 ) ? 1 : $score[1];
//sub cat weight
@ -359,20 +366,24 @@ class FlatViewDataGenerator
if ($this->category->get_parent_id() == 0 ) {
$item_value = $score[0]/$divide*$item->get_weight();
} else {
$item_value = $item_value*$item->get_weight();
//var_dump($item_value.' - '.$item->get_weight());
//$item_value = $main_weight*$item_value/$item->get_weight();
//$item_value = $item_value*100/$item->get_weight();
$item_value = $item_value*$item->get_weight();
}
$item_total += $item->get_weight();
$complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
//$temp_score = $item_value.' - '.$scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
//$temp_score = $item_value;
$temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $complete_score);
$item_total += $item->get_weight();
/*
$complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
$temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $complete_score);*/
//if (true) {
if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
$real_score = $scoredisplay->display_score($real_score, SCORE_SIMPLE);
$temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($real_score, $temp_score);
} else {
$temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $complete_score);
}
if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) {
if (!$show_all) {

@ -84,7 +84,9 @@ function update_resource_from_course_gradebook($link_id, $course_code, $weight)
* @return bool false on error, true on success
*/
function remove_resource_from_course_gradebook($link_id) {
if ( empty($link_id) ) { return false; }
if (empty($link_id)) {
return false;
}
// TODO find the corresponding category (the first one for this course, ordered by ID)
$l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = "DELETE FROM $l WHERE id = ".(int)$link_id;
@ -367,7 +369,9 @@ function is_resource_in_course_gradebook($course_code, $resource_type, $resource
* @return bool false on error, true on success
*/
function get_resource_from_course_gradebook($link_id) {
if ( empty($link_id) ) { return false; }
if (empty($link_id)) {
return false;
}
// TODO find the corresponding category (the first one for this course, ordered by ID)
$l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = "SELECT * FROM $l WHERE id = ".(int)$link_id;
@ -542,7 +546,7 @@ function register_user_info_about_certificate ($cat_id, $user_id, $score_certifi
*/
function get_certificate_by_user_id ($cat_id,$user_id) {
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$sql_get_date='SELECT * FROM '.$table_certificate.' WHERE cat_id="'.intval($cat_id).'" AND user_id="'.intval($user_id).'"';
$sql_get_date = 'SELECT * FROM ' . $table_certificate . ' WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
$rs_get_date=Database::query($sql_get_date);
$row =Database::fetch_array($rs_get_date,'ASSOC');
return $row;

@ -92,6 +92,12 @@ if (isset($_GET['action'])) {
case 'show_msg' :
Display :: display_confirmation_message($my_msg);
break;
case 'warning_message' :
Display :: display_warning_message($my_msg);
break;
case 'success_message' :
Display :: display_confirmation_message($my_msg);
break;
}
}
@ -250,7 +256,7 @@ foreach ($group_cats as $index => $category) {
GroupManager::user_has_access($_user['user_id'], $this_group['id'], GroupManager::GROUP_TOOL_WIKI))
&& !(api_is_course_coach() && intval($this_group['session_id']) != intval($_SESSION['id_session']))) {
$orig = isset($origin) ? $origin : null;
$group_name = '<a href="group_space.php?'.api_get_cidreq().'&amp;origin='.$orig.'&amp;gidReq='.$this_group['id'].'">'.stripslashes($this_group['name']).'</a>';
$group_name = '<a href="group_space.php?cidReq='.api_get_course_id().'&amp;origin='.$orig.'&amp;gidReq='.$this_group['id'].'">'.Security::remove_XSS($this_group['name']).'</a>';
if (!empty($_SESSION['_user']['user_id']) && !empty($this_group['id_tutor']) && $_SESSION['_user']['user_id'] == $this_group['id_tutor']) {
$group_name .= ' ('.get_lang('OneMyGroups').')';
} elseif ($this_group['is_member']) {
@ -307,10 +313,10 @@ foreach ($group_cats as $index => $category) {
// Edit-links
if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && intval($this_group['session_id']) != intval($_SESSION['id_session']))) {
$edit_actions = '<a href="group_edit.php?'.api_get_cidreq().'&gidReq='.$this_group['id'].'" title="'.get_lang('Edit').'">'.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&category='.$category['id'].'&amp;action=empty_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('EmptyGroup').'">'.Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&category='.$category['id'].'&amp;action=fill_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('FillGroup').'">'.Display::return_icon('fill.png',get_lang('FillGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&category='.$category['id'].'&amp;action=delete_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$edit_actions = '<a href="group_edit.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'" title="'.get_lang('Edit').'">'.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category['id'].'&amp;action=empty_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('EmptyGroup').'">'.Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category['id'].'&amp;action=fill_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('FillGroup').'">'.Display::return_icon('fill.png',get_lang('FillGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category['id'].'&amp;action=delete_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
$row[] = $edit_actions;
}
if (!empty($this_group['nbMember'])) {

@ -74,7 +74,7 @@ if (isset ($_GET['id'])) {
// Update settings of existing category
$action = 'update_settings';
$form = new FormValidator('group_category', 'post', '?id='.$category['id']);
$form->addElement('header','',$nameTools);
$form->addElement('header', $nameTools);
$form->addElement('hidden', 'id');
} else {
// Checks if the field was created in the table Category. It creates it if is neccesary

@ -17,8 +17,6 @@ $current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'classmanager.lib.php';
/* Create the groups */
@ -288,6 +286,7 @@ EOT;
/*
* Show form to generate groups from classes subscribed to the course
*/
/*
$classes = ClassManager :: get_classes_in_course($_course['sysCode']);
if (count($classes) > 0) {
echo '<b>'.get_lang('GroupsFromClasses').'</b>';
@ -324,7 +323,8 @@ EOT;
$create_class_groups_form->setDefaults($defaults);
$create_class_groups_form->display();
echo '</blockquote>';
}
}*/
}
/* FOOTER */

@ -23,16 +23,12 @@ $current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);
/* Libraries & settings */
$group_id = api_get_group_id();
/* Constants & variables */
$current_group = GroupManager :: get_group_properties($group_id);
/* Header */
$nameTools = get_lang('EditGroup');
$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']);
$is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id);
@ -113,9 +109,9 @@ function check_group_members($value) {
/* MAIN CODE */
// Build form
$form = new FormValidator('group_edit');
$form = new FormValidator('group_edit', 'post', api_get_self().'?'.api_get_cidreq());
$form->addElement('header', '', $nameTools);
$form->addElement('header', $nameTools);
$form->addElement('hidden', 'action');
$form->addElement('hidden', 'referer');
@ -137,8 +133,7 @@ foreach ($complete_user_list as $index => $user) {
$group_tutor_list = GroupManager :: get_subscribed_tutors($current_group['id']);
$selected_users = array();
$selected_tutors = array();
foreach ($group_tutor_list as $index => $user) {
//$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], .$user['lastname']);
foreach ($group_tutor_list as $index => $user) {
$selected_tutors[] = $user['user_id'];
}
@ -193,19 +188,6 @@ $group_members_element->setButtonAttributes('add', array('class' => 'btn arrowr'
$group_members_element->setButtonAttributes('remove', array('class' => 'btn arrowl'));
$form->addFormRule('check_group_members');
// Tutors: this has been replaced with the new tutors code
//$tutors = GroupManager :: get_all_tutors();
//$possible_tutors[0] = get_lang('GroupNoTutor');
//foreach ($tutors as $index => $tutor)
//{
// $possible_tutors[$tutor['user_id']] = api_get_person_name($tutor['lastname'], $tutor['firstname']);
//}
//$group = array ();
//$group[] = & $form->createElement('select', 'tutor_id', null, $possible_tutors);
//$group[] = & $form->createElement('static', null, null, '&nbsp;&nbsp;<a href="../user/user.php">'.get_lang('AddTutors').'</a>');
//$form->addGroup($group, 'tutor_group', get_lang('GroupTutor'), '', false);
// Members per group
$form->addElement('radio', 'max_member_no_limit', get_lang('GroupLimit'), get_lang('NoLimit'), GroupManager::MEMBER_PER_GROUP_NO_LIMIT);
$group = array();
@ -235,7 +217,6 @@ $group[] = $form->createElement('radio', 'work_state', null, get_lang('Public'),
$group[] = $form->createElement('radio', 'work_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE);
$form->addGroup($group, '', Display::return_icon('work.png', get_lang('GroupWork') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupWork'), '', false);
// Calendar settings
$group = array();
$group[] = $form->createElement('radio', 'calendar_state', get_lang('GroupCalendar'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE);
@ -297,14 +278,14 @@ if ($form->validate()) {
GroupManager :: subscribe_users($values['group_members'], $current_group['id']);
}
// Returning to the group area (note: this is inconsistent with the rest of chamilo)
//var_dump(count($_POST['group_members']), $max_member, GroupManager::MEMBER_PER_GROUP_NO_LIMIT);
// Returning to the group area (note: this is inconsistent with the rest of chamilo)
$cat = GroupManager :: get_category_from_group($current_group['id']);
if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
header('Location:group_edit.php?show_message='.get_lang('GroupTooMuchMembers'));
header('Location: group.php?'.api_get_cidreq(true, false).'&action=warning_message&msg='.get_lang('GroupTooMuchMembers'));
} else {
header('Location: '.$values['referer'].'?action=show_msg&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']);
header('Location: group.php?'.api_get_cidreq(true, false).'&action=success_message&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']);
}
exit;
}
$defaults = $current_group;
@ -318,11 +299,6 @@ if ($defaults['maximum_number_of_students'] == GroupManager::MEMBER_PER_GROUP_NO
$defaults['max_member_no_limit'] = 1;
$defaults['max_member'] = $defaults['maximum_number_of_students'];
}
$referer = parse_url($_SERVER['HTTP_REFERER']);
$referer = basename($referer['path']);
if ($referer != 'group_space.php' && $referer != 'group.php') {
$referer = 'group.php';
}
if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
$keyword_name = Security::remove_XSS($_GET['keyword']);
@ -330,18 +306,17 @@ if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
}
Display :: display_header($nameTools, 'Group');
?>
<div class="actions">
<a href="group_space.php"><?php echo Display::return_icon('back.png', get_lang('ReturnTo').' '.get_lang('GroupSpace'),'',ICON_SIZE_MEDIUM); ?></a>
</div>
<?php
if (isset($_GET['show_message'])) {
echo Display::display_error_message($_GET['show_message']);
//@todo fix this
if (isset($_GET['show_message_warning'])) {
echo Display::display_warning_message($_GET['show_message_warning']);
}
$defaults['referer'] = $referer;
if (isset($_GET['show_message_sucess'])) {
echo Display::display_normal_message($_GET['show_message_sucess']);
}
$form->setDefaults($defaults);
$form->display();
/* FOOTER */
Display :: display_footer();

@ -28,12 +28,13 @@ require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php';
/* MAIN CODE */
$group_id = api_get_group_id();
$user_id = api_get_user_id();
$current_group = GroupManager :: get_group_properties($group_id);
if (empty($current_group)) {
api_not_allowed();
api_not_allowed(true);
}
$this_section = SECTION_COURSES;
@ -123,7 +124,7 @@ $is_course_member = CourseManager :: is_user_subscribed_in_real_or_linked_course
$edit_url = '';
if (api_is_allowed_to_edit(false, true) or GroupManager :: is_tutor_of_group(api_get_user_id(), api_get_group_id())) {
$my_origin = isset($origin) ? $origin : '';
$edit_url = '<a href="group_edit.php?origin='.$my_origin.'&gidReq='.api_get_group_id().'">'.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>';
$edit_url = '<a href="group_edit.php?cidReq='. api_get_course_id().'&origin='.$my_origin.'&gidReq='.api_get_group_id().'">'.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>';
}
echo Display::page_header(Security::remove_XSS($current_group['name']).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group);
@ -136,9 +137,8 @@ if (!empty($current_group['description'])) {
* Group Tools
*/
// If the user is subscribed to the group or the user is a tutor of the group then
if (api_is_allowed_to_edit(false, true) OR GroupManager :: is_user_in_group(api_get_user_id(), $current_group['id'])) {
echo '<ul>';
$tools = '';
if (api_is_allowed_to_edit(false, true) OR GroupManager :: is_user_in_group(api_get_user_id(), $current_group['id'])) {
$actions_array = array();
// Link to the forum of this group
$forums_of_groups = get_forums_of_group($current_group['id']);
@ -146,93 +146,141 @@ if (api_is_allowed_to_edit(false, true) OR GroupManager :: is_user_in_group(api_
if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE ) {
foreach ($forums_of_groups as $key => $value) {
if ($value['forum_group_public_private'] == 'public' || (/*!empty($user_subscribe_to_current_group) && */ $value['forum_group_public_private'] == 'private') || !empty($user_is_tutor) || api_is_allowed_to_edit(false, true)) {
$tools .= '<li style="display:inline; margin:5px;"><a href="../forum/viewforum.php?forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&amp;origin=group">'.Display::return_icon('forum.png', get_lang('Forum').': '.$value['forum_title'] , array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../forum/viewforum.php?forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&amp;origin=group',
'content' => Display::return_icon('forum.png', get_lang('Forum').': '.$value['forum_title'] , array(), 32)
);
}
}
}
}
if ($current_group['doc_state'] != GroupManager::TOOL_NOT_AVAILABLE ) {
// Link to the documents area of this group
$tools .= '<li style="display:inline; margin:5px;" ><a href="../document/document.php?'.api_get_cidreq().'&amp;gidReq='.$current_group['id'].'">'.Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32).'</a></li>';
// Link to the documents area of this group
$actions_array[] = array(
'url' => '../document/document.php?'.api_get_cidreq(),
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32)
);
}
if ($current_group['calendar_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to a group-specific part of agenda
$tools .= '<li style="display:inline; margin:5px;"><a href="../calendar/agenda.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'&amp;group='.$current_group['id'].'&amp;acces=0">'.Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../calendar/agenda.php?'.api_get_cidreq(),
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32)
);
}
if ($current_group['work_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the works area of this group
$tools .= '<li style="display:inline; margin:5px;" ><a href="../work/work.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'">'.Display::return_icon('work.png', get_lang('GroupWork'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), 32)
);
}
if ($current_group['announcements_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to a group-specific part of announcements
$tools .= '<li style="display:inline; margin:5px;"><a href="../announcements/announcements.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'">'.Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32)
);
}
if ($current_group['wiki_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the wiki area of this group
$tools .= '<li style="display:inline; margin:5px;"><a href="../wiki/index.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'].'">'.Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../wiki/index.php?'.api_get_cidreq().'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
);
}
if ($current_group['chat_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) {
$tools .= "<li style=\"display:inline; margin:5px;\"><a href=\"javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \" >".Display::return_icon('chat.png', get_lang('Chat'),'',ICON_SIZE_MEDIUM)."</a></li>";
$actions_array[] = array(
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
} else {
$tools .= "<li style=\"display:inline; margin:5px;\"><a href=\"../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('chat.png', get_lang('Chat'), array(), 32)."</a></li>";
$actions_array[] = array(
'url' => "../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
}
}
echo '</ul>';
echo Display::page_subheader(get_lang('Tools'));
if (!empty($tools)) {
echo $tools;
if (!empty($actions_array)) {
echo Display::page_subheader(get_lang('Tools'));
echo Display::actions($actions_array);
}
} else {
echo '<ul>';
$tools = '';
$actions_array = array();
// Link to the forum of this group
$forums_of_groups = get_forums_of_group($current_group['id']);
if (is_array($forums_of_groups)) {
if ( $current_group['forum_state'] == GroupManager::TOOL_PUBLIC ) {
foreach ($forums_of_groups as $key => $value) {
if ($value['forum_group_public_private'] == 'public' ) {
$tools.= '<li style="display:inline; margin:5px;"><a href="../forum/viewforum.php?forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&amp;origin=group">'.Display::return_icon('forum.png', get_lang('GroupForum'), array(), 32).'</a></li>';
if ($value['forum_group_public_private'] == 'public' ) {
$actions_array[] = array(
'url' => '../forum/viewforum.php?cidReq='.api_get_course_id().'&forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&amp;origin=group',
'content' => Display::return_icon('forum.png', get_lang('GroupForum'), array(), ICON_SIZE_MEDIUM)
);
}
}
}
}
if ($current_group['doc_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the documents area of this group
$tools .= '<li style="display:inline; margin:5px;"><a href="../document/document.php?'.api_get_cidreq().'&amp;gidReq='.$current_group['id'].'&amp;origin='.$origin.'">'.Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../document/document.php?cidReq='.api_get_course_id().'&amp;origin='.$origin,
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['calendar_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of agenda
$tools .= '<li style="display:inline; margin:5px;"><a href="../calendar/agenda.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'&amp;group='.$current_group['id'].'">'.Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../calendar/agenda.php?'.api_get_cidreq(),
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['work_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the works area of this group
$tools .= '<li style="display:inline; margin:5px;"><a href="../work/work.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'">'.Display::return_icon('work.png', get_lang('GroupWork'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['announcements_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of announcements
$tools .= '<li style="display:inline; margin:5px;"><a href="../announcements/announcements.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'&amp;group='.$current_group['id'].'">'.Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['wiki_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the wiki area of this group
$tools .= '<li style="display:inline; margin:5px;"><a href="../wiki/index.php?'.api_get_cidreq().'&amp;toolgroup='.$current_group['id'].'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'].'">'.Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32).'</a></li>';
$actions_array[] = array(
'url' => '../wiki/index.php?'.api_get_cidreq().'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
);
}
if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC ) {
// Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) {
$tools .= "<li style=\"display:inline; margin:5px;\"><a href=\"javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \" >".Display::return_icon('chat.png', get_lang("Chat"), array(), 32)."</a></li>";
$actions_array[] = array(
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
} else {
$tools .= "<li style=\"display:inline; margin:5px;\"><a href=\"../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('chat.png', get_lang("Chat"), array(), 32)."</a></li>";
$actions_array[] = array(
'url' => "../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
}
}
echo '</ul>';
echo Display::page_subheader(get_lang('Tools'));
if (!empty($tools)) {
echo $tools;
if (!empty($actions_array)) {
echo Display::page_subheader(get_lang('Tools'));
echo Display::actions($actions_array);
}
}

@ -26,7 +26,8 @@ if (!in_array($action, array(
'get_hotpotatoes_exercise_results',
'get_work_user_list',
'get_timelines',
'get_user_skill_ranking'))
'get_user_skill_ranking',
'get_usergroups_teacher'))
) {
api_protect_admin_script(true);
}
@ -225,9 +226,18 @@ switch ($action) {
$count = $obj->get_count();
break;
case 'get_usergroups':
$obj = new UserGroup();
$count = $obj->get_count();
break;
case 'get_usergroups_teacher':
$obj = new UserGroup();
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'registered';
$course_id = api_get_course_int_id();
if ($type == 'registered') {
$count = $obj->get_usergroup_by_course_with_data_count($course_id);
} else {
$count = $obj->get_count();
}
break;
default:
exit;
@ -491,11 +501,20 @@ switch ($action) {
$result = $new_result;
}*/
break;
case 'get_usergroups_teacher':
case 'get_usergroups_teacher':
$columns = array('name', 'users', 'actions');
$result = Database::select('*', $obj->table, array('order'=>"name $sord", 'LIMIT'=> "$start , $limit"));
$options = array('order'=>"name $sord", 'LIMIT'=> "$start , $limit");
switch ($type) {
case 'not_registered':
$options['where'] = array(" usergroup.course_id IS NULL" => ' ');
$result = $obj->get_usergroup_not_in_course($options);
break;
case 'registered':
$options['where'] = array(" usergroup.course_id = ? " => $course_id);
$result = $obj->get_usergroup_in_course($options);
break;
}
$new_result = array();
$course_id = api_get_course_int_id();
if (!empty($result)) {
foreach ($result as $group) {

@ -120,7 +120,7 @@ class Attendance
FROM $tbl_attendance att
WHERE c_id = $course_id AND $active_plus $condition_session
ORDER BY col$column $direction LIMIT $from,$number_of_items ";
var_dump($sql);exit;
$res = Database::query($sql);
$attendances = array ();

@ -1582,16 +1582,17 @@ class CourseManager {
$course_id = $course_info['real_id'];
$group_list = array();
$session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0';
$sql = "SELECT g.id, g.name, COUNT(gu.id) userNb
$sql = "SELECT g.id, g.name
FROM ".Database::get_course_table(TABLE_GROUP)." AS g
LEFT JOIN ".Database::get_course_table(TABLE_GROUP_USER)." gu
INNER JOIN ".Database::get_course_table(TABLE_GROUP_USER)." gu
ON (g.id = gu.group_id AND g.c_id = $course_id AND gu.c_id = $course_id)
$session_condition
GROUP BY g.id
$session_condition
ORDER BY g.name";
$result = Database::query($sql);
while ($group_data = Database::fetch_array($result)) {
$group_data['userNb'] = GroupManager::number_of_students($group_data['id'], $course_id);
$group_list[$group_data['id']] = $group_data;
}
return $group_list;
@ -3690,13 +3691,16 @@ class CourseManager {
$course_info = api_get_course_info($my_course['course_code']);
$my_course['extra_info'] = $course_info;
$my_course['extra_info']['go_to_course_button'] = '';
$my_course['extra_info']['register_button'] = '';
$access_link = self::get_access_link_by_user(api_get_user_id(), $course_info, $my_course_code_list);
//Course visibility
if (0 === strcmp($access_link,'register')) {
if ($access_link && in_array('register', $access_link)) {
$stok = Security::get_token();
$my_course['extra_info']['go_to_course_button'] = Display::url(get_lang('Subscribe'), api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?action=subscribe&amp;sec_token='.$stok, array('class' => 'btn btn-primary'));
} elseif (0 === strcmp($access_link,'enter')) {
$my_course['extra_info']['register_button'] = Display::url(get_lang('Subscribe'), api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?action=subscribe&amp;sec_token='.$stok, array('class' => 'btn btn-primary'));
}
if ($access_link && in_array('enter', $access_link)) {
$my_course['extra_info']['go_to_course_button'] = Display::url(get_lang('GoToCourse'), api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php', array('class' => 'btn btn-primary'));
}
@ -3779,31 +3783,41 @@ class CourseManager {
if (empty($uid) or empty($course)) { return false; }
if (empty($user_courses)) {
// get the array of courses to which the user is subscribed
$user_courses = CourseManager::get_courses_list_by_user_id($uid);
$user_courses = CourseManager::get_courses_list_by_user_id($uid);
foreach ($user_courses as $k => $v) {
$user_courses[$k] = $v['real_id'];
}
}
if (!isset($course['real_id']) && empty($course['real_id'])) {
$course = api_get_course_info($course['code']);
}
$is_admin = api_is_platform_admin_by_id($uid);
$options = array();
// Register button
if (!api_is_anonymous($uid) && !$is_admin
&& ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
&& $course['subscribe_allowed'] == SUBSCRIBE_ALLOWED
&& (!in_array($course['real_id'], $user_courses) || empty($user_courses))
if (!api_is_anonymous($uid) &&
!$is_admin &&
(
($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM) ||
$course['visibility'] == COURSE_VISIBILITY_REGISTERED && $course['subscribe'] == SUBSCRIBE_ALLOWED
) &&
$course['subscribe'] == SUBSCRIBE_ALLOWED &&
(!in_array($course['real_id'], $user_courses) || empty($user_courses))
) {
return 'register';
$options[]= 'register';
}
// Go To Course button (only if admin, if course public or if student already subscribed)
if ($is_admin
|| $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
|| (api_user_is_login($uid) && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
|| (in_array($course['real_id'], $user_courses) && $course['visibility'] != COURSE_VISIBILITY_CLOSED)
) {
return 'enter';
$options[]= 'enter';
}
// Print register button (if any)
return false;
return $options;
}
// TODO: Such a function might be useful in other places too. It might be moved in the CourseManager class.

@ -906,7 +906,7 @@ class CourseHome {
return $lp_id;
}
function get_navigation_items($include_admin_tools = false) {
static function get_navigation_items($include_admin_tools = false) {
$navigation_items = array();
$course_id = api_get_course_int_id();
@ -957,7 +957,8 @@ class CourseHome {
//link doesn't contain a parameter yet, add course id parameter with ?
$parameter_separator = '?';
}
$navigation_items[$key]['link'] .= $parameter_separator.api_get_cidreq();
//$navigation_items[$key]['link'] .= $parameter_separator.api_get_cidreq();
$navigation_items[$key]['link'] .= $parameter_separator.'cidReq='.api_get_course_id().'&gidReq=0&id_session='.api_get_session_id();
}
return $navigation_items;
@ -966,7 +967,7 @@ class CourseHome {
/**
* Show a navigation menu
*/
function show_navigation_menu() {
static function show_navigation_menu() {
$navigation_items = self::get_navigation_items(true);
$course_id = api_get_course_id();

@ -1354,4 +1354,4 @@ class Database {
public static function get_last_insert_id() {
return mysql_insert_id();
}
}
}

@ -35,7 +35,9 @@ class Display {
self::$global_template->set_help($help);
if (!empty(self::$preview_style)) {
self::$global_template->preview_theme = self::$preview_style;
self::$global_template->set_theme();
self::$global_template->set_css_files();
self::$global_template->set_js_files();
}
if (!empty($page_header)) {
self::$global_template->assign('header', $page_header);
@ -847,6 +849,11 @@ class Display {
$obj->datatype = 'json';
//Default row quantity
if (!isset($extra_params['rowList'])) {
$extra_params['rowList'] = array(50, 100, 200);
}
$json = '';
if (!empty($extra_params['datatype'])) {
$obj->datatype = $extra_params['datatype'];

@ -220,8 +220,8 @@ class DocumentManager {
'wmlc' => 'application/vnd.wap.wmlc',
'wmls' => 'text/vnd.wap.wmlscript',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'wma' => 'video/x-ms-wma',
'wmv' => 'audio/x-ms-wmv',
'wma' => 'audio/x-ms-wma',
'wmv' => 'video/x-ms-wmv',
'wrl' => 'model/vrml',
'xbm' => 'image/x-xbitmap',
'xht' => 'application/xhtml+xml',
@ -492,27 +492,26 @@ class DocumentManager {
}
//condition for search (get ALL folders and documents)
if ($search) {
$sql = "SELECT docs.id, docs.filetype, docs.path, docs.title, docs.comment, docs.size, docs.readonly, docs.session_id, last.id_session item_property_session_id, last.lastedit_date, last.visibility, last.insert_user_id
FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs
WHERE docs.id = last.ref
AND last.tool = '".TOOL_DOCUMENT."'
AND ".$to_field." = ".$to_value."
AND last.visibility".$visibility_bit . $condition_session." AND
docs.c_id = {$_course['real_id']} AND
last.c_id = {$_course['real_id']} ";
} else {
$sql = "SELECT docs.id, docs.filetype, docs.path, docs.title, docs.comment, docs.size, docs.readonly, docs.session_id, last.id_session item_property_session_id, last.lastedit_date, last.visibility, last.insert_user_id
FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs
WHERE docs.id = last.ref
AND docs.path LIKE '".$path.$added_slash."%'
AND docs.path NOT LIKE '".$path.$added_slash."%/%'
AND last.tool = '".TOOL_DOCUMENT."'
AND ".$to_field." = ".$to_value."
AND last.visibility".$visibility_bit.$condition_session." AND
docs.c_id = {$_course['real_id']} AND
last.c_id = {$_course['real_id']} ";
}
$sql = "SELECT docs.id,
docs.filetype,
docs.path,
docs.title,
docs.comment,
docs.size,
docs.readonly,
docs.session_id,
last.id_session item_property_session_id,
last.lastedit_date,
last.visibility,
last.insert_user_id
FROM ".$TABLE_ITEMPROPERTY." AS last INNER JOIN ".$TABLE_DOCUMENT." AS docs
ON (docs.id = last.ref AND docs.c_id = {$_course['real_id']} AND last.c_id = {$_course['real_id']})
WHERE
docs.path LIKE '".$path.$added_slash."%' AND
docs.path NOT LIKE '".$path.$added_slash."%/%' AND
last.tool = '".TOOL_DOCUMENT."' AND
".$to_field." = ".$to_value." AND
last.visibility".$visibility_bit.$condition_session;
$result = Database::query($sql);
@ -546,7 +545,7 @@ class DocumentManager {
//Templates management
$table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES);
$sql_is_template = "SELECT id FROM $table_template
WHERE course_code='".$_course['id']."'
WHERE course_code = '".$_course['code']."'
AND user_id='".api_get_user_id()."'
AND ref_doc='".$row['id']."'";
$template_result = Database::query($sql_is_template);
@ -985,8 +984,8 @@ class DocumentManager {
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$row2 = Database::fetch_array($res);
require_once api_get_path(LIBRARY_PATH) .'search/DokeosIndexer.class.php';
$di = new DokeosIndexer();
require_once api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php';
$di = new ChamiloIndexer();
$di->remove_document((int)$row2['search_did']);
}
$sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1';
@ -1178,10 +1177,26 @@ class DocumentManager {
$condition = "AND id_session IN ('$session_id', '0') ";
// The " d.filetype='file' " let the user see a file even if the folder is hidden see #2198
//When using hotpotatoes files, new files are generated in the hotpotatoe folder, if user_id=1 does the exam a new html file will be generated: hotpotatoe.html.(user_id).t.html
//so we remove that string in order to find correctly the origin file
if (strpos($doc_path, 'HotPotatoes_files')) {
// $doc_path = substr($doc_path, 0, strlen($doc_path) - 8); // issue #5359
/*
When using hotpotatoes files, a new html files are generated in the hotpotatoes folder
to display the test.
The genuine html file is copied to math4.htm(user_id).t.html
Images files are not copied, and keep same name.
To check the html file visibility, we don't have to check file math4.htm(user_id).t.html but file math4.htm
In this case, we have to remove (user_id).t.html to check the visibility of the file
For images, we just check the path of the image file.
Exemple of hotpotatoes folder :
A.jpg
maths4-consigne.jpg
maths4.htm
maths4.htm1.t.html
maths4.htm52.t.html
maths4.htm654.t.html
omega.jpg
theta.jpg
*/
if (strpos($doc_path, 'HotPotatoes_files') && preg_match("/\.t\.html$/", $doc_path)) {
$doc_path = substr($doc_path, 0, strlen($doc_path) - 7 - strlen(api_get_user_id()));
}
@ -1415,13 +1430,15 @@ class DocumentManager {
$date_long_certificate = '';
if (!empty($date_certificate)) {
$date_long_certificate = api_convert_and_format_date($date_certificate);
$date_no_time = api_convert_and_format_date($date_certificate, DATE_FORMAT_LONG_NO_DAY);
}
if ($is_preview) {
$date_long_certificate = api_convert_and_format_date(api_get_utc_datetime());
$date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
}
$url = api_get_path(WEB_PATH).'certificates/?id='.$info_grade_certificate['id'];
$url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id'];
//replace content
$info_to_replace_in_content_html = array($first_name,
$last_name,
@ -1431,6 +1448,7 @@ class DocumentManager {
$teacher_last_name,
$official_code,
$date_long_certificate,
$date_no_time,
$course_id,
$course_info['name'],
$info_grade_certificate['grade'],
@ -1446,6 +1464,7 @@ class DocumentManager {
'((teacher_lastname))',
'((official_code))',
'((date_certificate))',
'((date_certificate_no_time))',
'((course_code))',
'((course_title))',
'((gradebook_grade))',
@ -2178,7 +2197,7 @@ class DocumentManager {
return $return;
}
public function export_to_pdf($document_id, $course_code) {
public static function export_to_pdf($document_id, $course_code) {
require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
$course_data = api_get_course_info($course_code);
$document_data = self::get_document_data_by_id($document_id, $course_code);
@ -2271,7 +2290,7 @@ class DocumentManager {
// TODO: review w$ compatibility
// Use usual exec output lines array to store stdout instead of a temp file
// because we need to store it at RAM anyway before index on DokeosIndexer object
// because we need to store it at RAM anyway before index on ChamiloIndexer object
$ret_val = null;
switch ($doc_mime) {
case 'text/plain':
@ -3000,7 +3019,7 @@ class DocumentManager {
$file_content = self::get_text_content($doc_path, $doc_mime);
$course_code = Database::escape_string($course_code);
require_once api_get_path(LIBRARY_PATH).'search/DokeosIndexer.class.php';
require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
$ic_slide = new IndexableChunk();
@ -3015,7 +3034,7 @@ class DocumentManager {
);
$ic_slide->xapian_data = serialize($xapian_data);
$di = new DokeosIndexer();
$di = new ChamiloIndexer();
$return = $di->connectDb(null, null, $lang);
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';

@ -0,0 +1,23 @@
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: de.js
* Abbr German language file.
*
* File Author:
* Christian Zwahlen
*/
FCKLang.Abbr = 'Abkürzung' ;
FCKLang.AbbrBtn = 'Abkürzung einfügen' ;
FCKLang.AbbrDlgTitle = 'Abkürzungs-Tag einfügen' ;
FCKLang.AbbrDlgName = 'Popup-Text bitte hier eingeben:' ;
FCKLang.AbbrDlgTxt = '...Text wird bei &Uuml;berfahren mit der Maus sichtbar [<abbr title="Beispiel-Pop-Up">Beispiel...</abbr>]';
FCKLang.AbbrDlgRemove = 'Entfernen Abkürzung-Tag (Inhalt Überreste)';
FCKLang.AbbrDlgSelectFirst = 'Sie müssen zuerst den Text auswählen!';

@ -1,122 +1,122 @@
// I18N constants
// LANG: "de", ENCODING: UTF-8
// Author: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de
// Updated for FCKeditor by: Paul Moers, http://www.saulmade.nl/FCKeditor/FCKPlugins.php
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
if (!this.ImageManager)
{
ImageManager = new Object();
};
ImageManager.I18N = {
"Demo" : "Demo",
"Replace" : "Ersetzen ",
"Watermark" : "Wasserzeichen",
"Image Manager" : "Bildmanager",
"Insert Image" : "Bild einfügen",
"Directory" : "Ordner",
"Directory Up" : "übergeordneter Ordner",
"New Folder" : "Neuer Ordner",
"Trash" : "Müll",
"Edit" : "bearbeiten",
"Image File" : "Bilddatei",
"Upload" : "Hochladen",
"Width" : "Breite",
"Height" : "Höhe",
"Width:" : "Breite:",
"Height:" : "Höhe:",
"Constrain Proportions" : "Proportional",
"Border" : "Rand",
"V Space" : "vertikaler Freiraum",
"H Space" : "horizontaler Freiraum",
"Refresh" : "Aktualisieren",
"Uploading..." : "Hochladen...",
"Crop" : "Beschneiden",
"Resize" : "Größe ändern",
"Rotate" : "Drehen",
"Measure" : "Abmessungen",
"Marker" : "Marker",
"Save" : "Speichern",
"Filename:" : "Dateiname:",
"Image Format" : "Bildformat",
"Quality:" : "Qualität:",
"JPEG High" : "JPEG hoch",
"JPEG Medium" : "JPEG mittel",
"JPEG Low" : "JPEG niedrig",
"File saved." : "Datei gespeichert.",
"File was not saved." : "Datei wurde nicht gespeichert.",
"Start X:" : "Start X:",
"Start Y:" : "Start Y:",
"Lock" : "Sperren",
"Flip Image" : "Bild spiegeln",
"Flip Horizontal" : "horizontal spiegeln",
"Flip Vertical" : "vertikal spiegeln",
"Rotate Image" : "Bild drehen",
"Rotate 180 °" : "180° drehen",
"Rotate 90 ° CW" : "90° drehen im UZS",
"Rotate 90 ° CCW" : "90° drehen gegen UZS",
"Angle:" : "Winkel:",
"W:" : "B:",
"H:" : "H:",
"A:" : "W:",
"D:" : "D:",
"Clear" : "Entfernen",
"Loading" : "Laden",
"Invalid base directory:" : "Ungültiges Startverzeichnis:",
"Delete file?" : "Datei löschen?",
"Delete folder?" : "Ordner löschen?",
"Folder Name:" : "Ordnername:",
"No Images Found" : "Kein Bild gefunden",
"No Image Available" : "Kein Bild verfügbar",
"No Image selected." : "Kein Bild ausgewählt.",
"Color:" : "Farbe:",
"Align:" : "Ausrichtung:",
"Description:" : "Beschreibung:",
"Margin:" : "Außenabstand:",
"Padding:" : "Innenabstand:",
"Border:" : "Rand:",
"Upload:" : "Hochladen:",
"File name was changed into " : "File name was changed into ", // not translated yet
"start x coordinate" : "start x coordinate", // not translated yet
"start y coordinate" : "start y coordinate", // not translated yet
"height" : "höhe",
"width" : "breite ",
"angle" : "winkel ",
"opacity" : "opazität",
"diagonal length" : "diagonal length", // not translated yet
"Watermarking is disabled." : "Watermarking is disabled.", // not translated yet
"No watermarks were found or all watermarks are to big for the target image." : "No watermarks were found or all watermarks are to big for the target image.", // not translated yet
"Please delete all files/folders inside the folder you wish to delete first." : "Bitte löschen Sie zuerst alle Dateien im Ordner den Sie löschen möchten.",
"Invalid folder name, please choose another folder name." : "Ungültiger Ordnername, bitte wählen sie einen anderen Namen.",
"GIF format is not supported, image editing not supported." : "GIF Format wird nicht unterstützt, Bildbearbeitung wird nicht unterstützt.",
"Please do not close the window while uploading a new image! If you do, the original image gets deleted!" : "Please do not close the window while uploading a new image! If you do, the original image gets deleted!", // not translated yet
"Error: Couldn't update editor window.\nAny image that was edited and saved will still be visible as the old version!\nPlease save and reload the editor content." : "Error: Couldn't update editor window.\nAny image that was edited and saved will still be visible as the old version!\nPlease save and reload the editor content.", // not translated yet
"Edit image" : "Edit image",
"Alt" : "Alt",
"Align" : "Align",
"Not Set" : "Not Set",
"Left" : "Left",
"Right" : "Right",
"Texttop" : "Text Top",
"Absmiddle" : "Abs Middle",
"Baseline" : "Baseline",
"Absbottom" : "Abs Bottom",
"Bottom" : "Bottom",
"Middle" : "Middle",
"Top" : "Top",
"OK" : "OK",
"Cancel" : "Cancel"
};
// I18N constants
// LANG: "de", ENCODING: UTF-8
// Author: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de
// Updated for FCKeditor by: Paul Moers, http://www.saulmade.nl/FCKeditor/FCKPlugins.php
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
if (!this.ImageManager)
{
ImageManager = new Object();
};
ImageManager.I18N = {
"Demo" : "Demo",
"Replace" : "Ersetzen ",
"Watermark" : "Wasserzeichen",
"Image Manager" : "Bildmanager",
"Insert Image" : "Bild einfügen",
"Directory" : "Ordner",
"Directory Up" : "übergeordneter Ordner",
"New Folder" : "Neuer Ordner",
"Trash" : "Müll",
"Edit" : "bearbeiten",
"Image File" : "Bilddatei",
"Upload" : "Hochladen",
"Width" : "Breite",
"Height" : "Höhe",
"Width:" : "Breite:",
"Height:" : "Höhe:",
"Constrain Proportions" : "Proportional",
"Border" : "Rand",
"V Space" : "vertikaler Freiraum",
"H Space" : "horizontaler Freiraum",
"Refresh" : "Aktualisieren",
"Uploading..." : "Hochladen...",
"Crop" : "Beschneiden",
"Resize" : "Größe ändern",
"Rotate" : "Drehen",
"Measure" : "Abmessungen",
"Marker" : "Marker",
"Save" : "Speichern",
"Filename:" : "Dateiname:",
"Image Format" : "Bildformat",
"Quality:" : "Qualität:",
"JPEG High" : "JPEG hoch",
"JPEG Medium" : "JPEG mittel",
"JPEG Low" : "JPEG niedrig",
"File saved." : "Datei gespeichert.",
"File was not saved." : "Datei wurde nicht gespeichert.",
"Start X:" : "Start X:",
"Start Y:" : "Start Y:",
"Lock" : "Sperren",
"Flip Image" : "Bild spiegeln",
"Flip Horizontal" : "horizontal spiegeln",
"Flip Vertical" : "vertikal spiegeln",
"Rotate Image" : "Bild drehen",
"Rotate 180 °" : "180° drehen",
"Rotate 90 ° CW" : "90° drehen im UZS",
"Rotate 90 ° CCW" : "90° drehen gegen UZS",
"Angle:" : "Winkel:",
"W:" : "B:",
"H:" : "H:",
"A:" : "W:",
"D:" : "D:",
"Clear" : "Entfernen",
"Loading" : "Laden",
"Invalid base directory:" : "Ungültiges Startverzeichnis:",
"Delete file?" : "Datei löschen?",
"Delete folder?" : "Ordner löschen?",
"Folder Name:" : "Ordnername:",
"No Images Found" : "Kein Bild gefunden",
"No Image Available" : "Kein Bild verfügbar",
"No Image selected." : "Kein Bild ausgewählt.",
"Color:" : "Farbe:",
"Align:" : "Ausrichtung:",
"Description:" : "Beschreibung:",
"Margin:" : "Außenabstand:",
"Padding:" : "Innenabstand:",
"Border:" : "Rand:",
"Upload:" : "Hochladen:",
"File name was changed into " : "Dateiname wurde geändert zu ",
"start x coordinate" : "X Koordinate Anfang",
"start y coordinate" : "Y Koordinate Anfang",
"height" : "Höhe",
"width" : "Breite ",
"angle" : "Winkel ",
"opacity" : "Opazität",
"diagonal length" : "Diagonale",
"Watermarking is disabled." : "Wasserzeichen wurde deaktiviert.",
"No watermarks were found or all watermarks are to big for the target image." : "Keine Wasserzeichen gefunden oder diese sind zu groß für das Ziel-Bild.",
"Please delete all files/folders inside the folder you wish to delete first." : "Bitte löschen Sie zuerst alle Dateien im Ordner den Sie löschen möchten.",
"Invalid folder name, please choose another folder name." : "Ungültiger Ordnername, bitte wählen sie einen anderen Namen.",
"GIF format is not supported, image editing not supported." : "GIF Format wird zur Bildbearbeitung nicht unterstützt.",
"Please do not close the window while uploading a new image! If you do, the original image gets deleted!" : "Bitte das Fenster während dem Hochladen beim Überschreiben nicht schliessen! Ansonsten wird das Originalbild gelöscht!",
"Error: Couldn't update editor window.\nAny image that was edited and saved will still be visible as the old version!\nPlease save and reload the editor content." : "Fehler: Editor kann nicht aktualisiert werde.\nAlle Bilder, die bearbeitet und gespeichert wurden, werden daher nicht korrekt angezeigt!\nBitte nochmals speichern, und den Editor neu laden.",
"Edit image" : "Bild bearbeiten",
"Alt" : "alternativer Text",
"Align" : "Ausrichtung",
"Not Set" : "nicht gesetzt",
"Left" : "links",
"Right" : "rechts",
"Texttop" : "am oberen Schriftrand ausrichten",
"Absmiddle" : "in jedem Fall mittig ausrichten",
"Baseline" : "am unteren Schriftrand ausrichten",
"Absbottom" : "in jedem Fall untenbündig ausrichten",
"Bottom" : "unten",
"Middle" : "mitte",
"Top" : "oben",
"OK" : "OK",
"Cancel" : "Abbruch"
};

@ -1,7 +1,7 @@
// German language file.
// MP3 Dialog.
// Please, use UTF-8 encoding.
FCKLang["DlgMP3Title"] = "Import MP3" ;
FCKLang["DlgMP3Upload"] = "From my Computer" ;
FCKLang["DlgMP3Tab"] = "From course" ;
// German language file.
// MP3 Dialog.
// Please, use UTF-8 encoding.
FCKLang["DlgMP3Title"] = "MP3 importieren" ;
FCKLang["DlgMP3Upload"] = "von meinem Computer" ;
FCKLang["DlgMP3Tab"] = "aus dem Kurs" ;

@ -1,8 +1,8 @@
// Audio Dialog.
// German language file.
// Please, use UTF-8 encoding.
FCKLang['DlgAudioTitle'] = 'Insert audio / Audio properties' ;
FCKLang['DlgAudioPlayback'] = 'Playback' ;
FCKLang['DlgAudioAutoplay'] = 'Autoplay' ;

// Audio Dialog.
// German language file.
// Please, use UTF-8 encoding.
FCKLang['DlgAudioTitle'] = 'Audio einfügen/ Audio Eigenschaften' ;
FCKLang['DlgAudioPlayback'] = 'Playback' ;
FCKLang['DlgAudioAutoplay'] = 'Autoplay' ;


@ -1,39 +1,39 @@
/*
* Please, use UTF-8 encoding.
*
* German language file.
*/
FCKLang['Dir'] = 'ltr' ;
FCKLang['BrowseServer'] = 'Server durchsuchen' ;
FCKLang['Folder'] = 'Verzeichnis' ;
FCKLang['CreateNewFolder'] = 'Verzeichnis erstellen' ;
FCKLang['UploadFile'] = 'Datei hochladen' ;
FCKLang['Upload'] = 'Datei' ;
FCKLang['UploadSelectFileFirst'] = 'Please, select a file before pressing the upload button.' ;
FCKLang['ResourceTypeRoot'] = 'Wurzelverzeichnis' ;
FCKLang['ResourceTypeAudio'] = 'Audio' ;
FCKLang['ResourceTypeFlash'] = 'Flash' ;
FCKLang['ResourceTypeImages'] = 'Bilder' ;
FCKLang['ResourceTypeVideo'] = 'Video' ;
FCKLang['FileSuccessfullyUploaded'] = 'Your file has been successfully uploaded.' ;
FCKLang['FileRenamed'] = 'A file with the same name is already available. The uploaded file has been renamed to ' ;
FCKLang['InvalidFileType'] = 'Invalid file type.' ;
FCKLang['SecurityError'] = 'Security error. You probably don\'t have enough permissions to upload. Please check your server.' ;
FCKLang['ConnectorDisabled'] = 'The upload feature (connector) is disabled.' ;
FCKLang['UploadError'] = 'Error on file upload. Error number: ' ;
FCKLang['UploadInProgress'] = '(Upload in progress, please wait...)' ;
FCKLang['NewFolderName'] = 'Type the name of the new folder:' ;
FCKLang['NewFolderNameRequest'] = 'Please, type the folder name.' ;
FCKLang['FolderAlreadyExists'] = 'Folder already exists.' ;
FCKLang['InvalidFolderName'] = 'Invalid folder name.' ;
FCKLang['NoPermissionsToCreateFolder'] = 'You have no permissions to create the folder.' ;
FCKLang['UnknownErrorCreatingFolder'] = 'Unknown error creating folder.' ;
FCKLang['ErrorCreatingFolder'] = 'Error creating folder. Error number: ' ;
FCKLang['ServerDidNotReturnProperXmlData'] = 'The server didn\'t reply with a proper XML data. Please check your configuration.' ;
/*
* Please, use UTF-8 encoding.
*
* German language file.
*/
FCKLang['Dir'] = 'ltr' ;
FCKLang['BrowseServer'] = 'Server durchsuchen' ;
FCKLang['Folder'] = 'Verzeichnis' ;
FCKLang['CreateNewFolder'] = 'Verzeichnis erstellen' ;
FCKLang['UploadFile'] = 'Datei hochladen' ;
FCKLang['Upload'] = 'Datei' ;
FCKLang['UploadSelectFileFirst'] = 'Vor dem Drücken des Upload-Buttons bitte eine Datei auswählen.' ;
FCKLang['ResourceTypeRoot'] = 'Wurzelverzeichnis' ;
FCKLang['ResourceTypeAudio'] = 'Audio' ;
FCKLang['ResourceTypeFlash'] = 'Flash' ;
FCKLang['ResourceTypeImages'] = 'Bilder' ;
FCKLang['ResourceTypeVideo'] = 'Video' ;
FCKLang['FileSuccessfullyUploaded'] = 'Deine Datei wurde erfolgreich hochgeladen.' ;
FCKLang['FileRenamed'] = 'Eine Datei mit gleichem Namen existiert bereits. Die hochgeladene Datei wurde daher umbenannt zu ' ;
FCKLang['InvalidFileType'] = 'Ungültiger Dateityp.' ;
FCKLang['SecurityError'] = 'Sicherheits-Warnung. Du hast wahrscheinlich keine Upload-Berechtigung. Bitte Verzeichnisrechte/User überprüfen.' ;
FCKLang['ConnectorDisabled'] = 'Der Upload (connector) ist deaktiviert.' ;
FCKLang['UploadError'] = 'Fehler beim Hochladen. Fehler-Nummer: ' ;
FCKLang['UploadInProgress'] = '(Upload, bitte warten...)' ;
FCKLang['NewFolderName'] = 'Bitte neuen Verzeichnis-Namen angeben:' ;
FCKLang['NewFolderNameRequest'] = 'Bitte Ordner benennen.' ;
FCKLang['FolderAlreadyExists'] = 'Verzeichnis existiert bereits.' ;
FCKLang['InvalidFolderName'] = 'Ungültiger Ordner-Name.' ;
FCKLang['NoPermissionsToCreateFolder'] = 'Berechtigung zur Ordnererstellung fehlt.' ;
FCKLang['UnknownErrorCreatingFolder'] = 'Unbekannter Fehler beim Erstellen des Ordners.' ;
FCKLang['ErrorCreatingFolder'] = 'Fehler beim Erstellen des Ordners. Fehler-Nummer: ' ;
FCKLang['ServerDidNotReturnProperXmlData'] = 'Der Server antwortete nicht mit korrekten XML-Daten. Bitte Konfiguration prüfen.' ;

@ -1,14 +1,14 @@
// German language file.
// Video Dialog.
// Please, use UTF-8 encoding.
FCKLang["DlgEmbedMoviesTitle"] = "Insert video / Video properties" ;
FCKLang["DlgEmbedMoviesAutosize"] = "Auto size" ;
FCKLang["DlgEmbedMoviesGotoBar"] = "Show gotobar" ;
FCKLang["DlgEmbedMoviesStatusbar"] = "Show statusbar" ;
FCKLang["DlgEmbedMoviesControls"] = "Show controls" ;
FCKLang["DlgEmbedMoviesPositionControls"] = "Position controls" ;
FCKLang["DlgEmbedMoviesTracker"] = "Tracker" ;
FCKLang["DlgEmbedMoviesAudioControls"] = "Audio controls" ;
FCKLang["DlgEmbedMoviesExtensionSupported"] = "Only a mpg, mpeg, mp4, avi, wmv, mov or asf file extension is allowed." ;
// German language file.
// Video Dialog.
// Please, use UTF-8 encoding.
FCKLang["DlgEmbedMoviesTitle"] = "Video einfügen / Video Eigenschaften" ;
FCKLang["DlgEmbedMoviesAutosize"] = "automatische Skalierung" ;
FCKLang["DlgEmbedMoviesGotoBar"] = "Zeige gotobar" ;
FCKLang["DlgEmbedMoviesStatusbar"] = "Zeige Statusbar" ;
FCKLang["DlgEmbedMoviesControls"] = "Zeige Kontrollelemente" ;
FCKLang["DlgEmbedMoviesPositionControls"] = "Positioniere Kontrollelemente" ;
FCKLang["DlgEmbedMoviesTracker"] = "Tracker" ;
FCKLang["DlgEmbedMoviesAudioControls"] = "Audio Kontrollelemente" ;
FCKLang["DlgEmbedMoviesExtensionSupported"] = "Nur mpg, mpeg, mp4, avi, wmv, mov oder asf Dateien sind erlaubt." ;

@ -1,47 +1,47 @@
// German language file.
// Video (flv) Dialog.
// Please, use UTF-8 encoding.
FCKLang["DlgFLVPlayerTitle"] = "FLV Media Player" ;
FCKLang["DlgFLVPlayerURL"] = "Movie/Media File" ;
FCKLang["DlgFLVPlayerBtnBrowse"] = "Browse..." ;
FCKLang["DlgFLVPlayerImgURL"] = "Preview Image" ;
FCKLang["DlgFLVPlayerWidth"] = "Player Width (px)" ;
FCKLang["DlgFLVPlayerHeight"] = "Player Height (px)" ;
FCKLang["DlgFLVPlayerAlign"] = "Player Alignment" ;
FCKLang["DlgFLVPlayerAlignLeft"] = "Left" ;
FCKLang["DlgFLVPlayerAlignRight"] = "Right" ;
FCKLang["DlgFLVPlayerAlignCenter"] = "Center" ;
FCKLang["DlgFLVPlayerHSpace"] = "HSpace" ;
FCKLang["DlgFLVPlayerVSpace"] = "VSpace" ;
FCKLang["DlgFLVPlayerBgColor"] = "Background Color" ;
FCKLang["DlgFLVPlayerTBColor"] = "Toolbar Color" ;
FCKLang["DlgFLVPlayerTBTColor"] = "Text Color" ;
FCKLang["DlgFLVPlayerTBTRColor"] = "Rollover Text Color" ;
FCKLang["DlgFLVPlayerBtnSelect"] = "Select..." ;
FCKLang["DlgFLVPlayerAutoplay"] = "Autoplay" ;
FCKLang["DlgFLVPlayerLoop"] = "Loop" ;
FCKLang["DlgFLVPlayerDownload"] = "Downloadable" ;
FCKLang["DlgFLVPlayerFullscreen"] = "Allow Fullscreen" ;
FCKLang["DlgFLVPlayerAlertUrl"] = "Please input the URL" ;
FCKLang["DlgFLVPlayerAlertPlaylist"] = "Please input the Playlist URL" ;
FCKLang["DlgFLVPlayerAlertWidth"] = "Please input the Width" ;
FCKLang["DlgFLVPlayerAlertHeight"] = "Please input the Height" ;
FCKLang["DlgFLVPlayerPlayerAttrs"] = "Player Attributes" ;
FCKLang["DlgFLVPlayerMovieAttrs"] = "Media Attributes" ;
FCKLang["DlgFLVPlayerShowNavigation"] = "Display Navigation" ;
FCKLang["DlgFLVPlayerShowDigits"] = "Display Time" ;
FCKLang["DlgFLVPlayerWatermarkURL"] = "Watermark Image" ;
FCKLang["DlgFLVPlayerFileType"] = "File Type" ;
FCKLang["DlgFLVPlayerSingleFile"] = "Single Media File" ;
FCKLang["DlgFLVPlayerPlaylistFile"] = "Media Playlist" ;
FCKLang["DlgFLVPlayerPlaylistURL"] = "Playlist URL" ;
FCKLang["DlgFLVPlayerDispPlaylist"] = "Display Playlist" ;
FCKLang["DlgFLVPlayerDispPLNone"] = "Do Not Display" ;
FCKLang["DlgFLVPlayerDispPLRight"] = "Display On Right" ;
FCKLang["DlgFLVPlayerDispPLBelow"] = "Display Below" ;
FCKLang["DlgFLVPlayerRecommendURL"] = "Recommendations List" ;
FCKLang["DlgFLVPlaylistWidth"] = "Playlist Width (px)" ;
FCKLang["DlgFLVPlaylistHeight"] = "Playlist Height (px)" ;
FCKLang["DlgFLVPlaylistDimText"] = "Playlist Dimension" ;
FCKLang["DlgFLVPlayerPLThumbs"] = "Display Thumbnails in Playlist" ;
// German language file.
// Video (flv) Dialog.
// Please, use UTF-8 encoding.
FCKLang["DlgFLVPlayerTitle"] = "FLV Media Player" ;
FCKLang["DlgFLVPlayerURL"] = "Movie/Medien Datei" ;
FCKLang["DlgFLVPlayerBtnBrowse"] = "Suche..." ;
FCKLang["DlgFLVPlayerImgURL"] = "Vorschau Bild" ;
FCKLang["DlgFLVPlayerWidth"] = "Player Breite (px)" ;
FCKLang["DlgFLVPlayerHeight"] = "Player Höhe (px)" ;
FCKLang["DlgFLVPlayerAlign"] = "Player Ausrichtung" ;
FCKLang["DlgFLVPlayerAlignLeft"] = "Links" ;
FCKLang["DlgFLVPlayerAlignRight"] = "Rechts" ;
FCKLang["DlgFLVPlayerAlignCenter"] = "Mitte" ;
FCKLang["DlgFLVPlayerHSpace"] = "horizontaler Abstand" ;
FCKLang["DlgFLVPlayerVSpace"] = "vertikaler Abstand" ;
FCKLang["DlgFLVPlayerBgColor"] = "Hintergrundfarbe" ;
FCKLang["DlgFLVPlayerTBColor"] = "Toolbar Farbe" ;
FCKLang["DlgFLVPlayerTBTColor"] = "Text Farbe" ;
FCKLang["DlgFLVPlayerTBTRColor"] = "Rollover Text Farbe" ;
FCKLang["DlgFLVPlayerBtnSelect"] = "Wähle..." ;
FCKLang["DlgFLVPlayerAutoplay"] = "Autoplay" ;
FCKLang["DlgFLVPlayerLoop"] = "Schleife" ;
FCKLang["DlgFLVPlayerDownload"] = "kann heruntergeladen werden" ;
FCKLang["DlgFLVPlayerFullscreen"] = "Vollbild erlaubt" ;
FCKLang["DlgFLVPlayerAlertUrl"] = "Bitte URL angeben" ;
FCKLang["DlgFLVPlayerAlertPlaylist"] = "Bitte URL der Wiedergabeliste angeben" ;
FCKLang["DlgFLVPlayerAlertWidth"] = "Bitte Breite angeben" ;
FCKLang["DlgFLVPlayerAlertHeight"] = "Bitte Höhe angeben" ;
FCKLang["DlgFLVPlayerPlayerAttrs"] = "Player Eigenschaften" ;
FCKLang["DlgFLVPlayerMovieAttrs"] = "Medien-Eigenschaften" ;
FCKLang["DlgFLVPlayerShowNavigation"] = "Navigation anzeigen" ;
FCKLang["DlgFLVPlayerShowDigits"] = "Zeit anzeigen" ;
FCKLang["DlgFLVPlayerWatermarkURL"] = "Wasserzeichen" ;
FCKLang["DlgFLVPlayerFileType"] = "Dateityp" ;
FCKLang["DlgFLVPlayerSingleFile"] = "einzelne Medien-Datei" ;
FCKLang["DlgFLVPlayerPlaylistFile"] = "Medien-Wiedergabeliste" ;
FCKLang["DlgFLVPlayerPlaylistURL"] = "Wiedergabeliste URL" ;
FCKLang["DlgFLVPlayerDispPlaylist"] = "Zeige Wiedergabeliste" ;
FCKLang["DlgFLVPlayerDispPLNone"] = "nicht anzeigen" ;
FCKLang["DlgFLVPlayerDispPLRight"] = "rechts anzeigen" ;
FCKLang["DlgFLVPlayerDispPLBelow"] = "darunter anzeigen" ;
FCKLang["DlgFLVPlayerRecommendURL"] = "Empfohlen-Liste" ;
FCKLang["DlgFLVPlaylistWidth"] = "Wiedergabeliste Breite (px)" ;
FCKLang["DlgFLVPlaylistHeight"] = "Wiedergabeliste Höhe (px)" ;
FCKLang["DlgFLVPlaylistDimText"] = "Dimension der Wiedergabeliste" ;
FCKLang["DlgFLVPlayerPLThumbs"] = "Zeige Thumbnails in Wiedergabeliste" ;

@ -1,45 +1,45 @@
/*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Google Maps for FCKeditor, German language file.
*/
FCKLang.DlgGMapsTitle = 'Google Maps Eigenschaften';
FCKLang.GMapsBtn = 'Google Maps';
FCKLang.GMapsBtnTooltip = 'Google Map einfügen/editieren';
FCKLang.GMapsMap = 'Karte';
FCKLang.GMapsZoomLevel = 'Zoom-Faktor';
FCKLang.txtLatitude = 'Breite';
FCKLang.txtLongitude = 'Länge';
FCKLang.GMapsMarker = 'Ortsmarke';
FCKLang.GMapsSearchLabel = 'Adresse suchen';
FCKLang.GMapsSearch = 'Suchen';
FCKLang.GMapsNotFound = '%s wurde nicht gefunden.';
FCKLang.GMapsMarkerText = 'Text';
FCKLang.GMapsMarkerDefaultText = 'Geben Sie einen Text ein';
FCKLang.GMapsLine = 'Linie';
FCKLang.GMapsLineInstructions = 'Klicken Sie auf die Karte um den ersten Punkt zu setzten. Jeder weitere Klick setzt einen neuen Punkte.<br>Gesetzte Punkte können Sie auch verschieben und wieder löschen.';
FCKLang.GMapsHelpFile = 'install.html';
FCKLang.GMapsUserHelpFile = 'users.html';
FCKLang.Help = 'Hilfe';
FCKLang.GMapsClickToAddMarker = 'Klicken Sie auf die Karte um eine Ortsmarke zu setzen.';
FCKLang.GMapsDeleteMarker = 'Ortsmarke löschen';
FCKLang.GMapsAddMarker = 'Neue Ortsmarke setzen';
FCKLang.GMaps_MissingKey = 'You must enter the Google Maps Key for your domain.' ;
/*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Google Maps for FCKeditor, German language file.
*/
FCKLang.DlgGMapsTitle = 'Google Maps Eigenschaften';
FCKLang.GMapsBtn = 'Google Maps';
FCKLang.GMapsBtnTooltip = 'Google Map einfügen/editieren';
FCKLang.GMapsMap = 'Karte';
FCKLang.GMapsZoomLevel = 'Zoom-Faktor';
FCKLang.txtLatitude = 'Breite';
FCKLang.txtLongitude = 'Länge';
FCKLang.GMapsMarker = 'Ortsmarke';
FCKLang.GMapsSearchLabel = 'Adresse suchen';
FCKLang.GMapsSearch = 'Suchen';
FCKLang.GMapsNotFound = '%s wurde nicht gefunden.';
FCKLang.GMapsMarkerText = 'Text';
FCKLang.GMapsMarkerDefaultText = 'Geben Sie einen Text ein';
FCKLang.GMapsLine = 'Linie';
FCKLang.GMapsLineInstructions = 'Klicken Sie auf die Karte um den ersten Punkt zu setzten. Jeder weitere Klick setzt einen neuen Punkte.<br>Gesetzte Punkte können Sie auch verschieben und wieder löschen.';
FCKLang.GMapsHelpFile = 'install.html';
FCKLang.GMapsUserHelpFile = 'users.html';
FCKLang.Help = 'Hilfe';
FCKLang.GMapsClickToAddMarker = 'Klicken Sie auf die Karte um eine Ortsmarke zu setzen.';
FCKLang.GMapsDeleteMarker = 'Ortsmarke löschen';
FCKLang.GMapsAddMarker = 'Neue Ortsmarke setzen';
FCKLang.GMaps_MissingKey = 'Bitte einen gültigen Google Maps Key für Deine Domain angeben.' ;

@ -0,0 +1,6 @@
FCKLang.inserHTML_buttonTooltip = 'HTML einfügen';
FCKLang.insertHtml_dialogTitle = 'HTML einfügen';
FCKLang.inserHtml_help = 'HTML Markup einfügen und auf \'ok\' klicken, um es an der Stelle des Cursors in den Editor einzufügen.';

@ -0,0 +1,20 @@
/*
* For FCKeditor 2.3
*
*
*/
FCKLang['MediaTip'] = 'Medien einfügen/bearbeiten' ;
FCKLang['DlgMediaTitle'] = 'Medien-Eigenschaft' ;
FCKLang['DlgMediaCode'] = '"Bitte die URL des Videos eigeben."' ;
FCKLang['DlgMediaSecurity'] = 'Ungültige URL.' ;
FCKLang['DlgMediaURL'] = 'URL' ;
FCKLang['DlgMediaWidth'] = 'Breite' ;
FCKLang['DlgMediaHeight'] = 'Höhe' ;
FCKLang['DlgMediaQuality'] = 'Qualität' ;
FCKLang['DlgMediaLow'] = 'niedrig' ;
FCKLang['DlgMediaHigh'] = 'hoch (wenn verfügbar)' ;
FCKLang['DlgMediaURLTip'] = 'Tip:' ;
FCKLang['DlgMediaURLTipContent1'] = 'Gehe zu %s. Navigiere innerhalb des Verzeichnises, um Dein Video zu finden.' ;
FCKLang['DlgMediaURLTipContent2'] = 'Kopiere die URL des Videos aus der Adressleiste Deines Browsers und füge Sie hier im Dialog in die "URL" Zeie.' ;
FCKLang['DlgMediaURLTipContent3'] = 'Die kopierte URL sollte wie %s aussehen.' ;

@ -1,28 +1,28 @@
/*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Wiki link dialog.
* German language file.
* Please, use UTF-8 encoding.
*/
FCKLang.WikilinkBtn = 'Insert/Edit Wiki link' ;
FCKLang.WikilinkDlgTitle = 'Wiki link' ;
FCKLang.WikilinkDlgName = 'Wiki link name' ;
FCKLang.WikilinkErrNoName = 'Please type the wiki link name.' ;
FCKLang.WikilinkErrNameInUse = 'The specified name is already in use.';
FCKLang.WikilinkHelp = 'TIP: Also, you can create a wiki link without using this button. To create a new page or create a link to an existing one using wiki links, edit a page and add [[page title]] or [[name of link|title of page]] to its content.';
/*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Wiki link dialog.
* German language file.
* Please, use UTF-8 encoding.
*/
FCKLang.WikilinkBtn = 'Wiki Link einfügen/ändern' ;
FCKLang.WikilinkDlgTitle = 'Wiki Link' ;
FCKLang.WikilinkDlgName = 'Name des Links' ;
FCKLang.WikilinkErrNoName = 'Bitte den Namen des Links eingeben.' ;
FCKLang.WikilinkErrNameInUse = 'Der angegebene Name ist bereits in Verwendung.';
FCKLang.WikilinkHelp = 'Hinweis: Wiki-Links können auch ohne diesen Button erstellt werden. Um eine neue Seite oder einen Link auf eine existierende Seite zu erstellen, reicht es, eine bereits existierende Seite zu modifizieren und [[Titel der Seite]] oder [[Name des Links|Titel der Seite]] zum bestehenden Inhalt hinzuzufügen.';

@ -1,20 +1,20 @@
/*
* Please, use UTF-8 encoding.
*
* German language file.
*/
FCKLang['YouTubeTip'] = 'Insert/Edit YouTube' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube Property' ;
FCKLang['DlgYouTubeCode'] = '"Please insert the URL of YouTube videos."' ;
FCKLang['DlgYouTubeSecurity'] = 'Invalid URL.' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = 'Width' ;
FCKLang['DlgYouTubeHeight'] = 'Height' ;
FCKLang['DlgYouTubeQuality'] = 'Quality' ;
FCKLang['DlgYouTubeLow'] = 'Low' ;
FCKLang['DlgYouTubeHigh'] = 'High (If available)' ;
FCKLang['DlgYouTubeURLTip'] = 'Tip:' ;
FCKLang['DlgYouTubeURLTipContent1'] = 'Go to %s. Navigate within the site to find your video.' ;
FCKLang['DlgYouTubeURLTipContent2'] = 'Copy the URL of the video from your browser\'s address box and paste it in this dialog, the "URL" box.' ;
FCKLang['DlgYouTubeURLTipContent3'] = 'The copied URL should look like %s.' ;
/*
* Please, use UTF-8 encoding.
*
* German language file.
*/
FCKLang['YouTubeTip'] = 'Youtube Video einfügen/ändern' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube Eigenschaft' ;
FCKLang['DlgYouTubeCode'] = '"Bitte die URL des Youtube Videos eingeben."' ;
FCKLang['DlgYouTubeSecurity'] = 'Ungültige URL.' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = 'Breite' ;
FCKLang['DlgYouTubeHeight'] = 'Höhe' ;
FCKLang['DlgYouTubeQuality'] = 'Qualität' ;
FCKLang['DlgYouTubeLow'] = 'iedrig' ;
FCKLang['DlgYouTubeHigh'] = 'hoch (wenn verfügbar)' ;
FCKLang['DlgYouTubeURLTip'] = 'Tip:' ;
FCKLang['DlgYouTubeURLTipContent1'] = 'Gehe zu %s. Navigiere im Verzeichnis, um das Video zu finden.' ;
FCKLang['DlgYouTubeURLTipContent2'] = 'Einfach die URL aus der Browser-Adressleiste in die "URL" Zeile des Dialogfensters einfügen.' ;
FCKLang['DlgYouTubeURLTipContent3'] = 'Die kopierte URL sollte so aussehen %s.' ;

@ -264,8 +264,7 @@ function handle_uploaded_document($_course, $uploaded_file, $base_work_dir, $upl
// Update document item_property
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', $user_id, $to_group_id, $to_user_id, null, null, $current_session_id);
//Redo visibility
//api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'visible', $user_id, $to_group_id, $to_user_id, null, null, $current_session_id);
//Redo visibility
api_set_default_visibility(TOOL_DOCUMENT, $document_id);
}
// If the file is in a folder, we need to update all parent folders
@ -277,7 +276,7 @@ function handle_uploaded_document($_course, $uploaded_file, $base_work_dir, $upl
return $file_path;
} else {
// Put the document data in the database
$document_id = add_document($_course, $file_path, 'file', $file_size, $document_name);
$document_id = add_document($_course, $file_path, 'file', $file_size, $document_name, null, 0, true);
if ($document_id) {
// Put the document in item_property update
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $user_id, $to_group_id, $to_user_id, null, null, $current_session_id);
@ -309,13 +308,14 @@ function handle_uploaded_document($_course, $uploaded_file, $base_work_dir, $upl
chmod($store_path, $files_perm);
// Put the document data in the database
$document_id = add_document($_course, $new_file_path, 'file', $file_size, $document_name);
$document_id = add_document($_course, $new_file_path, 'file', $file_size, $document_name, null, 0, true);
if ($document_id) {
// Update document item_property
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $user_id, $to_group_id, $to_user_id, null, null, $current_session_id);
}
// If the file is in a folder, we need to update all parent folders
item_property_update_on_folder($_course, $upload_path, $user_id);
// Display success message to user
if ($output){
Display::display_confirmation_message(get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').$new_file_path, false);
@ -340,14 +340,15 @@ function handle_uploaded_document($_course, $uploaded_file, $base_work_dir, $upl
chmod($store_path, $files_perm);
// Put the document data in the database
$document_id = add_document($_course, $file_path, 'file', $file_size, $document_name);
$document_id = add_document($_course, $file_path, 'file', $file_size, $document_name, null, 0, true);
if ($document_id) {
// Update document item_property
api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $user_id, $to_group_id, $to_user_id, null, null, $current_session_id);
}
// If the file is in a folder, we need to update all parent folders
item_property_update_on_folder($_course,$upload_path,$user_id);
// Display success message to user
if ($output){
Display::display_confirmation_message(get_lang('UplUploadSucceeded').'<br />'.$file_path, false);
@ -839,15 +840,14 @@ function filter_extension(&$filename) {
* @param string $title
* @return id if inserted document
*/
function add_document($_course, $path, $filetype, $filesize, $title, $comment = null, $readonly = 0, $save_visibility = true) {
function add_document($_course, $path, $filetype, $filesize, $title, $comment = null, $readonly = 0, $save_visibility = true, $group_id = null) {
$session_id = api_get_session_id();
$readonly = intval($readonly);
$comment = Database::escape_string($comment);
$path = Database::escape_string($path);
$filetype = Database::escape_string($filetype);
$filesize = intval($filesize);
$title = htmlspecialchars($title);
$title = Database::escape_string($title);
$filesize = intval($filesize);
$title = Database::escape_string(htmlspecialchars($title));
$c_id = $_course['real_id'];
$table_document = Database::get_course_table(TABLE_DOCUMENT);
@ -855,10 +855,10 @@ function add_document($_course, $path, $filetype, $filesize, $title, $comment =
VALUES ($c_id, '$path','$filetype','$filesize','$title', '$comment', $readonly, $session_id)";
if (Database::query($sql)) {
$document_id = Database::insert_id();
$document_id = Database::insert_id();
if ($document_id) {
if ($save_visibility) {
api_set_default_visibility($document_id, TOOL_DOCUMENT);
if ($save_visibility) {
api_set_default_visibility($document_id, TOOL_DOCUMENT, $group_id);
}
}
return $document_id;
@ -1089,7 +1089,7 @@ function create_unexisting_directory($_course, $user_id, $session_id, $to_group_
$rs = Database::query($sql);
if (Database::num_rows($rs) == 0) {
$document_id = add_document($_course, $desired_dir_name.$nb, 'folder', 0, $title);
$document_id = add_document($_course, $desired_dir_name.$nb, 'folder', 0, $title, null, 0, true, $to_group_id);
if ($document_id) {
// Update document item_property
if ($visibility !== '') {

@ -7,7 +7,6 @@
/**
* Code
*/
//require_once 'tablesort.lib.php';moved to autoload
require_once 'fileManage.lib.php';
require_once 'fileUpload.lib.php';
require_once 'document.lib.php';
@ -195,6 +194,7 @@ class GroupManager {
}
return $groups;
}
/**
* Create a group
* @param string $name The name for this group
@ -202,19 +202,21 @@ class GroupManager {
* @param int $places How many people can subscribe to the new group
*/
public static function create_group ($name, $category_id, $tutor, $places) {
global $_course,$_user;
isset($_SESSION['id_session'])?$my_id_session = intval($_SESSION['id_session']):$my_id_session=0;
global $_course;
$table_group = Database :: get_course_table(TABLE_GROUP);
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$currentCourseRepository = $_course['path'];
$table_group = Database :: get_course_table(TABLE_GROUP);
$table_forum = Database :: get_course_table(TABLE_FORUM);
$category = self :: get_category($category_id);
$course_id = api_get_course_int_id();
$category = self :: get_category($category_id);
if (intval($places) == 0) {
//if the amount of users per group is not filled in, use the setting from the category
$places = $category['max_student'];
}
$sql = "INSERT INTO ".$table_group." SET
c_id = $course_id ,
category_id='".Database::escape_string($category_id)."',
@ -228,55 +230,62 @@ class GroupManager {
chat_state = '".$category['chat_state']."',
self_registration_allowed = '".$category['self_reg_allowed']."',
self_unregistration_allowed = '".$category['self_unreg_allowed']."',
session_id='".Database::escape_string($my_id_session)."'";
session_id='".Database::escape_string($session_id)."'";
Database::query($sql);
$lastId = Database::insert_id();
if ($lastId) {
$desired_dir_name= '/'.replace_dangerous_char($name,'strict').'_groupdocs';
$my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document';
$unique_name = create_unexisting_directory($_course, api_get_user_id(), $session_id, $lastId, NULL, $my_path, $desired_dir_name);
/* Stores the directory path into the group table */
$sql = "UPDATE ".$table_group." SET name = '".Database::escape_string($name)."', secret_directory = '".$unique_name."'
WHERE c_id = $course_id AND id ='".$lastId."'";
$desired_dir_name= '/'.replace_dangerous_char($name,'strict').'_groupdocs';
$my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document';
$unique_name = create_unexisting_directory($_course,$_user['user_id'], api_get_session_id(), $lastId,NULL,$my_path, $desired_dir_name);
/* Stores the directory path into the group table */
$sql = "UPDATE ".$table_group." SET name = '".Database::escape_string($name)."', secret_directory = '".$unique_name."'
WHERE c_id = $course_id AND id ='".$lastId."'";
Database::query($sql);
Database::query($sql);
// create a forum if needed
if ($category['forum_state'] >= 0) {
require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
// create a forum if needed
if ($category['forum_state'] >= 0) {
require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forum_categories = get_forum_categories();
$values['forum_title'] = $name;
$counter = 0;
foreach ($forum_categories as $key=>$value) {
if ($counter==0) {
$forum_category_id = $key;
}
$counter++;
}
// A sanity check.
if (empty($forum_category_id)) {
$forum_category_id = 0;
}
$values['forum_category'] = $forum_category_id;
$values['allow_anonymous_group']['allow_anonymous'] = 0;
$values['students_can_edit_group']['students_can_edit'] = 0;
$values['approval_direct_group']['approval_direct'] = 0;
$values['allow_attachments_group']['allow_attachments'] = 1;
$values['allow_new_threads_group']['allow_new_threads'] = 1;
$values['default_view_type_group']['default_view_type']=api_get_setting('default_forum_view');
$values['group_forum'] = $lastId;
if ($category['forum_state'] == '1') {
$values['public_private_group_forum_group']['public_private_group_forum']='public';
} elseif ($category['forum_state'] == '2') {
$values['public_private_group_forum_group']['public_private_group_forum']='private';
} elseif ($category['forum_state'] == '0') {
$values['public_private_group_forum_group']['public_private_group_forum']='unavailable';
}
store_forum($values);
}
$forum_categories = get_forum_categories();
$values = array();
$values['forum_title'] = $name;
$values['group_id'] = $lastId;
$counter = 0;
foreach ($forum_categories as $key=>$value) {
if ($counter==0) {
$forum_category_id = $key;
}
$counter++;
}
// A sanity check.
if (empty($forum_category_id)) {
$forum_category_id = 0;
}
$values['forum_category'] = $forum_category_id;
$values['allow_anonymous_group']['allow_anonymous'] = 0;
$values['students_can_edit_group']['students_can_edit'] = 0;
$values['approval_direct_group']['approval_direct'] = 0;
$values['allow_attachments_group']['allow_attachments'] = 1;
$values['allow_new_threads_group']['allow_new_threads'] = 1;
$values['default_view_type_group']['default_view_type']=api_get_setting('default_forum_view');
$values['group_forum'] = $lastId;
if ($category['forum_state'] == '1') {
$values['public_private_group_forum_group']['public_private_group_forum']='public';
} elseif ($category['forum_state'] == '2') {
$values['public_private_group_forum_group']['public_private_group_forum']='private';
} elseif ($category['forum_state'] == '0') {
$values['public_private_group_forum_group']['public_private_group_forum']='unavailable';
}
store_forum($values);
}
}
return $lastId;
}
/**
@ -822,7 +831,6 @@ class GroupManager {
while ($row = Database::fetch_array($rs)) {
$result[] = $row['user_id'];
}
return $result;
}
@ -956,10 +964,14 @@ class GroupManager {
* @param int $group_id
* @return int Number of students in the given group.
*/
public static function number_of_students ($group_id) {
public static function number_of_students ($group_id, $course_id = null) {
$table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
$group_id = Database::escape_string($group_id);
$course_id = api_get_course_int_id();
if (empty($course_id)) {
$course_id = api_get_course_int_id();
} else {
$course_id = intval($course_id);
}
$sql = "SELECT COUNT(*) AS number_of_students FROM $table_group_user WHERE c_id = $course_id AND group_id = $group_id";
$db_result = Database::query($sql);
$db_object = Database::fetch_object($db_result);
@ -1099,20 +1111,23 @@ class GroupManager {
* @return array An array with information of all users from the given group.
* (user_id, firstname, lastname, email)
*/
public static function get_subscribed_users ($group_id) {
public static function get_subscribed_users($group_id) {
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
$order_clause = api_sort_by_first_name() ? ' ORDER BY u.firstname, u.lastname' : ' ORDER BY u.lastname, u.firstname';
$group_id = Database::escape_string($group_id);
if (empty($group_id)) {
return array();
}
$group_id = intval($group_id);
$course_id = api_get_course_int_id();
$sql = "SELECT ug.id, u.user_id, u.lastname, u.firstname, u.email, u.username
FROM ".$table_user." u, ".$table_group_user." ug
WHERE ug.c_id = $course_id AND
ug.group_id='".$group_id."' AND
ug.user_id=u.user_id". $order_clause;
FROM $table_user u INNER JOIN $table_group_user ug ON (ug.user_id = u.user_id)
WHERE ug.c_id = $course_id AND
ug.group_id = $group_id
$order_clause";
$db_result = Database::query($sql);
$users = array ();
$users = array();
while ($user = Database::fetch_object($db_result)) {
$member['user_id'] = $user->user_id;
$member['firstname'] = $user->firstname;
@ -1684,7 +1699,7 @@ class GroupManager {
//first sort by user_id to filter out duplicates
$complete_user_list = TableSort :: sort_table($complete_user_list, 'user_id');
$complete_user_list = self :: filter_duplicates($complete_user_list, 'user_id');
$complete_user_list = self :: filter_only_students($complete_user_list);
//$complete_user_list = self :: filter_only_students($complete_user_list);
//now sort by # of group left
$complete_user_list = TableSort :: sort_table($complete_user_list, 'number_groups_left', SORT_DESC);
return $complete_user_list;

@ -25,15 +25,16 @@ define('SPECIAL_CLOSING_TAG', '=]');
define('TIME_NO_SEC_FORMAT', 0); // 15:23
define('DATE_FORMAT_SHORT', 1); // Aug 25, 09
define('DATE_FORMAT_LONG', 2); // Aug 25, 09
define('DATE_TIME_FORMAT_LONG', 3); // August 25, 2009 at 03:28 PM
define('DATE_FORMAT_LONG', 2); // Monday August 25, 09
define('DATE_FORMAT_LONG_NO_DAY', 10); // August 25, 2009
define('DATE_TIME_FORMAT_LONG', 3); // Monday August 25, 2009 at 03:28 PM
define('DATE_FORMAT_NUMBER', 4); // 25.08.09
define('DATE_TIME_FORMAT_LONG_24H', 5); // August 25, 2009 at 15:28
define('DATE_TIME_FORMAT_LONG_24H', 5); // August 25, 2009 at 15:28
define('DATE_TIME_FORMAT_SHORT', 6); // Aug 25, 2009 at 03:28 PM
define('DATE_TIME_FORMAT_SHORT_TIME_FIRST', 7); // 03:28 PM, Aug 25 2009
define('DATE_FORMAT_NUMBER_NO_YEAR', 8); // 25.08
define('DATE_FORMAT_NUMBER_NO_YEAR', 8); // 25.08 dd-mm
define('DATE_FORMAT_ONLY_DAYNAME', 9); // Monday, Sunday, etc
// Formatting person's name.
define('PERSON_NAME_COMMON_CONVENTION', 0); // Formatting a person's name using the pattern as it has been
@ -716,6 +717,13 @@ function api_format_date($time, $format = null, $language = null) {
if (is_int($format)) {
switch ($format) {
case DATE_FORMAT_ONLY_DAYNAME:
$date_format = get_lang('dateFormatOnlyDayName', '', $language);
if (IS_PHP_53 && INTL_INSTALLED) {
$datetype = IntlDateFormatter::SHORT;
$timetype = IntlDateFormatter::NONE;
}
break;
case DATE_FORMAT_NUMBER_NO_YEAR:
$date_format = get_lang('dateFormatShortNumberNoYear', '', $language);
if (IS_PHP_53 && INTL_INSTALLED) {
@ -758,6 +766,13 @@ function api_format_date($time, $format = null, $language = null) {
$timetype = IntlDateFormatter::SHORT;
}
break;
case DATE_FORMAT_LONG_NO_DAY:
$date_format = get_lang('dateFormatLongNoDay', '', $language);
if (IS_PHP_53 && INTL_INSTALLED) {
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::SHORT;
}
break;
case DATE_TIME_FORMAT_SHORT:
$date_format = get_lang('dateTimeFormatShort', '', $language);
if (IS_PHP_53 && INTL_INSTALLED) {

@ -121,7 +121,7 @@ function addlinkcategory($type) {
}
if ((api_get_setting('search_enabled') == 'true') && $link_id && extension_loaded('xapian')) {
require_once api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php';
require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
@ -174,7 +174,7 @@ function addlinkcategory($type) {
}
}
$di = new DokeosIndexer();
$di = new ChamiloIndexer();
isset ($_POST['language']) ? $lang = Database :: escape_string($_POST['language']) : $lang = 'english';
$di->connectDb(NULL, NULL, $lang);
$di->addChunk($ic_slide);
@ -288,8 +288,8 @@ function delete_link_from_search_engine($course_id, $link_id) {
$res = Database :: query($sql);
if (Database :: num_rows($res) > 0) {
$row = Database :: fetch_array($res);
require_once api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php';
$di = new DokeosIndexer();
require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
$di = new ChamiloIndexer();
$di->remove_document((int) $row['search_did']);
}
$sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1';
@ -451,7 +451,7 @@ function editlinkcategory($type) {
$res = Database :: query($sql);
if (Database :: num_rows($res) > 0) {
require_once api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php';
require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
@ -504,7 +504,7 @@ function editlinkcategory($type) {
}
}
$di = new DokeosIndexer();
$di = new ChamiloIndexer();
isset ($_POST['language']) ? $lang = Database :: escape_string($_POST['language']) : $lang = 'english';
$di->connectDb(NULL, NULL, $lang);
$di->remove_document((int) $se_ref['search_did']);

@ -162,9 +162,11 @@ define('LOG_SESSION_DELETE', 'session_deleted');
define('LOG_SESSION_CATEGORY_CREATE', 'session_category_created');
define('LOG_SESSION_CATEGORY_DELETE', 'session_category_deleted');
define('LOG_CONFIGURATION_SETTINGS_CHANGE', 'settings_changed');
define('LOG_PLATFORM_LANGUAGE_CHANGE', 'platform_language_changed');
define('LOG_SUBSCRIBE_USER_TO_COURSE', 'user_subscribed');
define('LOG_UNSUBSCRIBE_USER_FROM_COURSE', 'user_unsubscribed');
define('LOG_HOMEPAGE_CHANGED', 'homepage_changed');
define('LOG_PROMOTION_CREATE', 'promotion_created');
define('LOG_PROMOTION_DELETE', 'promotion_deleted');
define('LOG_CAREER_CREATE', 'career_created');
@ -178,6 +180,7 @@ define('LOG_SESSION_ID', 'session_id');
define('LOG_SESSION_CATEGORY_ID', 'session_category_id');
define('LOG_CONFIGURATION_SETTINGS_CATEGORY', 'settings_category');
define('LOG_CONFIGURATION_SETTINGS_VARIABLE', 'settings_variable');
define('LOG_PLATFORM_LANGUAGE', 'default_platform_language');
define('LOG_CAREER_ID', 'career_id');
define('LOG_PROMOTION_ID', 'promotion_id');
@ -1270,10 +1273,15 @@ function api_get_anonymous_id() {
*
* @see Uri.course_params
*/
function api_get_cidreq() {
return empty($GLOBALS['_cid']) ? '' : 'cidReq='.htmlspecialchars($GLOBALS['_cid']).
(api_get_session_id() == 0 ? '&amp;id_session=0' : '&amp;id_session='.api_get_session_id()).
(api_get_group_id() == 0 ? '&amp;gidReq=0' : '&amp;gidReq='.api_get_group_id());
function api_get_cidreq($add_session_id = true, $add_group_id = true) {
$url = empty($GLOBALS['_cid']) ? '' : 'cidReq='.htmlspecialchars($GLOBALS['_cid']);
if ($add_session_id) {
$url .= api_get_session_id() == 0 ? '&id_session=0' : '&id_session='.api_get_session_id();
}
if ($add_group_id) {
$url .= api_get_group_id() == 0 ? '&gidReq=0' : '&gidReq='.api_get_group_id();
}
return $url;
}
/**
* Returns the current course info array.
@ -1386,6 +1394,7 @@ function api_format_course_array($course_data) {
$_course['visibility' ] = $course_data['visibility' ];
$_course['subscribe_allowed'] = $course_data['subscribe' ];
$_course['subscribe'] = $course_data['subscribe'];
$_course['unsubscribe'] = $course_data['unsubscribe' ];
$_course['course_language'] = $course_data['course_language'];
@ -6175,7 +6184,7 @@ function api_is_global_chat_enabled(){
/**
* @todo Fix tool_visible_by_default_at_creation labels
*/
function api_set_default_visibility($item_id, $tool_id) {
function api_set_default_visibility($item_id, $tool_id, $group_id = null) {
$original_tool_id = $tool_id;
switch ($tool_id) {
@ -6199,28 +6208,39 @@ function api_set_default_visibility($item_id, $tool_id) {
case TOOL_QUIZ:
$tool_id = 'quiz';
break;
/*case TOOL_GRADEBOOK:
$tool_id = 'gradebook'; */
break;
}
$setting = api_get_setting('tool_visible_by_default_at_creation');
if (isset($setting[$tool_id])) {
//$visibility_boolean = false;
$visibility = 'invisible';
if (isset($setting[$tool_id])) {
$visibility = 'invisible';
if ($setting[$tool_id] == 'true') {
$visibility = 'visible';
//$visibility_boolean = true;
$visibility = 'visible';
}
if (empty($group_id)) {
$group_id = api_get_group_id();
}
api_item_property_update(api_get_course_info(), $original_tool_id, $item_id, $visibility, api_get_user_id(), $group_id, null, null, null, api_get_session_id());
//Fixes default visibility for tests
switch ($original_tool_id) {
case TOOL_QUIZ:
$objExerciseTmp = new Exercise();
$objExerciseTmp->read($item_id);
if ($visibility == 'visible') {
$objExerciseTmp->enable();
$objExerciseTmp->save();
} else {
$objExerciseTmp->disable();
$objExerciseTmp->save();
}
break;
}
//Hack for gradebook because we don't use the item property table
/*
if ($tool_id == TOOL_GRADEBOOK) {
return $visibility_boolean;
}*/
api_item_property_update(api_get_course_info(), $original_tool_id, $item_id, $visibility, api_get_user_id(), api_get_group_id(), null, null, null, api_get_session_id());
}
}
function api_get_datetime_picker_js($htmlHeadXtra) {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/datetimepicker/jquery-ui-timepicker-addon.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/datetimepicker/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css" />';

@ -205,11 +205,23 @@ class PDF {
if (strpos($old_src, 'http') === false) {
if (strpos($old_src, '/main/default_course_document') === false) {
$old_src_fixed = str_replace('/courses/'.$course_data['path'].'/document/', '', $old_src);
$old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed);
if (api_get_path(REL_PATH) != '/') {
$old_src = str_replace(api_get_path(REL_PATH), '', $old_src);
}
$old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src);
//$old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed);
$new_path = $document_path.$old_src_fixed;
$document_html= str_replace($old_src, $new_path, $document_html);
}
} else {
//Check if this is a complete URL
/*if (strpos($old_src, 'courses/'.$course_data['path'].'/document/') === false) {
} else {
$old_src_fixed = str_replace(api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/', '', $old_src);
$new_path = $document_path.$old_src_fixed;
$document_html= str_replace($old_src, $new_path, $document_html);
}*/
}
}
}
@ -219,6 +231,7 @@ class PDF {
$title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through
// $_GET[] too, as it is done with file name.
// At the moment the title is retrieved from the html document itself.
//echo $document_html;exit;
if (empty($title)) {
$title = $filename; // Here file name is expected to contain ASCII symbols only.
}

@ -1334,7 +1334,7 @@ class HTML_QuickForm extends HTML_Common
* @param array $b array which will be merged into first one
* @return array merged array
*/
function arrayMerge($a, $b)
static function arrayMerge($a, $b)
{
foreach ($b as $k => $v) {
if (is_array($v)) {

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.include.search
@ -15,78 +16,79 @@ include_once 'xapian/XapianIndexer.class.php';
*/
class ChamiloIndexer extends XapianIndexer {
/**
* Set terms on search_did given
*
* @param string $terms_string Comma-separated list of terms from input form
* @param string $prefix Search engine prefix
* @param string $course_code Course code
* @param string $tool_id Tool id from mainapi.lib.php
* @param int $ref_id_high_level Main id of the entity to index (Ex. lp_id)
* @param int $ref_id_second_level Secondary id of the entity to index (Ex. lp_item)
* @param int $search_did Search engine document id from search_engine_ref table
* @return boolean False on error or nothing to do, true otherwise
*/
function set_terms($terms_string, $prefix, $course_code, $tool_id, $ref_id_high_level, $ref_id_second_level, $search_did) {
$terms_string = trim($terms_string);
$terms = explode(',', $terms_string);
array_walk($terms, 'trim_value');
$stored_terms = $this->get_terms_on_db($prefix, $course_code, $tool_id, $ref_id_high_level);
// don't do anything if no change, verify only at DB, not the search engine
if ( (count(array_diff($terms, $stored_terms))==0) && (count(array_diff($stored_terms, $terms))==0) )
return FALSE;
require_once api_get_path(LIBRARY_PATH).'search/xapian/XapianQuery.php';
// compare terms
$doc = $this->get_document($search_did);
$xapian_terms = xapian_get_doc_terms($doc, $prefix);
$xterms = array();
foreach ($xapian_terms as $xapian_term) $xterms[] = substr($xapian_term['name'],1);
$dterms = $terms;
$missing_terms = array_diff($dterms, $xterms);
$deprecated_terms = array_diff($xterms, $dterms);
// save it to search engine
foreach ($missing_terms as $term)
{
$this->add_term_to_doc($prefix. $term, $doc);
}
foreach ($deprecated_terms as $term)
{
$this->remove_term_from_doc($prefix.$term, $doc);
}
// don't do anything if no change
if ( (count($missing_terms) > 0) || (count($deprecated_terms) > 0)) {
$this->replace_document($doc, (int)$search_did);
}
return TRUE;
}
/**
* Get the terms stored at database
* @return array Array of terms
*/
function get_terms_on_db($prefix, $course_code, $tool_id, $ref_id) {
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
$terms = get_specific_field_values_list_by_prefix($prefix, $course_code, $tool_id, $ref_id);
$prefix_terms = array();
foreach($terms as $term) {
$prefix_terms[] = $term['value'];
}
return $prefix_terms;
}
/**
* Set terms on search_did given
*
* @param string $terms_string Comma-separated list of terms from input form
* @param string $prefix Search engine prefix
* @param string $course_code Course code
* @param string $tool_id Tool id from mainapi.lib.php
* @param int $ref_id_high_level Main id of the entity to index (Ex. lp_id)
* @param int $ref_id_second_level Secondary id of the entity to index (Ex. lp_item)
* @param int $search_did Search engine document id from search_engine_ref table
* @return boolean False on error or nothing to do, true otherwise
*/
function set_terms($terms_string, $prefix, $course_code, $tool_id, $ref_id_high_level, $ref_id_second_level, $search_did) {
$terms_string = trim($terms_string);
$terms = explode(',', $terms_string);
array_walk($terms, 'trim_value');
$stored_terms = $this->get_terms_on_db($prefix, $course_code, $tool_id, $ref_id_high_level);
// don't do anything if no change, verify only at DB, not the search engine
if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
return FALSE;
require_once api_get_path(LIBRARY_PATH) . 'search/xapian/XapianQuery.php';
// compare terms
$doc = $this->get_document($search_did);
$xapian_terms = xapian_get_doc_terms($doc, $prefix);
$xterms = array();
foreach ($xapian_terms as $xapian_term)
$xterms[] = substr($xapian_term['name'], 1);
$dterms = $terms;
$missing_terms = array_diff($dterms, $xterms);
$deprecated_terms = array_diff($xterms, $dterms);
// save it to search engine
foreach ($missing_terms as $term) {
$this->add_term_to_doc($prefix . $term, $doc);
}
foreach ($deprecated_terms as $term) {
$this->remove_term_from_doc($prefix . $term, $doc);
}
// don't do anything if no change
if ((count($missing_terms) > 0) || (count($deprecated_terms) > 0)) {
$this->replace_document($doc, (int) $search_did);
}
return TRUE;
}
/**
* Get the terms stored at database
* @return array Array of terms
*/
function get_terms_on_db($prefix, $course_code, $tool_id, $ref_id) {
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
$terms = get_specific_field_values_list_by_prefix($prefix, $course_code, $tool_id, $ref_id);
$prefix_terms = array();
foreach ($terms as $term) {
$prefix_terms[] = $term['value'];
}
return $prefix_terms;
}
}
if (!function_exists('trim_value')) {
function trim_value(&$value) {
$value = trim($value);
}
function trim_value(&$value) {
$value = trim($value);
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.include.search
@ -17,15 +18,14 @@ define('SE_DOCTYPE_EXERCISE_EXERCISE', 0);
define('SE_DOCTYPE_EXERCISE_QUESTION', 1);
// xapian prefixes
define('XAPIAN_PREFIX_COURSEID','C');
define('XAPIAN_PREFIX_TOOLID', 'O');
define('XAPIAN_PREFIX_COURSEID', 'C');
define('XAPIAN_PREFIX_TOOLID', 'O');
/**
* Class
* @package chamilo.include.search
*/
abstract class _IndexableChunk
{
abstract class _IndexableChunk {
/* struct (array)
* {
* string title; <- nombre de archivo/elemento
@ -33,6 +33,7 @@ abstract class _IndexableChunk
* string ids; <- los flags a guardar "cidReq:lp_id:path"
* }
*/
public $data;
/**
@ -53,12 +54,12 @@ abstract class _IndexableChunk
*/
public $terms;
/**
* Add a value to the indexed item
* @param string Key
* @param string Value
* @return void
*/
/**
* Add a value to the indexed item
* @param string Key
* @param string Value
* @return void
*/
function addValue($key, $value) {
$this->data[$key] = $value;
}
@ -69,46 +70,47 @@ abstract class _IndexableChunk
* @param string Flag (one character)
*/
public function addTerm($term, $flag) {
global $charset;
if (strlen($flag) == 1) {
$this->terms[] = array('name' => api_convert_encoding(stripslashes($term),'UTF-8',$charset), 'flag' => $flag);
}
global $charset;
if (strlen($flag) == 1) {
$this->terms[] = array('name' => api_convert_encoding(stripslashes($term), 'UTF-8', $charset), 'flag' => $flag);
}
}
/**
* Class constructor. Just generates an empty 'data' array attribute
*/
/**
* Class constructor. Just generates an empty 'data' array attribute
*/
function __construct() {
$this->data = array();
}
/**
* Class desctructor. Unsets attributes.
*/
/**
* Class desctructor. Unsets attributes.
*/
function __destruct() {
unset($this->data);
unset($this->terms);
}
}
/**
* Extension of the _IndexableChunk class to make IndexableChunk extensible.
* @package chamilo.include.search
*/
class IndexableChunk extends _IndexableChunk
{
/**
* Let add course id term
*/
public function addCourseId($course_id) {
$this->addTerm($course_id, XAPIAN_PREFIX_COURSEID);
}
/**
* Let add tool id term
*/
public function addToolId($tool_id) {
$this->addTerm($tool_id, XAPIAN_PREFIX_TOOLID);
}
class IndexableChunk extends _IndexableChunk {
/**
* Let add course id term
*/
public function addCourseId($course_id) {
$this->addTerm($course_id, XAPIAN_PREFIX_COURSEID);
}
/**
* Let add tool id term
*/
public function addToolId($tool_id) {
$this->addTerm($tool_id, XAPIAN_PREFIX_TOOLID);
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script retrieves a list of terms that have xapian documents
@ -17,7 +18,7 @@ if (empty($_GET['term']) || empty($_GET['prefix']) || !in_array($_GET['operator'
}
require_once dirname(__FILE__) . '../../../global.inc.php';
require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php';
/**
* search with filter and build base array avoding repeated terms
@ -31,8 +32,8 @@ function get_usual_sf_terms($filter, $specific_fields) {
if (is_array($dkterms) && is_array($dkterms[1])) {
foreach ($specific_fields as $specific_field) {
foreach($dkterms[1] as $obj) {
foreach ($obj['sf-'.$specific_field['code']] as $raw_term) {
foreach ($dkterms[1] as $obj) {
foreach ($obj['sf-' . $specific_field['code']] as $raw_term) {
if (count($raw_term['name']) > 1) {
$normal_term = substr($raw_term['name'], 1);
$sf_terms[$specific_field['code']][$normal_term] = $normal_term;
@ -51,7 +52,7 @@ $operator = $_GET['operator'];
$specific_fields = get_specific_field_list();
$sf_terms = array();
if ( ($cid=api_get_course_id()) != -1) { // with cid
if (($cid = api_get_course_id()) != -1) { // with cid
// course filter
$filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
// term filter
@ -62,16 +63,14 @@ if ( ($cid=api_get_course_id()) != -1) { // with cid
}
$sf_terms = get_usual_sf_terms($filter, $specific_fields);
} else { // without cid
if ($term != '__all__') {
$filter[] = chamilo_get_boolean_query($prefix . $term);
$sf_terms = get_usual_sf_terms($filter, $specific_fields);
} else { // no cid and all/any terms
foreach ($specific_fields as $specific_field) {
foreach(xapian_get_all_terms(1000, $specific_field['code']) as $raw_term) {
foreach (xapian_get_all_terms(1000, $specific_field['code']) as $raw_term) {
if (count($raw_term['name']) > 1) {
$normal_term = substr($raw_term['name'], 1);
$sf_terms[$specific_field['code']][$normal_term] = $normal_term;
@ -79,13 +78,12 @@ if ( ($cid=api_get_course_id()) != -1) { // with cid
}
}
}
}
// build array to return
foreach ($sf_terms as $sf_prefix => $term_group) {
//if (count($tem_group) > 0) {
$first_term = array('__all__' => ($operator=='or'? '-- Any --': '-- All -- '));
$first_term = array('__all__' => ($operator == 'or' ? '-- Any --' : '-- All -- '));
//}
if ($sf_prefix != $prefix) {
$terms_list[] = array(

@ -9,7 +9,6 @@
*/
require_once dirname(__FILE__) . '/IndexableChunk.class.php';
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
//require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
/**
* Add some required CSS and JS to html's head.

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
*
@ -9,6 +10,7 @@
*/
include_once dirname(__FILE__) . '/../../../global.inc.php';
require_once dirname(__FILE__) . '/search_processor.class.php';
/**
* Process documents before pass it to search listing scripts
* @package chamilo.include.search
@ -22,38 +24,38 @@ class document_processor extends search_processor {
public function process() {
$results = array();
foreach ($this->rows as $row_val) {
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $row_val['courseid']);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($row_val['courseid']), TOOL_DOCUMENT, $row_val['xapian_data'][SE_DATA]['doc_id']);
if ($visibility) {
list($thumbnail, $image, $name, $author, $url) = $this->get_information($row_val['courseid'], $row_val['xapian_data'][SE_DATA]['doc_id']);
$result = array(
'toolid' => TOOL_DOCUMENT,
'score' => $row_val['score'],
'url' => $url,
'thumbnail' => $thumbnail,
'image' => $image,
'title' => $name,
'author' => $author,
);
if ($course_visible_for_user) {
$results[] = $result;
} else { // course not visible for user
if ($search_show_unlinked_results) {
$result['url'] = '';
$results[] = $result;
}
}
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $row_val['courseid']);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($row_val['courseid']), TOOL_DOCUMENT, $row_val['xapian_data'][SE_DATA]['doc_id']);
if ($visibility) {
list($thumbnail, $image, $name, $author, $url) = $this->get_information($row_val['courseid'], $row_val['xapian_data'][SE_DATA]['doc_id']);
$result = array(
'toolid' => TOOL_DOCUMENT,
'score' => $row_val['score'],
'url' => $url,
'thumbnail' => $thumbnail,
'image' => $image,
'title' => $name,
'author' => $author,
);
if ($course_visible_for_user) {
$results[] = $result;
} else { // course not visible for user
if ($search_show_unlinked_results) {
$result['url'] = '';
$results[] = $result;
}
}
}
}
}
}
// get information to sort
foreach ($results as $key => $row) {
$score[$key] = $row['score'];
$score[$key] = $row['score'];
}
// Sort results with score descending
@ -66,44 +68,45 @@ class document_processor extends search_processor {
* Get document information
*/
private function get_information($course_id, $doc_id) {
$course_information = api_get_course_info($course_id);
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_path = $course_information['path'];
if (!empty($course_information)) {
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$doc_id = Database::escape_string($doc_id);
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$doc_id = Database::escape_string($doc_id);
$sql = "SELECT * FROM $doc_table
WHERE $doc_table.id = $doc_id AND c_id = $course_id
LIMIT 1";
$dk_result = Database::query ($sql);
$dk_result = Database::query($sql);
$sql = "SELECT insert_user_id FROM $item_property_table
WHERE ref = $doc_id AND tool = '". TOOL_DOCUMENT ."' AND c_id = $course_id
LIMIT 1";
WHERE ref = $doc_id AND tool = '" . TOOL_DOCUMENT . "' AND c_id = $course_id
LIMIT 1";
$name = '';
if ($row = Database::fetch_array ($dk_result)) {
if ($row = Database::fetch_array($dk_result)) {
$name = $row['title'];
$url = api_get_path(WEB_PATH) . 'courses/%s/document%s';
$url = sprintf($url, $course_path, $row['path']);
// Get the image path
include_once api_get_path(LIBRARY_PATH). 'fileDisplay.lib.php';
include_once api_get_path(LIBRARY_PATH) . 'fileDisplay.lib.php';
$icon = choose_image(basename($row['path']));
$thumbnail = api_get_path(WEB_CODE_PATH) .'img/'. $icon;
$thumbnail = api_get_path(WEB_CODE_PATH) . 'img/' . $icon;
$image = $thumbnail;
//FIXME: use big images
// get author
$author = '';
$item_result = Database::query ($sql);
if ($row = Database::fetch_array ($item_result)) {
$item_result = Database::query($sql);
if ($row = Database::fetch_array($item_result)) {
$user_data = api_get_user_info($row['insert_user_id']);
$author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
}
}
}
return array($thumbnail, $image, $name, $author, $url); // FIXME: is it posible to get an author here?
} else {
return array();
}
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
*
@ -16,6 +17,7 @@ require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
* @package chamilo.include.search
*/
class learnpath_processor extends search_processor {
public $learnpaths = array();
function learnpath_processor($rows) {
@ -27,11 +29,11 @@ class learnpath_processor extends search_processor {
$document_id = $row_val['xapian_data'][SE_DATA]['document_id'];
$courseid = $row_val['courseid'];
$item = array(
'courseid' => $courseid,
'lp_item' => $lp_item,
'score' => $row_val['score'],
'row_id' => $row_id,
);
'courseid' => $courseid,
'lp_item' => $lp_item,
'score' => $row_val['score'],
'row_id' => $row_id,
);
$this->learnpaths[$courseid][$lp_id][] = $item;
$this->learnpaths[$courseid][$lp_id]['total_score'] += $row_val['score'];
$this->learnpaths[$courseid][$lp_id]['has_document_id'] = is_numeric($document_id);
@ -41,65 +43,65 @@ class learnpath_processor extends search_processor {
public function process() {
$results = array();
foreach ($this->learnpaths as $courseid => $learnpaths) {
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $courseid);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
foreach ($learnpaths as $lp_id => $lp) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_LEARNPATH, $lp_id);
if($visibility) {
list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $lp_id, $lp['has_document_id']);
$url = api_get_path(WEB_PATH) . 'main/newscorm/lp_controller.php?cidReq=%s&action=view&lp_id=%s';
$url = sprintf($url, $courseid, $lp_id);
$result = array(
'toolid' => TOOL_LEARNPATH,
'score' => $lp['total_score']/(count($lp)-1), // not count total_score array item
'url' => $url,
'thumbnail' => $thumbnail,
'image' => $image,
'title' => $name,
'author' => $author,
);
if ($course_visible_for_user) {
$results[] = $result;
} else { // course not visible for user
if ($search_show_unlinked_results) {
$result['url'] = '';
$results[] = $result;
}
}
}
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $courseid);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
foreach ($learnpaths as $lp_id => $lp) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_LEARNPATH, $lp_id);
if ($visibility) {
list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $lp_id, $lp['has_document_id']);
$url = api_get_path(WEB_PATH) . 'main/newscorm/lp_controller.php?cidReq=%s&action=view&lp_id=%s';
$url = sprintf($url, $courseid, $lp_id);
$result = array(
'toolid' => TOOL_LEARNPATH,
'score' => $lp['total_score'] / (count($lp) - 1), // not count total_score array item
'url' => $url,
'thumbnail' => $thumbnail,
'image' => $image,
'title' => $name,
'author' => $author,
);
if ($course_visible_for_user) {
$results[] = $result;
} else { // course not visible for user
if ($search_show_unlinked_results) {
$result['url'] = '';
$results[] = $result;
}
}
}
}
}
}
}
// get information to sort
foreach ($results as $key => $row) {
$score[$key] = $row['score'];
}
// Sort results with score descending
array_multisort($score, SORT_DESC, $results);
return $results;
$score[$key] = $row['score'];
}
// Sort results with score descending
array_multisort($score, SORT_DESC, $results);
return $results;
}
/**
* Get learning path information
*/
private function get_information($course_id, $lp_id, $has_document_id=TRUE) {
$course_information = api_get_course_info($course_id);
private function get_information($course_id, $lp_id, $has_document_id = TRUE) {
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_path = $course_information['path'];
if (!empty($course_information)) {
$lpi_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$lpi_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$lp_id = Database::escape_string($lp_id);
if ($has_document_id) {
$sql = "SELECT $lpi_table.id, $lp_table.name, $lp_table.author, $doc_table.path
$sql = "SELECT $lpi_table.id, $lp_table.name, $lp_table.author, $doc_table.path
FROM $lp_table, $lpi_table
INNER JOIN $doc_table ON $lpi_table.path = $doc_table.id AND $lpi_table.c_id = $course_id
WHERE $lpi_table.c_id = $course_id AND
@ -109,7 +111,7 @@ class learnpath_processor extends search_processor {
$lp_table.id = $lpi_table.lp_id
LIMIT 1";
} else {
$sql = "SELECT $lpi_table.id, $lp_table.name, $lp_table.author
$sql = "SELECT $lpi_table.id, $lp_table.name, $lp_table.author
FROM $lp_table, $lpi_table
WHERE
$lpi_table.c_id = $course_id AND
@ -119,29 +121,30 @@ class learnpath_processor extends search_processor {
$lp_table.id = $lpi_table.lp_id
LIMIT 1";
}
$dk_result = Database::query ($sql);
$dk_result = Database::query($sql);
$path = '';
$name = '';
if ($row = Database::fetch_array ($dk_result)) {
if ($row = Database::fetch_array($dk_result)) {
// Get the image path
$img_location = api_get_path(WEB_COURSE_PATH).$course_path."/document/";
$thumbnail_path = str_replace ('.png.html', '_thumb.png', $row['path']);
$big_img_path = str_replace ('.png.html', '.png', $row['path']);
$img_location = api_get_path(WEB_COURSE_PATH) . $course_path . "/document/";
$thumbnail_path = str_replace('.png.html', '_thumb.png', $row['path']);
$big_img_path = str_replace('.png.html', '.png', $row['path']);
$thumbnail = '';
if (!empty($thumbnail_path)) {
$thumbnail = $img_location . $thumbnail_path;
$thumbnail = $img_location . $thumbnail_path;
}
$image = '';
if (!empty($big_img_path)) {
$image = $img_location . $big_img_path;
$image = $img_location . $big_img_path;
}
$name = $row['name'];
}
}
return array($thumbnail, $image, $name, $row['author']);
} else {
return array();
}
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
*
@ -15,7 +16,8 @@ require_once dirname(__FILE__) . '/search_processor.class.php';
* @package chamilo.include.search
*/
class link_processor extends search_processor {
public $links = array();
public $links = array();
function link_processor($rows) {
$this->rows = $rows;
@ -25,37 +27,36 @@ class link_processor extends search_processor {
$link_id = $row_val['xapian_data'][SE_DATA]['link_id'];
$courseid = $row_val['courseid'];
$item = array(
'courseid' => $courseid,
'score' => $row_val['score'],
'link_id' => $link_id,
'row_id' => $row_id,
);
'courseid' => $courseid,
'score' => $row_val['score'],
'link_id' => $link_id,
'row_id' => $row_id,
);
$this->links[$courseid]['links'][] = $item;
$this->links[$courseid]['total_score'] += $row_val['score'];
}
}
public function process() {
$results = array();
foreach ($this->links as $courseid => $one_course_links) {
$course_info = api_get_course_info($courseid);
$course_info = api_get_course_info($courseid);
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $courseid);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
$result = NULL;
foreach ($one_course_links['links'] as $one_link) {
// is visible?
$visibility = api_get_item_visibility($course_info, TOOL_LINK, $one_link['link_id']);
if ($visibility) {
// if one is visible let show the result for a course
// also asume all data of this item like the data of the whole group of links(Ex. author)
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
$result = NULL;
foreach ($one_course_links['links'] as $one_link) {
// is visible?
$visibility = api_get_item_visibility($course_info, TOOL_LINK, $one_link['link_id']);
if ($visibility) {
// if one is visible let show the result for a course
// also asume all data of this item like the data of the whole group of links(Ex. author)
list($thumbnail, $image, $name, $author, $url) = $this->get_information($courseid, $one_link['link_id']);
$result_tmp = array(
'toolid' => TOOL_LINK,
'score' => $one_course_links['total_score']/(count($one_course_links)-1), // not count total_score array item
'score' => $one_course_links['total_score'] / (count($one_course_links) - 1), // not count total_score array item
'url' => $url,
'thumbnail' => $thumbnail,
'image' => $image,
@ -82,7 +83,7 @@ class link_processor extends search_processor {
// get information to sort
foreach ($results as $key => $row) {
$score[$key] = $row['score'];
$score[$key] = $row['score'];
}
// Sort results with score descending
@ -95,34 +96,35 @@ class link_processor extends search_processor {
* Get document information
*/
private function get_information($course_id, $link_id) {
$course_information = api_get_course_info($course_id);
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_id_alpha = $course_information['id'];
if (!empty($course_information)) {
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$link_id = Database::escape_string($link_id);
if (!empty($course_information)) {
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$link_id = Database::escape_string($link_id);
$sql = "SELECT insert_user_id FROM $item_property_table
WHERE ref = $link_id AND tool = '". TOOL_LINK ."' AND c_id = $course_id
WHERE ref = $link_id AND tool = '" . TOOL_LINK . "' AND c_id = $course_id
LIMIT 1";
$name = get_lang('Links');
$url = api_get_path(WEB_PATH) . 'main/link/link.php?cidReq=%s';
$url = sprintf($url, $course_id_alpha);
// Get the image path
$thumbnail = api_get_path(WEB_CODE_PATH) .'img/link.gif';
$thumbnail = api_get_path(WEB_CODE_PATH) . 'img/link.gif';
$image = $thumbnail; //FIXME: use big images
// get author
$author = '';
$item_result = Database::query ($sql);
if ($row = Database::fetch_array ($item_result)) {
$user_data = api_get_user_info($row['insert_user_id']);
$author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
$item_result = Database::query($sql);
if ($row = Database::fetch_array($item_result)) {
$user_data = api_get_user_info($row['insert_user_id']);
$author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
}
return array($thumbnail, $image, $name, $author, $url);
} else {
return array();
}
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
*
@ -15,6 +16,7 @@ require_once dirname(__FILE__) . '/search_processor.class.php';
* @package chamilo.include.search
*/
class quiz_processor extends search_processor {
public $exercices = array();
function quiz_processor($rows) {
@ -28,11 +30,11 @@ class quiz_processor extends search_processor {
$exercise_id = $se_data['exercise_id'];
$question = NULL;
$item = array(
'courseid' => $courseid,
'question' => $question,
'score' => $row_val['score'],
'row_id' => $row_id,
);
'courseid' => $courseid,
'question' => $question,
'score' => $row_val['score'],
'row_id' => $row_id,
);
$this->exercises[$courseid][$exercise_id][] = $item;
$this->exercises[$courseid][$exercise_id]['total_score'] += $row_val['score'];
break;
@ -61,18 +63,18 @@ class quiz_processor extends search_processor {
foreach ($this->exercises as $courseid => $exercises) {
$search_show_unlinked_results = (api_get_setting('search_show_unlinked_results') == 'true');
$course_visible_for_user = api_is_course_visible_for_user(NULL, $courseid);
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
foreach ($exercises as $exercise_id => $exercise) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_QUIZ, $exercise_id);
if($visibility) {
list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $exercise_id);
$url = api_get_path(WEB_PATH) . 'main/exercice/exercise_submit.php?cidReq=%s&exerciseId=%s';
// can view course?
if ($course_visible_for_user || $search_show_unlinked_results) {
foreach ($exercises as $exercise_id => $exercise) {
// is visible?
$visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_QUIZ, $exercise_id);
if ($visibility) {
list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $exercise_id);
$url = api_get_path(WEB_PATH) . 'main/exercice/exercise_submit.php?cidReq=%s&exerciseId=%s';
$url = sprintf($url, $courseid, $exercise_id);
$result = array(
'toolid' => TOOL_QUIZ,
'score' => $exercise['total_score']/(count($exercise)-1), // not count total_score array item
'score' => $exercise['total_score'] / (count($exercise) - 1), // not count total_score array item
'url' => $url,
'thumbnail' => $thumbnail,
'image' => $image,
@ -87,14 +89,14 @@ class quiz_processor extends search_processor {
$results[] = $result;
}
}
}
}
}
}
}
}
}
// get information to sort
foreach ($results as $key => $row) {
$score[$key] = $row['score'];
$score[$key] = $row['score'];
}
// Sort results with score descending
array_multisort($score, SORT_DESC, $results);
@ -105,23 +107,23 @@ class quiz_processor extends search_processor {
* Get learning path information
*/
private function get_information($course_id, $exercise_id) {
$course_information = api_get_course_info($course_id);
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
if (!empty($course_information)) {
$exercise_table = Database::get_course_table(TABLE_QUIZ_TEST);
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$exercise_id = intval($exercise_id);
$sql = "SELECT * FROM $exercise_table WHERE id = $exercise_id AND c_id = $course_id LIMIT 1";
$dk_result = Database::query($sql);
$exercise_table = Database::get_course_table(TABLE_QUIZ_TEST);
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$exercise_id = intval($exercise_id);
$sql = "SELECT * FROM $exercise_table WHERE id = $exercise_id AND c_id = $course_id LIMIT 1";
$dk_result = Database::query($sql);
//actually author isn't saved on exercise tool, but prepare for when it's ready
$sql = "SELECT insert_user_id FROM $item_property_table
WHERE ref = $doc_id AND tool = '". TOOL_DOCUMENT ."' AND c_id = $course_id
WHERE ref = $doc_id AND tool = '" . TOOL_DOCUMENT . "' AND c_id = $course_id
LIMIT 1";
$name = '';
if ($row = Database::fetch_array ($dk_result)) {
if ($row = Database::fetch_array($dk_result)) {
// Get the image path
$thumbnail = api_get_path(WEB_PATH) . 'main/img/quiz.gif';
$image = $thumbnail; //FIXME: use big images
@ -129,7 +131,7 @@ class quiz_processor extends search_processor {
// get author
$author = '';
$item_result = Database::query($sql);
if ($item_result !== FALSE && $row = Database::fetch_array ($item_result)) {
if ($item_result !== FALSE && $row = Database::fetch_array($item_result)) {
$user_data = api_get_user_info($row['insert_user_id']);
$author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
}
@ -139,4 +141,5 @@ class quiz_processor extends search_processor {
return array();
}
}
}

@ -1,8 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.include.search
*/
/**
* Base class to make tool processors
*
@ -16,6 +18,7 @@
* @package chamilo.include.search
*/
abstract class search_processor {
/**
* Search engine api results
*/

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.include.search
@ -6,6 +7,7 @@
/**
* Code
*/
require_once 'xapian.php';
require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
@ -15,6 +17,7 @@ require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
*/
abstract class XapianIndexer {
/* XapianWritableDatabase */
protected $db;
/* IndexableChunk[] */
protected $chunks;
@ -23,48 +26,48 @@ abstract class XapianIndexer {
/* XapianStem */
public $stemmer;
/**
* Generates a list of languages Xapian manages
*
* This method enables the definition of more matches between
* Chamilo languages and Xapian languages (through hardcoding)
* @return array Array of languages codes -> Xapian languages
*/
/**
* Generates a list of languages Xapian manages
*
* This method enables the definition of more matches between
* Chamilo languages and Xapian languages (through hardcoding)
* @return array Array of languages codes -> Xapian languages
*/
public final function xapian_languages() {
/* http://xapian.org/docs/apidoc/html/classXapian_1_1Stem.html */
return array(
'none' => 'none', //don't stem terms
'da' => 'danish',
'nl' => 'dutch',
/* Martin Porter's 2002 revision of his stemmer */
'en' => 'english',
/* Lovin's stemmer */
'lovins' => 'english_lovins',
/* Porter's stemmer as described in his 1980 paper */
'porter' => 'english_porter',
'fi' => 'finnish',
'fr' => 'french',
'de' => 'german',
'it' => 'italian',
'no' => 'norwegian',
'pt' => 'portuguese',
'ru' => 'russian',
'es' => 'spanish',
'sv' => 'swedish',
);
/* http://xapian.org/docs/apidoc/html/classXapian_1_1Stem.html */
return array(
'none' => 'none', //don't stem terms
'da' => 'danish',
'nl' => 'dutch',
/* Martin Porter's 2002 revision of his stemmer */
'en' => 'english',
/* Lovin's stemmer */
'lovins' => 'english_lovins',
/* Porter's stemmer as described in his 1980 paper */
'porter' => 'english_porter',
'fi' => 'finnish',
'fr' => 'french',
'de' => 'german',
'it' => 'italian',
'no' => 'norwegian',
'pt' => 'portuguese',
'ru' => 'russian',
'es' => 'spanish',
'sv' => 'swedish',
);
}
/**
* Connect to the database, and create it if it doesn't exist
*/
function connectDb($path=NULL, $dbMode=NULL, $lang='english') {
if ($this->db != NULL)
return $this->db;
/**
* Connect to the database, and create it if it doesn't exist
*/
function connectDb($path = NULL, $dbMode = NULL, $lang = 'english') {
if ($this->db != NULL)
return $this->db;
if ($dbMode == NULL)
$dbMode = Xapian::DB_CREATE_OR_OPEN;
if ($path == NULL)
$path = api_get_path(SYS_PATH).'searchdb/';
$path = api_get_path(SYS_PATH) . 'searchdb/';
try {
$this->db = new XapianWritableDatabase($path, $dbMode);
@ -75,7 +78,7 @@ abstract class XapianIndexer {
}
$this->stemmer = new XapianStem($lang);
$this->indexer->set_stemmer($this->stemmer);
return $this->db;
} catch (Exception $e) {
Display::display_error_message($e->getMessage());
@ -91,11 +94,11 @@ abstract class XapianIndexer {
return $this->db;
}
/**
* Add this chunk to the chunk array attribute
* @param string Chunk of text
* @return void
*/
/**
* Add this chunk to the chunk array attribute
* @param string Chunk of text
* @return void
*/
function addChunk($chunk) {
$this->chunks[] = $chunk;
}
@ -107,7 +110,7 @@ abstract class XapianIndexer {
*/
function index() {
try {
if (!empty($this->chunks)) {
if (!empty($this->chunks)) {
foreach ($this->chunks as $chunk) {
$doc = new XapianDocument();
$this->indexer->set_document($doc);
@ -117,19 +120,19 @@ abstract class XapianIndexer {
$doc->add_term($term['flag'] . $term['name'], 1);
}
}
// free-form index all data array (title, content, etc)
if (!empty($chunk->data)) {
foreach ($chunk->data as $key => $value) {
$this->indexer->index_text($value, 1);
}
}
$doc->set_data($chunk->xapian_data, 1);
}
$doc->set_data($chunk->xapian_data, 1);
$did = $this->db->add_document($doc);
//write to disk
$this->db->flush();
return $did;
}
}
@ -146,17 +149,16 @@ abstract class XapianIndexer {
* @return mixed XapianDocument, or false on error
*/
function get_document($did) {
if ($this->db == NULL) {
$this->connectDb();
}
try {
$docid = $this->db->get_document($did);
}
catch (Exception $e) {
//Display::display_error_message($e->getMessage());
return false;
}
return $docid;
if ($this->db == NULL) {
$this->connectDb();
}
try {
$docid = $this->db->get_document($did);
} catch (Exception $e) {
//Display::display_error_message($e->getMessage());
return false;
}
return $docid;
}
/**
@ -166,20 +168,19 @@ abstract class XapianIndexer {
* @return mixed xapian document data or FALSE if error
*/
function get_document_data($doc) {
if ($this->db == NULL) {
$this->connectDb();
}
try {
if (!is_a($doc, 'XapianDocument')) {
return FALSE;
if ($this->db == NULL) {
$this->connectDb();
}
try {
if (!is_a($doc, 'XapianDocument')) {
return FALSE;
}
$doc_data = $doc->get_data();
return $doc_data;
} catch (Exception $e) {
//Display::display_error_message($e->getMessage());
return false;
}
$doc_data = $doc->get_data();
return $doc_data;
}
catch (Exception $e) {
//Display::display_error_message($e->getMessage());
return false;
}
}
/**
@ -190,16 +191,18 @@ abstract class XapianIndexer {
* @return boolean false on error
*/
function update_terms($did, $terms, $prefix) {
$doc = $this->get_document($did);
if($doc===false){return false;}
$doc->clear_terms();
foreach ($terms as $term) {
//add directly
$doc->add_term($prefix.$term, 1);
}
$this->db->replace_document($did, $doc);
$this->db->flush();
return true;
$doc = $this->get_document($did);
if ($doc === false) {
return false;
}
$doc->clear_terms();
foreach ($terms as $term) {
//add directly
$doc->add_term($prefix . $term, 1);
}
$this->db->replace_document($did, $doc);
$this->db->flush();
return true;
}
/**
@ -211,7 +214,7 @@ abstract class XapianIndexer {
if ($this->db == NULL) {
$this->connectDb();
}
if (is_numeric($did) && $did>0) {
if (is_numeric($did) && $did > 0) {
$doc = $this->get_document($did);
if ($doc !== FALSE) {
$this->db->delete_document($did);
@ -228,15 +231,14 @@ abstract class XapianIndexer {
* @return mixed XapianDocument, or false on error
*/
function add_term_to_doc($term, $doc) {
if (!is_a($doc,'XapianDocument')) {
if (!is_a($doc, 'XapianDocument')) {
return FALSE;
}
try {
$doc->add_term($term);
}
catch (Exception $e) {
Display::display_error_message($e->getMessage());
return 1;
} catch (Exception $e) {
Display::display_error_message($e->getMessage());
return 1;
}
}
@ -248,15 +250,14 @@ abstract class XapianIndexer {
* @return mixed XapianDocument, or false on error
*/
function remove_term_from_doc($term, $doc) {
if (!is_a($doc,'XapianDocument')) {
if (!is_a($doc, 'XapianDocument')) {
return FALSE;
}
try {
$doc->remove_term($term);
}
catch (Exception $e) {
Display::display_error_message($e->getMessage());
return 1;
} catch (Exception $e) {
Display::display_error_message($e->getMessage());
return 1;
}
}
@ -267,30 +268,29 @@ abstract class XapianIndexer {
* @param Xapian::docid $did xapian document id of the document to replace
*/
function replace_document($doc, $did) {
if (!is_a($doc,'XapianDocument')) {
if (!is_a($doc, 'XapianDocument')) {
return FALSE;
}
if ($this->db == NULL) {
$this->connectDb();
}
try {
$this->getDb()->replace_document((int)$did, $doc);
$this->getDb()->flush();
}
catch (Exception $e) {
Display::display_error_message($e->getMessage());
return 1;
$this->getDb()->replace_document((int) $did, $doc);
$this->getDb()->flush();
} catch (Exception $e) {
Display::display_error_message($e->getMessage());
return 1;
}
}
/**
* Class contructor
*/
/**
* Class contructor
*/
function __construct() {
$this->db = NULL;
$this->stemmer = NULL;
}
/**
* Class destructor
*/
@ -298,4 +298,5 @@ abstract class XapianIndexer {
unset($this->db);
unset($this->stemmer);
}
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.include.search
@ -9,9 +10,9 @@
require_once 'xapian.php';
require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
//TODO: think another way without including specific fields here
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
define('XAPIAN_DB', api_get_path(SYS_PATH).'searchdb/');
define('XAPIAN_DB', api_get_path(SYS_PATH) . 'searchdb/');
/**
* Queries the database.
@ -32,7 +33,7 @@ define('XAPIAN_DB', api_get_path(SYS_PATH).'searchdb/');
function xapian_query($query_string, $db = NULL, $start = 0, $length = 10, $extra = array(), $count_type = 0) {
try {
if (!is_object($db)) {
if (!is_object($db)) {
$db = new XapianDatabase(XAPIAN_DB);
}
@ -43,60 +44,60 @@ function xapian_query($query_string, $db = NULL, $start = 0, $length = 10, $extr
$subqueries[] = new XapianQuery($subquery);
}
}
$query = NULL;
$enquire = new XapianEnquire($db);
if (!empty($query_string)) {
$query_parser = new XapianQueryParser();
//TODO: choose stemmer
$stemmer = new XapianStem("english");
$query_parser->set_stemmer($stemmer);
$query_parser->set_database($db);
$query_parser->set_stemming_strategy(XapianQueryParser::STEM_SOME);
$query_parser->add_boolean_prefix('courseid', XAPIAN_PREFIX_COURSEID);
$query_parser->add_boolean_prefix('toolid', XAPIAN_PREFIX_TOOLID);
$query = $query_parser->parse_query($query_string);
$final_array = array_merge($subqueries, array($query));
$query = new XapianQuery(XapianQuery::OP_AND, $final_array);
$query_parser = new XapianQueryParser();
//TODO: choose stemmer
$stemmer = new XapianStem("english");
$query_parser->set_stemmer($stemmer);
$query_parser->set_database($db);
$query_parser->set_stemming_strategy(XapianQueryParser::STEM_SOME);
$query_parser->add_boolean_prefix('courseid', XAPIAN_PREFIX_COURSEID);
$query_parser->add_boolean_prefix('toolid', XAPIAN_PREFIX_TOOLID);
$query = $query_parser->parse_query($query_string);
$final_array = array_merge($subqueries, array($query));
$query = new XapianQuery(XapianQuery::OP_AND, $final_array);
} else {
$query = new XapianQuery(XapianQuery::OP_OR, $subqueries);
}
$enquire->set_query($query);
$matches = $enquire->get_mset((int)$start, (int)$length);
$matches = $enquire->get_mset((int) $start, (int) $length);
$specific_fields = get_specific_field_list();
$results = array();
$i = $matches->begin();
// Display the results.
// Display the results.
//echo $matches->get_matches_estimated().'results found';
$count = 0;
while (!$i->equals($matches->end())) {
$count++;
while (!$i->equals($matches->end())) {
$count++;
$document = $i->get_document();
if (is_object($document)) {
// process one item terms
$courseid_terms = xapian_get_doc_terms($document, XAPIAN_PREFIX_COURSEID);
$results[$count]['courseid'] = substr($courseid_terms[0]['name'], 1);
$toolid_terms = xapian_get_doc_terms($document, XAPIAN_PREFIX_TOOLID);
$results[$count]['toolid'] = substr($toolid_terms[0]['name'], 1);
// process each specific field prefix
foreach ($specific_fields as $specific_field) {
$results[$count]['sf-'.$specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
$results[$count]['sf-' . $specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
}
// rest of data
$results[$count]['xapian_data'] = unserialize($document->get_data());
$results[$count]['score'] = ($i->get_percent());
@ -105,21 +106,21 @@ function xapian_query($query_string, $db = NULL, $start = 0, $length = 10, $extr
}
switch ($count_type) {
case 1: // Lower bound
$count = $matches->get_matches_lower_bound();
break;
case 1: // Lower bound
$count = $matches->get_matches_lower_bound();
break;
case 2: // Upper bound
$count = $matches->get_matches_upper_bound();
break;
case 2: // Upper bound
$count = $matches->get_matches_upper_bound();
break;
case 0: // Best estimate
default:
$count = $matches->get_matches_estimated();
break;
case 0: // Best estimate
default:
$count = $matches->get_matches_estimated();
break;
}
return array($count, $results);
} catch (Exception $e) {
} catch (Exception $e) {
display_xapian_error($e->getMessage());
return NULL;
}
@ -131,6 +132,7 @@ function xapian_query($query_string, $db = NULL, $start = 0, $length = 10, $extr
function xapian_get_boolean_query($term) {
return new XapianQuery($term);
}
/**
* Retrieve a list db terms
*
@ -139,34 +141,32 @@ function xapian_get_boolean_query($term) {
* @param XapianDatabase $db Xapian database to connect
* @return array
*/
function xapian_get_all_terms($count=0, $prefix, $db=NULL) {
try {
if (!is_object($db)) {
$db = new XapianDatabase(XAPIAN_DB);
}
function xapian_get_all_terms($count = 0, $prefix, $db = NULL) {
try {
if (!is_object($db)) {
$db = new XapianDatabase(XAPIAN_DB);
}
if (!empty($prefix)) {
$termi= $db->allterms_begin($prefix);
}
else {
$termi= $db->allterms_begin();
}
if (!empty($prefix)) {
$termi = $db->allterms_begin($prefix);
} else {
$termi = $db->allterms_begin();
}
$terms = array();
$i = 0;
for ( ; !$termi->equals($db->allterms_end()) && (++$i<=$count || $count==0) ; $termi->next() ) {
$terms[] = array(
'frequency' => $termi->get_termfreq(),
'name' => $termi->get_term(),
);
}
$terms = array();
$i = 0;
for (; !$termi->equals($db->allterms_end()) && (++$i <= $count || $count == 0); $termi->next()) {
$terms[] = array(
'frequency' => $termi->get_termfreq(),
'name' => $termi->get_term(),
);
}
return $terms;
}
catch (Exception $e) {
display_xapian_error($e->getMessage());
return NULL;
}
return $terms;
} catch (Exception $e) {
display_xapian_error($e->getMessage());
return NULL;
}
}
/**
@ -175,32 +175,31 @@ function xapian_get_all_terms($count=0, $prefix, $db=NULL) {
* @param XapianDocument document searched
* @return array
*/
function xapian_get_doc_terms($doc=NULL, $prefix) {
try {
if (!is_a($doc, 'XapianDocument')) {
return;
}
function xapian_get_doc_terms($doc = NULL, $prefix) {
try {
if (!is_a($doc, 'XapianDocument')) {
return;
}
//TODO: make the filter by prefix on xapian if possible
//ojwb marvil07: use Document::termlist_begin() and then skip_to(prefix) on the TermIterator
//ojwb you'll need to check the end condition by hand though
$terms = array();
for ($termi=$doc->termlist_begin() ; !$termi->equals($doc->termlist_end()); $termi->next() ) {
$term = array(
'frequency' => $termi->get_termfreq(),
'name' => $termi->get_term(),
);
if ($term['name'][0] === $prefix) {
$terms[] = $term;
}
}
//TODO: make the filter by prefix on xapian if possible
//ojwb marvil07: use Document::termlist_begin() and then skip_to(prefix) on the TermIterator
//ojwb you'll need to check the end condition by hand though
$terms = array();
for ($termi = $doc->termlist_begin(); !$termi->equals($doc->termlist_end()); $termi->next()) {
$term = array(
'frequency' => $termi->get_termfreq(),
'name' => $termi->get_term(),
);
if ($term['name'][0] === $prefix) {
$terms[] = $term;
}
}
return $terms;
}
catch (Exception $e) {
display_xapian_error($e->getMessage());
return NULL;
}
return $terms;
} catch (Exception $e) {
display_xapian_error($e->getMessage());
return NULL;
}
}
/**
@ -211,53 +210,57 @@ function xapian_get_doc_terms($doc=NULL, $prefix) {
* @param string $op
* @return XapianQuery query joined
*/
function xapian_join_queries($query1, $query2=NULL, $op='or') {
// let decide how to join, avoiding include xapian.php outside
switch ($op) {
case 'or': $op = XapianQuery::OP_OR; break;
case 'and': $op = XapianQuery::OP_AND; break;
default: $op = XapianQuery::OP_OR; break;
}
// review parameters to decide how to join
if (!is_array($query1)) {
$query1 = array($query1);
}
if (is_null($query2)) {
// join an array of queries with $op
return new XapianQuery($op, $query1);
}
if (!is_array($query2)) {
$query2 = array($query2);
}
return new XapianQuery($op, array_merge($query1, $query2));
function xapian_join_queries($query1, $query2 = NULL, $op = 'or') {
// let decide how to join, avoiding include xapian.php outside
switch ($op) {
case 'or': $op = XapianQuery::OP_OR;
break;
case 'and': $op = XapianQuery::OP_AND;
break;
default: $op = XapianQuery::OP_OR;
break;
}
// review parameters to decide how to join
if (!is_array($query1)) {
$query1 = array($query1);
}
if (is_null($query2)) {
// join an array of queries with $op
return new XapianQuery($op, $query1);
}
if (!is_array($query2)) {
$query2 = array($query2);
}
return new XapianQuery($op, array_merge($query1, $query2));
}
/**
* @author Isaac flores paz <florespaz@bidsoftperu.com>
* @param String The xapian error message
* @return String The chamilo error message
*/
function display_xapian_error($xapian_error_message) {
$message=explode(':',$xapian_error_message);
$type_error_message=$message[0];
if ($type_error_message=='DatabaseOpeningError') {
$message_error=get_lang('SearchDatabaseOpeningError');
} elseif ($type_error_message=='DatabaseVersionError') {
$message_error=get_lang('SearchDatabaseVersionError');
} elseif ($type_error_message=='DatabaseModifiedError') {
$message_error=get_lang('SearchDatabaseModifiedError');
} elseif ($type_error_message=='DatabaseLockError') {
$message_error=get_lang('SearchDatabaseLockError');
} elseif ($type_error_message=='DatabaseCreateError') {
$message_error=get_lang('SearchDatabaseCreateError');
} elseif ($type_error_message=='DatabaseCorruptError') {
$message_error=get_lang('SearchDatabaseCorruptError');
} elseif ($type_error_message=='NetworkTimeoutError') {
$message_error=get_lang('SearchNetworkTimeoutError');
function display_xapian_error($xapian_error_message) {
$message = explode(':', $xapian_error_message);
$type_error_message = $message[0];
if ($type_error_message == 'DatabaseOpeningError') {
$message_error = get_lang('SearchDatabaseOpeningError');
} elseif ($type_error_message == 'DatabaseVersionError') {
$message_error = get_lang('SearchDatabaseVersionError');
} elseif ($type_error_message == 'DatabaseModifiedError') {
$message_error = get_lang('SearchDatabaseModifiedError');
} elseif ($type_error_message == 'DatabaseLockError') {
$message_error = get_lang('SearchDatabaseLockError');
} elseif ($type_error_message == 'DatabaseCreateError') {
$message_error = get_lang('SearchDatabaseCreateError');
} elseif ($type_error_message == 'DatabaseCorruptError') {
$message_error = get_lang('SearchDatabaseCorruptError');
} elseif ($type_error_message == 'NetworkTimeoutError') {
$message_error = get_lang('SearchNetworkTimeoutError');
} else {
$message_error=get_lang('SearchOtherXapianError');
$message_error = get_lang('SearchOtherXapianError');
}
$display_message=get_lang('Error').' : '. $message_error;
$display_message = get_lang('Error') . ' : ' . $message_error;
Display::display_error_message($display_message);
}

@ -686,6 +686,7 @@ class SocialManager extends UserManager {
// reduce image
$name = $user_info['complete_name'];
$status_icon = Display::span('', array('class' => 'online_user_in_text'));
//$user_status = $user_info['status'] == 1 ? Display::return_icon('teacher.png', get_lang('Teacher'), array('height' => '22px', 'width' => '22px')) : null;
if ($image_array['file'] == 'unknown.jpg' || !file_exists($image_array['dir'].$image_array['file'])) {
$friends_profile['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_180_100.jpg';
@ -694,7 +695,7 @@ class SocialManager extends UserManager {
$friends_profile = UserManager::get_picture_user($uid, $image_array['file'], 80, USER_IMAGE_SIZE_ORIGINAL);
$img = '<img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'">';
}
$name = '<a href="'.$url.'">'.$status_icon.$name.'</a><br>';
$name = '<a href="'.$url.'">'.$status_icon.$user_status.$name.'</a><br>';
$html .= '<li class="span'.($column_size/3).'"><div class="thumbnail">'.$img.'<div class="caption">'.$name.'</div</div></li>';
}
$counter = $_SESSION['who_is_online_counter'];

@ -3,15 +3,11 @@
/**
* This file contains class used like library, provides functions for thematic option inside attendance tool. It's also used like model to thematic_controller (MVC pattern)
* Thematic class can be used to instanciate objects or as a library for thematic control
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> SQL fixes
* @package chamilo.course_progress
*/
/**
* Thematic class can be used to instanciate objects or as a library for thematic control
* @package chamilo.course_progress
*/
class Thematic
{
private $session_id;
@ -45,13 +41,11 @@ class Thematic
}
$course_id = api_get_course_int_id();
$sql = "SELECT COUNT(id) AS total_number_of_items FROM $tbl_thematic WHERE c_id = $course_id AND active = 1 $condition_session ";
$res = Database::query($sql);
$res = Database::query($sql);
$res = Database::query($sql);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get the thematics to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
@ -484,8 +478,8 @@ class Thematic
$session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
}
}
$thematic_advance_item = '<div><strong>'.api_convert_and_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG).$session_star.'</strong></div>';
//DATE_TIME_FORMAT_LONG
$thematic_advance_item = '<div><strong>'.api_convert_and_format_date($thematic_advance['start_date'], DATE_FORMAT_LONG).$session_star.'</strong></div>';
// $thematic_advance_item .= '<div>'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'</div>';
$thematic_advance_item .= '<div>'.$thematic_advance['duration'].' '.get_lang('HourShort').'</div>';
$thematic_advance_item .= '<div>'.Security::remove_XSS($thematic_advance['content'], STUDENT).'</div>';
@ -749,10 +743,8 @@ class Thematic
$data[] = $row;
}
}
}
}
}
}
return $data;
}

@ -738,8 +738,8 @@ class Tracking {
//Getting lp_items done by the user
$sql = "SELECT DISTINCT lp_item_id
FROM $lp_item_view_table
WHERE c_id = $course_id AND
lp_view_id = $lp_view_id
WHERE c_id = $course_id AND
lp_view_id = $lp_view_id
ORDER BY lp_item_id";
$res_lp_item = Database::query($sql);
@ -747,11 +747,20 @@ class Tracking {
$my_lp_item_id = $row_lp_item['lp_item_id'];
//Getting the most recent attempt
$sql = "SELECT lp_iv.id as lp_item_view_id, lp_iv.score as score,lp_i.max_score, lp_iv.max_score as max_score_item_view, lp_i.path, lp_i.item_type, lp_i.id as iid
FROM $lp_item_view_table as lp_iv INNER JOIN $lp_item_table as lp_i ON lp_i.id = lp_iv.lp_item_id AND (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."')
WHERE lp_iv.c_id = $course_id AND
lp_i.c_id = $course_id AND
lp_item_id = $my_lp_item_id AND
$sql = "SELECT lp_iv.id as lp_item_view_id,
lp_iv.score as score,
lp_i.max_score,
lp_iv.max_score as max_score_item_view,
lp_i.path,
lp_i.item_type,
lp_i.id as iid
FROM $lp_item_view_table as lp_iv
INNER JOIN $lp_item_table as lp_i
ON lp_i.id = lp_iv.lp_item_id AND
lp_iv.c_id = $course_id AND
lp_i.c_id = $course_id AND
(lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."')
WHERE lp_item_id = $my_lp_item_id AND
lp_view_id = $lp_view_id
ORDER BY view_count DESC
LIMIT 1";
@ -763,11 +772,20 @@ class Tracking {
} else {
// For the currently analysed view, get the score and
// max_score of each item if it is a sco or a TOOL_QUIZ
$sql_max_score = "SELECT lp_iv.id as lp_item_view_id, lp_iv.score as score,lp_i.max_score, lp_iv.max_score as max_score_item_view, lp_i.path, lp_i.item_type, lp_i.id as iid
FROM $lp_item_view_table as lp_iv INNER JOIN $lp_item_table as lp_i ON lp_i.id = lp_iv.lp_item_id AND (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."')
WHERE lp_iv.c_id = $course_id AND
lp_i.c_id = $course_id AND
lp_view_id = $lp_view_id ";
$sql_max_score = "SELECT lp_iv.id as lp_item_view_id,
lp_iv.score as score,
lp_i.max_score,
lp_iv.max_score as max_score_item_view,
lp_i.path,
lp_i.item_type,
lp_i.id as iid
FROM $lp_item_view_table as lp_iv
INNER JOIN $lp_item_table as lp_i
ON lp_i.id = lp_iv.lp_item_id AND
lp_iv.c_id = $course_id AND
lp_i.c_id = $course_id AND
(lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."')
WHERE lp_view_id = $lp_view_id ";
if ($debug) echo $sql_max_score.'<br />';
$res_max_score = Database::query($sql_max_score);

@ -22,6 +22,7 @@ class UserGroup extends Model {
$this->usergroup_rel_user_table = Database::get_main_table(TABLE_USERGROUP_REL_USER);
$this->usergroup_rel_course_table = Database::get_main_table(TABLE_USERGROUP_REL_COURSE);
$this->usergroup_rel_session_table = Database::get_main_table(TABLE_USERGROUP_REL_SESSION);
$this->table_course = Database::get_main_table(TABLE_MAIN_COURSE);
}
public function get_count() {
@ -29,8 +30,12 @@ class UserGroup extends Model {
return $row['count'];
}
public function get_usergroup_by_course_with_data_count($course_id) {
$row = Database::select('count(*) as count', $this->usergroup_rel_course_table, array('where' => array('course_id = ?' => $course_id)), 'first');
return $row['count'];
}
public function get_id_by_name($name) {
$row = Database::select('id', $this->table, array('where' => array('name = ?', $name)),'first');
$row = Database::select('id', $this->table, array('where' => array('name = ?' => $name)),'first');
return $row['id'];
}
@ -72,8 +77,35 @@ class UserGroup extends Model {
return $array;
}
public function get_usergroup_in_course($options = array()) {
$sql = "SELECT u.* FROM {$this->usergroup_rel_course_table} usergroup
INNER JOIN {$this->table} u
ON (u.id = usergroup.usergroup_id)
INNER JOIN {$this->table_course} c
ON (usergroup.course_id = c.id)
";
$conditions = Database::parse_conditions($options);
$sql .= $conditions;
$result = Database::query($sql);
$array = Database::store_result($result, 'ASSOC');
return $array;
}
public function get_usergroup_not_in_course($options = array()) {
$sql = "SELECT DISTINCT u.* FROM {$this->usergroup_rel_course_table} usergroup
RIGHT JOIN {$this->table} u
ON (u.id = usergroup.usergroup_id)
";
$conditions = Database::parse_conditions($options);
$sql .= $conditions;
$result = Database::query($sql);
$array = Database::store_result($result, 'ASSOC');
return $array;
}
public function get_usergroup_by_course($course_id) {
$results = Database::select('usergroup_id', $this->usergroup_rel_course_table, array('where'=>array('course_id = ?'=> $course_id)));
$options = array('where' => array('course_id = ?' => $course_id));
$results = Database::select('usergroup_id', $this->usergroup_rel_course_table, $options);
$array = array();
if (!empty($results)) {
foreach($results as $row) {
@ -175,13 +207,7 @@ class UserGroup extends Model {
foreach($delete_items as $session_id) {
if (!empty($user_list)) {
foreach($user_list as $user_id) {
SessionManager::unsubscribe_user_from_session($session_id, $user_id);
/*foreach ($course_list as $course_data) {
foreach($user_list as $user_id) {
CourseManager::subscribe_user($user_id, $course_data['code'], $session_id);
}
}*/
}
}
Database::delete($this->usergroup_rel_session_table, array('usergroup_id = ? AND session_id = ?'=>array($usergroup_id, $session_id)));
@ -197,13 +223,6 @@ class UserGroup extends Model {
if (!empty($user_list)) {
SessionManager::suscribe_users_to_session($session_id, $user_list, null, false);
}
/*
$course_list = SessionManager::get_course_list_by_session_id($id);
foreach ($course_list as $course_data) {
foreach($user_list as $user_id) {
CourseManager::subscribe_user($user_id, $course_data['code'], $id);
}
}*/
}
}
}

@ -128,8 +128,7 @@ class UserManager {
/**
* Creates a new user for the platform
* @author Hugues Peeters <peeters@ipm.ucl.ac.be>,
* Roan Embrechts <roan_embrechts@yahoo.com>
*
* @author Roan Embrechts <roan_embrechts@yahoo.com>
* @param string Firstname
* @param string Lastname
* @param int Status (1 for course tutor, 5 for student, 6 for anonymous)
@ -147,10 +146,9 @@ class UserManager {
* @param array Extra fields
* @param string Encrypt method used if password is given encrypted. Set to an empty string by default
* @return mixed new user id - if the new user creation succeeds, false otherwise
*
* @desc The function tries to retrieve $_user['user_id'] from the global space.
* if it exists, $_user['user_id'] is the creator id. If a problem arises,
* it stores the error message in global $api_failureList
* @desc The function tries to retrieve $_user['user_id'] from the global space. If it exists, $_user['user_id'] is the creator id. If a problem arises, it stores the error message in global $api_failureList
* @assert ('Sam','Gamegie',5,'sam@example.com','jo','jo') > 1
* @assert ('Pippin','Took',null,null,'jo','jo') === false
*/
public static function create_user($firstName, $lastName, $status, $email, $loginName, $password, $official_code = '', $language = '', $phone = '', $picture_uri = '', $auth_source = PLATFORM_AUTH_SOURCE, $expiration_date = '0000-00-00 00:00:00', $active = 1, $hr_dept_id = 0, $extra = null, $encrypt_method = '', $send_mail = false) {
global $_user, $_configuration;

@ -804,7 +804,12 @@ class IndexManager {
$show_create_link = false;
$show_course_link = false;
$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview');
if ((api_get_setting('allow_users_to_create_courses') == 'false' && !api_is_platform_admin()) || api_is_student()) {
$display_add_course_link = false;
} else {
$display_add_course_link = true;
}
//$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview');
if ($display_add_course_link) {
$show_create_link = true;
}

@ -108,6 +108,12 @@
* @package chamilo.include
*/
/*
INIT SECTION
variables should be initialised here
*/
//require_once api_get_path(LIBRARY_PATH).'conditionallogin.lib.php'; moved to autologin
// verified if exists the username and password in session current
use \ChamiloSession as Session;
@ -569,11 +575,6 @@ if (!empty($cidReq) && (!isset($_SESSION['_cid']) or (isset($_SESSION['_cid']) &
$gidReset = true; // As groups depend from courses, group id is reset
}
// if the requested group is different from the group in session
$gid = isset($_SESSION['_gid']) ? $_SESSION['_gid'] : '';
if ($gidReq && $gidReq != $gid) {
$gidReset = true;
}
/* USER INIT */
@ -589,7 +590,7 @@ if (isset($uidReset) && $uidReset) { // session data refresh requested
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$track_e_login = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = "SELECT user.*, a.user_id is_admin, UNIX_TIMESTAMP(login.login_date) login_date
$sql = "SELECT user.*, a.user_id is_admin, login.login_date
FROM $user_table
LEFT JOIN $admin_table a
ON user.user_id = a.user_id
@ -605,17 +606,8 @@ if (isset($uidReset) && $uidReset) { // session data refresh requested
$uData = Database::fetch_array($result);
$_user ['firstName'] = $uData ['firstname' ];
$_user ['lastName' ] = $uData ['lastname' ];
$_user ['mail' ] = $uData ['email' ];
$_user ['lastLogin'] = $uData ['login_date'];
$_user ['official_code'] = $uData ['official_code'];
$_user ['picture_uri'] = $uData ['picture_uri'];
$_user ['user_id'] = $uData ['user_id'];
$_user ['language'] = $uData ['language'];
$_user ['auth_source'] = $uData ['auth_source'];
$_user ['theme'] = $uData ['theme'];
$_user ['status'] = $uData ['status'];
$_user = _api_format_user($uData, false);
$_user['lastLogin'] = api_strtotime($uData['login_date'], 'UTC');
$is_platformAdmin = (bool) (! is_null( $uData['is_admin']));
$is_allowedCreateCourse = (bool) (($uData ['status'] == COURSEMANAGER) or (api_get_setting('drhCourseManagerRights') and $uData['status'] == DRH));
@ -626,15 +618,6 @@ if (isset($uidReset) && $uidReset) { // session data refresh requested
Session::write('is_platformAdmin',$is_platformAdmin);
Session::write('is_allowedCreateCourse',$is_allowedCreateCourse);
// If request_uri is setted we have to go further to have course permissions
/*if (empty($_SESSION['request_uri']) || !isset($_SESSION['request_uri'])) {
if (isset($_SESSION['noredirection'])) {
//If we just want to reset info without redirecting user
unset($_SESSION['noredirection']);
} else {
LoginRedirection::redirect();
}
}*/
} else {
header('location:'.api_get_path(WEB_PATH));
//exit("WARNING UNDEFINED UID !! ");
@ -685,6 +668,11 @@ if (isset($cidReset) && $cidReset) {
Session::erase('id_session');
}
if (!empty($_GET['gidReq'])) {
$_SESSION['_gid'] = intval($_GET['gidReq']);
} else {
Session::erase('_gid');
}
if (!isset($_SESSION['login_as'])) {
//Course login
@ -717,6 +705,9 @@ if (isset($cidReset) && $cidReset) {
Session::erase('id_session');
Session::erase('session_name');
}
if (api_get_group_id()) {
Session::erase('_gid');
}
}
} else {
@ -752,6 +743,9 @@ if (isset($cidReset) && $cidReset) {
$_SESSION['id_session'] = intval($_GET['id_session']);
}
if (!empty($_REQUEST['gidReq'])) {
$_SESSION['_gid'] = intval($_REQUEST['gidReq']);
}
if (!isset($_SESSION['login_as'])) {
$save_course_access = true;
@ -813,6 +807,11 @@ if (isset($cidReset) && $cidReset) {
}
}
// if the requested group is different from the group in session
$gid = isset($_SESSION['_gid']) ? $_SESSION['_gid'] : '';
if (isset($gidReq) && $gidReq != $gid) {
$gidReset = true;
}
/* COURSE / USER REL. INIT */
$session_id = api_get_session_id();

@ -110,7 +110,7 @@ error_reporting(E_ALL);
// Upgrading from any subversion of 1.6 is just like upgrading from 1.6.5
$update_from_version_6 = array('1.6', '1.6.1', '1.6.2', '1.6.3', '1.6.4', '1.6.5');
// Upgrading from any subversion of 1.8 avoids the additional step of upgrading from 1.6
$update_from_version_8 = array('1.8', '1.8.2', '1.8.3', '1.8.4', '1.8.5', '1.8.6', '1.8.6.1', '1.8.6.2','1.8.7','1.8.7.1','1.8.8','1.8.8.2', '1.8.8.4', '1.8.8.6', '1.9.0');
$update_from_version_8 = array('1.8', '1.8.2', '1.8.3', '1.8.4', '1.8.5', '1.8.6', '1.8.6.1', '1.8.6.2','1.8.7','1.8.7.1','1.8.8','1.8.8.2', '1.8.8.4', '1.8.8.6', '1.9.0', '1.9.2');
$my_old_version = '';
$tmp_version = get_config_param('dokeos_version');

@ -1517,7 +1517,7 @@ function get_contact_registration_form() {
</div>
<div class="control-group">
<label class="control-label"><span class="form_required">*</span>'.get_lang('Email').'</label>
<div class="controls"><input id="person_name" type="text" name="person_email" size="30" /></div>
<div class="controls"><input id="person_email" type="text" name="person_email" size="30" /></div>
</div>
<div class="control-group">
<label class="control-label"><span class="form_required">*</span>'.get_lang('CompanyName').'</label>

@ -976,6 +976,7 @@ $NumberOfCoursesPrivate = "Number of private courses";
$NumberOfCoursesClosed = "Number of closed courses";
$NumberOfCoursesTotal = "Total number of courses";
$NumberOfUsersActive = "Number of active users";
$ReturnToCourseList = "Return to the course list";
$dateFormatShortNumberNoYear = "%d/%m";
$CourseTutor = "Course tutor";
$StudentInSessionCourse = "Student in session course";
@ -1003,13 +1004,13 @@ $YouMustAcceptLicence = "You must accept the licence";
$SelectOne = "Select one";
$ContactInformationHasBeenSent = "Contact information has been sent";
$UserInactivedSinceX = "User inactive since %s";
$ContactInformationDescription = "Dear user,<br />
<br />You are about to start using one of the best open-source e-learning platform on the market. Like many other open-source project, this project is backed up by a large community of students, teachers, developers and content creators who would like to promote the project better.<br />
<br />
By knowing a little bit more about you, one of our most important users, who will manage this e-learning system, we will be able to let people know that our software is used and let you know when we organize events that might be relevant to you.<br />
<br />
By filling this form, you accept that the Chamilo association or its members might send you information by e-mail about important events or updates in the Chamilo software or community. This will help the community grow as an organized entity where information flow, with a permanent respect of your time and your privacy.<br />
<br />
$ContactInformationDescription = "Dear user,<br />
<br />You are about to start using one of the best open-source e-learning platform on the market. Like many other open-source project, this project is backed up by a large community of students, teachers, developers and content creators who would like to promote the project better.<br />
<br />
By knowing a little bit more about you, one of our most important users, who will manage this e-learning system, we will be able to let people know that our software is used and let you know when we organize events that might be relevant to you.<br />
<br />
By filling this form, you accept that the Chamilo association or its members might send you information by e-mail about important events or updates in the Chamilo software or community. This will help the community grow as an organized entity where information flow, with a permanent respect of your time and your privacy.<br />
<br />
Please note that you are <b>not required</b> to fill this form. If you want to remain anonymous, we will loose the opportunity to offer you all the privileges of being a registered portal administrator, but we will respect your decision. Simply leave this form empty and click \"Next\".<br /><br />";
$CompanyActivity = "Your company's activity";
$DateUnLock = "Unlock date";
@ -1215,7 +1216,7 @@ $SaveForNow = "Save and continue later";
$NoQuicktime = "Your browser does not have the QuickTime plugin installed. You can still use the platform, but to run a larger number of media file types, we suggest you might want to install it.";
$NoJavaSun = "Your browser doesn't seem to have the Sun Java plugin installed. You can still use the platform, but you will lose a few of its capabilities.";
$NoJava = "Your browser does not support Java";
$JavaSun24 = "Your browser has a Java version not supported by this tool.
$JavaSun24 = "Your browser has a Java version not supported by this tool.
To use it you have to install a Java Sun version higher than 24";
$NoMessageAnywere = "If you do not want to see this message again during this session, click here";
$Attempts = "Attempts";
@ -1379,4 +1380,5 @@ $DataTableSearch = "Search";
$HideColumn = "Hide column";
$DisplayColumn = "Show column";
$LegalAgreementAccepted = "Legal agreement accepted";
$dateFormatLongNoDay = "%d %B %Y";
?>

@ -77,5 +77,6 @@ $Username = "Nom d'utilisateur";
$GoAheadAndBrowseOurCourseCatalogXOnceRegisteredYouWillSeeTheCourseHereX = "Révisez notre catalogue de cours %s pour vous inscrire à votre cours préféré. Une fois inscrit(e), votre cours apparaîtra %s, à la place de ce message.";
$HelloXAsYouCanSeeYourCourseListIsEmpty = "Bonjour %s, nous vous souhaitons la bienvenue,<br />
Comme vous pouvez le voir, votre liste de cours est vide. C'est parce que vous ne nous êtes pas encore inscrit à un cours!";
$PleaseAllowUsALittleTimeToSubscribeYouToOneOfOurCourses = "Merci de nous donner un moment pour vous inscrire à l'un de nos cours. Si vous pensez avoir été oublié, merci de contacter les administrateurs du site. Vous pouvez généralement trouver leurs informations de contact dans le pied de page.";
$Profile = "Profil";
?>

@ -976,6 +976,13 @@ $NumberOfCoursesPrivate = "Nombre de cours privés";
$NumberOfCoursesClosed = "Nombre de cours fermés";
$NumberOfCoursesTotal = "Nombre total de cours";
$NumberOfUsersActive = "Nombre d'utilisateurs actifs";
$ReturnToCourseList = "Retour liste de cours";
$dateFormatShortNumberNoYear = "%d/%m";
$CourseTutor = "Tuteur de cours";
$StudentInSessionCourse = "Étudiant dans cours de session";
$StudentInCourse = "Étudiant dans le cours";
$SessionGeneralCoach = "Tuteur général de la session";
$SessionCourseCoach = "Tuteur de cours dans la session";
$Admin = "Admin";
$UserNotAttendedSymbol = "NP";
$UserAttendedSymbol = "P";

@ -1256,6 +1256,8 @@ $SessionStartDate = "Datum pričetka dostopa";
$SessionDisplayEndDate = "Prikazan datum zaključka";
$SessionDisplayStartDate = "Prikazan datum začetka";
$UserHasNoCourse = "Ta uporabnik ni vpisan v noben tečaj";
$SessionTutorsCanSeeExpiredSessionsResultsComment = "Ali bo tutor seje videl poročila seje po tem, ko bo seja pretekla!?";
$SessionTutorsCanSeeExpiredSessionsResultsTitle = "Vidnost poročil tutorja seje";
$TheXMLImportLetYouAddMoreInfoAndCreateResources = "XML uvoz omogoča dodajanje več informacije in hkrati pri uvozu ustvari zahtevane elemente (tečaje, uporabnike). CSV uvoz zgolj kreira seje in omogoča prirejanje obstoječih resursov sejam.";
$ShowLinkBugNotificationTitle = "Pokoži povezavo za poročanje o napakah";
$ShowLinkBugNotificationComment = "V glavi prikaže povezavo na stran za poročanje o napakah (http://support.chamilo.org). S klikom na povezavo se prestavite na podporno stran z Wiki stranjo, ki opisuje proces poročanja o odkritih napakah.";

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

Loading…
Cancel
Save