echo $newtext;
echo '<div align="center"><input type="submit" name="saveandview" value="'.get_string('saveandview','data').'" />';
if ($rid) {
- echo ' <input type="submit" name="cancel" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)">';
+ echo ' <input type="submit" name="cancel" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
} else {
echo '<input type="submit" value="'.get_string('saveandadd','data').'" />';
}
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>'.
+ '<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" title="'.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>'
+ '<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>'
);
}
$content = explode('##', $content);
}
- $str = '<div title="'.$this->field->description.'">';
-
+ $str = '<div title="'.s($this->field->description).'">';
+ $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
+
+ $i = 0;
foreach (explode("\n", $this->field->param1) as $checkbox) {
$checkbox = trim($checkbox);
- $str .= '<input type="checkbox" name="field_' . $this->field->id . '[]" ';
- $str .= 'value="' . $checkbox . '" ';
+ $str .= '<input type="checkbox" id="field_'.$this->field->id.'_'.$i.'" name="field_' . $this->field->id . '[]" ';
+ $str .= 'value="' . s($checkbox) . '" ';
if (array_search($checkbox, $content) !== false) {
$str .= 'checked />';
} else {
$str .= '/>';
}
- $str .= $checkbox . '<br />';
+ $str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$checkbox.'</label><br />';
+ $i++;
}
+ $str .= '</fieldset>';
$str .= '</div>';
return $str;
}
function update_content($recordid, $value, $name='') {
- $content = new object;
+ $content = new object();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = $this->format_data_field_checkbox_content($value);
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
- <td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
- <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
+ <td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
+ <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
$content = time();
}
- $str = '<div title="'.$this->field->description.'">';
+ $str = '<div title="'.s($this->field->description).'">';
$str .= print_date_selector('field_'.$this->field->id.'_day', 'field_'.$this->field->id.'_month',
'field_'.$this->field->id.'_year', $content, true);
$str .= '</div>';
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
</table>
$source = '';
}
- $str = '<div title="' . $this->field->description . '">';
+ $str = '<div title="' . s($this->field->description) . '">';
+ $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$str .= '<input type="hidden" name ="field_'.$this->field->id.'_file" value="fakevalue" />';
- $str .= get_string('file','data'). ': <input type="file" name ="field_'.$this->field->id.'" id="field_'.
- $this->field->id.'" title="'.$this->field->description.'" /><br />';
- $str .= get_string('optionalfilename','data').': <input type="text" name="field_' .$this->field->id.'_filename"
- id="field_'.$this->field->id.'_filename" value="'.$displayname.'" /><br />';
- $str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.$this->field->param3.'" />';
+ $str .= get_string('file','data'). ' <input type="file" name ="field_'.$this->field->id.'" id="field_'.
+ $this->field->id.'" title="'.s($this->field->description).'" /><br />';
+ $str .= get_string('optionalfilename','data').' <input type="text" name="field_' .$this->field->id.'_filename"
+ id="field_'.$this->field->id.'_filename" value="'.s($displayname).'" /><br />';
+ $str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.s($this->field->param3).'" />';
+ $str .= '</fieldset>';
$str .= '</div>';
if ($recordid and isset($content)){ // Print icon
$source = $CFG->wwwroot.'/file.php?file=/'.$path;
}
- $width = $this->field->param1 ? ' width = "'.$this->field->param1.'" ':' ';
- $height = $this->field->param2 ? ' height = "'.$this->field->param2.'" ':' ';
+ $width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' ';
+ $height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
require_once($CFG->libdir.'/filelib.php');
$icon = mimeinfo('icon', $src);
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"> <?php echo get_string('fieldname', 'data'); ?>: </td>
- <td class="c1"> <input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"> <?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
+ </tr>
+ <tr>
+ <td class="c0"><label for="param3">
+ <?php echo get_string('maxsize', 'data'); ?></label></td>
+ <td class="c1">
+ <?php
+ $course->maxbytes = get_field('course', 'maxbytes', 'id', $this->data->course);
+ $choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
+ choose_from_menu($choices, 'param3', $this->field->param3, '', '', 0, false, false, 0, 'param3');
+ ?>
+ </td>
</tr>
</table>
}
}
- $str = '<div title="'.$this->field->description.'">';
+ $str = '<div title="'.s($this->field->description).'">';
+ $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$str .= '<table><tr><td align="right">';
- $str .= '<label for="field_'.$this->field->id.'_0">' . get_string('latitude', 'data') . '</label>:</td><td><input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.$lat.'" size="10" />°N</td></tr>';
- $str .= '<tr><td align="right"><label for="field_'.$this->field->id.'_1">' . get_string('longitude', 'data') . '</label>:</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.$long.'" size="10" />°E</td></tr>';
+ $str .= '<label for="field_'.$this->field->id.'_0">' . get_string('latitude', 'data') . '</label></td><td><input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.s($lat).'" size="10" />°N</td></tr>';
+ $str .= '<tr><td align="right"><label for="field_'.$this->field->id.'_1">' . get_string('longitude', 'data') . '</label></td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($long).'" size="10" />°E</td></tr>';
$str .= '</table>';
+ $str .= '</fieldset>';
$str .= '</div>';
return $str;
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p ($this->field->description);?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('latlonglinkservicesdisplayed', 'data'); ?>:</td>
+ <td class="c0"><label for="param1"><?php echo get_string('latlonglinkservicesdisplayed', 'data'); ?></label></td>
<td class="c1">
- <select class="linkservicesdisplayed" name="param1[]" id="param1" multiple="multiple" size="<?php echo sizeof($this->linkoutservices) ?>">
+ <select class="linkservicesdisplayed" name="param1[]" id="param1" multiple="multiple" size="<?php p(sizeof($this->linkoutservices)); ?>">
<?php
$serviceschosen = explode(',', htmlspecialchars($this->field->param1));
foreach($this->linkoutservices as $servicename=>$serviceurl) {
</td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('latlongkmllabelling', 'data'); ?>:</td>
+ <td class="c0"><label for="param2"><?php echo get_string('latlongkmllabelling', 'data'); ?></label></td>
<td class="c1">
<select class="kmllabelling" name="param2" id="param2">
<option value="-1"<?php if($this->field->param2==-1) echo ' selected="selected"' ?>><?php echo get_string('entry', 'data') ?> #</option>
$content = '';
}
- $str = '<div title="'.$this->field->description.'">';
+ $str = '<div title="'.s($this->field->description).'">';
$rawoptions = explode("\n",$this->field->param1);
foreach ($rawoptions as $option) {
}
$str .= choose_from_menu($options, 'field_'.$this->field->id, $content,
- get_string('menuchoose', 'data'), '', '', true, false);
+ get_string('menuchoose', 'data'), '', '', true, false, 0, 'field_'.$this->field->id);
$str .= '</div>';
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
<tr>
- <td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
- <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
+ <td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
+ <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
$content = array();
}
- $str = '<div title="'.$this->field->description.'">';
+ $str = '<div title="'.s($this->field->description).'">';
$str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '" multiple="multiple">';
foreach (explode("\n",$this->field->param1) as $option) {
$option = trim($option);
- $str .= '<option value="' . $option . '"';
+ $str .= '<option value="' . s($option) . '"';
if (array_search($option, $content) !== false) {
// Selected by user.
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
- <td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?></td>
- <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
+ <td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
+ <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
</table>
}
}
- $str = '<div title="'.$this->field->description.'">';
+ $str = '<div title="'.s($this->field->description).'">';
+ $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$str .= '<input type="hidden" name ="field_'.$this->field->id.'_file" id="field_'.$this->field->id.'_file" value="fakevalue" />';
- $str .= get_string('picture','data'). ': <input type="file" name ="field_'.$this->field->id.'" id="field_'.$this->field->id.'" /><br />';
- $str .= get_string('optionaldescription','data') .': <input type="text" name="field_'
- .$this->field->id.'_filename" id="field_'.$this->field->id.'_filename" value="'.$description.'" /><br />';
- $str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.$this->field->param3.'" />';
+ $str .= '<label for="field_'.$this->field->id.'">'.get_string('picture','data'). '</label> <input type="file" name ="field_'.$this->field->id.'" id="field_'.$this->field->id.'" /><br />';
+ $str .= '<label for="field_'.$this->field->id.'_filename">'.get_string('optionaldescription','data') .'</label> <input type="text" name="field_'
+ .$this->field->id.'_filename" id="field_'.$this->field->id.'_filename" value="'.s($description).'" /><br />';
+ $str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.s($this->field->param3).'" />';
if ($filepath){
- $str .= '<img width="'.$this->previewwidth.'" height="'.$this->previewheight.'" src="'.$filepath.'" alt="" />';
+ $str .= '<img width="'.s($this->previewwidth).'" height="'.s($this->previewheight).'" src="'.$filepath.'" alt="" />';
}
+ $str .= '</fieldset>';
$str .= '</div>';
return $str;
}
}
if ($template == 'listtemplate') {
- $width = $this->field->param4 ? ' width="'.$this->field->param4.'" ' : ' ';
- $height = $this->field->param5 ? ' height="'.$this->field->param5.'" ' : ' ';
+ $width = $this->field->param4 ? ' width="'.s($this->field->param4).'" ' : ' ';
+ $height = $this->field->param5 ? ' height="'.s($this->field->param5).'" ' : ' ';
$str = '<a href="view.php?d='.$this->field->dataid.'&rid='.$recordid.'"><img '.
- $width.$height.' src="'.$thumbnailsource.'" alt="'.$alt.'" title="'.$title.'" border="0" /></a>';
+ $width.$height.' src="'.$thumbnailsource.'" alt="'.s($alt).'" title="'.s($title).'" border="0" /></a>';
} else {
- $width = $this->field->param1 ? ' width="'.$this->field->param1.'" ':' ';
- $height = $this->field->param2 ? ' height="'.$this->field->param2.'" ':' ';
- $str = '<a href="'.$source.'"><img '.$width.$height.' src="'.$source.'" alt="'.$alt.'" title="'.$title.'" border="0"/></a>';
+ $width = $this->field->param1 ? ' width="'.s($this->field->param1).'" ':' ';
+ $height = $this->field->param2 ? ' height="'.s($this->field->param2).'" ':' ';
+ $str = '<a href="'.$source.'"><img '.$width.$height.' src="'.$source.'" alt="'.s($alt).'" title="'.s($title).'" border="0"/></a>';
}
return $str;
}
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0">
- <?php echo get_string('fieldname', 'data');?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" />
+ <td class="c0"><label for="name">
+ <?php echo get_string('fieldname', 'data');?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" />
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('fielddescription', 'data');?>:
- </td>
+ <td class="c0"><label for="description">
+ <?php echo get_string('fielddescription', 'data');?></label></td>
<td class="c1">
- <input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" />
+ <input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" />
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('fieldwidthsingleview', 'data');?>:
- </td>
+ <td class="c0"><label for="param1">
+ <?php echo get_string('fieldwidthsingleview', 'data');?></label></td>
<td class="c1">
- <input style="width:70px;" type="text" name="param1" id="param1" value = "<?php if (!empty($this->field->param1)) echo $this->field->param1; ?>" />
+ <input style="width:70px;" type="text" name="param1" id="param1" value="<?php if (!empty($this->field->param1)) p($this->field->param1); ?>" />
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('fieldheightsingleview', 'data');?>:
- </td>
+ <td class="c0"><label for="param2">
+ <?php echo get_string('fieldheightsingleview', 'data');?></label></td>
<td class="c1">
- <input style="width:70px;" type="text" name="param2" id="param2" value = "<?php if (!empty($this->field->param2)) echo $this->field->param2; ?>" />
+ <input style="width:70px;" type="text" name="param2" id="param2" value="<?php if (!empty($this->field->param2)) p($this->field->param2); ?>" />
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('fieldwidthlistview', 'data');?>:
- </td>
- <td class="c1"><input style="width:70px;" type="text" name="param4" id="param4" value = "<?php if (!empty($this->field->param4)) echo $this->field->param4; ?>" />
+ <td class="c0"><label for="param4">
+ <?php echo get_string('fieldwidthlistview', 'data');?></label></td>
+ <td class="c1"><input style="width:70px;" type="text" name="param4" id="param4" value="<?php if (!empty($this->field->param4)) p($this->field->param4); ?>" />
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('fieldheightlistview', 'data');?>:
- </td>
+ <td class="c0"><label for="param5">
+ <?php echo get_string('fieldheightlistview', 'data');?></label></td>
<td class="c1">
- <input style="width:70px;" type="text" name="param5" id="param5" value = "<?php if (!empty($this->field->param5)) echo $this->field->param5; ?>" />
+ <input style="width:70px;" type="text" name="param5" id="param5" value="<?php if (!empty($this->field->param5)) p($this->field->param5); ?>" />
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('maxsize', 'data'); ?>:
- </td>
+ <td class="c0"><label for="param3">
+ <?php echo get_string('maxsize', 'data'); ?></label></td>
<td class="c1">
<?php
$course->maxbytes = get_field('course', 'maxbytes', 'id', $this->data->course);
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
- choose_from_menu ($choices, "param3", $this->field->param3, "");
+ choose_from_menu($choices, 'param3', $this->field->param3, '', '', 0, false, false, 0, 'param3');
?>
</td>
</tr>
-</tr>
</table>
$content = '';
}
- $str = '<div title="'.$this->field->description.'">';
-
+ $str = '<div title="'.s($this->field->description).'">';
+ $str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
+
+ $i = 0;
foreach (explode("\n",$this->field->param1) as $radio) {
$radio = trim($radio);
- $str .= '<input type="radio" name="field_' . $this->field->id . '" ';
- $str .= 'value="' . $radio . '" ';
+ $str .= '<input type="radio" id="field_'.$this->field->id.'_'.$i.'" name="field_' . $this->field->id . '" ';
+ $str .= 'value="' . s($radio) . '" ';
if ($content == $radio) {
// Selected by user.
$str .= '/>';
}
- $str .= $radio . '<br />';
+ $str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$radio.'</label><br />';
+ $i++;
}
+ $str .= '</fieldset>';
$str .= '</div>';
return $str;
}
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
- <td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
- <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
+ <td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
+ <td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
- <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fieldallowautolink', 'data'); ?>:</td>
+ <td class="c0"><label for="param1"><?php echo get_string('fieldallowautolink', 'data'); ?></label></td>
<td class="c1"><input type="checkbox" name="param1" id="param1" <?php if($this->field->param1) {echo 'checked="checked"';} ?> value="1" /></td>
</tr>
</table>
function gen_textarea($usehtmleditor, $text='') {
return print_textarea($usehtmleditor, $this->field->param3, $this->field->param2,
- '', '', 'field_'.$this->field->id, $text, '', true);
+ '', '', 'field_'.$this->field->id, $text, '', true, 'field_' . $this->field->id);
}
function print_after_form() {
if (can_use_richtext_editor()) {
- use_html_editor('field_' . $this->field->id);
+ use_html_editor('field_' . $this->field->id, '', 'field_' . $this->field->id);
}
}
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
- <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1">
<input class="fielddescription" type="text" name="description" id="description"
- value="<?php echo($this->field->description); ?>" />
+ value="<?php p($this->field->description); ?>" />
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('fieldwidth', 'data'); ?>:
- </td>
+ <td class="c0"><label for="param2">
+ <?php echo get_string('fieldwidth', 'data'); ?></label></td>
<td class="c1">
- <input style="width:50px;" type="text" name="param2" id="width" value=
+ <input style="width:50px;" type="text" name="param2" id="param2" value=
<?php
if (empty($this->field->param2)) {
- echo '"60"';
+ echo('"60"');
} else {
- echo('"' . $this->field->param2 . '"');
+ echo '"'.s($this->field->param2).'"';
}
?> /> <?php echo get_string('columns', 'data'); ?>
</td>
</tr>
<tr>
- <td class="c0">
- <?php echo get_string('fieldheight', 'data'); ?>:
- </td>
+ <td class="c0"><label for="param3">
+ <?php echo get_string('fieldheight', 'data'); ?></label></td>
<td class="c1">
- <input style="width:50px;" type="text" name="param3" id="height" value=
+ <input style="width:50px;" type="text" name="param3" id="param3" value=
<?php
if (empty($this->field->param3)) {
- echo '"35"';
+ echo('"35"');
} else {
- echo('"' . $this->field->param3 . '"');
+ echo '"'.s($this->field->param2).'"';
}
?> /> <?php echo get_string('rows', 'data'); ?>
</td>
}
$url = empty($url) ? 'http://' : $url;
- $str = '<div title="'.$this->field->description.'">';
+ $str = '<div title="'.s($this->field->description).'">';
if (!empty($this->field->param1) and empty($this->field->param2)) {
$str .= '<table><tr><td align="right">';
$str .= get_string('url','data').':</td><td><input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.$url.'" size="60" /></td></tr>';
- $str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.$text.'" size="60" /></td></tr>';
+ $str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($text).'" size="60" /></td></tr>';
$str .= '</table>';
} else { // Just the URL field
- $str .= '<input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.$url.'" size="60" />';
+ $str .= '<input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.s($url).'" size="60" />';
}
$str .= '</div>';
-<table width="100%">
+<table width="100%" cellpadding="5">
<tr>
- <td class="c0"> <?php echo get_string('fieldname', 'data'); ?>: </td>
- <td class="c1"> <input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /> </td>
+ <td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
+ <td class="c1"> <input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
- <td class="c0"> <?php echo get_string('fielddescription', 'data'); ?>: </td>
- <td class="c1"> <input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /> </td>
+ <td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
+ <td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
<tr>
- <td class="c0"> <?php echo get_string('forcelinkname', 'data'); ?>: </td>
- <td class="c1"> <input class="forcelinkname" type="text" name="param2" id="forcelinkname" value = "<?php echo ($this->field->param2);?>" /> </td>
+ <td class="c0"><label for="param2"><?php echo get_string('forcelinkname', 'data'); ?></label></td>
+ <td class="c1"><input class="forcelinkname" type="text" name="param2" id="forcelinkname" value="<?php p($this->field->param2);?>" /></td>
</tr>
<tr>
- <td class="c0"><?php echo get_string('autolinkurl', 'data') ?></td>
+ <td class="c0"><label for="param1"><?php echo get_string('autolinkurl', 'data') ?></td>
<td class="c1"><input type="checkbox" name="param1" id="param1" <?php if($this->field->param1) {echo 'checked="checked"';} ?> value="1" /></td>
</tr>
</table>
echo '<div align="center">';
echo '<input type="submit" value="'.$savebutton.'" />'."\n";
echo '<input type="submit" name="cancel" value="'.get_string('cancel').'" />'."\n";
- echo '</div">';
+ echo '</div>';
echo '</form>';
if ($fields = get_records('data_fields', 'dataid', $data->id, 'id')) {
$str = '<div align="center">';
- $str .= '<table>';
+ $str .= '<table cellpadding="5">';
foreach ($fields as $field) {
$str .= '<tr><td valign="top" align="right">';
- $str .= $field->name.':';
+ if ($template == 'addtemplate') {
+ $str .= '<label';
+ if (!in_array($field->type, array('picture', 'checkbox', 'date', 'latlong', 'radiobutton'))) {
+ $str .= ' for="[['.$field->name.'#id]]"';
+ }
+ $str .= '>'.$field->name.'</label>';
+ } else {
+ $str .= $field->name.': ';
+ }
$str .= '</td>';
$str .='<td>';
}
if ($template != 'addtemplate' and $template != 'rsstemplate') { //if not adding, we put tags in there
- $str .= '<tr><td align="center" colspan="2">##Edit## ##More## ##Delete## ##Approve##</td></tr>';
+ $str .= '<tr><td align="center" colspan="2">##edit## ##more## ##delete## ##approve##</td></tr>';
}
$str .= '</table>';
}
/// Replacing special tags (##Edit##, ##Delete##, ##More##)
- $patterns[]='##Edit##';
- $patterns[]='##Delete##';
+ $patterns[]='##edit##';
+ $patterns[]='##delete##';
if (has_capability('mod/data:manageentries', $context) or data_isowner($record->id)) {
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/edit.php?d='
- .$data->id.'&rid='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" /></a>';
+ .$data->id.'&rid='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" title="'.get_string('edit').'" /></a>';
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='
- .$data->id.'&delete='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>';
+ .$data->id.'&delete='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>';
} else {
$replacement[] = '';
$replacement[] = '';
}
- $patterns[]='##More##';
- $replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id.'"><img src="'.$CFG->pixpath.'/i/search.gif" height="11" width="11" border="0" alt="'.get_string('more', 'data').'" /></a>';
+ $patterns[]='##more##';
+ $replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id.'"><img src="'.$CFG->pixpath.'/i/search.gif" height="11" width="11" border="0" alt="'.get_string('more', 'data').'" title="'.get_string('more', 'data').'" /></a>';
- $patterns[]='##MoreURL##';
+ $patterns[]='##moreurl##';
$replacement[] = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id;
- $patterns[]='##User##';
+ $patterns[]='##user##';
$replacement[] = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$record->userid.
'&course='.$data->course.'">'.fullname($record).'</a>';
- $patterns[]='##Approve##';
+ $patterns[]='##approve##';
if (has_capability('mod/data:approve', $context) && ($data->approval) && (!$record->approved)){
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&approve='.$record->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/i/approve.gif" height="11" width="11" border="0" alt="'.get_string('approve').'" /></a>';
} else {
$replacement[] = '';
}
- $patterns[]='##Comments##';
+ $patterns[]='##comments##';
if (($template == 'listtemplate') && ($data->comments)) {
$comments = count_records('data_comments','recordid',$record->id);
$replacement[] = '<a href="view.php?rid='.$record->id.'#comments">'.get_string('commentsn','data', $comments).'</a>';
echo '<table class="presets" cellpadding="5">';
echo '<tr><td valign="top" colspan="2" align="center"><h3>'.$strexport.'</h3></td></tr>';
-echo '<tr><td><label for="zipexport">'.$strexportaszip.'</label>';
+echo '<tr><td><label>'.$strexportaszip.'</label>';
helpbutton('exportzip', '', 'data');
echo '</td><td>';
$options = new object();
print_single_button('preset.php', $options, $strexport, 'post');
echo '</td></tr>';
-echo '<tr><td><label for="zipexport">'.$strsaveaspreset.'</label>';
+echo '<tr><td><label>'.$strsaveaspreset.'</label>';
helpbutton('savepreset', '', 'data');
echo '</td><td>';
$options = new object();
<div align="center">
-<table cellpadding="2">
+<table cellpadding="5">
<tr><td><label for="[[title#id]]">Title</label></td><td>[[title]]</td></tr>
<tr><td><label for="[[caption#id]]">Caption</label></td><td>[[caption]]</td></tr>
+<tr><td><label>Image</label></td><td>[[image]]</td></tr>
</table>
-<hr />
-[[image]]
</div>
\ No newline at end of file
<div class="picturediv">
<table class="pictureframe"><tr><td>
<table class="picture">
-<tr><td><div name="listimage">[[image]]</div></td></tr>
+<tr><td><div class="listimage">[[image]]</div></td></tr>
<tr><td align="right">##edit## ##delete## ##approve##</td></tr>
</table>
</td></tr></table>
if ($mode == 'addtemplate') {
echo '<optgroup label="'.get_string('fieldids', 'data').'">';
foreach ($fields as $field) {
+ if (in_array($field->type, array('picture', 'checkbox', 'date', 'latlong', 'radiobutton'))) {
+ continue; //ids are not usable for these composed items
+ }
echo '<option value="[['.$field->name.'#id]]" title="'.$field->description.' id">'.$field->name.' id - [['.$field->name.'#id]]</option>';
}
echo '</optgroup>';