require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/CssResources.php'; require_login(1); global $USER; $PAGE->requires->css(CssResources::HOME_COMMUNITY); $PAGE->set_url('/course/index.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_pagelayout('standard'); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $idFile = optional_param('file', 0, PARAM_INTEGER); echo $OUTPUT->header('themeselector'); $webgdCommunityDao = new WebgdCommunityDao(); $community = $webgdCommunityDao->findCommunityById($idCommunity); $url = $CFG->wwwroot . '/blocks/webgd_community/view.php?community=' . $idCommunity; if ($idFile) { $webgdCommunityDao = new WebgdCommunityDao(); if (!$webgdCommunityDao->searchFileCommunityById($idCommunity, $idFile)) { redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}&option=1", get_string('arqNaoEnc', 'block_webgd_community'), 10); echo $OUTPUT->footer(); die; } else { echo $OUTPUT->heading('<span class="titulo_list">' . '<a href="' . $url . '" >' . $OUTPUT->heading($community->name, 2, 'titulo_comunidade') . '</a></span><br/>'); echo "<div class='subTitle'>" . get_string('editarArq', 'block_webgd_community') . "</div><br/>"; } } else { echo $OUTPUT->heading('<span class="titulo_list">' . '<a href="' . $url . '" >' . $OUTPUT->heading($community->name, 2, 'titulo_comunidade') . '</a></span><br/>'); echo "<div class='subTitle'>" . get_string('cadastrarArq', 'block_webgd_community') . "</div><br/>"; } $mform = new CadastrarArquivoForm(null, array('community' => $idCommunity, 'file' => $idFile)); if ($data = $mform->get_data()) { if ($idFile) { $msg = get_string('msgErro', 'block_webgd_community');