From: toyomoyo Date: Wed, 4 Jul 2007 02:32:08 +0000 (+0000) Subject: added a method that returns the submitted data without validation MDL-10181, please... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f4bee9e5800987939ba557140b5d88e59c4b2f42;p=moodle.git added a method that returns the submitted data without validation MDL-10181, please let me know if this is not needed, thanks --- diff --git a/lib/formslib.php b/lib/formslib.php index bdd0d46f62..b50db7642d 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -369,6 +369,29 @@ class moodleform { } } + /** + * Return submitted data without validation or NULL if there is no submitted data. + * + * @param bool $slashed true means return data with addslashes applied + * @return object submitted data; NULL if not submitted + */ + function get_submitted_data($slashed=true) { + $mform =& $this->_form; + + if ($this->is_submitted()) { + $data = $mform->exportValues(null, $slashed); + unset($data['sesskey']); // we do not need to return sesskey + unset($data['_qf__'.$this->_formname]); // we do not need the submission marker too + if (empty($data)) { + return NULL; + } else { + return (object)$data; + } + } else { + return NULL; + } + } + /** * Save verified uploaded files into directory. Upload process can be customised from definition() * method by creating instance of upload manager and storing it in $this->_upload_form