* @package core * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(__FILE__) . '/../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->dirroot . '/blocks/webgd_community/form/ModuleForm.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; global $USER; require_login(1); $PAGE->set_url('/course/index.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_pagelayout('standard'); echo $OUTPUT->header(''); echo $OUTPUT->heading(get_string('adicionarComunidade', 'block_webgd_community')); $mform = new ModuleForm(); if ($data = $mform->get_data()) { $realfilename = $mform->get_new_filename('file'); // this gets the name of the file $random = rand(); // generate some random number $new_file = $random . '_' . $realfilename; //add some random string to the file $dst = $CFG->dataroot . "/blocks/webgd_community/{$new_file}"; // directory name+ new filename $communuty = new stdClass(); $communuty->name = $data->nome; $communuty->close_community = $data->close_community; $communuty->description = $data->conteudo['text']; $communuty->userid = $USER->id; $communuty->timecreated = time(); $msg = get_string('msgErroComunidadeEdicao', 'block_webgd_community');