automatic fix / pad 0 based arrays with the required number of false

values, to match the number of header lines in the rows template
--> allows to customize the template (number of header lines) without
the need to patch the code
(fixed pm's element list with uses 2 header lines, but required exactly
one pad done by the old code)
This commit is contained in:
Ralf Becker 2009-02-24 07:42:12 +00:00
parent b3b7487ad1
commit 587a3b92bc

View File

@ -331,10 +331,6 @@ class nextmatch_widget
$tmpl->sel_options = array_merge($tmpl->sel_options,$rows['sel_options']);
unset($rows['sel_options']);
}
if (is_array($rows[0])) // fixed 0 based arrays
{
array_unshift($rows,false);
}
$value['rows'] =& $rows;
unset($rows);
@ -347,6 +343,13 @@ class nextmatch_widget
{
$value['template'] =& new etemplate($value['template'],$tmpl->as_array());
}
if (is_array($value['rows'][0])) // pad 0 based arrays with rows-1 false values
{
for($i = 1; $i < $value['template']->rows; $i++)
{
array_unshift($value['rows'],false);
}
}
$extension_data['template'] = $value['template']->name; // used for the column-selection, and might be set in get_rows()
$extension_data['columnselection_pref'] = $value['columnselection_pref'];