소스 검색

[svn r17728] logic changes-allows move threads in the forum-(see FS#3460)

Isaac Flores 16 년 전
부모
커밋
23d00c0dd8
2개의 변경된 파일14개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 1
      main/forum/viewthread_flat.inc.php
  2. 9 1
      main/gradebook/lib/be/forumthreadlink.class.php

+ 5 - 1
main/forum/viewthread_flat.inc.php

@@ -26,6 +26,7 @@
 if (isset($current_thread['thread_id'])){
 
 $rows=get_posts($current_thread['thread_id']);
+$increment=0;
 foreach ($rows as $row) {
 	echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">\n";
 	// the style depends on the status of the message: approved or not
@@ -64,7 +65,9 @@ foreach ($rows as $row) {
 		echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=delete&amp;content=post&amp;id=".$row['post_id']."&origin=".$origin."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeletePost"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>\n";
 		display_visible_invisible_icon('post', $row['post_id'], $row['visible'],array('forum'=>Security::remove_XSS($_GET['forum']),'thread'=>Security::remove_XSS($_GET['thread']), 'origin'=>$origin ));
 		echo "\n";
-		echo "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=move&amp;post=".$row['post_id']."&origin=".$origin."\">".icon('../img/deplacer_fichier.gif',get_lang('MovePost'))."</a>";
+		if ($increment>0) {
+			echo "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;action=move&amp;post=".$row['post_id']."&origin=".$origin."\">".icon('../img/deplacer_fichier.gif',get_lang('MovePost'))."</a>";
+		}
 	}
 	
 	$userinf=api_get_user_info($row['user_id']);
@@ -138,5 +141,6 @@ foreach ($rows as $row) {
 	unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
 	unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']]);
 	echo "</table>";
+	$increment++;
 }
 }

+ 9 - 1
main/gradebook/lib/be/forumthreadlink.class.php

@@ -246,8 +246,15 @@ class ForumThreadLink extends AbstractLink
     } 
     
     public function get_link() {
+    	//it was extracts the forum id
+   		$tbl_name=$this->get_forum_thread_table();
+    	$sql = 'SELECT * FROM '.$this->get_forum_thread_table()." WHERE thread_id = '".$this->get_ref_id()."'";
+		$result = api_sql_query($sql,__FILE__,__LINE__);
+		$row    = Database::fetch_array($result,'ASSOC');
+		$forum_id=$row['forum_id'];
+		
     	$url = api_get_path(WEB_PATH)
-		.'main/forum/viewthread.php?cidReq='.$this->get_course_code().'&thread='.$this->get_ref_id().'&gradebook=view';
+		.'main/forum/viewthread.php?cidReq='.$this->get_course_code().'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id;
 		return $url;
 	}
 	private function get_exercise_data() {
@@ -261,4 +268,5 @@ class ForumThreadLink extends AbstractLink
     	}
     	return $this->exercise_data;
     }
+    
 }