Browse Source

[svn r11699] Student publications: no sortable table
http://www.dokeos.com/forum/viewtopic.php?t=8722

Patrick Cool 18 years ago
parent
commit
1e464dc072
2 changed files with 28 additions and 15 deletions
  1. 15 11
      main/work/work.lib.php
  2. 13 4
      main/work/work.php

+ 15 - 11
main/work/work.lib.php

@@ -174,7 +174,7 @@ function display_default_visibility_form($uploadvisibledisabled)
 */
 function display_student_publications_list($work_dir,$sub_course_dir,$currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin)
 {
-	//init
+	// Database table names
 	$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
 	$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
 	$is_allowed_to_edit = api_is_allowed_to_edit();
@@ -199,8 +199,14 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
 	}
 	$sort_params = implode('&',$sort_params);
 
-	if(substr($sub_course_dir,-1,1)!='/' && !empty($sub_course_dir)){$sub_course_dir = $sub_course_dir.'/';}
-	if($sub_course_dir == '/'){$sub_course_dir='';}
+	if(substr($sub_course_dir,-1,1)!='/' && !empty($sub_course_dir))
+	{
+		$sub_course_dir = $sub_course_dir.'/';
+	}
+	if($sub_course_dir == '/')
+	{
+		$sub_course_dir='';
+	}
 
 	//Get list from database
 	if($is_allowed_to_edit)
@@ -217,13 +223,11 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
 		{
 			$group_query = " WHERE post_group_id = '".$_SESSION['toolgroup']."' "; // set to select only messages posted by the user's group
 		}
-		else {
+		else
+		{
 			$group_query = '';
 		}
-		$sql_get_publications_list =	"SELECT * " .
-									"FROM  ".$work_table." " .
-									$group_query.
-									"ORDER BY id";
+		$sql_get_publications_list =	"SELECT * FROM  $work_table $group_query ORDER BY id";
 	}
 	//echo $sql_get_publications_list;
 	$sql_result = api_sql_query($sql_get_publications_list,__FILE__,__LINE__);
@@ -324,10 +328,10 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
 			$table_data[] = $row;
 		}
 	}
-	if( count($table_data) > 0)
-	{
+	//if( count($table_data) > 0)
+	//{
 		Display::display_sortable_table($table_header,$table_data);
-	}
+	//}
 }
 /**
  * Returns a list of subdirectories found in the given directory.

+ 13 - 4
main/work/work.php

@@ -23,7 +23,7 @@
 * 	@author Patrick Cool <patrick.cool@UGent.be>, Ghent University - ability for course admins to specify wether uploaded documents are visible or invisible by default.
 * 	@author Roan Embrechts, code refactoring and virtual course support
 * 	@author Frederic Vauthier, directories management
-*  	@version $Id: work.php 11391 2007-03-05 14:31:29Z elixir_julian $
+*  	@version $Id: work.php 11699 2007-03-26 13:47:44Z pcool $
 *
 * 	@todo refactor more code into functions, use quickforms, coding standards, ...
 */
@@ -263,11 +263,13 @@ if (!api_is_course_admin()){
 */
 if ($origin != 'learnpath')
 {
-	if($display_upload_form){
+	if($display_upload_form)
+	{
 		$tool_name = get_lang("UploadADocument");
 		$interbreadcrumb[] = array ("url" => "work.php", "name" => get_lang('StudentPublications'));
 	}
-	if($display_tool_options){
+	if($display_tool_options)
+	{
 		$tool_name = get_lang("EditToolOptions");
 		$interbreadcrumb[] = array ("url" => "work.php", "name" => get_lang('StudentPublications'));
 	}
@@ -912,7 +914,14 @@ if ($_POST['submitWork'] && $succeed &&!$id) //last value is to check this is no
 		Display list of student publications
 ==============================================================================
 */
-	if($cur_dir_path =='/'){$my_cur_dir_path = '';}else{$my_cur_dir_path = $cur_dir_path;}
+	if($cur_dir_path =='/')
+	{
+		$my_cur_dir_path = '';
+	}
+	else
+	{
+		$my_cur_dir_path = $cur_dir_path;
+	}
 	display_student_publications_list($base_work_dir.'/'.$my_cur_dir_path,'work/'.$my_cur_dir_path,$currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin);
 //}