* along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package Mod * @subpackage facetoface */ /** * Save pre-defined rooms */ require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); require_once($CFG->dirroot.'/mod/facetoface/room/room_form.php'); require_login(0, false); require_capability('moodle/site:config', context_system::instance()); $form = new f2f_room_form(null, null, 'post', '', null, true, 'ajaxmform'); // Process form data if ($data = $form->get_data()) { if (empty($data->id)) { // Add $todb = new stdClass; $todb->name = $data->name; $todb->building = $data->building; $todb->address = $data->address; $todb->capacity = $data->capacity; $todb->type = $data->type; $todb->description = $data->description; $todb->custom = 0; $todb->timecreated = time(); $todb->timemodified = $todb->timecreated;
$editoroptions = array( 'noclean' => false, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'context' => $systemcontext, ); if ($id == 0) { $room = new stdClass(); $room->id = 0; } else { $room = $DB->get_record('facetoface_room', array('id' => $id)); $room->descriptionformat = FORMAT_HTML; $room = file_prepare_standard_editor($room, 'description', $editoroptions, $systemcontext, 'facetoface', 'room', $room->id); } $form = new f2f_room_form(null, array('roomid' => $room->id, 'editoroptions' => $editoroptions)); $form->set_data($room); if ($form->is_cancelled()) { redirect($roomlisturl); } else if ($data = $form->get_data()) { if (isset($data->submitbutton)) { $now = time(); $todb = new stdClass(); $todb->name = $data->name; $todb->building = $data->building; $todb->address = $data->address; $todb->capacity = $data->capacity; $todb->type = $data->type;
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package mod * @subpackage facetoface */ require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); require_once($CFG->dirroot.'/mod/facetoface/room/room_form.php'); $system_context = context_system::instance(); require_login(0, false); require_capability('moodle/site:config', $system_context); $PAGE->set_context($system_context); $id = optional_param('id', 0, PARAM_INT); // roomid $form = new f2f_room_form(null, null, 'post', '', null, true, 'ajaxmform'); if (!empty($id) && $room = $DB->get_record('facetoface_room', array('id' => $id))) { $form->set_data($room); } echo '<div id="f2froomform">'; $form->display(); echo '</div>'; ?>