瀏覽代碼

[svn r18554] Logic change - Fixed notes ordering into notebook tool - see FS# 3668

Cristian Fasanando 16 年之前
父節點
當前提交
3fb4f8c3a4
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      main/notebook/index.php

+ 5 - 2
main/notebook/index.php

@@ -79,6 +79,7 @@ echo '</div>';
 if (isset($_GET['action']) && $_GET['action'] == 'addnote') 
 {
 	// initiate the object
+	$_SESSION['notebook_view'] = 'creation_date';
 	api_display_tool_title(get_lang('NoteAddNew'));	
 	$form = new FormValidator('note','post', api_get_self().'?action='.Security::remove_XSS($_GET['action']));
 	// settting the form elements	
@@ -285,8 +286,10 @@ function display_notes()
 	} else {
 		$order_by = " ORDER BY ".$_SESSION['notebook_view']." ASC ";
 	}
-	
-	$sql = "SELECT * FROM $t_notebook WHERE user_id = '".Database::escape_string(api_get_user_id())."' $order_by";
+		
+	$cond_extra = ($_SESSION['notebook_view']== 'update_date')?" AND update_date <> '0000-00-00 00:00:00'":" ";
+		
+	$sql = "SELECT * FROM $t_notebook WHERE user_id = '".Database::escape_string(api_get_user_id())."' $cond_extra $order_by";
 	$result = api_sql_query($sql, __FILE__, __LINE__);
 	while ($row = Database::fetch_array($result))
 	{