public function definition() { global $CFG; $question = null; $mform = $this->_form; // Don't forget the underscore! $namePage = 'Cadastrar Icone'; $nameButton = 'Salvar'; if ($this->_customdata['glossario']) { $namePage = 'Editar Icone'; $nameButton = 'Editar'; } $mform->addElement('header', 'nameforyourheaderelement', $namePage); $mform->addElement('hidden', 'community', $this->_customdata['community']); $mform->addElement('text', 'nome', get_string('labelNome', 'block_webgd_community')); $mform->addRule('nome', get_string('labelValidacaoNome', 'block_webgd_community'), 'required', null, 'client'); $mform->addElement('text', 'link', 'Url do icone'); $mform->addRule('link', 'Campo em branco', 'required', null, 'client'); if ($this->_customdata['glossario']) { $webgdCommunityDao = new WebgdCommunityDao(); $glossary = $webgdCommunityDao->searchGlossaryByCommunityById($this->_customdata['community'], $this->_customdata['glossario']); $mform->setDefault('nome', $glossary->name); $mform->setDefault('link', $glossary->url); $mform->addElement('hidden', 'glossario', $this->_customdata['glossario']); } $buttonarray = array(); $buttonarray[] =& $mform->createElement('submit', 'submitbutton', $nameButton); //$buttonarray[] = &$mform->createElement('reset', 'resetbutton', get_string('revert')); $buttonarray[] =& $mform->createElement('button', 'cancelar', 'Cancelar', 'onclick=location.href="' . $CFG->wwwroot . '/blocks/webgd_community/view.php?community=' . $this->_customdata['community'] . '"'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); $mform->closeHeaderBefore('buttonar'); }
public function definition() { global $CFG; $glossary = null; $mform = $this->_form; // Don't forget the underscore! $namePage = 'Cadastrar Glossario'; if ($this->_customdata['glossario']) { $namePage = 'Editar glossario'; $webgdCommunityDao = new WebgdCommunityDao(); $glossary = $webgdCommunityDao->searchGlossaryByCommunityById($this->_customdata['community'], $this->_customdata['glossario']); } $mform->addElement('hidden', 'community', $this->_customdata['community']); $mform->addElement('text', 'termo', 'Termo'); $mform->addRule('termo', 'Campo em branco', 'required', null, 'client'); $mform->addElement('textarea', 'conceito', 'Conceito ', ' rows="7" cols="90"'); $mform->addRule('conceito', 'Campo em branco', 'required', null, 'client'); $mform->addElement('textarea', 'exemplo', 'Exemplo', ' rows="7" cols="90"'); $mform->addRule('exemplo', 'Campo em branco', 'required', null, 'client'); if ($this->_customdata['glossario']) { $mform->addElement('hidden', 'glossario', $glossary->id); $mform->setDefault('termo', $glossary->termo); $mform->setDefault('conceito', $glossary->conceito); $mform->setDefault('exemplo', $glossary->exemplo); } else { $mform->addElement('filepicker', 'attachmentTermo', "Video Termo", null, array('accepted_types' => '*')); $mform->addRule('attachmentTermo', get_string('labelValidacaoArquivo', 'block_webgd_community'), 'required', null, 'client'); $mform->addElement('filepicker', 'attachmentConceito', "Video Conceito", null, array('accepted_types' => '*')); $mform->addRule('attachmentConceito', get_string('labelValidacaoArquivo', 'block_webgd_community'), 'required', null, 'client'); $mform->addElement('filepicker', 'attachmentExemplo', "Video exemplo", null, array('accepted_types' => '*')); $mform->addRule('attachmentExemplo', get_string('labelValidacaoArquivo', 'block_webgd_community'), 'required', null, 'client'); $mform->addElement('filepicker', 'attachmentImage', "Imagem", null, array('accepted_types' => '*')); $mform->addRule('attachmentImage', get_string('labelValidacaoArquivo', 'block_webgd_community'), 'required', null, 'client'); } $nameButton = get_string('savechanges'); $buttonarray = array(); $buttonarray[] =& $mform->createElement('submit', 'submitbutton', $nameButton); //$buttonarray[] = &$mform->createElement('reset', 'resetbutton', get_string('revert')); $buttonarray[] =& $mform->createElement('button', 'cancelar', get_string('cancelar', 'block_webgd_community'), 'onclick=location.href="' . $CFG->wwwroot . '/blocks/webgd_community/view.php?community=' . $this->_customdata['community'] . '"'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); $mform->closeHeaderBefore('buttonar'); }
<?php require_once dirname(__FILE__) . '/../../../../config.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.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('themeselector'); echo $OUTPUT->heading('Deletar Glossario'); $idGlosario = optional_param('glossario', 0, PARAM_INTEGER); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $msg = 'Glossario não Encontrado'; if ($map = $webgdCommunityDao->searchGlossaryByCommunityById($idCommunity, $idGlosario)) { $msg = 'Erro ao excluir Glossario'; if ($webgdCommunityDao->deleteGlossaryById($idGlosario)) { $msg = 'Glossario deletado com sucesso'; } } redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}", $msg, 10); echo $OUTPUT->footer();
<?php require_once dirname(__FILE__) . '/../../../../config.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_login(1); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $idGlossario = optional_param('glossary', 0, PARAM_INTEGER); $q = optional_param('q', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $glossary = $webgdCommunityDao->searchGlossaryByCommunityById($idCommunity, $idGlossario); switch ($q) { case 'termo': $path = $glossary->video_termo; break; case 'conceito': $path = $glossary->video_conceito; break; case 'exemplo': $path = $glossary->video_exemplo; break; } $aux = explode('.', $path); $extensao = $aux[sizeof($aux) - 1]; $size = filesize($path); $fm = @fopen($path, 'rb'); if (!$fm) { // You can also redirect here header("HTTP/1.0 404 Not Found"); die; } $begin = 0;
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'); $webgdCommunityDao = new WebgdCommunityDao(); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $idGlossario = optional_param('glossario', 0, PARAM_INTEGER); $community = $webgdCommunityDao->findCommunityById($idCommunity); $url = $CFG->wwwroot . '/blocks/webgd_community/view.php?community=' . $idCommunity; echo $OUTPUT->header('themeselector'); if ($idGlossario) { $webgdCommunityDao = new WebgdCommunityDao(); if (!$webgdCommunityDao->searchGlossaryByCommunityById($idCommunity, $idGlossario, $USER->id)) { redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}&option=8", 'Glossario não encontrado', 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'>Editar Termo</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'>Cadastrar Termo</div><br/>"; } $mform = new GlossaryForm(null, array('community' => $idCommunity, 'glossario' => $idGlossario)); if ($data = $mform->get_data()) { $msg = ""; if ($idGlossario) {