Should fix a bug when showing the gradebook form + other "PHP Strict standards" fixes

skala
Julio Montoya 13 years ago
parent 957ebe77bf
commit 86b2899d4f
  1. 21
      main/gradebook/index.php
  2. 4
      main/gradebook/lib/be/abstractlink.class.php
  3. 4
      main/gradebook/lib/be/category.class.php
  4. 4
      main/gradebook/lib/be/evaluation.class.php
  5. 2
      main/gradebook/lib/be/linkfactory.class.php
  6. 4
      main/gradebook/lib/fe/catform.class.php
  7. 4
      main/gradebook/lib/fe/dataform.class.php
  8. 4
      main/gradebook/lib/fe/evalform.class.php
  9. 3
      main/gradebook/lib/fe/gradebooktable.class.php
  10. 4
      main/gradebook/lib/fe/userform.class.php
  11. 2
      main/inc/lib/formvalidator/Element/style_submit_button.php
  12. 3
      main/inc/lib/grade_model.lib.php
  13. 69
      main/inc/lib/pear/HTML/QuickForm/hidden.php

@ -831,7 +831,8 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
if (!empty($cats)) {
if ( (api_get_setting('gradebook_enable_grade_model') == 'true') && (api_is_platform_admin() || (api_is_allowed_to_edit(null, true) && api_get_setting('teachers_can_change_grade_model_settings') == 'true'))) {
if ( (api_get_setting('gradebook_enable_grade_model') == 'true') &&
(api_is_platform_admin() || (api_is_allowed_to_edit(null, true) && api_get_setting('teachers_can_change_grade_model_settings') == 'true'))) {
//Getting grade models
$obj = new GradeModel();
@ -841,13 +842,13 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
//No children
if (count($cats) == 1 && empty($grade_model_id)) {
if (!empty($grade_models)) {
$form = new FormValidator('grade_model_settings');
$obj->fill_grade_model_select_in_form();
$form->addElement('style_submit_button', 'submit', get_lang('Save'), 'class="save"');
if ($form->validate()) {
$value = $form->exportValue('grade_model_id');
//if (0) {
$form_grade = new FormValidator('grade_model_settings');
$obj->fill_grade_model_select_in_form($form_grade);
$form_grade->addElement('style_submit_button', 'submit', get_lang('Save'), 'class="save"');
if ($form_grade->validate()) {
$value = $form_grade->exportValue('grade_model_id');
$gradebook = new Gradebook();
$gradebook->update(array('id'=> $cats[0]->get_id(), 'grade_model_id' => $value), true);
@ -873,8 +874,8 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
//Reloading cats
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
} else {
$form->display();
}
$form_grade->display();
}
}
}
}

@ -129,7 +129,7 @@ abstract class AbstractLink implements GradebookItem {
* Retrieve links and return them as an array of extensions of AbstractLink.
* To keep consistency, do not call this method but LinkFactory::load instead.
*/
public function load ($id = null, $type = null, $ref_id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null) {
public static function load ($id = null, $type = null, $ref_id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null) {
$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql='SELECT * FROM '.$tbl_grade_links;
$paramcount = 0;
@ -191,7 +191,7 @@ abstract class AbstractLink implements GradebookItem {
return $links;
}
private function create_objects_from_sql_result($result) {
private static function create_objects_from_sql_result($result) {
$links=array();
while ($data=Database::fetch_array($result)) {
$link = LinkFactory::create(intval($data['type']));

@ -172,7 +172,7 @@ class Category implements GradebookItem
*/
public function load($id = null, $user_id = null, $course_code = null, $parent_id = null, $visible = null, $session_id = null, $order_by = null) {
public static function load($id = null, $user_id = null, $course_code = null, $parent_id = null, $visible = null, $session_id = null, $order_by = null) {
//if the category given is explicitly 0 (not null), then create
// a root category object (in memory)
if ( isset($id) && (int)$id === 0 ) {
@ -277,7 +277,7 @@ class Category implements GradebookItem
return $cat;
}
private function create_category_objects_from_sql_result($result) {
private static function create_category_objects_from_sql_result($result) {
$allcat=array();
while ($data=Database::fetch_array($result)) {
$cat= new Category();

@ -142,7 +142,7 @@ class Evaluation implements GradebookItem
* @param $category_id parent category
* @param $visible visible
*/
public function load ($id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null, $locked = null) {
public static function load ($id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null, $locked = null) {
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$sql = 'SELECT * FROM '.$tbl_grade_evaluations;
$paramcount = 0;
@ -185,7 +185,7 @@ class Evaluation implements GradebookItem
return $alleval;
}
private function create_evaluation_objects_from_sql_result($result) {
private static function create_evaluation_objects_from_sql_result($result) {
$alleval=array();
if (Database::num_rows($result)) {
while ($data = Database::fetch_array($result)) {

@ -50,7 +50,7 @@ class LinkFactory
* @param $category_id parent category
* @param $visible visible
*/
public function load ($id = null, $type = null, $ref_id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null) {
public static function load ($id = null, $type = null, $ref_id = null, $user_id = null, $course_code = null, $category_id = null, $visible = null) {
return AbstractLink::load($id, $type, $ref_id, $user_id, $course_code, $category_id, $visible);
}

@ -266,7 +266,7 @@ class CatForm extends FormValidator {
parent :: display();
}
function setDefaults($defaults = array ()) {
parent :: setDefaults($defaults);
function setDefaults($defaults = array(), $filter = null) {
parent :: setDefaults($defaults, $filter);
}
}

@ -111,7 +111,7 @@ class DataForm extends FormValidator {
parent :: display();
}
function setDefaults($defaults = array ()) {
parent :: setDefaults($defaults);
function setDefaults($defaults = array(), $filter = null) {
parent :: setDefaults($defaults, $filter);
}
}

@ -521,8 +521,8 @@ class EvalForm extends FormValidator
parent :: display();
}
function setDefaults($defaults= array ()) {
parent :: setDefaults($defaults);
function setDefaults($defaults= array(), $filter = null) {
parent :: setDefaults($defaults, $filter);
}
private function build_stud_label ($id, $username,$lastname, $firstname) {

@ -104,7 +104,8 @@ class GradebookTable 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) {
//variables load in index.php
global $my_score_in_gradebook, $certificate_min_score;
$scoretotal = 0;

@ -76,7 +76,7 @@ class UserForm extends FormValidator
function display() {
parent :: display();
}
function setDefaults($defaults= array ()) {
parent :: setDefaults($defaults);
function setDefaults($defaults= array(), $filter = null) {
parent :: setDefaults($defaults, $filter);
}
}

@ -51,7 +51,7 @@ class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
* @access public
* @return void
*/
function HTML_QuickForm_stylesubmitbutton($elementName=null, $value=null, $attributes=null,$img=null) {
function HTML_QuickForm_stylesubmitbutton($elementName = null, $value = null, $attributes = array(), $img=null) {
if (!isset($attributes['class'])) {
$attributes['class'] = 'btn';
}

@ -217,7 +217,8 @@ class GradeModel extends Model {
parent::delete($id);
//event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
}
public function fill_grade_model_select_in_form($form, $name = 'gradebook_model_id') {
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id') {
if (api_get_setting('gradebook_enable_grade_model') == 'false') {
return false;
}

@ -1,41 +1,41 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* HTML class for a hidden type element
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @copyright 2001-2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: hidden.php,v 1.12 2009/04/04 21:34:03 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Base class for <input /> form elements
*/
require_once 'HTML/QuickForm/input.php';
/**
* HTML class for a hidden type element
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @copyright 2001-2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: hidden.php,v 1.12 2009/04/04 21:34:03 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Base class for <input /> form elements
*/
require_once 'HTML/QuickForm/input.php';
/**
* HTML class for a hidden type element
*
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @version Release: 3.2.11
* @since 1.0
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @version Release: 3.2.11
* @since 1.0
*/
class HTML_QuickForm_hidden extends HTML_QuickForm_input
{
@ -79,11 +79,12 @@ class HTML_QuickForm_hidden extends HTML_QuickForm_input
/**
* Accepts a renderer
*
* @param HTML_QuickForm_Renderer renderer object
* @param HTML_QuickForm_Renderer renderer object
* @access public
* @return void
*/
function accept(&$renderer)
//function accept(&$renderer)
function accept(&$renderer, $required=false, $error=null)
{
$renderer->renderHidden($this);
} // end func accept

Loading…
Cancel
Save