include('tabs.php');
-/********************************************
- * code to handle form processing *
- * add individual data_content *
- ********************************************/
- $entrysaved = false; //flag for displaying entry saved msg
-
- $ignorenames = array('MAX_FILE_SIZE','sesskey','d','rid'); // strings to be ignored in input data
+/// Process incoming data for adding/updating records
if ($datarecord = data_submitted($CFG->wwwroot.'/mod/data/add.php') and confirm_sesskey()) {
+ $ignorenames = array('MAX_FILE_SIZE','sesskey','d','rid'); // strings to be ignored in input data
+
if ($rid) { /// Update some records
/// All student edits are marked unapproved by default
} // End of form processing
-///Check if maximum number of entry as specified by this database is reached
-///Of course, you can't be stopped if you are an editting teacher! =)
+/// Check if maximum number of entry as specified by this database is reached
+/// Of course, you can't be stopped if you are an editting teacher! =)
+
if (data_atmaxentries($data) and !isteacheredit($course->id)){
notify (get_string('atmaxentry','data'));
print_footer($course);
parent::data_field_base($field, $data);
}
-
function display_add_field($recordid=0) {
global $CFG;
$content = explode('##', $content);
}
- $str = '<div title="'.$field->description.'">';
+ $str = '<div title="'.$this->field->description.'">';
- foreach (explode("\n", $field->param1) as $checkbox) {
- $checkbox = ltrim(rtrim($checkbox));
- $str .= '<input type="checkbox" name="field_' . $field->id . '[]" ';
+ foreach (explode("\n", $this->field->param1) as $checkbox) {
+ $checkbox = trim($checkbox);
+ $str .= '<input type="checkbox" name="field_' . $this->field->id . '[]" ';
$str .= 'value="' . $checkbox . '" ';
if (array_search($checkbox, $content) !== false) {
global $CFG;
$filepath = '';
+ $filename = '';
$description = '';
if ($recordid){
function display_add_field($recordid=0) {
global $CFG;
+ $text = '';
+ $format = 0;
+
if ($recordid){
- $content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid);
- $text = $content->content;
- $format = $content->content1;
- } else {
- $text = '';
- $format = '';
+ if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)) {
+ $text = $content->content;
+ $format = $content->content1;
+ }
}
- $str = '<div title="'.$thisfield->description.'">';
+ $str = '<div title="'.$this->field->description.'">';
if (can_use_richtext_editor()) {
// Show a rich text html editor.
require_login();
- $id = optional_param('id', 0, PARAM_INT); // course module id
- $d = optional_param('d', 0, PARAM_INT); // database id
- $fid = optional_param('fid', 0 , PARAM_INT); //update field id
- $newtype = optional_param('fieldmenu','',PARAM_ALPHA); //type of the new field
-
- //action specifies what action is performed when data is submitted
- $mode = optional_param('mode','',PARAM_ALPHA);
+ $id = optional_param('id', 0, PARAM_INT); // course module id
+ $d = optional_param('d', 0, PARAM_INT); // database id
+ $fid = optional_param('fid', 0 , PARAM_INT); // update field id
+ $newtype = optional_param('fieldmenu','',PARAM_ALPHA); // type of the new field
+ $mode = optional_param('mode','',PARAM_ALPHA);
+
$displaynotice = ''; //str to print after an operation,
if ($id) {
foreach ($fff as $ff) {
$field = data_get_field($ff, $data);
- ///Print Action Column
+ /// Print Action Column
echo '<tr><td align="center">';
echo '<a href="fields.php?d='.$data->id.'&mode=display&fid='.$field->field->id.'&sesskey='.sesskey().'">';
echo '<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>';
echo '</td>';
- ///Print Fieldname Column
+ /// Print Fieldname Column
echo '<td>';
echo '<a href="fields.php?mode=display&d='.$data->id;
echo '&fid='.$field->field->id.'&sesskey='.sesskey().'">'.$field->field->name.'</a>';
echo '</td>';
- ///Print Type Column
+ /// Print Type Column
echo '<td align="center">';
echo $field->image(); //print type icon