Last active
August 11, 2016 00:01
-
-
Save dcai/848ff389fac49e81a9ac to your computer and use it in GitHub Desktop.
basic moodle form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("$CFG->libdir/formslib.php"); | |
class calendar_form extends moodleform { | |
public function definition() { | |
global $CFG; | |
$mform = $this->_form; | |
$mform->addElement('text', 'calendarname', get_string('calendarname', 'block_gcal')); | |
$mform->setType('calendarname', PARAM_TEXT); | |
$mform->setDefault('calendarname', ''); | |
$mform->addElement('text', 'calendarid', get_string('calendarid', 'block_gcal')); | |
$mform->setType('calendarid', PARAM_TEXT); | |
$mform->setDefault('calendarid', ''); | |
} | |
function validation($data, $files) { | |
return array(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(dirname(dirname(__DIR__)).'/config.php'); | |
require_once(__DIR__ . '/calendar_form.php'); | |
require_login(); | |
$context = context_system::instance(); | |
$PAGE->set_context($context); | |
$url = new moodle_url('/blocks/gcal/add_calendar.php'); | |
$PAGE->set_url($url); | |
$mform = new calendar_form(); | |
echo $OUTPUT->header(); | |
echo $OUTPUT->heading('mapping', 2); | |
if ($mform->is_cancelled()) { | |
} else if ($fromform = $mform->get_data()) { | |
} else { | |
$toform = array(); | |
$mform->set_data($toform); | |
$mform->display(); | |
} | |
echo $OUTPUT->footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment