Browse Source

Fixed bug whereby the tasks added to the calendar were added by creation date instead of hand out date. Now creating event on the basis of hand-out date if defined (fixes CT#1638)

Yannick Warnier 14 năm trước cách đây
mục cha
commit
9342b07297
2 tập tin đã thay đổi với 10 bổ sung3 xóa
  1. 1 0
      documentation/changelog.html
  2. 9 3
      main/work/work.php

+ 1 - 0
documentation/changelog.html

@@ -36,6 +36,7 @@
   <li>Tests tool: Errors have been fixed about showing HotPotatoes tests and results. The solution has been proposed by Hubert Borderiou (Bug #1301)</li>
   <li>Tests tool: Titles of the imported HotPotatoes tests are retrieved in their original spelling, without modifications due to technical reasons, as it was before. The problem has been reported by Oliver Corre (Bug #1761)</li>
   <li>Improved resource visibility from sessions (Bug #1599)</li>
+  <li>Tasks now create a calendar event based on the hand out date instead of the task creation date (if hand out date is defined) (Bug #1638)</li>
 </ul>
 
 <h3>Deprecated files</h3>

+ 9 - 3
main/work/work.php

@@ -536,9 +536,15 @@ if (!empty($_REQUEST['new_dir'])) {
 				require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php';
 				require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
 				$course = isset($course_info) ? $course_info : null;
-				$content = '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.substr(Security::remove_XSS($dir_name_sql), 1).'" >'.$_POST['new_dir'].'</a> - '.$_POST['description'];
-
-				$agenda_id = agenda_add_item($course, $_POST['new_dir'], $content, date('Y-m-d H:i:s'), date('Y-m-d H:i:s'), array('GROUP:'.$toolgroup), 0);
+				$date = date('Y-m-d H:i:s');
+				$title = Security::remove_XSS($_POST['new_dir']);
+				if (!empty($_POST['type1'])) {
+					$date = get_date_from_select('expires');
+					$title = sprintf(get_lang('HandingOverOfTaskX'),Security::remove_XSS($_POST['new_dir']));
+				}
+				$content = '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.substr(Security::remove_XSS($dir_name_sql), 1).'" >'.Security::remove_XSS($_POST['new_dir']).'</a> - '.Security::remove_XSS($_POST['description']);
+				error_log($date);
+				$agenda_id = agenda_add_item($course, $title, $content, $date, $date, array('GROUP:'.$toolgroup), 0);
 			}
 			$sql_add_publication = "INSERT INTO " . $work_table . " SET " .
 									   "url         = '".Database::escape_string($dir_name_sql)."',