* @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //include the report form class require_once $CFG->dirroot . '/blocks/ilp/classes/forms/edit_report_mform.php'; //if set get the id of the report to be edited $report_id = $PARSER->optional_param('report_id', NULL, PARAM_INT); // instantiate the db $dbc = new ilp_db(); //instantiate the edit_report_mform class $mform = new edit_report_mform($report_id); //was the form cancelled? if ($mform->is_cancelled()) { //send the user back $return_url = $CFG->wwwroot . '/blocks/ilp/actions/edit_report_configuration.php'; redirect($return_url, '', ILP_REDIRECT_DELAY); } //was the form submitted? // has the form been submitted? if ($mform->is_submitted()) { // check the validation rules if ($mform->is_validated()) { //get the form data submitted $formdata = $mform->get_data(); //only try to change the icon if a file was submitted if ($mform->get_file_content('binary_icon') != false) {
protected function create_report($name, $description) { //does this report exist already ? //@todo return 0 if report already exists if ($this->report_already_exists($name)) { return 0; } global $USER; //$name .= "-" . date( 'Hms' ); $formdata = new stdClass(); $formdata->id = 0; $formdata->creator_id = $USER->id; $formdata->name = $name; $formdata->description = $description; $formdata->status = 1; $course_id = 0; //not necessary for report creation, so just a dummy value $mform = new edit_report_mform($course_id, null); $report_id = $mform->process_data($formdata); return $report_id; }