From: scyrma Date: Wed, 16 Jan 2008 08:17:25 +0000 (+0000) Subject: MDL-13020 : deprecates make_table X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=aa68a7b0a2d232e07b4d90198d777670658594bb;p=moodle.git MDL-13020 : deprecates make_table --- diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index b723804519..89679a90f9 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -853,6 +853,29 @@ function get_group_teachers($courseid, $groupid) { ########### FROM weblib.php ########################################################################## +/** + * Creates a nicely formatted table and returns it. + * + * @param array $table is an object with several properties. + * $table->head - An array of heading names. + *
  • $table->align - An array of column alignments + *
  • $table->size - An array of column sizes + *
  • $table->wrap - An array of "nowrap"s or nothing + *
  • $table->data[] - An array of arrays containing the data. + *
  • $table->class - A css class name + *
  • $table->fontsize - Is the size of all the text + *
  • $table->tablealign - Align the whole table + *
  • $table->width - A percentage of the page + *
  • $table->cellpadding - Padding on each cell + *
  • $table->cellspacing - Spacing between cells + * + * @return string + * @todo Finish documenting this function + */ +function make_table($table) { + return print_table($table, true); +} + /** * Print a message in a standard themed box. diff --git a/lib/weblib.php b/lib/weblib.php index b6ec9f7c79..997bdb3e3e 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -4756,119 +4756,6 @@ function print_table($table, $return=false) { return true; } -/** - * Creates a nicely formatted table and returns it. - * - * @param array $table is an object with several properties. - * $table->head - An array of heading names. - *
  • $table->align - An array of column alignments - *
  • $table->size - An array of column sizes - *
  • $table->wrap - An array of "nowrap"s or nothing - *
  • $table->data[] - An array of arrays containing the data. - *
  • $table->class - A css class name - *
  • $table->fontsize - Is the size of all the text - *
  • $table->tablealign - Align the whole table - *
  • $table->width - A percentage of the page - *
  • $table->cellpadding - Padding on each cell - *
  • $table->cellspacing - Spacing between cells - * - * @return string - * @todo Finish documenting this function - */ -function make_table($table) { - - if (isset($table->align)) { - foreach ($table->align as $key => $aa) { - if ($aa) { - $align[$key] = ' align="'. $aa .'"'; - } else { - $align[$key] = ''; - } - } - } - if (isset($table->size)) { - foreach ($table->size as $key => $ss) { - if ($ss) { - $size[$key] = ' width="'. $ss .'"'; - } else { - $size[$key] = ''; - } - } - } - if (isset($table->wrap)) { - foreach ($table->wrap as $key => $ww) { - if ($ww) { - $wrap[$key] = ' style="white-space:nowrap;" '; - } else { - $wrap[$key] = ''; - } - } - } - - if (empty($table->width)) { - $table->width = '80%'; - } - - if (empty($table->tablealign)) { - $table->tablealign = 'center'; - } - - if (empty($table->cellpadding)) { - $table->cellpadding = '5'; - } - - if (empty($table->cellspacing)) { - $table->cellspacing = '1'; - } - - if (empty($table->class)) { - $table->class = 'generaltable'; - } - - if (empty($table->fontsize)) { - $fontsize = ''; - } else { - $fontsize = ''; - } - - $output = 'cellpadding .'" cellspacing="'. $table->cellspacing .'" class="'. $table->class .'">'."\n"; - - if (!empty($table->head)) { - $output .= ''; - foreach ($table->head as $key => $heading) { - if (!isset($size[$key])) { - $size[$key] = ''; - } - if (!isset($align[$key])) { - $align[$key] = ''; - } - $output .= ''; - } - $output .= ''."\n"; - } - - foreach ($table->data as $row) { - $output .= ''; - foreach ($row as $key => $item) { - if (!isset($size[$key])) { - $size[$key] = ''; - } - if (!isset($align[$key])) { - $align[$key] = ''; - } - if (!isset($wrap[$key])) { - $wrap[$key] = ''; - } - $output .= ''; - } - $output .= ''."\n"; - } - $output .= '
    '.$fontsize.$heading.'
    '. $fontsize . $item .'
    '."\n"; - - return $output; -} - function print_recent_activity_note($time, $user, $text, $link, $return=false) { static $strftimerecent; $output = ''; diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 9807d7351f..079a622696 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -933,7 +933,7 @@ class default_questiontype { ); } } - $history = make_table($table); + $history = print_table($table, true); } } return $history;