} else { //else print quiz style list of fields
- $table->head = array(get_string('action','data'), get_string('fieldname','data'), get_string('type','data'), get_string('fielddescription', 'data'));
- $table->align = array('center','left','left','left');
+ $table->head = array(get_string('fieldname','data'), get_string('type','data'), get_string('fielddescription', 'data'), get_string('action','data'));
+ $table->align = array('left','left','left', 'center');
$table->wrap = array(false,false,false,false);
if ($fff = get_records('data_fields','dataid',$data->id,'id')){
foreach ($fff as $ff) {
$field = data_get_field($ff, $data);
- /// Print Action Column
$table->data[] = array(
- '<a href="field.php?d='.$data->id.'&mode=display&fid='.$field->field->id.'&sesskey='.sesskey().'">'.
- '<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" /></a>'.
- ' '.
- '<a href="field.php?d='.$data->id.'&mode=delete&fid='.$field->field->id.'&sesskey='.sesskey().'">'.
- '<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>',
'<a href="field.php?mode=display&d='.$data->id.
$field->image().' '.get_string($field->type, 'data'),
- shorten_text($field->field->description, 30)
+ shorten_text($field->field->description, 30),
+
+ '<a href="field.php?d='.$data->id.'&mode=display&fid='.$field->field->id.'&sesskey='.sesskey().'">'.
+ '<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" /></a>'.
+ ' '.
+ '<a href="field.php?d='.$data->id.'&mode=delete&fid='.$field->field->id.'&sesskey='.sesskey().'">'.
+ '<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>'
);
}
'', '', true, '', navmenu($course, $cm), '', $bodytag);
print_heading(format_string($data->name));
-
- /// Processing submitted data, i.e updating form.
+
+/// Print the tabs.
+ $currenttab = 'templates';
+ include('tabs.php');
+
+/// Processing submitted data, i.e updating form.
if (($mytemplate = data_submitted($CFG->wwwroot.'/mod/data/templates.php')) && confirm_sesskey()){
// Generate default template.
// Check for multiple tags, only need to check for add template.
if ($mode != 'addtemplate' or data_tags_check($data->id, $newtemplate->{$mode})){
- update_record('data',$newtemplate);
+ if (update_record('data',$newtemplate)) {
+ notify(get_string('templatesaved','data'), 'notifysuccess');
+ }
}
add_to_log($course->id, 'data', 'templates saved', "templates.php?id=$cm->id&d=$data->id", $data->id, $cm->id);
}
+ } else {
+ echo '<div class="littleintro" align="center">'.get_string('header'.$mode,'data').'</div>';
}
/// If everything is empty then generate some defaults
data_generate_default_template($data, 'rsstemplate');
}
-/// Print the tabs.
- $currenttab = 'templates';
- include('tabs.php');
-
/// Print the browsing interface.
- echo '<div align="center">'.get_string('header'.$mode,'data').'</div><br />';
-
echo '<form name="tempform" action="templates.php?d='.$data->id.'&mode='.$mode.'" method="post">';
echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
// Print button to autogen all forms, if all templates are empty