diff --git a/documentation/changelog.html b/documentation/changelog.html
index 1b0efb83f3..dcf47a4913 100644
--- a/documentation/changelog.html
+++ b/documentation/changelog.html
@@ -61,6 +61,119 @@
+Chamilo 1.9.4 - , 15th of November, 2012
+Release notes - summary
+Chamilo 1.9.4 is a minor stable version with a series of improvements on top of 1.9.2.
+
+Release name
+
+New Features
+
+Improvements
+
+Debugging
+
+
+
+Chamilo 1.9.2 - Hanga Roa, 27th of September, 2012
+Release notes - summary
+Chamilo 1.9.2 is a minor stable version with a series of improvements on top of 1.9.0.
+
+Release name
+Hanga Roa 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...
+
+New Features
+
+ Course home: Allow for the publication of direct links to learning paths in the sessions (#3367)
+ Global: We now show th teacher's professional "card" when clicking on the teacher's name in the courses list (#3388)
+ Global: Added option to send the student to the courses catalog the first time he logs in (#3898)
+ Exercises: Added "success score" to exercises (#4541)
+ Exercises: Added automated distribution of score in specific question type (#4656)
+ Attendances: Added PDF + print button to attendance sheets (#5069)
+ Assignments: Users can now see if they have already uploaded their assignment (#5145)
+ Global: Added a course-specific registration link to increase speed of auto-registration (#5299)
+ Exercises: Success score for an exercise can now be set manually to allow for specific percentages (#5330)
+ Documents: The images and audio integrated apps now check available space left on disk before saving (#5346)
+ Sessions: Added an "official" start and end date to the sessions
+ 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)
+ Users: Added the possibility for teachers to add students to their course through users classes (#5514)
+
+Improvements
+
+ Exercises: Exercises and questions can now be copied inside or between courses, and be better included into learning paths (#651)
+ Global: Improved WYSIWYG behaviour, now more natural (#1780)
+ Interface: The action icons bar was improved (#2810)
+ Social network: Added an icon to show whether users are on- or offline (#3316)
+ Exercises: Improved interface in true/false/don't know question type (#3370)
+ Learning paths: Fixed a series of small issues with the learning paths edition page (#3533)
+ Global: Improvements on various timezone issues (#3747)
+ Exercises: The test description now only shows on the test start page (#3845)
+ Global: Fixed CSS positionning problem (#4075)
+ Learning paths: Improved error message for too large SCORM files (#4142)
+ Attendances: Reduced steps to create attendance sheets (#4484)
+ Forum: E-mail notifications can now be sent daily only (#4761)
+ Plugins: Improved the BBB 0.8 plugin (#4840 & #5312)
+ Global: Enabled custom pages feature, which allows the system to server specific pages after login to specific user roles (#4850)
+ Survey: Added surveys in item_property tracking (#4923)
+ Global: Disable auto-capitalize when using mobile phones (#5116)
+ Agenda: Improved the personal agenda items system (#5201)
+ Global: Added a link for portal admins to hide the "Popular courses" block (#5268)
+ Social network: Deleting private messages now requires confirmation (#5269)
+ Global: Invalid address errors are now saved to the default error log (#5306)
+ Exercises: Exercises with a pass % of 0 disable the pass % feature (#5383)
+ Exercises: Small aesthetics improvements for true/false/dunno answer type (#5385)
+ Users: Added the registration date in the users lists tables (#5473)
+ Course copy: Improved error message on missing file (#5515)
+ Exercises: Added grey icon for audio questions when exercise is bloqued (#5516)
+
+Debugging
+
+ Global: Fixed a bug with XLS export encoding (#1831)
+ Documents: Fixed bug editing jpg/png with SVGedit (#3261)
+ Exercises: Fixed missing reports on some questions in test feedback (#3347)
+ Learning paths: Fixed tab-switching issue in LP edition (#3352)
+ Assignments: Fixed issue by which students could send assignments passed the end date (#3918)
+ Global: Fixed issue by which password reminder stopped working in some cases (#4032)
+ Global: Fixed bug by which users lost their sessions when the Wiris plugin was enabled (#4468)
+ Assessments: Fixed issue with the QR code generation in certificates (#5015)
+ Plugins: Fixed issue when installing the BBB plugin when using subdirectories (#5103)
+ Learning paths: Fixed the learning path tracking reset buttong (#5239)
+ Learning paths: Fixed issue with HotPotatoes files paths being shown (#5253)
+ Learning paths: Fixed blanck page when editing a document without title (#5265)
+ Learning paths: Fixed issues in learning paths export (#5286)
+ Social network: Fixed chat box remaining enabled when social network is not (#5295)
+ Exercises: Fixed issue with exercise's start time not being saved (#5301)
+ Migration: Fixed courses disappearing when migrating from 1.8 to 1.9 (#5302)
+ Global: Fixed font preview being different from the final result (#5303)
+ Exercises: Fixed very rare case where the expiration of time when reviewing questions with delete results (#5304)
+ Exercises: Fixed display bug in modal results window (#5311)
+ Social network: Fixed wrong extra text field in reply form in social messaging (#5327)
+ Learning paths: Fixed a fatal error in learner reporting (#5347)
+ Agenda: Fixed wrong month in calendar event popup (#5348)
+ Global: Fixed issue by which profile fields of type select did not unfold (#5351)
+ Sessions: Fixed issue by which access delays did not influence the visibility in courses list (#5353)
+ Global: Fixed online e-mail editor setting (#5356)
+ Exercises: Fixed but in exercises scenario (#5375)
+ Exercixes: Fixed issue with open questions (#5434)
+ Global: Fixed issue when enabling openid without the right config in the right place (#5463)
+ Assignments: Fixed SQL error when adding an assignment (#5484)
+ Global: Fixed FCKEditor error in assessments model creation (#5490)
+ Global: Fixed courses backup (broken by the implementation of forum backup) (#5499)
+ Assessments: Qualification's icon did not appear on tasks (#5517)
+ Exercises: Fixed issue with reviewed question and 0 score (#5517)
+ Global: Fixed missing student view button (#5528)
+ Survey: Fixed issue sending survey invitations by e-mail (#5529)
+ Admin: Fixed name clash between home-made function http_request() and a pre-defined http_request() function (#5531)
+ Users: Problem accessing the course groups (#5537)
+ Social network: An user could not modify its own official code, even if configured to be possible (#5538)
+
+
Chamilo 1.9.0 - Vogüé, 31st of July, 2012
Release notes - summary
diff --git a/documentation/credits.html b/documentation/credits.html
index 82d84f38a8..04b3a8116d 100644
--- a/documentation/credits.html
+++ b/documentation/credits.html
@@ -124,6 +124,9 @@ In the following credits, when possible, we tried to put the latest contributors
Quality Assurance
Yannick Warnier as QA coordinator
+ Yoselyn Castillo
+ Jeremy Saavedra
+ Coursenligne on the forum
Noa Orizales, through numerous implementations in Spain
Hector Lacherre and colleagues from USIL, Lima
Carlos Vargas
@@ -136,6 +139,7 @@ In the following credits, when possible, we tried to put the latest contributors
Yannick Warnier - implementation of CDN, SQL improvements, memcached and documentation in the optimization guide
Ivan Tcholakov - language loading performances improvements in 1.8
+ Julio Montoya
Arnaud Ligot
Jérôme Warnier
Ludwig Chauvin
@@ -655,6 +659,8 @@ There are too much translators to list them all. Please check http://translate.c
Henri Hedman, for bug reports in LMS 1.9
Ludovic Gasc, France, for optimization patch in LMS 1.9
Juho Paranko, Finland, for bug reports in LMS 1.9
+ Jeremy Saavedra, for bug reports in LMS 1.9.2
+ Ricel Leite, for bug reports and fixes in LMS 1.9.4
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
@@ -679,6 +685,8 @@ These institutions and companies have either contributed to the Chamilo project
Commission Scolaire des Hautes-Rivières, project TIC-FP, Canada
ACTA VZW, Belgium
NoSoloRed, Spain
+ ICPNA, Peru
+ Universidad Autónoma, Chile
diff --git a/documentation/installation_guide.html b/documentation/installation_guide.html
index edb21aeb7f..50d61b97fd 100644
--- a/documentation/installation_guide.html
+++ b/documentation/installation_guide.html
@@ -299,7 +299,7 @@ date.timezone = 'America/New_York'
3. Upgrade from a
-previous version of Chamilo LMS (1.*) or Dok€os (<2.0)
+previous version of Chamilo LMS (1.*) or Dok€os (<2.0)
Before upgrading, we heavily 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.
diff --git a/documentation/optimization.html b/documentation/optimization.html
index f66c91f02c..a9671859dc 100644
--- a/documentation/optimization.html
+++ b/documentation/optimization.html
@@ -9,7 +9,7 @@
-
Chamilo 1.8.8.4 : Optimization Guide
+
Chamilo : Optimization Guide
Documentation > Optimization Guide
diff --git a/main/admin/add_courses_to_usergroup.php b/main/admin/add_courses_to_usergroup.php
index 4b8adc4d71..bce7881345 100644
--- a/main/admin/add_courses_to_usergroup.php
+++ b/main/admin/add_courses_to_usergroup.php
@@ -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 .= '
'.$row['title'].' ('.$row['code'].') ';
+ $return .= '
'.$row['title'].' ('.$row['visual_code'].') ';
}
}
$return .= '';
diff --git a/main/admin/configure_homepage.php b/main/admin/configure_homepage.php
index b4d505f6c2..2877dc580f 100644
--- a/main/admin/configure_homepage.php
+++ b/main/admin/configure_homepage.php
@@ -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, "
$notice_title \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)) {
diff --git a/main/admin/course_category.php b/main/admin/course_category.php
index b6f48d9059..dc1bec913b 100644
--- a/main/admin/course_category.php
+++ b/main/admin/course_category.php
@@ -1,19 +1,19 @@
'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') {
- ?>
-
- addElement('header', '', $form_title);
- $form->display();
- ?>
-
-
-
-
-0){
- $parent_id=Database::fetch_array($result);
- }
+if ($action == 'add' || $action == 'edit') {
+ ?>
+
+ addElement('header', '', $form_title);
+ $form->display();
+ ?>
+
+
+
+
+ 0) {
+ $parent_id = Database::fetch_array($result);
+ }
+
+ $parent_id['parent_id'] ? $link = ' (' . $parent_id['parent_id'] . ')' : $link = '';
+ ?>
+
+
+
+
+
+
+
+
+
+ 0) {
+ foreach ($Categories as $enreg) {
+ ?>
+
+
+
+
+
+
+ ( - )
+
+
+
+
+
+
+
+Display::display_footer();
-
+/* * ****** Functions ******* */
-
-
-
-
-
+function deleteNode($node) {
+ global $tbl_category, $tbl_course;
+ $node = Database::escape_string($node);
-0)
-{
- foreach($Categories as $enreg)
- {
- ?>
-
-
-
-
-
-
- ( - )
-
-
-
+ $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'");
- '".$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);
}
\ No newline at end of file
diff --git a/main/admin/index.php b/main/admin/index.php
index 3334671628..3d15c58bca 100644
--- a/main/admin/index.php
+++ b/main/admin/index.php
@@ -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) ? '?' : '';
diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php
index 987379734f..1bb37e2c81 100644
--- a/main/admin/settings.lib.php
+++ b/main/admin/settings.lib.php
@@ -210,19 +210,20 @@ function handle_stylesheets() {
echo '
';
}
- $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'];
}
diff --git a/main/admin/sub_language.class.php b/main/admin/sub_language.class.php
index e7f8d1f12b..9c93f1bb5e 100644
--- a/main/admin/sub_language.class.php
+++ b/main/admin/sub_language.class.php
@@ -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;
}
/**
diff --git a/main/admin/usergroup_export.php b/main/admin/usergroup_export.php
index a8f8f1ec0d..96d78f9cc9 100644
--- a/main/admin/usergroup_export.php
+++ b/main/admin/usergroup_export.php
@@ -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();
diff --git a/main/admin/usergroup_user_import.php b/main/admin/usergroup_user_import.php
index 231be401c2..9ad5d4104c 100644
--- a/main/admin/usergroup_user_import.php
+++ b/main/admin/usergroup_user_import.php
@@ -1,69 +1,69 @@
$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.' ', 'normal', false);
- $message .= Display::return_message(get_lang('Users').': '.implode(', ', $user_list_name));
-
- return $message;
-
+ $message .= Display::return_message(get_lang('Class') . ': ' . $class_name . ' ', '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'].'';
+ $error_message .= get_lang('Line') . ' ' . $error_class_user['line'] . ': ' . $error_class_user['error'] . '';
$error_message .= " ";
}
$error_message .= "\n";
@@ -208,7 +181,7 @@ if (count($errors) != 0) {
}
$form->display();
?>
- :
+ :
UserName ;ClassName
jdoe;class01
diff --git a/main/announcements/announcements.inc.php b/main/announcements/announcements.inc.php
index 608aa809d4..d3468b8552 100644
--- a/main/announcements/announcements.inc.php
+++ b/main/announcements/announcements.inc.php
@@ -604,7 +604,7 @@ class AnnouncementManager {
*/
public static function construct_not_selected_select_form($group_list = null, $user_list = null, $to_already_selected) {
- echo "";
+ echo '';
// 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 "";
+ echo '';
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);
}
diff --git a/main/announcements/announcements.php b/main/announcements/announcements.php
index 59fcb5c6d9..bad862c0a1 100644
--- a/main/announcements/announcements.php
+++ b/main/announcements/announcements.php
@@ -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();
-}
+}
\ No newline at end of file
diff --git a/main/auth/external_login/functions.inc.php b/main/auth/external_login/functions.inc.php
index 6d306e2e10..5b85785d97 100644
--- a/main/auth/external_login/functions.inc.php
+++ b/main/auth/external_login/functions.inc.php
@@ -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']) )
diff --git a/main/auth/external_login/login.ldap.php b/main/auth/external_login/login.ldap.php
index 8e01546699..5c462aa12f 100644
--- a/main/auth/external_login/login.ldap.php
+++ b/main/auth/external_login/login.ldap.php
@@ -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']);
-}
\ No newline at end of file
+}
diff --git a/main/auth/external_login/newUser.ldap.php b/main/auth/external_login/newUser.ldap.php
index cfc504d91f..12f62e9c31 100644
--- a/main/auth/external_login/newUser.ldap.php
+++ b/main/auth/external_login/newUser.ldap.php
@@ -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']);
-}
\ No newline at end of file
+}
diff --git a/main/auth/profile.php b/main/auth/profile.php
index 6086c53b7f..954b25dd37 100644
--- a/main/auth/profile.php
+++ b/main/auth/profile.php
@@ -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[] = ' 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);
diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php
index dfdd9b5b15..a5c292046b 100644
--- a/main/course_progress/thematic_controller.php
+++ b/main/course_progress/thematic_controller.php
@@ -1,4 +1,5 @@
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 .= ''.$plan['title']. ' '.$plan['description'].' ';
+ $plan_html .= '' . $plan['title'] . ' ' . $plan['description'] . ' ';
}
}
- $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'].' '.$advance['content'].' ';
+ foreach ($data as $advance) {
+ $advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG) . ' ('.$advance['duration'].' '.get_lang('HourShort').') '.$advance['content'].' ';
}
- }
+ }
$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;$iset_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();
+ }
+
}
\ No newline at end of file
diff --git a/main/coursecopy/classes/Course.class.php b/main/coursecopy/classes/Course.class.php
index bba526c04c..c4e63efe60 100644
--- a/main/coursecopy/classes/Course.class.php
+++ b/main/coursecopy/classes/Course.class.php
@@ -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 = '';
diff --git a/main/coursecopy/classes/CourseBuilder.class.php b/main/coursecopy/classes/CourseBuilder.class.php
index 8e64208493..8ae8604e62 100644
--- a/main/coursecopy/classes/CourseBuilder.class.php
+++ b/main/coursecopy/classes/CourseBuilder.class.php
@@ -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);
diff --git a/main/coursecopy/classes/CourseRestorer.class.php b/main/coursecopy/classes/CourseRestorer.class.php
index 7be71a8d2d..c34081979f 100644
--- a/main/coursecopy/classes/CourseRestorer.class.php
+++ b/main/coursecopy/classes/CourseRestorer.class.php
@@ -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);
diff --git a/main/coursecopy/classes/CourseSelectForm.class.php b/main/coursecopy/classes/CourseSelectForm.class.php
index b8de02b726..d7c7673f45 100644
--- a/main/coursecopy/classes/CourseSelectForm.class.php
+++ b/main/coursecopy/classes/CourseSelectForm.class.php
@@ -140,14 +140,7 @@ class CourseSelectForm
echo get_lang('DestinationCourse').' : '.$course_infos['title'];
echo '';
}
-
- echo '';
- echo get_lang('SelectResources');
- echo '
';
-
- Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt'));
-
- echo '';
+ echo '';
echo '';
echo '';
echo '
';
}
-}
+}
\ No newline at end of file
diff --git a/main/css/base.css b/main/css/base.css
index a9b5cc2887..ce27eb8100 100644
--- a/main/css/base.css
+++ b/main/css/base.css
@@ -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;
diff --git a/main/document/document.inc.php b/main/document/document.inc.php
index bcccdfc611..8d9eb3a0c1 100644
--- a/main/document/document.inc.php
+++ b/main/document/document.inc.php
@@ -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(' ', count($path_parts) - 2).' — '.$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(' ', count($path_parts) - 2).' — '.$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)?'':''.Display::return_icon($forcedownload_icon, get_lang('Download'), array(),ICON_SIZE_SMALL).' ';
}
- //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') {
diff --git a/main/document/document.php b/main/document/document.php
index 1c85bc5fe8..e0931aad8c 100644
--- a/main/document/document.php
+++ b/main/document/document.php
@@ -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).' '.$last_edit_date."
";
$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'));
diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php
index e5a6e965ac..aa34a8f366 100644
--- a/main/exercice/exercice.php
+++ b/main/exercice/exercice.php
@@ -870,7 +870,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
if ($active == 1) {
$nbrActiveTests = $nbrActiveTests +1;
$item .= Display::tag('td', ''.$title.' ');
- $item .= Display::tag('td', '');
+ //$item .= Display::tag('td', '');
$actions ='' . Display :: return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_SMALL).' ';
$item .= Display::tag('td', $actions);
echo Display::tag('tr',$item, array('class'=>$class));
diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php
index 19267b34d7..a6fe8b2683 100644
--- a/main/exercice/exercise.class.php
+++ b/main/exercice/exercise.class.php
@@ -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."'";
diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php
index 3688c724e3..2ebb1b4cc0 100644
--- a/main/exercice/exercise.lib.php
+++ b/main/exercice/exercise.lib.php
@@ -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(' ', '', $value);
- }
- $answer = api_preg_replace('/\['.$teacher_item.'+\]/', Display::input('text', "choice[$questionId][]", $value), $answer);
- }
+
+ if (!empty($value[0])) {
+ $value = str_replace(' ', '', 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 .= ''.$answer.' ';
} 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;
}
diff --git a/main/exercice/exercise_admin.php b/main/exercice/exercise_admin.php
index aef615e423..5a4ea7648f 100644
--- a/main/exercice/exercise_admin.php
+++ b/main/exercice/exercise_admin.php
@@ -27,7 +27,7 @@ if(!api_is_allowed_to_edit(null,true)) {
api_not_allowed(true);
}
-$htmlHeadXtra[] = '';
- // to correct #4029 Random and number of attempt menu empty added window.onload=advanced_parameters;
-$htmlHeadXtra[] = '';
// 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 "".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM)." ";
- }
- else{
-
+ } else {
echo '' . Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).' ';
}
}
diff --git a/main/exercice/exercise_report.php b/main/exercice/exercise_report.php
index 8aed804efc..2bc1dfbe2b 100644
--- a/main/exercice/exercise_report.php
+++ b/main/exercice/exercise_report.php
@@ -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 = ''.get_lang('DearStudentEmailIntroduction') . '
'.get_lang('AttemptVCC');
+ $message .= '
'.get_lang('CourseName'). ' '.Security::remove_XSS($course_info['name']).'';
+ $message .= '
'.get_lang('Exercise') . ' '.Security::remove_XSS($test);
+
+ //Only for exercises not in a LP
+ if ($lp_id == 0) {
+ $message .= '
'.get_lang('ClickLinkToViewComment') . ' #url# ';
+ }
- //@todo move this somewhere else
- $subject = get_lang('ExamSheetVCC');
-
- $message = '
'.get_lang('DearStudentEmailIntroduction') . '
'.get_lang('AttemptVCC');
- $message .= '
'.get_lang('CourseName'). ' '.Security::remove_XSS($course_info['name']).'';
- $message .= '
'.get_lang('Exercise') . ' '.Security::remove_XSS($test);
-
- //Only for exercises not in a LP
- if ($lp_id == 0) {
- $message .= '
'.get_lang('ClickLinkToViewComment') . ' #url# ';
+ $message .= '
'.get_lang('Regards').'
';
+ $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 .= ''.get_lang('Regards').'
';
- $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 = '
-
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;
\ No newline at end of file
diff --git a/main/exercice/hotspot_admin.inc.php b/main/exercice/hotspot_admin.inc.php
index 8b1ee6aa4d..bd661b9ef0 100644
--- a/main/exercice/hotspot_admin.inc.php
+++ b/main/exercice/hotspot_admin.inc.php
@@ -6,36 +6,38 @@
* @package chamilo.exercise
* @author Toon Keppens
*/
+
/**
* Code
* ALLOWED_TO_INCLUDE is defined in admin.php
*/
-
use \ChamiloSession as Session;
if (!defined('ALLOWED_TO_INCLUDE')) {
- exit();
+ exit();
}
$modifyAnswers = intval($_GET['hotspotadmin']);
if (!is_object($objQuestion)) {
- $objQuestion = Question :: read($modifyAnswers);
+ $objQuestion = Question :: read($modifyAnswers);
}
-$questionName = $objQuestion->selectTitle();
-$answerType = $objQuestion->selectType();
-$pictureName = $objQuestion->selectPicture();
+$questionName = $objQuestion->selectTitle();
+$answerType = $objQuestion->selectType();
+$pictureName = $objQuestion->selectPicture();
$debug = 0; // debug variable to get where we are
-$okPicture = empty($pictureName)?false:true;
+$okPicture = empty($pictureName) ? false : true;
// if we come from the warning box "this question is used in serveral exercises"
-if ($modifyIn) {
- if($debug>0){echo '$modifyIn was set'." \n";}
+if ($modifyIn) {
+ if ($debug > 0) {
+ echo '$modifyIn was set' . " \n";
+ }
// if the user has chosed to modify the question only in the current exercise
if ($modifyIn == 'thisExercise') {
// duplicates the question
- $questionId=$objQuestion->duplicate();
+ $questionId = $objQuestion->duplicate();
// deletes the old question
$objQuestion->delete($exerciseId);
@@ -57,943 +59,948 @@ if ($modifyIn) {
// construction of the duplicated Answers
- $objAnswer=new Answer($questionId);
+ $objAnswer = new Answer($questionId);
}
- $color = unserialize($color);
- $reponse = unserialize($reponse);
- $comment = unserialize($comment);
- $weighting = unserialize($weighting);
- $hotspot_coordinates= unserialize($hotspot_coordinates);
- $hotspot_type = unserialize($hotspot_type);
- $destination = unserialize($destination);
+ $color = unserialize($color);
+ $reponse = unserialize($reponse);
+ $comment = unserialize($comment);
+ $weighting = unserialize($weighting);
+ $hotspot_coordinates = unserialize($hotspot_coordinates);
+ $hotspot_type = unserialize($hotspot_type);
+ $destination = unserialize($destination);
unset($buttonBack);
}
-$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$exerciseId;
+$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId;
// the answer form has been submitted
if ($submitAnswers || $buttonBack) {
-
- if ($answerType==HOT_SPOT) {
-
- if($debug>0){echo '$submitAnswers or $buttonBack was set'." \n";}
- $questionWeighting=$nbrGoodAnswers=0;
- for($i=1;$i <= $nbrAnswers;$i++) {
- if($debug>0){echo str_repeat(' ',4).'$answerType is HOT_SPOT'." \n";}
-
- $reponse[$i]=trim($reponse[$i]);
- $comment[$i]=trim($comment[$i]);
- $weighting[$i]=$weighting[$i]; // it can be float
-
- // checks if field is empty
- if(empty($reponse[$i]) && $reponse[$i] != '0') {
- $msgErr=get_lang('HotspotGiveAnswers');
-
- // clears answers already recorded into the Answer object
- $objAnswer->cancel();
- break;
- }
-
- if($weighting[$i] <= 0) {
- $msgErr=get_lang('HotspotWeightingError');
- // clears answers already recorded into the Answer object
- $objAnswer->cancel();
- break;
- }
-
- if($hotspot_coordinates[$i] == '0;0|0|0' || empty($hotspot_coordinates[$i])) {
- $msgErr=get_lang('HotspotNotDrawn');
- // clears answers already recorded into the Answer object
- $objAnswer->cancel();
- break;
- }
-
- } // end for()
-
-
- if (empty($msgErr)) {
- for($i=1;$i <= $nbrAnswers;$i++) {
- if($debug>0){echo str_repeat(' ',4).'$answerType is HOT_SPOT'." \n";}
- $reponse[$i]=trim($reponse[$i]);
- $comment[$i]=trim($comment[$i]);
- $weighting[$i]=($weighting[$i]); //it can be float
- if($weighting[$i]) {
- $questionWeighting+=$weighting[$i];
- }
- // creates answer
- $objAnswer->createAnswer($reponse[$i], '',$comment[$i],$weighting[$i],$i,$hotspot_coordinates[$i],$hotspot_type[$i]);
- } // end for()
- // saves the answers into the data base
- $objAnswer->save();
-
- // sets the total weighting of the question
- $objQuestion->updateWeighting($questionWeighting);
- $objQuestion->save($exerciseId);
-
- $editQuestion=$questionId;
- unset($modifyAnswers);
- echo '';
-
- }
- if($debug>0){echo '$modifyIn was set - end'." \n";}
- } else {
+
+ if ($answerType == HOT_SPOT) {
+
+ if ($debug > 0) {
+ echo '$submitAnswers or $buttonBack was set' . " \n";
+ }
+ $questionWeighting = $nbrGoodAnswers = 0;
+ for ($i = 1; $i <= $nbrAnswers; $i++) {
+ if ($debug > 0) {
+ echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . " \n";
+ }
+ $reponse[$i] = trim($reponse[$i]);
+ $comment[$i] = trim($comment[$i]);
+ $weighting[$i] = $weighting[$i]; // it can be float
+ // checks if field is empty
+ if (empty($reponse[$i]) && $reponse[$i] != '0') {
+ $msgErr = get_lang('HotspotGiveAnswers');
+
+ // clears answers already recorded into the Answer object
+ $objAnswer->cancel();
+ break;
+ }
+
+ if ($weighting[$i] <= 0) {
+ $msgErr = get_lang('HotspotWeightingError');
+ // clears answers already recorded into the Answer object
+ $objAnswer->cancel();
+ break;
+ }
+
+ if ($hotspot_coordinates[$i] == '0;0|0|0' || empty($hotspot_coordinates[$i])) {
+ $msgErr = get_lang('HotspotNotDrawn');
+ // clears answers already recorded into the Answer object
+ $objAnswer->cancel();
+ break;
+ }
+ } // end for()
+
+ if (empty($msgErr)) {
+ for ($i = 1; $i <= $nbrAnswers; $i++) {
+ if ($debug > 0) {
+ echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . " \n";
+ }
+ $reponse[$i] = trim($reponse[$i]);
+ $comment[$i] = trim($comment[$i]);
+ $weighting[$i] = ($weighting[$i]); //it can be float
+ if ($weighting[$i]) {
+ $questionWeighting+=$weighting[$i];
+ }
+ // creates answer
+ $objAnswer->createAnswer($reponse[$i], '', $comment[$i], $weighting[$i], $i, $hotspot_coordinates[$i], $hotspot_type[$i]);
+ } // end for()
+ // saves the answers into the data base
+ $objAnswer->save();
+
+ // sets the total weighting of the question
+ $objQuestion->updateWeighting($questionWeighting);
+ $objQuestion->save($exerciseId);
+
+ $editQuestion = $questionId;
+ unset($modifyAnswers);
+ echo '';
+ }
+ if ($debug > 0) {
+ echo '$modifyIn was set - end' . " \n";
+ }
+ } else {
+
+ if ($debug > 0) {
+ echo '$submitAnswers or $buttonBack was set' . " \n";
+ }
+ $questionWeighting = $nbrGoodAnswers = 0;
+ $select_question = $_POST['select_question'];
+ $try = $_POST['try'];
+ $url = $_POST['url'];
+ $destination = array();
+
+ $threadhold1 = $_POST['threadhold1'];
+ $threadhold2 = $_POST['threadhold2'];
+ $threadhold3 = $_POST['threadhold3'];
+
+ for ($i = 1; $i <= $nbrAnswers; $i++) {
+ if ($debug > 0) {
+ echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . " \n";
+ }
+
+ $reponse[$i] = trim($reponse[$i]);
+ $comment[$i] = trim($comment[$i]);
+ $weighting[$i] = $weighting[$i];
+
+ if (empty($threadhold1[$i]))
+ $threadhold1_str = 0;
+ else
+ $threadhold1_str = intval($threadhold1[$i]);
+
+ if (empty($threadhold2[$i]))
+ $threadhold2_str = 0;
+ else
+ $threadhold2_str = intval($threadhold2[$i]);
+
+ if (empty($threadhold3[$i]))
+ $threadhold3_str = 0;
+ else
+ $threadhold3_str = intval($threadhold3[$i]);
+
+ $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str;
+ //echo '';print_r($_POST);echo ' ';
+
+ if ($try[$i] == 'on') {
+ $try_str = 1;
+ } else {
+ $try_str = 0;
+ }
+
+ if (empty($lp[$i])) {
+ $lp_str = 0;
+ } else {
+ $lp_str = $lp[$i];
+ }
+
+ if ($url[$i] == '') {
+ $url_str = '';
+ } else {
+ $url_str = $url[$i];
+ }
+
+ if ($select_question[$i] == '') {
+ $question_str = 0;
+ } else {
+ $question_str = $select_question[$i];
+ }
+ $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
+
+ // the last answer is the IF NO ERROR section witch has not have the reponse, weight and coordinates values
+ //if ($i!=$nbrAnswers && !($answerType==HOT_SPOT_DELINEATION))
+ // {
+ // checks if field is empty
+ if (empty($reponse[$i]) && $reponse[$i] != '0') {
+ $msgErr = get_lang('HotspotGiveAnswers');
+
+ // clears answers already recorded into the Answer object
+ $objAnswer->cancel();
+ break;
+ }
+
+ if ($weighting[$i] <= 0 && $_SESSION['tmp_answers']['hotspot_type'][$i] != 'oar') {
+ $msgErr = get_lang('HotspotWeightingError');
+ // clears answers already recorded into the Answer object
+ $objAnswer->cancel();
+ break;
+ }
+
+ if ($hotspot_coordinates[$i] == '0;0|0|0' || empty($hotspot_coordinates[$i])) {
+ $msgErr = get_lang('HotspotNotDrawn');
+ // clears answers already recorded into the Answer object
+ $objAnswer->cancel();
+ break;
+ }
+ } // end for()
- if($debug>0){echo '$submitAnswers or $buttonBack was set'." \n";}
- $questionWeighting=$nbrGoodAnswers=0;
- $select_question=$_POST['select_question'];
- $try=$_POST['try'];
- $url=$_POST['url'];
- $destination=array();
-
- $threadhold1 = $_POST['threadhold1'];
- $threadhold2 = $_POST['threadhold2'];
- $threadhold3 = $_POST['threadhold3'];
-
- for($i=1;$i <= $nbrAnswers;$i++) {
- if($debug>0){echo str_repeat(' ',4).'$answerType is HOT_SPOT'." \n";}
-
- $reponse[$i]=trim($reponse[$i]);
- $comment[$i]=trim($comment[$i]);
- $weighting[$i] = $weighting[$i];
-
- if (empty($threadhold1[$i]))
- $threadhold1_str=0;
- else
- $threadhold1_str=intval($threadhold1[$i]);
-
- if (empty($threadhold2[$i]))
- $threadhold2_str=0;
- else
- $threadhold2_str=intval($threadhold2[$i]);
-
- if (empty($threadhold3[$i]))
- $threadhold3_str=0;
- else
- $threadhold3_str=intval($threadhold3[$i]);
-
- $threadhold_total=$threadhold1_str.';'.$threadhold2_str.';'.$threadhold3_str;
- //echo '';print_r($_POST);echo ' ';
-
- if ($try[$i]=='on') {
- $try_str=1;
- } else {
- $try_str=0;
- }
-
- if (empty($lp[$i])) {
- $lp_str=0;
- } else {
- $lp_str=$lp[$i];
- }
-
- if ($url[$i]=='') {
- $url_str='';
- } else {
- $url_str=$url[$i];
- }
-
- if ($select_question[$i]=='') {
- $question_str=0;
- } else {
- $question_str=$select_question[$i];
- }
- $destination[$i]= $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
-
- // the last answer is the IF NO ERROR section witch has not have the reponse, weight and coordinates values
- //if ($i!=$nbrAnswers && !($answerType==HOT_SPOT_DELINEATION))
- // {
-
- // checks if field is empty
- if(empty($reponse[$i]) && $reponse[$i] != '0') {
- $msgErr=get_lang('HotspotGiveAnswers');
-
- // clears answers already recorded into the Answer object
- $objAnswer->cancel();
- break;
- }
-
- if($weighting[$i] <= 0 && $_SESSION['tmp_answers']['hotspot_type'][$i] != 'oar') {
- $msgErr=get_lang('HotspotWeightingError');
- // clears answers already recorded into the Answer object
- $objAnswer->cancel();
- break;
- }
-
- if($hotspot_coordinates[$i] == '0;0|0|0' || empty($hotspot_coordinates[$i])) {
- $msgErr=get_lang('HotspotNotDrawn');
- // clears answers already recorded into the Answer object
- $objAnswer->cancel();
- break;
- }
- } // end for()
-
- //now the noerror section
- $select_question_noerror=$_POST['select_question_noerror'];
- $lp_noerror=$_POST['lp_noerror'];
- $try_noerror=$_POST['try_noerror'];
- $url_noerror=$_POST['url_noerror'];
- $comment_noerror=$_POST['comment_noerror'];
- $threadhold_total='0;0;0';
-
- if ($try_noerror=='on') {
- $try_str=1;
- } else {
- $try_str=0;
- }
-
- if (empty($lp_noerror)) {
- $lp_str=0;
- } else {
- $lp_str=$lp_noerror;
- }
-
- if ($url_noerror=='') {
- $url_str='';
- } else {
- $url_str=$url_noerror;
- }
-
- if ($select_question_noerror=='') {
- $question_str=0;
- } else {
- $question_str=$select_question_noerror;
- }
-
- $destination_noerror= $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
-
- if(empty($msgErr)) {
- for($i=1;$i <= $nbrAnswers;$i++) {
- if($debug>0){echo str_repeat(' ',4).'$answerType is HOT_SPOT'." \n";}
-
- $reponse[$i]=trim($reponse[$i]);
- $comment[$i]=trim($comment[$i]);
- $weighting[$i]=($weighting[$i]); //it can be float
- if($weighting[$i]) {
- $questionWeighting+=$weighting[$i];
- }
- // creates answer
- $objAnswer->createAnswer($reponse[$i], '',$comment[$i],$weighting[$i],$i,$hotspot_coordinates[$i],$hotspot_type[$i],$destination[$i]);
- } // end for()
-
- // saves the answers into the data base
-
- $objAnswer->createAnswer('noerror', '',$comment_noerror,'0',$nbrAnswers+1,null,'noerror',$destination_noerror);
- $objAnswer->save();
-
- // sets the total weighting of the question
- $objQuestion->updateWeighting($questionWeighting);
- $objQuestion->save($exerciseId);
-
- $editQuestion=$questionId;
- unset($modifyAnswers);
-
- echo '';
- }
- }
+ //now the noerror section
+ $select_question_noerror = $_POST['select_question_noerror'];
+ $lp_noerror = $_POST['lp_noerror'];
+ $try_noerror = $_POST['try_noerror'];
+ $url_noerror = $_POST['url_noerror'];
+ $comment_noerror = $_POST['comment_noerror'];
+ $threadhold_total = '0;0;0';
+
+ if ($try_noerror == 'on') {
+ $try_str = 1;
+ } else {
+ $try_str = 0;
+ }
+
+ if (empty($lp_noerror)) {
+ $lp_str = 0;
+ } else {
+ $lp_str = $lp_noerror;
+ }
+
+ if ($url_noerror == '') {
+ $url_str = '';
+ } else {
+ $url_str = $url_noerror;
+ }
+
+ if ($select_question_noerror == '') {
+ $question_str = 0;
+ } else {
+ $question_str = $select_question_noerror;
+ }
+
+ $destination_noerror = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
+
+ if (empty($msgErr)) {
+ for ($i = 1; $i <= $nbrAnswers; $i++) {
+ if ($debug > 0) {
+ echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . " \n";
+ }
+
+ $reponse[$i] = trim($reponse[$i]);
+ $comment[$i] = trim($comment[$i]);
+ $weighting[$i] = ($weighting[$i]); //it can be float
+ if ($weighting[$i]) {
+ $questionWeighting+=$weighting[$i];
+ }
+ // creates answer
+ $objAnswer->createAnswer($reponse[$i], '', $comment[$i], $weighting[$i], $i, $hotspot_coordinates[$i], $hotspot_type[$i], $destination[$i]);
+ } // end for()
+ // saves the answers into the data base
+
+ $objAnswer->createAnswer('noerror', '', $comment_noerror, '0', $nbrAnswers + 1, null, 'noerror', $destination_noerror);
+ $objAnswer->save();
+
+ // sets the total weighting of the question
+ $objQuestion->updateWeighting($questionWeighting);
+ $objQuestion->save($exerciseId);
+
+ $editQuestion = $questionId;
+ unset($modifyAnswers);
+
+ echo '';
+ }
+ }
}
if ($modifyAnswers) {
- if($debug>0){echo str_repeat(' ',0).'$modifyAnswers is set'." \n";}
+ if ($debug > 0) {
+ echo str_repeat(' ', 0) . '$modifyAnswers is set' . " \n";
+ }
// construction of the Answer object
- $objAnswer=new Answer($objQuestion -> id);
- Session::write('objAnswer',$objAnswer);
- if($debug>0){echo str_repeat(' ',2).'$answerType is HOT_SPOT'." \n";}
-
- if ($answerType == HOT_SPOT_DELINEATION) {
- $try=$_POST['try'];
-
- for($i=1;$i <= $nbrAnswers;$i++) {
- if ($try[$i]=='on') {
- $try[$i]=1;
- } else {
- $try[$i]=0;
- }
- }
-
- if ($_POST['try_noerror']=='on') {
- $try_noerror=1;
- } else {
- $try_noerror=0;
- }
- }
-
- if(!$nbrAnswers) {
- $nbrAnswers=$objAnswer->selectNbrAnswers();
- if ($answerType == HOT_SPOT_DELINEATION) {
- // the magic happens here ...
- // we do this to not count the if no error section
- if ($nbrAnswers>=2)
- $nbrAnswers--;
+ $objAnswer = new Answer($objQuestion->id);
+ Session::write('objAnswer', $objAnswer);
+ if ($debug > 0) {
+ echo str_repeat(' ', 2) . '$answerType is HOT_SPOT' . " \n";
+ }
+
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ $try = $_POST['try'];
+
+ for ($i = 1; $i <= $nbrAnswers; $i++) {
+ if ($try[$i] == 'on') {
+ $try[$i] = 1;
+ } else {
+ $try[$i] = 0;
+ }
}
- $reponse=array();
- $comment=array();
- $weighting=array();
- $hotspot_coordinates=array();
- $hotspot_type=array();
- $destination_items = array();
- $destination = array();
+ if ($_POST['try_noerror'] == 'on') {
+ $try_noerror = 1;
+ } else {
+ $try_noerror = 0;
+ }
+ }
+
+ if (!$nbrAnswers) {
+ $nbrAnswers = $objAnswer->selectNbrAnswers();
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ // the magic happens here ...
+ // we do this to not count the if no error section
+ if ($nbrAnswers >= 2)
+ $nbrAnswers--;
+ }
+ $reponse = array();
+ $comment = array();
+ $weighting = array();
+ $hotspot_coordinates = array();
+ $hotspot_type = array();
+ $destination_items = array();
+ $destination = array();
- for($i=1;$i <= $nbrAnswers;$i++) {
- $reponse[$i]=$objAnswer->selectAnswer($i);
+
+ for ($i = 1; $i <= $nbrAnswers; $i++) {
+ $reponse[$i] = $objAnswer->selectAnswer($i);
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
- $comment[$i]=$objAnswer->selectComment($i);
+ $comment[$i] = $objAnswer->selectComment($i);
+ }
+ $weighting[$i] = $objAnswer->selectWeighting($i);
+ $hotspot_coordinates[$i] = $objAnswer->selectHotspotCoordinates($i);
+ $hotspot_type[$i] = $objAnswer->selectHotspotType($i);
+
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ $destination[$i] = $objAnswer->selectDestination($i);
+
+ $destination_items = explode('@@', $destination[$i]);
+ $threadhold_total = $destination_items[0];
+ $threadhold_items = explode(';', $threadhold_total);
+ $threadhold1[$i] = $threadhold_items[0];
+ $threadhold2[$i] = $threadhold_items[1];
+ $threadhold3[$i] = $threadhold_items[2];
+
+ $try[$i] = $destination_items[1];
+ $lp[$i] = $destination_items[2];
+ $select_question[$i] = $destination_items[3];
+ $url[$i] = $destination_items[4];
}
- $weighting[$i]=$objAnswer->selectWeighting($i);
- $hotspot_coordinates[$i]=$objAnswer->selectHotspotCoordinates($i);
- $hotspot_type[$i]=$objAnswer->selectHotspotType($i);
-
- if ($answerType==HOT_SPOT_DELINEATION) {
- $destination[$i]=$objAnswer->selectDestination($i);
-
- $destination_items= explode('@@', $destination[$i]);
- $threadhold_total = $destination_items[0];
- $threadhold_items=explode(';',$threadhold_total);
- $threadhold1[$i] = $threadhold_items[0];
- $threadhold2[$i] = $threadhold_items[1];
- $threadhold3[$i] = $threadhold_items[2];
-
- $try[$i]=$destination_items[1];
- $lp[$i]=$destination_items[2];
- $select_question[$i]=$destination_items[3];
- $url[$i]=$destination_items[4];
- }
}
}
-
- if ($answerType==HOT_SPOT_DELINEATION) {
- //added the noerror answer
- $reponse_noerror='noerror';
- $comment_noerror=$objAnswer->selectComment($nbrAnswers+1);
- $destination_noerror_list=$objAnswer->selectDestination($nbrAnswers+1);
- $destination_items= explode('@@', $destination_noerror_list);
-
- $try_noerror=$destination_items[1];
- $lp_noerror=$destination_items[2];
- $select_question_noerror=$destination_items[3];
- $url_noerror=$destination_items[4];
- }
+
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ //added the noerror answer
+ $reponse_noerror = 'noerror';
+ $comment_noerror = $objAnswer->selectComment($nbrAnswers + 1);
+ $destination_noerror_list = $objAnswer->selectDestination($nbrAnswers + 1);
+ $destination_items = explode('@@', $destination_noerror_list);
+
+ $try_noerror = $destination_items[1];
+ $lp_noerror = $destination_items[2];
+ $select_question_noerror = $destination_items[3];
+ $url_noerror = $destination_items[4];
+ }
$_SESSION['tmp_answers'] = array();
$_SESSION['tmp_answers']['answer'] = $reponse;
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
- $_SESSION['tmp_answers']['comment'] = $comment;
+ $_SESSION['tmp_answers']['comment'] = $comment;
}
$_SESSION['tmp_answers']['weighting'] = $weighting;
$_SESSION['tmp_answers']['hotspot_coordinates'] = $hotspot_coordinates;
$_SESSION['tmp_answers']['hotspot_type'] = $hotspot_type;
- if ($answerType==HOT_SPOT_DELINEATION) {
- $_SESSION['tmp_answers']['destination'] = $destination;
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ $_SESSION['tmp_answers']['destination'] = $destination;
}
if ($lessAnswers) {
- if ($answerType==HOT_SPOT_DELINEATION) {
- $lest_answer=1;
- // At least 1 answer
- if ($nbrAnswers > $lest_answer) {
- $nbrAnswers--;
- // Remove the last answer
- $tmp = array_pop($_SESSION['tmp_answers']['answer']);
- $tmp = array_pop($_SESSION['tmp_answers']['comment']);
- $tmp = array_pop($_SESSION['tmp_answers']['weighting']);
- $tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']);
- $tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']);
-
- if (is_array($_SESSION['tmp_answers']['destination'])) {
- $tmp = array_pop($_SESSION['tmp_answers']['destination']);
- }
-
- } else {
- $msgErr=get_lang('MinHotspot');
- }
- } else {
- // At least 1 answer
- if ($nbrAnswers > 1) {
- $nbrAnswers--;
- // Remove the last answer
- $tmp = array_pop($_SESSION['tmp_answers']['answer']);
- if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
- $tmp = array_pop($_SESSION['tmp_answers']['comment']);
- }
- $tmp = array_pop($_SESSION['tmp_answers']['weighting']);
- $tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']);
- $tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']);
- } else {
- $msgErr=get_lang('MinHotspot');
- }
- }
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ $lest_answer = 1;
+ // At least 1 answer
+ if ($nbrAnswers > $lest_answer) {
+ $nbrAnswers--;
+ // Remove the last answer
+ $tmp = array_pop($_SESSION['tmp_answers']['answer']);
+ $tmp = array_pop($_SESSION['tmp_answers']['comment']);
+ $tmp = array_pop($_SESSION['tmp_answers']['weighting']);
+ $tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']);
+ $tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']);
+
+ if (is_array($_SESSION['tmp_answers']['destination'])) {
+ $tmp = array_pop($_SESSION['tmp_answers']['destination']);
+ }
+ } else {
+ $msgErr = get_lang('MinHotspot');
+ }
+ } else {
+ // At least 1 answer
+ if ($nbrAnswers > 1) {
+ $nbrAnswers--;
+ // Remove the last answer
+ $tmp = array_pop($_SESSION['tmp_answers']['answer']);
+ if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
+ $tmp = array_pop($_SESSION['tmp_answers']['comment']);
+ }
+ $tmp = array_pop($_SESSION['tmp_answers']['weighting']);
+ $tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']);
+ $tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']);
+ } else {
+ $msgErr = get_lang('MinHotspot');
+ }
+ }
}
if ($moreAnswers) {
- if ($nbrAnswers < 12) {
+ if ($nbrAnswers < 12) {
$nbrAnswers++;
// Add a new answer
- $_SESSION['tmp_answers']['answer'][]='';
+ $_SESSION['tmp_answers']['answer'][] = '';
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
- $_SESSION['tmp_answers']['comment'][]='';
+ $_SESSION['tmp_answers']['comment'][] = '';
}
- $_SESSION['tmp_answers']['weighting'][]='1';
- $_SESSION['tmp_answers']['hotspot_coordinates'][]='0;0|0|0';
- $_SESSION['tmp_answers']['hotspot_type'][]='square';
- $_SESSION['tmp_answers']['destination'][]='';
- } else {
- $msgErr=get_lang('MaxHotspot');
- }
+ $_SESSION['tmp_answers']['weighting'][] = '1';
+ $_SESSION['tmp_answers']['hotspot_coordinates'][] = '0;0|0|0';
+ $_SESSION['tmp_answers']['hotspot_type'][] = 'square';
+ $_SESSION['tmp_answers']['destination'][] = '';
+ } else {
+ $msgErr = get_lang('MaxHotspot');
+ }
}
-
- if($moreOARAnswers) {
- if ($nbrAnswers < 12) {
+
+ if ($moreOARAnswers) {
+ if ($nbrAnswers < 12) {
// Add a new answer
$nbrAnswers++;
-
- $_SESSION['tmp_answers']['answer'][]='';
- $_SESSION['tmp_answers']['comment'][]='';
- $_SESSION['tmp_answers']['weighting'][]='1';
- $_SESSION['tmp_answers']['hotspot_coordinates'][]='0;0|0|0';
- $_SESSION['tmp_answers']['hotspot_type'][]='oar';
- $_SESSION['tmp_answers']['destination'][]='';
- } else {
- $msgErr=get_lang('MaxHotspot');
- }
+
+ $_SESSION['tmp_answers']['answer'][] = '';
+ $_SESSION['tmp_answers']['comment'][] = '';
+ $_SESSION['tmp_answers']['weighting'][] = '1';
+ $_SESSION['tmp_answers']['hotspot_coordinates'][] = '0;0|0|0';
+ $_SESSION['tmp_answers']['hotspot_type'][] = 'oar';
+ $_SESSION['tmp_answers']['destination'][] = '';
+ } else {
+ $msgErr = get_lang('MaxHotspot');
+ }
}
- if($debug>0){echo str_repeat(' ',2).'$usedInSeveralExercises is untrue'." \n";}
- if($debug>0){echo str_repeat(' ',4).'$answerType is HOT_SPOT'." \n";}
- if ($answerType==HOT_SPOT_DELINEATION) {
- $hotspot_colors = array("", "#4271B5", "#FE8E16", "#45C7F0", "#BCD631", "#D63173", "#D7D7D7", "#90AFDD", "#AF8640", "#4F9242", "#F4EB24", "#ED2024", "#3B3B3B");
+ if ($debug > 0) {
+ echo str_repeat(' ', 2) . '$usedInSeveralExercises is untrue' . " \n";
+ }
+ if ($debug > 0) {
+ echo str_repeat(' ', 4) . '$answerType is HOT_SPOT' . " \n";
+ }
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ $hotspot_colors = array("", "#4271B5", "#FE8E16", "#45C7F0", "#BCD631", "#D63173", "#D7D7D7", "#90AFDD", "#AF8640", "#4F9242", "#F4EB24", "#ED2024", "#3B3B3B");
} else {
$hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
- "#4271B5",
- "#FE8E16",
- "#45C7F0",
- "#BCD631",
- "#D63173",
- "#D7D7D7",
- "#90AFDD",
- "#AF8640",
- "#4F9242",
- "#F4EB24",
- "#ED2024",
- "#3B3B3B",
- "#F7BDE2");
- }
-
- Display::tag('h3',get_lang('Question').": ".$questionName.' ');
- if(!empty($msgErr)) {
+ "#4271B5",
+ "#FE8E16",
+ "#45C7F0",
+ "#BCD631",
+ "#D63173",
+ "#D7D7D7",
+ "#90AFDD",
+ "#AF8640",
+ "#4F9242",
+ "#F4EB24",
+ "#ED2024",
+ "#3B3B3B",
+ "#F7BDE2");
+ }
+
+ Display::tag('h3', get_lang('Question') . ": " . $questionName . ' ');
+ if (!empty($msgErr)) {
Display::display_normal_message($msgErr); //main API
}
-$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin='.$modifyAnswers. '&exerciseId='.$exerciseId;
-?>
-
-
-0){echo str_repeat(' ',0).'$modifyAnswers was set - end'." \n";}
-}
+ $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId;
+ ?>
+
+
+
+
+ 0) {
+ echo str_repeat(' ', 0) . '$modifyAnswers was set - end' . " \n";
+ }
+}
\ No newline at end of file
diff --git a/main/exercice/overview.php b/main/exercice/overview.php
index c2e3414f58..028c9021e5 100644
--- a/main/exercice/overview.php
+++ b/main/exercice/overview.php
@@ -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;
diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php
index f163f66787..bc82dcd9fc 100644
--- a/main/exercice/question.class.php
+++ b/main/exercice/question.class.php
@@ -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 ''.$explanation.' ';
} 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 ' ';
//echo ''.$explanation.'';
}
@@ -1395,8 +1395,9 @@ abstract class Question
}
}
- $question_title = get_lang("Question").' '.($counter_label).' : '.$this->question;
- $header = Display::div('
'.$score_label.' '.$question_title.' '.$score['result'].' ', array('class'=>'ribbon'));
+ $question_title = $this->question;
+ $header = Display::div('
'.$score_label.' '.get_lang("Question").' '.($counter_label).' '.$score['result'].' ', array('class'=>'ribbon'));
+ $header .= '';
$header .= Display::div($this->description, array('id'=>'question_description'));
return $header;
}
diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php
index c3a5c68ee3..36d8fed169 100644
--- a/main/forum/forumfunction.inc.php
+++ b/main/forum/forumfunction.inc.php
@@ -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'), ' ');
}
-
- // 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=' '.Display::return_icon('div_hide.gif').' ".get_lang('AddAnAttachment')."';
- } else {
- document.getElementById('options').style.display = 'none';
- document.getElementById('plus').innerHTML=' '.Display::return_icon('div_show.gif').' ".get_lang('AddAnAttachment')."';
- }*/
-
+
$form->addElement('advanced_settings', ' '.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').' ','');
$form->addElement('html', '');
- $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'), ' ');
- // 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'), ' ');
-
- // 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'), ' ');
-
- // 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'), ' ');
- $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'), ' ');
- //$form->addElement('static','Group', '
'.get_lang('GroupSettings').' ');
-
- // 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'), ' ');
@@ -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', '
'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').' ');
$form->addElement('html', '
');
+
+ 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', '
');
- $form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'),'Style="width:40px"');
+ $form->addElement('html', '
');
+
+ $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', '
');
}
@@ -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'] = '
'.get_lang('Quoting').' '.api_get_person_name($values['firstname'], $values['lastname']).':
'.prepare4display($values['post_text']).'
';
+ $defaults['post_text'] = '
'.get_lang('Quoting').' '.api_get_person_name($values['firstname'], $values['lastname']).':
'.prepare4display($values['post_text']).'
';
}
}
$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', '
'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).''.get_lang('AdvancedParameters').' ');
$form->addElement('html', '
');
- if (!isset($_GET['edit'])) {
- $form->addElement('label', ''.get_lang('AlterQualifyThread').' ');
- $form->applyFilter('numeric_calification', 'html_filter');
- if(Gradebook::is_active()){
+ if (!isset($_GET['edit'])) {
+ if (Gradebook::is_active()) {
+ $form->addElement('label', ''.get_lang('AlterQualifyThread').' ');
$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', '
');
}
@@ -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', '
');
-
$form->addElement('style_submit_button', 'SubmitPost', get_lang('ModifyThread'), 'class="save"');
// Setting the default values for the form elements.
diff --git a/main/forum/index.php b/main/forum/index.php
index 321167e6a1..84a4dba4dd 100644
--- a/main/forum/index.php
+++ b/main/forum/index.php
@@ -291,7 +291,7 @@ if (is_array($forum_categories_list)) {
$forum_image = '';
- echo '
';
+ echo ' ';
// 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 = " ";
} else {
$forum_image = '';
}
echo $forum_image;
-
} else {
if ($forum['forum_of_group'] !== '0') {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
diff --git a/main/gradebook/index.php b/main/gradebook/index.php
index 6b19370f4a..bdd255dab8 100644
--- a/main/gradebook/index.php
+++ b/main/gradebook/index.php
@@ -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);
diff --git a/main/gradebook/lib/fe/flatviewtable.class.php b/main/gradebook/lib/fe/flatviewtable.class.php
index e0f56ffb4f..63407b5eef 100644
--- a/main/gradebook/lib/fe/flatviewtable.class.php
+++ b/main/gradebook/lib/fe/flatviewtable.class.php
@@ -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();
diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php
index fff60fba4a..4d1f8fefc4 100644
--- a/main/gradebook/lib/flatview_data_generator.class.php
+++ b/main/gradebook/lib/flatview_data_generator.class.php
@@ -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) {
diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php
index 49ba1a2258..2cdf7b98d5 100644
--- a/main/gradebook/lib/gradebook_functions.inc.php
+++ b/main/gradebook/lib/gradebook_functions.inc.php
@@ -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;
diff --git a/main/group/group.php b/main/group/group.php
index 371e65a238..52d896f7c9 100644
--- a/main/group/group.php
+++ b/main/group/group.php
@@ -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 = ''.stripslashes($this_group['name']).' ';
+ $group_name = ''.Security::remove_XSS($this_group['name']).' ';
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 = ''.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).' ';
- $edit_actions .= ''.Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).' ';
- $edit_actions .= ''.Display::return_icon('fill.png',get_lang('FillGroup'),'',ICON_SIZE_SMALL).' ';
- $edit_actions .= ''.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).' ';
+ $edit_actions = ''.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).' ';
+ $edit_actions .= ''.Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).' ';
+ $edit_actions .= ''.Display::return_icon('fill.png',get_lang('FillGroup'),'',ICON_SIZE_SMALL).' ';
+ $edit_actions .= ''.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).' ';
$row[] = $edit_actions;
}
if (!empty($this_group['nbMember'])) {
diff --git a/main/group/group_category.php b/main/group/group_category.php
index d8924acb27..d184bb447e 100644
--- a/main/group/group_category.php
+++ b/main/group/group_category.php
@@ -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
diff --git a/main/group/group_creation.php b/main/group/group_creation.php
index eb95bb1870..799471565b 100644
--- a/main/group/group_creation.php
+++ b/main/group/group_creation.php
@@ -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 ''.get_lang('GroupsFromClasses').' ';
@@ -324,7 +323,8 @@ EOT;
$create_class_groups_form->setDefaults($defaults);
$create_class_groups_form->display();
echo '';
- }
+ }*/
+
}
/* FOOTER */
diff --git a/main/group/group_edit.php b/main/group/group_edit.php
index c393c99336..b7ddb53a13 100644
--- a/main/group/group_edit.php
+++ b/main/group/group_edit.php
@@ -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, ' '.get_lang('AddTutors').' ');
-//$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');
-?>
-
-setDefaults($defaults);
$form->display();
-/* FOOTER */
Display :: display_footer();
\ No newline at end of file
diff --git a/main/group/group_space.php b/main/group/group_space.php
index 2ff27a6e8c..e521964978 100644
--- a/main/group/group_space.php
+++ b/main/group/group_space.php
@@ -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 = ''.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).' ';
+ $edit_url = ''.Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).' ';
}
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 '';
- $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 .= ''.Display::return_icon('forum.png', get_lang('Forum').': '.$value['forum_title'] , array(), 32).' ';
+ $actions_array[] = array(
+ 'url' => '../forum/viewforum.php?forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&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 .= ''.Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32).' ';
+ // 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 .= ''.Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32).' ';
+ $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 .= ''.Display::return_icon('work.png', get_lang('GroupWork'), array(), 32).' ';
+ $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 .= ''.Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32).' ';
+ $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 .= ''.Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32).' ';
+ $actions_array[] = array(
+ 'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&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 .= "".Display::return_icon('chat.png', get_lang('Chat'),'',ICON_SIZE_MEDIUM)." ";
+ $actions_array[] = array(
+ 'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&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 .= "".Display::return_icon('chat.png', get_lang('Chat'), array(), 32)." ";
+ $actions_array[] = array(
+ 'url' => "../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
+ 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
+ );
}
}
-echo ' ';
- 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 '';
-
- $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.= ''.Display::return_icon('forum.png', get_lang('GroupForum'), array(), 32).' ';
+ 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']).'&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 .= ''.Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32).' ';
+ $actions_array[] = array(
+ 'url' => '../document/document.php?cidReq='.api_get_course_id().'&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 .= ''.Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32).' ';
+ $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 .= ''.Display::return_icon('work.png', get_lang('GroupWork'), array(), 32).' ';
+ $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 .= ''.Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32).' ';
+ $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 .= ''.Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32).' ';
+ $actions_array[] = array(
+ 'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&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 .= "".Display::return_icon('chat.png', get_lang("Chat"), array(), 32)." ";
+ $actions_array[] = array(
+ 'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&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 .= "".Display::return_icon('chat.png', get_lang("Chat"), array(), 32)." ";
+ $actions_array[] = array(
+ 'url' => "../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
+ 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
+ );
}
}
- echo ' ';
-
- 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);
}
}
diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php
index 26cafba9cf..e2d1ef2f8a 100644
--- a/main/inc/ajax/model.ajax.php
+++ b/main/inc/ajax/model.ajax.php
@@ -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) {
diff --git a/main/inc/lib/attendance.lib.php b/main/inc/lib/attendance.lib.php
index 40ca1f206c..c9adecce08 100644
--- a/main/inc/lib/attendance.lib.php
+++ b/main/inc/lib/attendance.lib.php
@@ -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 ();
diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php
index aa6cb8bdea..ef8730bb34 100644
--- a/main/inc/lib/course.lib.php
+++ b/main/inc/lib/course.lib.php
@@ -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&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&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.
diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php
index a50d7aa684..12f6428a62 100644
--- a/main/inc/lib/course_home.lib.php
+++ b/main/inc/lib/course_home.lib.php
@@ -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();
diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php
index c8236830da..2ff03c0cc5 100644
--- a/main/inc/lib/database.lib.php
+++ b/main/inc/lib/database.lib.php
@@ -1354,4 +1354,4 @@ class Database {
public static function get_last_insert_id() {
return mysql_insert_id();
}
-}
\ No newline at end of file
+}
diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php
index 3e7d7f40bf..201517f5d7 100644
--- a/main/inc/lib/display.lib.php
+++ b/main/inc/lib/display.lib.php
@@ -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'];
diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php
index 48a2d74b50..048519e6da 100755
--- a/main/inc/lib/document.lib.php
+++ b/main/inc/lib/document.lib.php
@@ -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';
diff --git a/main/inc/lib/fckeditor/editor/plugins/Abbr/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/Abbr/lang/de.js
new file mode 100644
index 0000000000..aa04b721bc
--- /dev/null
+++ b/main/inc/lib/fckeditor/editor/plugins/Abbr/lang/de.js
@@ -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 Überfahren mit der Maus sichtbar [Beispiel... ]';
+FCKLang.AbbrDlgRemove = 'Entfernen Abkürzung-Tag (Inhalt Überreste)';
+FCKLang.AbbrDlgSelectFirst = 'Sie müssen zuerst den Text auswählen!';
diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/ImageManager/lang/de.js
old mode 100755
new mode 100644
index 3c6d71c346..0e2fe9e4f4
--- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/lang/de.js
@@ -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"
+
+};
diff --git a/main/inc/lib/fckeditor/editor/plugins/MP3/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/MP3/lang/de.js
old mode 100755
new mode 100644
index 069f5a7df0..1392711019
--- a/main/inc/lib/fckeditor/editor/plugins/MP3/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/MP3/lang/de.js
@@ -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" ;
diff --git a/main/inc/lib/fckeditor/editor/plugins/audio/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/audio/lang/de.js
index 962aa4eecd..d0140561d9 100644
--- a/main/inc/lib/fckeditor/editor/plugins/audio/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/audio/lang/de.js
@@ -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' ;
+
diff --git a/main/inc/lib/fckeditor/editor/plugins/customizations/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/customizations/lang/de.js
index eb5b25d0b7..d345e82cf3 100644
--- a/main/inc/lib/fckeditor/editor/plugins/customizations/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/customizations/lang/de.js
@@ -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.' ;
+
diff --git a/main/inc/lib/fckeditor/editor/plugins/fckEmbedMovies/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/fckEmbedMovies/lang/de.js
index 78904b4c13..35760549ab 100644
--- a/main/inc/lib/fckeditor/editor/plugins/fckEmbedMovies/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/fckEmbedMovies/lang/de.js
@@ -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." ;
+
diff --git a/main/inc/lib/fckeditor/editor/plugins/flvPlayer/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/flvPlayer/lang/de.js
old mode 100755
new mode 100644
index cf9dcd5ab2..0b52160c05
--- a/main/inc/lib/fckeditor/editor/plugins/flvPlayer/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/flvPlayer/lang/de.js
@@ -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" ;
diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/googlemaps/lang/de.js
old mode 100755
new mode 100644
index 89bd35ece5..93e6aa3ebd
--- a/main/inc/lib/fckeditor/editor/plugins/googlemaps/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/lang/de.js
@@ -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. 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.' ;
\ No newline at end of file
+/*
+ * == 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. 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.' ;
\ No newline at end of file
diff --git a/main/inc/lib/fckeditor/editor/plugins/insertHtml/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/insertHtml/lang/de.js
new file mode 100644
index 0000000000..13dc076bd9
--- /dev/null
+++ b/main/inc/lib/fckeditor/editor/plugins/insertHtml/lang/de.js
@@ -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.';
+
diff --git a/main/inc/lib/fckeditor/editor/plugins/media/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/media/lang/de.js
new file mode 100644
index 0000000000..1ff927f030
--- /dev/null
+++ b/main/inc/lib/fckeditor/editor/plugins/media/lang/de.js
@@ -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.' ;
diff --git a/main/inc/lib/fckeditor/editor/plugins/wikilink/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/wikilink/lang/de.js
old mode 100755
new mode 100644
index 836a0422dd..19773f60cf
--- a/main/inc/lib/fckeditor/editor/plugins/wikilink/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/wikilink/lang/de.js
@@ -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.';
diff --git a/main/inc/lib/fckeditor/editor/plugins/youtube/lang/de.js b/main/inc/lib/fckeditor/editor/plugins/youtube/lang/de.js
index 7e78ac37c5..5909ad9869 100644
--- a/main/inc/lib/fckeditor/editor/plugins/youtube/lang/de.js
+++ b/main/inc/lib/fckeditor/editor/plugins/youtube/lang/de.js
@@ -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.' ;
diff --git a/main/inc/lib/fileUpload.lib.php b/main/inc/lib/fileUpload.lib.php
index 5e46ff12e4..06abd32ddb 100644
--- a/main/inc/lib/fileUpload.lib.php
+++ b/main/inc/lib/fileUpload.lib.php
@@ -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').' '.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').' '.$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 !== '') {
diff --git a/main/inc/lib/groupmanager.lib.php b/main/inc/lib/groupmanager.lib.php
index 531ac04822..ef084358f5 100644
--- a/main/inc/lib/groupmanager.lib.php
+++ b/main/inc/lib/groupmanager.lib.php
@@ -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;
diff --git a/main/inc/lib/internationalization.lib.php b/main/inc/lib/internationalization.lib.php
index 2ee5d895af..ce028b0b4d 100644
--- a/main/inc/lib/internationalization.lib.php
+++ b/main/inc/lib/internationalization.lib.php
@@ -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) {
diff --git a/main/inc/lib/link.lib.php b/main/inc/lib/link.lib.php
index 232b9d182b..8966dcddb8 100644
--- a/main/inc/lib/link.lib.php
+++ b/main/inc/lib/link.lib.php
@@ -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']);
diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php
index 61c1c2fa40..911fe8cf70 100644
--- a/main/inc/lib/main_api.lib.php
+++ b/main/inc/lib/main_api.lib.php
@@ -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 ? '&id_session=0' : '&id_session='.api_get_session_id()).
- (api_get_group_id() == 0 ? '&gidReq=0' : '&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[] = '';
$htmlHeadXtra[] = ' ';
diff --git a/main/inc/lib/pdf.lib.php b/main/inc/lib/pdf.lib.php
index 262ae525ee..b6e63f26e4 100644
--- a/main/inc/lib/pdf.lib.php
+++ b/main/inc/lib/pdf.lib.php
@@ -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.
}
diff --git a/main/inc/lib/pear/HTML/QuickForm.php b/main/inc/lib/pear/HTML/QuickForm.php
index 80f3e90d03..8d990fbc89 100644
--- a/main/inc/lib/pear/HTML/QuickForm.php
+++ b/main/inc/lib/pear/HTML/QuickForm.php
@@ -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)) {
diff --git a/main/inc/lib/search/ChamiloIndexer.class.php b/main/inc/lib/search/ChamiloIndexer.class.php
index 3a9fdffa7a..0e19de409a 100644
--- a/main/inc/lib/search/ChamiloIndexer.class.php
+++ b/main/inc/lib/search/ChamiloIndexer.class.php
@@ -1,4 +1,5 @@
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);
+ }
+
}
diff --git a/main/inc/lib/search/IndexableChunk.class.php b/main/inc/lib/search/IndexableChunk.class.php
old mode 100755
new mode 100644
index b5b766a404..4ee9f7a648
--- a/main/inc/lib/search/IndexableChunk.class.php
+++ b/main/inc/lib/search/IndexableChunk.class.php
@@ -1,4 +1,5 @@
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);
+ }
}
diff --git a/main/inc/lib/search/get_terms.php b/main/inc/lib/search/get_terms.php
index 3d7e8db2e9..91a273ac62 100644
--- a/main/inc/lib/search/get_terms.php
+++ b/main/inc/lib/search/get_terms.php
@@ -1,4 +1,5 @@
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(
diff --git a/main/inc/lib/search/search_widget.php b/main/inc/lib/search/search_widget.php
index 3e8cec81b9..4b4bebe997 100644
--- a/main/inc/lib/search/search_widget.php
+++ b/main/inc/lib/search/search_widget.php
@@ -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.
diff --git a/main/inc/lib/search/tool_processors/document_processor.class.php b/main/inc/lib/search/tool_processors/document_processor.class.php
index 51689316b7..3ae195e573 100644
--- a/main/inc/lib/search/tool_processors/document_processor.class.php
+++ b/main/inc/lib/search/tool_processors/document_processor.class.php
@@ -1,4 +1,5 @@
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();
}
}
+
}
diff --git a/main/inc/lib/search/tool_processors/learnpath_processor.class.php b/main/inc/lib/search/tool_processors/learnpath_processor.class.php
index b964019861..51fee7268a 100644
--- a/main/inc/lib/search/tool_processors/learnpath_processor.class.php
+++ b/main/inc/lib/search/tool_processors/learnpath_processor.class.php
@@ -1,4 +1,5 @@
$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();
}
}
+
}
diff --git a/main/inc/lib/search/tool_processors/link_processor.class.php b/main/inc/lib/search/tool_processors/link_processor.class.php
index 8d55816874..53a69546a4 100644
--- a/main/inc/lib/search/tool_processors/link_processor.class.php
+++ b/main/inc/lib/search/tool_processors/link_processor.class.php
@@ -1,4 +1,5 @@
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();
}
}
+
}
diff --git a/main/inc/lib/search/tool_processors/quiz_processor.class.php b/main/inc/lib/search/tool_processors/quiz_processor.class.php
index 15738307d0..8304c3fcd6 100644
--- a/main/inc/lib/search/tool_processors/quiz_processor.class.php
+++ b/main/inc/lib/search/tool_processors/quiz_processor.class.php
@@ -1,4 +1,5 @@
$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();
}
}
+
}
\ No newline at end of file
diff --git a/main/inc/lib/search/tool_processors/search_processor.class.php b/main/inc/lib/search/tool_processors/search_processor.class.php
index 74233e8a68..e406c16834 100644
--- a/main/inc/lib/search/tool_processors/search_processor.class.php
+++ b/main/inc/lib/search/tool_processors/search_processor.class.php
@@ -1,8 +1,10 @@
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);
}
-}
+
+}
\ No newline at end of file
diff --git a/main/inc/lib/search/xapian/XapianQuery.php b/main/inc/lib/search/xapian/XapianQuery.php
index a67dad3544..6068bbec7b 100644
--- a/main/inc/lib/search/xapian/XapianQuery.php
+++ b/main/inc/lib/search/xapian/XapianQuery.php
@@ -1,4 +1,5 @@
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
* @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);
}
diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php
index 90fa5d4dda..6dda5e4061 100644
--- a/main/inc/lib/social.lib.php
+++ b/main/inc/lib/social.lib.php
@@ -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 = ' ';
}
- $name = ''.$status_icon.$name.' ';
+ $name = ''.$status_icon.$user_status.$name.' ';
$html .= ''.$img.'
'.$name.'
';
}
$counter = $_SESSION['who_is_online_counter'];
diff --git a/main/inc/lib/thematic.lib.php b/main/inc/lib/thematic.lib.php
index f1494b9668..56c624d592 100644
--- a/main/inc/lib/thematic.lib.php
+++ b/main/inc/lib/thematic.lib.php
@@ -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
* @author Julio Montoya 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 = ''.api_convert_and_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG).$session_star.'
';
+ //DATE_TIME_FORMAT_LONG
+ $thematic_advance_item = ''.api_convert_and_format_date($thematic_advance['start_date'], DATE_FORMAT_LONG).$session_star.'
';
// $thematic_advance_item .= ''.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'
';
$thematic_advance_item .= ''.$thematic_advance['duration'].' '.get_lang('HourShort').'
';
$thematic_advance_item .= ''.Security::remove_XSS($thematic_advance['content'], STUDENT).'
';
@@ -749,10 +743,8 @@ class Thematic
$data[] = $row;
}
}
- }
-
- }
-
+ }
+ }
return $data;
}
diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php
index 958d508cff..2d660aeabb 100644
--- a/main/inc/lib/tracking.lib.php
+++ b/main/inc/lib/tracking.lib.php
@@ -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.' ';
$res_max_score = Database::query($sql_max_score);
diff --git a/main/inc/lib/usergroup.lib.php b/main/inc/lib/usergroup.lib.php
index 29ed934b8e..a638e872cf 100644
--- a/main/inc/lib/usergroup.lib.php
+++ b/main/inc/lib/usergroup.lib.php
@@ -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);
- }
- }*/
}
}
}
diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php
index dbc9640ebb..1e3e2a40bf 100644
--- a/main/inc/lib/usermanager.lib.php
+++ b/main/inc/lib/usermanager.lib.php
@@ -128,8 +128,7 @@ class UserManager {
/**
* Creates a new user for the platform
* @author Hugues Peeters ,
- * Roan Embrechts
- *
+ * @author Roan Embrechts
* @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;
diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php
index ffe6b97abf..2460b49e46 100644
--- a/main/inc/lib/userportal.lib.php
+++ b/main/inc/lib/userportal.lib.php
@@ -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;
}
diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php
index 709f4d4181..67bc1aae0b 100644
--- a/main/inc/local.inc.php
+++ b/main/inc/local.inc.php
@@ -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();
diff --git a/main/install/index.php b/main/install/index.php
index ca1d981f92..f9067fe59a 100644
--- a/main/install/index.php
+++ b/main/install/index.php
@@ -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');
diff --git a/main/install/install.lib.php b/main/install/install.lib.php
index 18dafb9ac3..e6e0b94174 100755
--- a/main/install/install.lib.php
+++ b/main/install/install.lib.php
@@ -1517,7 +1517,7 @@ function get_contact_registration_form() {
* '.get_lang('CompanyName').'
diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php
index eb8d1188ac..bdb49df006 100644
--- a/main/lang/english/trad4all.inc.php
+++ b/main/lang/english/trad4all.inc.php
@@ -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,
- 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.
-
-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.
-
-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.
-
+$ContactInformationDescription = "Dear user,
+ 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.
+
+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.
+
+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.
+
Please note that you are not required 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\". ";
$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";
?>
\ No newline at end of file
diff --git a/main/lang/french/index.inc.php b/main/lang/french/index.inc.php
index 1dd8cea8df..d33da70136 100644
--- a/main/lang/french/index.inc.php
+++ b/main/lang/french/index.inc.php
@@ -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,
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";
?>
\ No newline at end of file
diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php
index 69f4c768e1..615abc073d 100644
--- a/main/lang/french/trad4all.inc.php
+++ b/main/lang/french/trad4all.inc.php
@@ -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";
diff --git a/main/lang/slovenian/admin.inc.php b/main/lang/slovenian/admin.inc.php
index 2ef3e8c01d..1bda89a244 100644
--- a/main/lang/slovenian/admin.inc.php
+++ b/main/lang/slovenian/admin.inc.php
@@ -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.";
diff --git a/main/lang/slovenian/agenda.inc.php b/main/lang/slovenian/agenda.inc.php
index f954f7025c..bf9679a72a 100644
--- a/main/lang/slovenian/agenda.inc.php
+++ b/main/lang/slovenian/agenda.inc.php
@@ -75,6 +75,7 @@ $AgendaSortChronologicallyDown = "Padajoče";
$ItemForUserSelection = "Izbira uporabnikov";
$IsNotiCalFormatFile = "Datoteka ni v iCal obliki";
$RepeatEvent = "Ponovi dogodek";
+$SessionCalendar = "Koledar seje";
$RepeatDate = "Ponovi datum";
$EndDateMustBeMoreThanStartDate = "Končni datum mora biti kasnejši od začetnega datuma";
$SelectACourse = "Izberi tečaj";
diff --git a/main/lang/slovenian/trad4all.inc.php b/main/lang/slovenian/trad4all.inc.php
index 611c10b6e4..cbd0b66cea 100644
--- a/main/lang/slovenian/trad4all.inc.php
+++ b/main/lang/slovenian/trad4all.inc.php
@@ -937,13 +937,21 @@ $DateTime = "Datum in čas";
$Item = "Element";
$Never = "Nikoli";
$CopyLabelSuffix = "Kopiraj";
+$SkillsWheel = "Kolo veščin";
$Legend = "Legenda";
$ClickToZoom = "Povečaj";
$SkillXWithCourseX = "%s s %s";
$SkillRoot = "Koren";
+$ViewSkillsWheel = "Poglej kolo veščin";
$MissingXStepsToMatch = "Manjka korakov: %s";
$Rank = "Rang";
+$CurrentlyLearning = "Trenutno se uči";
+$SkillsAcquired = "Dosežene veščine";
+$AddSkillToProfileSearch = "Dodaj veščino k iskanju v profilu";
$ShortCode = "Kratka koda";
+$CreateChildSkill = "Ustvari podrejeno veščino";
+$IsThisWhatYouWereLookingFor = "Je to tisto, kar ste iskali?";
+$WhatSkillsAreYouLookingFor = "Katere veščine želite poiskati?";
$ProfileSearch = "Iskanje profila";
$here = "tule";
$ImportUsers = "Uvozi uporabnike";
diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php
index a3f838413a..50288ebd6c 100644
--- a/main/lang/spanish/trad4all.inc.php
+++ b/main/lang/spanish/trad4all.inc.php
@@ -841,7 +841,7 @@ $AssignSessions = "Asignar sesiones de formación";
$Timezone = "Zona horaria";
$DashboardPluginsHaveBeenUpdatedSucesslly = "Los plugins del panel de control han sido actualizados correctamente";
$LoginEnter = "Entrar";
-$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente.
+$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente.
Es posible crear más de una lista de asistencia por cada curso; así por ejemplo, podrá registrar separadamente la asistencia a las clases teóricas y prácticas.";
$ThereAreNoRegisteredLearnersInsidetheCourse = "No hay estudiantes inscritos en este curso";
$GoToAttendanceCalendarList = "Ir al calendario de asistencia";
@@ -977,6 +977,7 @@ $NumberOfCoursesPrivate = "Número de cursos privados";
$NumberOfCoursesClosed = "Número de cursos cerrados";
$NumberOfCoursesTotal = "Número total de cursos";
$NumberOfUsersActive = "Número de usuarios activos";
+$ReturnToCourseList = "Regreso a lista de cursos";
$dateFormatShortNumberNoYear = "%d/%m";
$CourseTutor = "Tutor de curso";
$StudentInSessionCourse = "Estudiante en un curso de sesión";
@@ -1004,14 +1005,14 @@ $YouMustAcceptLicence = "Debe aceptar la licencia para poder usar este software"
$SelectOne = "Seleccione uno";
$ContactInformationHasBeenSent = "Información de contacto enviada";
$UserInactivedSinceX = "Usuario inactivo desde %s";
-$ContactInformationDescription = "Estimado usuario,
-
-está a punto de instalar una de las mejores plataformas e-learning de código abierto que existen en el mercado. Al igual de muchos otros proyectos de código abierto, Chamilo está respaldado por una amplia comunidad de profesores, estudiantes, desarrolladores y creadores de contenido.
-
-Si sabemos algo más de quien va a gestionar este sistema e-learning, podremos dar a conocer a otros que nuestro software lo utiliza y a usted podremos informarle sobre eventos que pueden ser de su interés.
-
-Cumplimentar este formulario, implica la aceptación de que la asociación Chamilo o sus miembros puedan enviarle información por correo electrónico sobre eventos importantes o actualizaciones en el software Chamilo. Esto ayudará a crecer a la comunidad como una entidad organizada, donde el flujo de información, se haga con respeto permanente a su tiempo y su privacidad.
-
+$ContactInformationDescription = "Estimado usuario,
+
+está a punto de instalar una de las mejores plataformas e-learning de código abierto que existen en el mercado. Al igual de muchos otros proyectos de código abierto, Chamilo está respaldado por una amplia comunidad de profesores, estudiantes, desarrolladores y creadores de contenido.
+
+Si sabemos algo más de quien va a gestionar este sistema e-learning, podremos dar a conocer a otros que nuestro software lo utiliza y a usted podremos informarle sobre eventos que pueden ser de su interés.
+
+Cumplimentar este formulario, implica la aceptación de que la asociación Chamilo o sus miembros puedan enviarle información por correo electrónico sobre eventos importantes o actualizaciones en el software Chamilo. Esto ayudará a crecer a la comunidad como una entidad organizada, donde el flujo de información, se haga con respeto permanente a su tiempo y su privacidad.
+
De cualquier forma, tenga en cuenta que no tiene la obligación de rellenar este formulario. Si desea permanecer en el anonimato, perderemos la oportunidad de ofrecerle todos los privilegios de ser un administrador de portal registrado, pero respetaremos su decisión. Basta con dejar vacío este formulario y hacer clic en \"Siguiente\" para seguir instalando Chamilo.";
$CompanyActivity = "Sector";
$DateUnLock = "Desbloquear fecha";
@@ -1209,11 +1210,11 @@ $CertificateOnlineLink = "Vínculo al certificado en línea";
$NewExercises = "Nuevo ejercicio";
$MyAverage = "Mi promedio";
$AllAttempts = "Todos los intentos";
-$NoCookies = "Las cookies no están activadas en su navegador.
+$NoCookies = "Las cookies no están activadas en su navegador.
Chamilo utiliza \"cookies\" para almacenar sus datos de conexión, por lo que no le será posible entrar si las cookies no están habilitadas. Por favor, cambie la configuración de su navegador y recargue esta página.";
-$NoJavascript = "Su navegador no tiene activado JavaScript.
+$NoJavascript = "Su navegador no tiene activado JavaScript.
Chamilo se sirve de JavaScript para proporcionar un interfaz más dinámico. Es probable que muchas prestaciones sigan funcionando pero otras no lo harán, especialmente las relacionadas con la usabilidad. Le recomendamos que cambie la configuración de su navegador y recargue esta página.";
-$NoFlash = "Su navegador no tiene activado el soporte de Flash.
+$NoFlash = "Su navegador no tiene activado el soporte de Flash.
Chamilo sólo se apoya en Flash para algunas de sus funciones por lo que su ausencia no le impedirá continuar. Pero si quiere beneficiarse del conjunto de las herramientas de Chamilo, le recomendamos que instale-active el plugin de Flash y reinicialice su navegador.";
$Attempt = "Intento";
$SaveForNow = "Guardar y continuar más tarde";
@@ -1293,7 +1294,7 @@ $LoginX = "Nombre de usuario: %s";
$ChatConnected = "Chat (Conectado)";
$ChatDisconnected = "Chat (Desconectado)";
$ThingsToDo = "Actividades por realizar";
-$WamiFlashDialog = "Se mostrará un cuadro de diálogo en el que se le pedirá permiso para poder acceder al micrófono, responda afirmativamente y cierre el cuadro de diálogo (si no desea que vuelva a aparecer, antes de cerrar marque la opción
+$WamiFlashDialog = "Se mostrará un cuadro de diálogo en el que se le pedirá permiso para poder acceder al micrófono, responda afirmativamente y cierre el cuadro de diálogo (si no desea que vuelva a aparecer, antes de cerrar marque la opción
recordar)";
$WamiStartRecorder = "Inicie la grabación pulsando el micrófono y deténgala pulsándolo de nuevo. Cada vez que haga esto se generará un archivo.";
$InputNameHere = "Escriba el nombre aquí";
@@ -1384,4 +1385,5 @@ $DataTableSearch = "Buscar";
$HideColumn = "Ocultar columna";
$DisplayColumn = "Mostrar columna";
$LegalAgreementAccepted = "Condiciones legales aceptadas";
+$dateFormatOnlyDayName = "%A";
?>
\ No newline at end of file
diff --git a/main/mySpace/lp_tracking.php b/main/mySpace/lp_tracking.php
index 8b01e16a97..813b5ea7e0 100644
--- a/main/mySpace/lp_tracking.php
+++ b/main/mySpace/lp_tracking.php
@@ -6,7 +6,6 @@ require_once '../inc/global.inc.php';
// resetting the course id
$cidReset = true;
-
$from_myspace = false;
$from_link = '';
if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php
index b4d687b4bc..98ecefb935 100644
--- a/main/mySpace/myStudents.php
+++ b/main/mySpace/myStudents.php
@@ -23,8 +23,12 @@ require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
api_block_anonymous_users();
-if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh()) {
- api_not_allowed(true);
+if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh()) {
+ // Check if the user is tutor of the course
+ $user_course_status = CourseManager::get_tutor_in_course_status(api_get_user_id(), api_get_course_id());
+ if ($user_course_status != 1) {
+ api_not_allowed(true);
+ }
}
$htmlHeadXtra[] = '';
+$htmlHeadXtra[] = '';
if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
$htmlHeadXtra[] = '';
// Document API
$htmlHeadXtra[] = '';
// Storage API
-$htmlHeadXtra[] = '