Adding static in some functions

skala
Julio Montoya 13 years ago
parent 28d2fb2d43
commit 6adebfc36c
  1. 2
      main/gradebook/lib/be/result.class.php
  2. 5
      main/inc/lib/message.lib.php
  3. 78
      main/inc/lib/pear/HTML/QuickForm/file.php
  4. 2
      main/inc/lib/pear/Pager/Pager.php
  5. 2
      main/inc/lib/security.lib.php
  6. 2
      main/inc/lib/social.lib.php
  7. 24
      main/inc/lib/table_sort.class.php

@ -76,7 +76,7 @@ class Result
* @param $user_id user id (student)
* @param $evaluation_id evaluation where this is a result for
*/
public function load ($id = null, $user_id = null, $evaluation_id = null) {
public static function load ($id = null, $user_id = null, $evaluation_id = null) {
$tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$tbl_course_rel_course = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_rel_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);

@ -1232,14 +1232,15 @@ class MessageManager
return $item;
}
function generate_message_form($id, $params = array()) {
static function generate_message_form($id, $params = array()) {
$form = new FormValidator('send_message', null, 'post', null, array('id'=>$id.'_form', 'class' =>'form-vertical'));
$form->addElement('text', 'subject', get_lang('Subject'), array('id' => 'subject_id', 'class' => 'span5'));
$form->addElement('textarea', 'content', get_lang('Message'), array('id' => 'content_id', 'rows' => '5', 'class' => 'span5'));
$div = Display::div($form->return_form(), array('id' => $id.'_div', 'style' => 'display:none'));
return $div;
}
function generate_invitation_form($id , $params = array()) {
static function generate_invitation_form($id , $params = array()) {
$form = new FormValidator('send_invitation', null, 'post', null, array('id'=>$id.'_form','class' =>'form-vertical'));
//$form->addElement('text', 'subject', get_lang('Subject'), array('id' => 'subject_id'));
$form->addElement('textarea', 'content', get_lang('AddPersonalMessage'), array('id' => 'content_invitation_id', 'rows' => '5', 'class' => 'span5'));

@ -1,32 +1,32 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* HTML class for a file upload field
*
* 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>
* @author Alexey Borzov <avb@php.net>
* @copyright 2001-2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: file.php,v 1.25 2009/04/04 21:34:02 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Base class for <input /> form elements
*/
require_once 'HTML/QuickForm/input.php';
'<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* HTML class for a file upload field
*
* 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>
* @author Alexey Borzov <avb@php.net>
* @copyright 2001-2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: file.php,v 1.25 2009/04/04 21:34:02 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Base class for <input /> form elements
*/
require_once 'HTML/QuickForm/input.php';
// register file-related rules
if (class_exists('HTML_QuickForm')) {
@ -37,15 +37,15 @@ if (class_exists('HTML_QuickForm')) {
}
/**
* HTML class for a file upload field
* HTML class for a file upload field
*
* @category HTML
* @package HTML_QuickForm
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @author Alexey Borzov <avb@php.net>
* @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>
* @author Alexey Borzov <avb@php.net>
* @version Release: 3.2.11
* @since 1.0
*/
class HTML_QuickForm_file extends HTML_QuickForm_input
{
@ -307,7 +307,7 @@ class HTML_QuickForm_file extends HTML_QuickForm_input
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
return true;
}
return (bool)preg_match($regex, $elementValue['name']);
return (bool)preg_match($regex, $elementValue['name']);
} // end func _ruleCheckFileName
// }}}
@ -322,7 +322,7 @@ class HTML_QuickForm_file extends HTML_QuickForm_input
* @access private
* @return mixed
*/
function _findValue()
function _findValue(&$values = null)
{
if (empty($_FILES)) {
return null;

@ -166,7 +166,7 @@ class Pager
* @static
* @access public
*/
function &factory($options = array())
static function &factory($options = array())
{
$mode = (isset($options['mode']) ? ucfirst($options['mode']) : 'Jumping');
$classname = 'Pager_' . $mode;

@ -331,7 +331,7 @@ class Security {
* @param string content to be filter
* @return string
*/
function filter_terms($text) {
static function filter_terms($text) {
static $bad_terms = array();
if (empty($bad_terms)) {

@ -920,7 +920,7 @@ class SocialManager extends UserManager {
}
}
public function social_wrapper_div($content, $span_count) {
public static function social_wrapper_div($content, $span_count) {
$span_count = intval($span_count);
$html = '<div class="span'.$span_count.'">';
$html .= '<div class="well_border">';

@ -85,7 +85,7 @@ class TableSort {
* @return array The sorted dataset
* @author bart.mollet@hogent.be
*/
public function sort_table_config($data, $column = 0, $direction = SORT_ASC, $column_show = null, $column_order = null, $type = SORT_REGULAR, $doc_filter = false) {
public static function sort_table_config($data, $column = 0, $direction = SORT_ASC, $column_show = null, $column_order = null, $type = SORT_REGULAR, $doc_filter = false) {
if (!is_array($data) || empty($data)) {
return array();
@ -105,16 +105,16 @@ class TableSort {
$column = isset($column_order[$column]) ? $column_order[$column] : $column;
}
if ($type == SORT_REGULAR) {
if ($type == SORT_REGULAR) {
if (TableSort::is_image_column($data, $column)) {
$type = SORT_IMAGE;
} elseif (TableSort::is_date_column($data, $column)) {
$type = SORT_IMAGE;
} elseif (TableSort::is_date_column($data, $column)) {
$type = SORT_DATE;
} elseif (TableSort::is_numeric_column($data, $column)) {
} elseif (TableSort::is_numeric_column($data, $column)) {
$type = SORT_NUMERIC;
} else {
$type = SORT_STRING;
}
} else {
$type = SORT_STRING;
}
}
//This fixs only works in the document tool when ordering by name
@ -158,7 +158,7 @@ class TableSort {
}
$data = $new_data_order;
}
} else {
} else {
$compare_operator = $direction == SORT_ASC ? '>' : '<=';
switch ($type) {
case SORT_NUMERIC:
@ -208,7 +208,7 @@ class TableSort {
* @todo Take locale into account (eg decimal point or comma ?)
* @author bart.mollet@hogent.be
*/
private function is_numeric_column(& $data, $column) {
private static function is_numeric_column(& $data, $column) {
$is_numeric = true;
foreach ($data as $index => & $row) {
$is_numeric &= is_numeric(strip_tags($row[$column]));
@ -226,7 +226,7 @@ class TableSort {
* @return bool TRUE if column contains only dates, FALSE otherwise
* @author bart.mollet@hogent.be
*/
private function is_date_column(& $data, $column) {
private static function is_date_column(& $data, $column) {
$is_date = true;
foreach ($data as $index => & $row) {
if (strlen(strip_tags($row[$column])) != 0) {
@ -251,7 +251,7 @@ class TableSort {
* @return bool TRUE if column contains only images, FALSE otherwise
* @author bart.mollet@hogent.be
*/
private function is_image_column(& $data, $column) {
private static function is_image_column(& $data, $column) {
$is_image = true;
foreach ($data as $index => & $row) {
$is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag

Loading…
Cancel
Save