function display_add_field($recordid = 0, $formdata = NULL) { if (empty($this->field->param2)) { return ''; } return data_field_admin::format_hidden_field('field_' . $this->field->id, 0); }
/** * Display the content of the field in browse mode * * @param integer $recordid * @param string $template * @return bool|string */ function display_browse_field($recordid, $template) { global $DB; if (!($itemid = $this->field->id)) { return ''; } if (!($content = $this->field->param1)) { return ''; } if (!($format = $this->field->param2)) { $format = FORMAT_MOODLE; } $options = data_field_admin::get_fileoptions($this->context); $content = file_rewrite_pluginfile_urls($content, 'pluginfile.php', $this->context->id, 'mod_data', 'content', $itemid, $options); // these values may be needed by the replace_fieldnames() method $userid = $DB->get_field('data_records', 'userid', array('id' => $recordid)); $user = $DB->get_record('user', array('id' => $userid)); // reduce IF-ELSE-ENDIF blocks $content = self::replace_if_blocks($this->data, $this->field, $recordid, $template, $content); // replace all fieldnames $content = self::replace_fieldnames($this->context, $this->cm, $this->data, $this->field, $recordid, $template, $user, $content); $options = data_field_admin::get_formatoptions(); $content = format_text($content, $format, $options); return $content; }