Browse Source

Work Tool: Teacher can edit the score even if the 2nd date is already passed

Julio Montoya 13 years ago
parent
commit
5e4a4d4ce3
3 changed files with 20 additions and 18 deletions
  1. 1 0
      documentation/changelog.html
  2. 6 10
      main/work/work.lib.php
  3. 13 8
      main/work/work.php

+ 1 - 0
documentation/changelog.html

@@ -64,6 +64,7 @@ This version of Chamilo only includes a few minor new features:
       Assignments
       <ul>
         <li>Made assignments editable/removable by students only until they have been reviewed and scored (&#062; 0) by the teacher (changeset bc1b8e1e603d)</li>
+        <li>Teachers can changed the score even if the assignment is already passed.</li>
       </ul>
     </li>
     <li>

+ 6 - 10
main/work/work.lib.php

@@ -372,12 +372,7 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
 	$my_params      = $sort_params;
 	$origin         = Security::remove_XSS($origin);
 
-	/*
-	 *
-	* Getting may work data
-	*
-	*/
-
+	// Getting the work data
 	$my_folder_data = get_work_data_by_id($id);
 
 	$work_in_gradebook_link_id = is_resource_in_course_gradebook(api_get_course_id(), 3 , $id, api_get_session_id());
@@ -434,9 +429,7 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
 
 		$sql_get_publications_list = "SELECT * FROM  $work_table $group_query $subdirs_query ".$add_in_where_query."  $condition_session ORDER BY id";
 		$sql_get_publications_num  = "SELECT count(url) FROM  ".$work_table." " .
-								    "WHERE url LIKE BINARY '$sub_course_dir%' AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query.
-		$condition_session.
-		                 			" ORDER BY id";
+								     " WHERE url LIKE BINARY '$sub_course_dir%' AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query.$condition_session." ORDER BY id";
 	}
 
 	//echo $sql_get_publications_list;
@@ -852,10 +845,12 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
 		while ($work = Database::fetch_object($sql_result)) {
 			//Get the author ID for that document from the item_property table
 			$is_author = false;
-			$item_property_data = api_get_item_property_info(api_get_course_int_id(), 'work', $work->id);
+			$item_property_data = api_get_item_property_info(api_get_course_int_id(), 'work', $work->id, api_get_session_id());
+			
 			if (!$is_allowed_to_edit && $item_property_data['insert_user_id'] == api_get_user_id()) {
 				$is_author = true;
 			}
+			
 			$user_info = api_get_user_info($item_property_data['insert_user_id']);
 				
 			//display info depending on the permissions
@@ -916,6 +911,7 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
 						$table_header[] = array(get_lang('Actions'), false, 'style="width:90px"');
 						$table_has_actions_column = true;
 					}
+					
 					$action = '';
 					$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&curdirpath='.urlencode($my_sub_dir).'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'" title="'.get_lang('Modify').'"  >'.Display::return_icon('edit.png', get_lang('Modify'),array(), 22).'</a>';
 					if (api_get_course_setting('student_delete_own_publication') == 1) {

+ 13 - 8
main/work/work.php

@@ -120,7 +120,7 @@ $table_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURS
 
 /*	Constants and variables */
 
-$tool_name = get_lang('StudentPublications');
+$tool_name 		= get_lang('StudentPublications');
 $user_id 		= api_get_user_id();
 $course_code 	= api_get_course_id();
 $session_id 	= api_get_session_id();
@@ -140,7 +140,7 @@ $delete = isset($_REQUEST['delete']) ? Database::escape_string($_REQUEST['delete
 $description = isset($_REQUEST['description']) ? Database::escape_string($_REQUEST['description']) : '';
 $display_tool_options = isset($_REQUEST['display_tool_options']) ? $_REQUEST['display_tool_options'] : '';
 $display_upload_form = isset($_REQUEST['display_upload_form']) ? $_REQUEST['display_upload_form'] : '';
-$edit = isset($_REQUEST['edit']) ? Database::escape_string($_REQUEST['edit']) : '';
+$edit = isset($_REQUEST['edit']) ? intval($_REQUEST['edit']) : '';
 $parent_id = isset($_REQUEST['parent_id']) ? Database::escape_string($_REQUEST['parent_id']) : '';
 $make_invisible = isset($_REQUEST['make_invisible']) ? Database::escape_string($_REQUEST['make_invisible']) : '';
 $make_visible = isset($_REQUEST['make_visible']) ? Database::escape_string($_REQUEST['make_visible']) : '';
@@ -804,10 +804,10 @@ else {
 			$result = Database::query($sql);
 			if ($result) {
 				$row = Database::fetch_array($result);
-				$workTitle = $row['title'];
-				$workAuthor = $row['author'];
-				$workDescription = $row['description'];
-				$workUrl = $row['url'];
+				$workTitle 			  = $row['title'];
+				$workAuthor 		  = $row['author'];
+				$workDescription 	  = $row['description'];
+				$workUrl 			  = $row['url'];
 				$qualification_number = $row['qualification'];
 			}
 		}
@@ -1130,11 +1130,16 @@ if ($is_special) {
 /*	Display form to upload document */
 
 if ($is_course_member) {
-	if (($display_upload_form || $edit) && !$has_ended) {
-
+	if (($display_upload_form || $edit)) {
+		
+		/*if (!$is_allowed_to_edit && $edit) {
+			api_not_allowed();
+		}*/
+		
 		if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
 			api_not_allowed();
 		}
+		
 
 		if ($edit) {
 			//Get the author ID for that document from the item_property table