Browse Source

Fixing PHP warnings

Julio Montoya 12 years ago
parent
commit
598e9e9a74

+ 1 - 1
main/gradebook/gradebook_view_result.php

@@ -372,7 +372,7 @@ if (isset ($_GET['print'])) {
 	}
 	}
 	$newarray = array();
 	$newarray = array();
 	foreach ($data_array as $data) {
 	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());
 	echo print_table($newarray, $header_names,get_lang('ViewResult'), $eval[0]->get_name());

+ 1 - 1
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) {
     private static function create_objects_from_sql_result($result) {
     	$links=array();
     	$links=array();
 		while ($data=Database::fetch_array($result)) {
 		while ($data=Database::fetch_array($result)) {
-			$link = LinkFactory::create(intval($data['type']));
+			$link = LinkFactory::create($data['type']);
 			$link->set_id($data['id']);
 			$link->set_id($data['id']);
 			$link->set_type($data['type']);
 			$link->set_type($data['type']);
 			$link->set_ref_id($data['ref_id']);
 			$link->set_ref_id($data['ref_id']);

+ 3 - 2
main/gradebook/lib/be/linkfactory.class.php

@@ -80,7 +80,8 @@ class LinkFactory
 	 * Static method to create specific link objects
 	 * Static method to create specific link objects
 	 * @param $type link type
 	 * @param $type link type
 	 */
 	 */
-	public function create ($type) {
+	public static function create ($type) {
+        $type = intval($type);
 		switch ($type) {
 		switch ($type) {
 			case LINK_EXERCISE:
 			case LINK_EXERCISE:
 				return new ExerciseLink();
 				return new ExerciseLink();
@@ -103,7 +104,7 @@ class LinkFactory
 	/**
 	/**
 	 * Return an array of all known link types
 	 * Return an array of all known link types
 	 */
 	 */
-	public function get_all_types () {
+	public static function get_all_types () {
 		//LINK_DROPBOX,
 		//LINK_DROPBOX,
 		return array (LINK_EXERCISE,
 		return array (LINK_EXERCISE,
 					  //LINK_DROPBOX,
 					  //LINK_DROPBOX,

+ 3 - 3
main/gradebook/lib/fe/displaygradebook.php

@@ -17,7 +17,7 @@ class DisplayGradebook
 	* @param $shownavbar 1=show navigation bar
 	* @param $shownavbar 1=show navigation bar
 	* @param $forpdf only output for pdf file
 	* @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)) {
 		if (api_is_allowed_to_edit(null, true)) {
 			$header = '<div class="actions">';			
 			$header = '<div class="actions">';			
 			if ($page != 'statistics') {
 			if ($page != 'statistics') {
@@ -158,7 +158,7 @@ class DisplayGradebook
 	* @param $showeval
 	* @param $showeval
 	* @param $showlink
 	* @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">';
 		$header = '<div class="actions">';
         if ($catobj->get_parent_id() == 0) {
         if ($catobj->get_parent_id() == 0) {
             $select_cat = $catobj->get_id();
             $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)
      * @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
      * @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
 		//student
 		$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
 		$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
 		$objcat = new Category();
 		$objcat = new Category();

+ 1 - 2
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 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();
 		$is_western_name_order = api_is_western_name_order();
 
 
 		// create page navigation if needed
 		// create page navigation if needed

+ 2 - 2
main/gradebook/lib/fe/gradebooktable.class.php

@@ -186,10 +186,10 @@ class GradebookTable extends SortableTable {
                 $main_categories[$item->get_id()]['name'] = $item->get_name();                
                 $main_categories[$item->get_id()]['name'] = $item->get_name();                
 			} else {
 			} else {
 				$row[] = $invisibility_span_open.$this->build_name_link($item) . $invisibility_span_close;
 				$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();
             $total_categories_weight += $item->get_weight();
             
             
 			//Description
 			//Description

+ 1 - 1
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 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();
 		$is_western_name_order = api_is_western_name_order();
 		$scoredisplay = ScoreDisplay :: instance();
 		$scoredisplay = ScoreDisplay :: instance();