MDL-13020 : deprecates make_table
This commit is contained in:
@@ -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.
|
||||
* <ul<li>$table->head - An array of heading names.
|
||||
* <li>$table->align - An array of column alignments
|
||||
* <li>$table->size - An array of column sizes
|
||||
* <li>$table->wrap - An array of "nowrap"s or nothing
|
||||
* <li>$table->data[] - An array of arrays containing the data.
|
||||
* <li>$table->class - A css class name
|
||||
* <li>$table->fontsize - Is the size of all the text
|
||||
* <li>$table->tablealign - Align the whole table
|
||||
* <li>$table->width - A percentage of the page
|
||||
* <li>$table->cellpadding - Padding on each cell
|
||||
* <li>$table->cellspacing - Spacing between cells
|
||||
* </ul>
|
||||
* @return string
|
||||
* @todo Finish documenting this function
|
||||
*/
|
||||
function make_table($table) {
|
||||
return print_table($table, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a message in a standard themed box.
|
||||
|
||||
-113
@@ -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.
|
||||
* <ul<li>$table->head - An array of heading names.
|
||||
* <li>$table->align - An array of column alignments
|
||||
* <li>$table->size - An array of column sizes
|
||||
* <li>$table->wrap - An array of "nowrap"s or nothing
|
||||
* <li>$table->data[] - An array of arrays containing the data.
|
||||
* <li>$table->class - A css class name
|
||||
* <li>$table->fontsize - Is the size of all the text
|
||||
* <li>$table->tablealign - Align the whole table
|
||||
* <li>$table->width - A percentage of the page
|
||||
* <li>$table->cellpadding - Padding on each cell
|
||||
* <li>$table->cellspacing - Spacing between cells
|
||||
* </ul>
|
||||
* @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 = '<font size="'. $table->fontsize .'">';
|
||||
}
|
||||
|
||||
$output = '<table width="'. $table->width .'" align="'. $table->tablealign .'" ';
|
||||
$output .= ' cellpadding="'. $table->cellpadding .'" cellspacing="'. $table->cellspacing .'" class="'. $table->class .'">'."\n";
|
||||
|
||||
if (!empty($table->head)) {
|
||||
$output .= '<tr valign="top">';
|
||||
foreach ($table->head as $key => $heading) {
|
||||
if (!isset($size[$key])) {
|
||||
$size[$key] = '';
|
||||
}
|
||||
if (!isset($align[$key])) {
|
||||
$align[$key] = '';
|
||||
}
|
||||
$output .= '<th valign="top" '. $align[$key].$size[$key] .' style="white-space:nowrap;" class="'. $table->class .'header" scope="col">'.$fontsize.$heading.'</th>';
|
||||
}
|
||||
$output .= '</tr>'."\n";
|
||||
}
|
||||
|
||||
foreach ($table->data as $row) {
|
||||
$output .= '<tr valign="top">';
|
||||
foreach ($row as $key => $item) {
|
||||
if (!isset($size[$key])) {
|
||||
$size[$key] = '';
|
||||
}
|
||||
if (!isset($align[$key])) {
|
||||
$align[$key] = '';
|
||||
}
|
||||
if (!isset($wrap[$key])) {
|
||||
$wrap[$key] = '';
|
||||
}
|
||||
$output .= '<td '. $align[$key].$size[$key].$wrap[$key] .' class="'. $table->class .'cell">'. $fontsize . $item .'</td>';
|
||||
}
|
||||
$output .= '</tr>'."\n";
|
||||
}
|
||||
$output .= '</table>'."\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function print_recent_activity_note($time, $user, $text, $link, $return=false) {
|
||||
static $strftimerecent;
|
||||
$output = '';
|
||||
|
||||
@@ -933,7 +933,7 @@ class default_questiontype {
|
||||
);
|
||||
}
|
||||
}
|
||||
$history = make_table($table);
|
||||
$history = print_table($table, true);
|
||||
}
|
||||
}
|
||||
return $history;
|
||||
|
||||
Reference in New Issue
Block a user