mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-7812 warning in sorting form in data module when no fields defined
This commit is contained in:
parent
eb7ac7fc00
commit
196da4a45e
@ -297,32 +297,32 @@
|
||||
helpbutton('fields', get_string('addafield','data'), 'data');
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="sortdefault" align="center">';
|
||||
echo '<form name="sortdefault" action="'.$CFG->wwwroot.'/mod/data/field.php" method="get">';
|
||||
echo '<input type="hidden" name="d" value="'.$data->id.'" />';
|
||||
echo '<input type="hidden" name="mode" value="sort" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo ' '.get_string('defaultsortfield','data').':';
|
||||
$fields = get_records('data_fields','dataid',$data->id);
|
||||
echo '<select name="defaultsort"><option value="0">'.get_string('dateentered','data').'</option>';
|
||||
foreach ($fields as $field) {
|
||||
if ($field->id == $data->defaultsort) {
|
||||
echo '<option value="'.$field->id.'" selected="selected">'.$field->name.'</option>';
|
||||
} else {
|
||||
echo '<option value="'.$field->id.'">'.$field->name.'</option>';
|
||||
if ($fields = get_records('data_fields','dataid',$data->id)) {
|
||||
echo '<div class="sortdefault" align="center">';
|
||||
echo '<form name="sortdefault" action="'.$CFG->wwwroot.'/mod/data/field.php" method="get">';
|
||||
echo '<input type="hidden" name="d" value="'.$data->id.'" />';
|
||||
echo '<input type="hidden" name="mode" value="sort" />';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo ' '.get_string('defaultsortfield','data').':';
|
||||
echo '<select name="defaultsort"><option value="0">'.get_string('dateentered','data').'</option>';
|
||||
foreach ($fields as $field) {
|
||||
if ($field->id == $data->defaultsort) {
|
||||
echo '<option value="'.$field->id.'" selected="selected">'.$field->name.'</option>';
|
||||
} else {
|
||||
echo '<option value="'.$field->id.'">'.$field->name.'</option>';
|
||||
}
|
||||
}
|
||||
echo '</select>';
|
||||
echo ' ';
|
||||
|
||||
$options = array(0 => get_string('ascending', 'data'),
|
||||
1 => get_string('descending', 'data'));
|
||||
choose_from_menu($options, 'defaultsortdir', $data->defaultsortdir, '');
|
||||
echo '<input type="submit" value="'.get_string('go').'" />';
|
||||
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
echo ' ';
|
||||
|
||||
$options = array(0 => get_string('ascending', 'data'),
|
||||
1 => get_string('descending', 'data'));
|
||||
choose_from_menu($options, 'defaultsortdir', $data->defaultsortdir, '');
|
||||
echo '<input type="submit" value="'.get_string('go').'" />';
|
||||
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user