From 598e9e9a74befed3c1de4f58d0a3a2b3381c1cec Mon Sep 17 00:00:00 2001
From: Julio Montoya <gugli100@gmail.com>
Date: Tue, 7 Aug 2012 13:37:47 +0200
Subject: [PATCH] Fixing PHP warnings

---
 main/gradebook/gradebook_view_result.php       | 2 +-
 main/gradebook/lib/be/abstractlink.class.php   | 2 +-
 main/gradebook/lib/be/linkfactory.class.php    | 5 +++--
 main/gradebook/lib/fe/displaygradebook.php     | 6 +++---
 main/gradebook/lib/fe/flatviewtable.class.php  | 3 +--
 main/gradebook/lib/fe/gradebooktable.class.php | 4 ++--
 main/gradebook/lib/fe/resulttable.class.php    | 2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/main/gradebook/gradebook_view_result.php b/main/gradebook/gradebook_view_result.php
index 666480dd59..70eb240431 100644
--- a/main/gradebook/gradebook_view_result.php
+++ b/main/gradebook/gradebook_view_result.php
@@ -372,7 +372,7 @@ if (isset ($_GET['print'])) {
 	}
 	$newarray = array();
 	foreach ($data_array as $data) {
-		$newarray[] = array_slice($data, 2);
+		$newarray[] = array_slice($data, 3);
 	}
 
 	echo print_table($newarray, $header_names,get_lang('ViewResult'), $eval[0]->get_name());
diff --git a/main/gradebook/lib/be/abstractlink.class.php b/main/gradebook/lib/be/abstractlink.class.php
index e6ea2cb45d..07ed8d9511 100644
--- a/main/gradebook/lib/be/abstractlink.class.php
+++ b/main/gradebook/lib/be/abstractlink.class.php
@@ -194,7 +194,7 @@ abstract class AbstractLink implements GradebookItem {
     private static function create_objects_from_sql_result($result) {
     	$links=array();
 		while ($data=Database::fetch_array($result)) {
-			$link = LinkFactory::create(intval($data['type']));
+			$link = LinkFactory::create($data['type']);
 			$link->set_id($data['id']);
 			$link->set_type($data['type']);
 			$link->set_ref_id($data['ref_id']);
diff --git a/main/gradebook/lib/be/linkfactory.class.php b/main/gradebook/lib/be/linkfactory.class.php
index da32d41659..595bc6cc7f 100644
--- a/main/gradebook/lib/be/linkfactory.class.php
+++ b/main/gradebook/lib/be/linkfactory.class.php
@@ -80,7 +80,8 @@ class LinkFactory
 	 * Static method to create specific link objects
 	 * @param $type link type
 	 */
-	public function create ($type) {
+	public static function create ($type) {
+        $type = intval($type);
 		switch ($type) {
 			case LINK_EXERCISE:
 				return new ExerciseLink();
@@ -103,7 +104,7 @@ class LinkFactory
 	/**
 	 * Return an array of all known link types
 	 */
-	public function get_all_types () {
+	public static function get_all_types () {
 		//LINK_DROPBOX,
 		return array (LINK_EXERCISE,
 					  //LINK_DROPBOX,
diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php
index 7698a6a0a6..1ad1b1a265 100644
--- a/main/gradebook/lib/fe/displaygradebook.php
+++ b/main/gradebook/lib/fe/displaygradebook.php
@@ -17,7 +17,7 @@ class DisplayGradebook
 	* @param $shownavbar 1=show navigation bar
 	* @param $forpdf only output for pdf file
 	*/
-	function display_header_result($evalobj, $selectcat, $page) {
+	static function display_header_result($evalobj, $selectcat, $page) {
 		if (api_is_allowed_to_edit(null, true)) {
 			$header = '<div class="actions">';			
 			if ($page != 'statistics') {
@@ -158,7 +158,7 @@ class DisplayGradebook
 	* @param $showeval
 	* @param $showlink
 	*/
-	function display_header_reduce_flatview($catobj, $showeval, $showlink,$simple_search_form) {
+	static function display_header_reduce_flatview($catobj, $showeval, $showlink,$simple_search_form) {
 		$header = '<div class="actions">';
         if ($catobj->get_parent_id() == 0) {
             $select_cat = $catobj->get_id();
@@ -356,7 +356,7 @@ class DisplayGradebook
      * @param boolean Whether to show or not the link to add a new item inside the qualification (we hide it in case of the course-embedded tool where we have only one calification per course or session)
      * @return void Everything is printed on screen upon closing
 	 */
-	function display_header_gradebook($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true) {
+	static function display_header_gradebook($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true) {
 		//student
 		$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
 		$objcat = new Category();
diff --git a/main/gradebook/lib/fe/flatviewtable.class.php b/main/gradebook/lib/fe/flatviewtable.class.php
index 8d3dd203bd..e0f56ffb4f 100644
--- a/main/gradebook/lib/fe/flatviewtable.class.php
+++ b/main/gradebook/lib/fe/flatviewtable.class.php
@@ -410,8 +410,7 @@ class FlatViewTable extends SortableTable
 	/**
 	 * Function used by SortableTable to generate the data to display
 	 */
-	function get_table_data ($from = 1) {
-
+	function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
 		$is_western_name_order = api_is_western_name_order();
 
 		// create page navigation if needed
diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php
index ffae6c1829..c241ed1061 100644
--- a/main/gradebook/lib/fe/gradebooktable.class.php
+++ b/main/gradebook/lib/fe/gradebooktable.class.php
@@ -186,10 +186,10 @@ class GradebookTable extends SortableTable {
                 $main_categories[$item->get_id()]['name'] = $item->get_name();                
 			} else {
 				$row[] = $invisibility_span_open.$this->build_name_link($item) . $invisibility_span_close;
-                $main_categories[$item->get_id()] = $this->build_name_link($item);                
+                $main_categories[$item->get_id()]['name'] = $this->build_name_link($item);                
 			}
             
-            $main_categories[$item->get_id()]['weight'] = $item->get_weight();
+            $main_categories[$item->get_id()]['weight']= $item->get_weight();
             $total_categories_weight += $item->get_weight();
             
 			//Description
diff --git a/main/gradebook/lib/fe/resulttable.class.php b/main/gradebook/lib/fe/resulttable.class.php
index f816ae6322..bec6e9207e 100644
--- a/main/gradebook/lib/fe/resulttable.class.php
+++ b/main/gradebook/lib/fe/resulttable.class.php
@@ -74,7 +74,7 @@ class ResultTable extends SortableTable
 	/**
 	 * Function used by SortableTable to generate the data to display
 	 */
-	function get_table_data ($from = 1) {
+	function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
 
 		$is_western_name_order = api_is_western_name_order();
 		$scoredisplay = ScoreDisplay :: instance();