public function definition() { global $CFG; $question = null; $mform = $this->_form; // Don't forget the underscore! $namePage = 'Cadastrar Mapa Mental'; $nameButton = 'Salvar'; if ($this->_customdata['map']) { $namePage = 'Editar Mapa Mental'; $nameButton = 'Editar'; } $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 link (com http://)'); $mform->addRule('link', 'Campo em branco', 'required', null, 'client'); if ($this->_customdata['map']) { $webgdCommunityDao = new WebgdCommunityDao(); $map = $webgdCommunityDao->searchMentalMapByCommunityById($this->_customdata['community'], $this->_customdata['map']); $mform->setDefault('nome', $map->name); $mform->setDefault('link', $map->url); $mform->addElement('hidden', 'map', $this->_customdata['map']); } $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, $DB, $USER; $mform = $this->_form; // Don't forget the underscore! $multiSelect = new MultiSelectHelper('users[]', 'users'); $webgdCommunityDao = new WebgdCommunityDao(); $mform->addElement('text', 'nome', get_string('labelNome', 'block_webgd_community')); $mform->addRule('nome', get_string('labelValidacaoNome', 'block_webgd_community'), 'required', null, 'client'); $mform->setType('nome', PARAM_TEXT); if ($this->_customdata['community']) { $mform->addElement('hidden', 'id', $this->_customdata['community']); $communityDao = $webgdCommunityDao->findCommunityById($this->_customdata['community']); $mform->setDefault('nome', $communityDao->name); //preciso ainda ler os dados da comunidade para inserir aqui quando for edição } else { $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_NOTAGS); } $formCheckbox = $mform->createElement('advcheckbox', 'close_community', 'Comunidade fechada', array('group' => 1), array(0, 1)); if ($this->_customdata['community']) { $communityDao = $webgdCommunityDao->findCommunityById($this->_customdata['community']); if ($communityDao->close_community == 1) { $formCheckbox->setChecked(true); } else { $formCheckbox->setChecked(false); } } else { $formCheckbox->setChecked(false); } $mform->addElement($formCheckbox); //$mform->addElement('advcheckbox', 'close_community', 'Comunidade fechada','' , array('group' => 1), array(0, 1)); $mform->addElement('filepicker', 'video', "Vídeo", null, array('accepted_types' => array('*'))); $records = $webgdCommunityDao->getListNameUser($USER->id); foreach ($records as $record) { $selected = false; if ($this->_customdata['community']) { if ($webgdCommunityDao->participanteInCommunity($record->id, $this->_customdata['community'])) { $selected = true; } } $multiSelect->addElement($record->firstname, $record->id, $selected); } $radioarray = array(); $radioarray[] =& $mform->createElement('html', ''); $radioarray[] =& $mform->createElement('html', ''); $mform->addGroup($radioarray, 'radioar', 'Participante', array(' '), false); $mform->addElement('html', $multiSelect->printMultiSelect()); $mform->addElement('textarea', 'conteudo', get_string('labelDescricao', 'block_webgd_community'), null); $mform->addHelpButton('conteudo', 'coursesummary'); $mform->setType('conteudo', PARAM_RAW); if ($this->_customdata['community']) { $mform->setDefault('conteudo', $communityDao->description); } $buttonarray = array(); $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('savechanges')); $buttonarray[] =& $mform->createElement('button', 'cancelar', get_string('cancelar', 'block_webgd_community'), 'onclick=location.href="' . $CFG->wwwroot . '/blocks/webgd_community/index.php"'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); $mform->closeHeaderBefore('buttonar'); }
public function definition() { global $CFG; $mform = $this->_form; // Don't forget the underscore! $mform->addElement('hidden', 'community', $this->_customdata['community']); $mform->setType('community', PARAM_NOTAGS); $mform->addElement('text', 'nome', get_string('labelNome', 'block_webgd_community')); $mform->setType('nome', PARAM_TEXT); $mform->addRule('nome', get_string('labelValidacaoNome', 'block_webgd_community'), 'required', null, 'client'); //não usei o get_string pois não há esse termo no $nameButton = get_string('save', 'block_webgd_community'); if ($this->_customdata['file']) { $nameButton = 'Editar'; $mform->addElement('hidden', 'file', $this->_customdata['file']); $webgdCommunityDao = new WebgdCommunityDao(); $file = $webgdCommunityDao->searchFileById($this->_customdata['file']); $mform->setDefault('nome', $file->name); } else { $mform->addElement('filepicker', 'attachment', get_string('attachment', 'forum'), null, array('accepted_types' => '*')); $mform->addRule('attachment', get_string('labelValidacaoArquivo', 'block_webgd_community'), 'required', null, 'client'); } $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'); }
public function definition() { global $CFG; $question = null; $mform = $this->_form; // Don't forget the underscore! $this->dateIntervalScript(); $this->questionScript(); $namePage = 'Cadastrar Enquete'; if ($this->_customdata['question']) { $namePage = 'Editar Enquete'; $webgdCommunityDao = new WebgdCommunityDao(); $question = $webgdCommunityDao->searchQuestionByCommunityById($this->_customdata['question']); } $mform->addElement('hidden', 'path_arquivos', $CFG->dataroot . '/blocks/webgd_community' . '/', array('id' => 'path_arquivos')); $mform->addElement('hidden', 'community', $this->_customdata['community']); $mform->addElement('text', 'nome', "Pergunta"); $mform->addRule('nome', get_string('labelValidacaoNome', 'block_webgd_community'), 'required', null, 'client'); $mform->addElement('text', 'from', 'Data Inicio', array("id" => "from")); $mform->addRule('from', null, 'required', null, 'client'); $mform->addElement('text', 'to', 'Data Fim', array("id" => "to")); $mform->addRule('to', null, 'required', null, 'client'); $options = array('1' => 'Sim', '0' => 'Não'); $mform->addElement('select', 'enable', 'Habilitado', $options); $mform->addElement('filepicker', 'attachmentQuestion', 'Pergunta em Libras', null, array('accepted_types' => '*')); $nameButton = 'Salvar'; $mform->addElement("html", "<div style='background: #f5f5f5; margin-bottom:-30px;'>"); $mform->addElement('file', 'attachmentAnswer', 'Respostas em Libras', null, array('accepted_types' => '*')); $mform->addElement('hidden', 'video', array("id" => "video_hidden")); $mform->addElement("html", "</div>"); $buttonarray = array(); $buttonarray[] =& $mform->createElement('text', 'pergunta', 'Adicionar Resposta', array("id" => "nome_pergunta")); $buttonarray[] =& $mform->createElement('button', 'bt_pergunta', 'Adicionar', array("id" => "bt_pergunta")); $mform->addGroup($buttonarray, 'buttonar', 'Adicionar Resposta', array(' '), false); if (!empty($question)) { $nameButton = 'Salvar'; $mform->setDefault("nome", $question->name); $mform->setDefault("from", date("d/m/Y", $question->startdate)); $mform->setDefault("to", date("d/m/Y", $question->enddate)); $mform->setDefault("enable", $question->enabled); $mform->addElement('hidden', 'question', $this->_customdata['question']); $answers = $webgdCommunityDao->searchAskQuestionByCommunityById($question->id); $mform->addElement("html", "<div id='perfuntas'>"); foreach ($answers as $dataAnswer) { $rand = rand(); $mform->addElement("html", "<div id=" . $rand . " >Resposta: " . $dataAnswer->name_question . " <a href='#' onclick=\"remover('" . $rand . "')\"><input type=\"hidden\" value='" . $dataAnswer->name_question . "' name=\"pergunta[]\"><input type=\"hidden\" value='" . $dataAnswer->video . "' name=\"video[]\"> remover</a><br></div>"); } $mform->addElement("html", "</div>"); } else { $mform->addElement("html", "<div id='perfuntas'></div>"); } $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 Comunidade'); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $msg = 'Erro ao excluir Comunidade'; if ($webgdCommunityDao->deleteCommunityById($idCommunity)) { $msg = 'Comunidade deletada com sucesso'; } redirect("{$CFG->wwwroot}/blocks/webgd_community/index.php", $msg, 10); echo $OUTPUT->footer();
<?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 Icone'); $idGlosario = optional_param('glossario', 0, PARAM_INTEGER); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $msg = 'Icone não Encontrado'; if ($webgdCommunityDao->searchIconeByCommunityByIdByUser($idCommunity, $idGlosario, $USER->id)) { $icone = $webgdCommunityDao->searchIconeByCommunityById($idGlosario); $msg = 'Erro ao excluir icone'; if ($webgdCommunityDao->deleteIconsByCommunityByIdByuser($icone->id, $USER->id, $icone->post)) { $msg = 'Icone 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/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(get_string('deletarArq', 'block_webgd_community')); $idFile = optional_param('file', 0, PARAM_INTEGER); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $msg = get_string('nenhumArqEnc', 'block_webgd_community'); if ($webgdCommunityDao->searchFileCommunityById($idCommunity, $idFile)) { $file = $webgdCommunityDao->searchFileById($idFile); if ($webgdCommunityDao->deleteFileByIdUser($file->id, $USER->id, $file->post)) { $msg = get_string('deletarArqSuc', 'block_webgd_community'); unlink($file->path); } } 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/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 Mapa mental'); $idQuestion = optional_param('map', 0, PARAM_INTEGER); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $msg = 'Mapa mental não Encontrado'; if ($webgdCommunityDao->searchMentalMapByCommunityByIdByUser($idCommunity, $idQuestion, $USER->id)) { $map = $webgdCommunityDao->searchMentalMapByCommunityById($idQuestion); $msg = 'Erro ao excluir mapa mental'; if ($webgdCommunityDao->deleteMentalMapByCommunityByIdByuser($map->id, $USER->id, $map->post)) { $msg = 'Mapa mental deletado com sucesso'; } } redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}&suboption=1", $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); $idFile = optional_param('file', 0, PARAM_INTEGER); $webgdDao = new WebgdCommunityDao(); $fileBd = $webgdDao->searchMovieById($idFile); $path = $fileBd->path; $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; $end = $size; if (isset($_SERVER['HTTP_RANGE'])) { if (preg_match('/bytes=\\h*(\\d+)-(\\d*)[\\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) { $begin = intval($matches[0]); if (!empty($matches[1])) { $end = intval($matches[1]); } } } if ($begin > 0 || $end < $size) { header('HTTP/1.0 206 Partial Content'); } else {
require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/CssResources.php'; 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 = "";
<?php require_once dirname(__FILE__) . '/../../config.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; require_once $CFG->dirroot . '/blocks/webgd_community/menus/Commons.php'; require_login(1); global $USER, $DB; $idCommunity = optional_param('community', 0, PARAM_INT); $message = optional_param('message', '', PARAM_TEXT); $webgbDao = new WebgdCommunityDao(); try { $transaction = $DB->start_delegated_transaction(); $post = new stdClass(); $post->community = $idCommunity; $post->userid = $USER->id; $post->time = time(); $post->type = 'text'; $idPost = $webgbDao->insertRecordInTableCommunityPost($post); $postText = new stdClass(); $postText->post = $idPost; $postText->message = $message; $webgbDao->insertRecordInTableCommunityText($postText); $transaction->allow_commit(); if ($communities = $webgbDao->getAllCommunityPost($idCommunity)) { foreach ($communities as $community) { Commons::printListPost($community); } } } catch (Exception $e) { $transaction->rollback($e);
require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; 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) {
<?php require_once dirname(__FILE__) . '/../../../../config.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_login(1); $idFile = optional_param('file', 0, PARAM_INTEGER); $q = optional_param('q', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); if ($q) { $fileBd = $webgdCommunityDao->searchQuestionByCommunityById($idFile); $path = $fileBd->attachmentquestion; } else { $fileBd = $webgdCommunityDao->searchAnswerById($idFile); $path = $fileBd->video; } $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; $end = $size; if (isset($_SERVER['HTTP_RANGE'])) { if (preg_match('/bytes=\\h*(\\d+)-(\\d*)[\\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) { $begin = intval($matches[0]); if (!empty($matches[1])) { $end = intval($matches[1]);
<?php require_once dirname(__FILE__) . '/../../config.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_login(1); $idFile = optional_param('file', 0, PARAM_INTEGER); $webgdDao = new WebgdCommunityDao(); $fileBd = $webgdDao->findCommunityById($idFile); $path = $fileBd->video; $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; $end = $size; if (isset($_SERVER['HTTP_RANGE'])) { if (preg_match('/bytes=\\h*(\\d+)-(\\d*)[\\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) { $begin = intval($matches[0]); if (!empty($matches[1])) { $end = intval($matches[1]); } } } if ($begin > 0 || $end < $size) { header('HTTP/1.0 206 Partial Content'); } else {
<?php require_once dirname(__FILE__) . '/../../config.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; require_login(1); global $USER, $DB, $CFG; $idPost = optional_param('idPost', 0, PARAM_INT); $voto = optional_param('votacao', 0, PARAM_INT); if ($voto == 0) { $voto = -1; } $webgdCommunityDao = new WebgdCommunityDao(); $votoAnterior = 0; if ($likedislike = $webgdCommunityDao->searchLikeDislikeUserVotation($idPost, $USER->id)) { $votoAnterior = $likedislike->voto; $DB->delete_records(TableResouces::$TABLE_PAGE_COMMUNITY_LIKEDISLIKE, array('id' => $likedislike->id)); } $likedislike_user_votation = new stdClass(); $likedislike_user_votation->userid = $USER->id; $likedislike_user_votation->postid = $idPost; $likedislike_user_votation->voto = $voto; $DB->insert_record(TableResouces::$TABLE_PAGE_COMMUNITY_LIKEDISLIKE, $likedislike_user_votation); $post = $webgdCommunityDao->searchPostByID($idPost); if ($votoAnterior != 0) { if ($votoAnterior > 0) { $post->total_votos_sim = $post->total_votos_sim - 1; } else { $post->total_votos_nao = $post->total_votos_nao - 1; } }
<?php require_once dirname(__FILE__) . '/../../../../config.php'; global $USER, $CFG, $DB; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; require_login(1); $idGlossario = optional_param('idGlossario', 0, PARAM_INT); $voto = optional_param('votacao', 0, PARAM_INT); $webgdCommunityDao = new WebgdCommunityDao(); $votoAnterior = 0; if ($glossaryvotacao = $webgdCommunityDao->searchGlossaryUserVotation($idGlossario, $USER->id)) { $votoAnterior = $glossaryvotacao->voto; $DB->delete_records(TableResouces::$TABLE_PAGE_COMMUNITY_GLOSSARRY_VOTACAO, array('id' => $glossaryvotacao->id)); } $glossary_user_votation = new stdClass(); $glossary_user_votation->userid = $USER->id; $glossary_user_votation->glossarryid = $idGlossario; $glossary_user_votation->voto = $voto; $DB->insert_record(TableResouces::$TABLE_PAGE_COMMUNITY_GLOSSARRY_VOTACAO, $glossary_user_votation); $glossary = $webgdCommunityDao->searchGlossaryById($idGlossario); if ($votoAnterior != 0) { $glossary->votos = $glossary->votos - $votoAnterior + $voto; $votos = $glossary->votos; $total = $glossary->totalvotos; } else { $glossary->totalVotos = $glossary->totalvotos + 1; $total = $glossary->totalVotos; $glossary->votos = $glossary->votos + $voto; $votos = $glossary->votos; }
<?php require_once dirname(__FILE__) . '/../../config.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; require_once $CFG->dirroot . '/blocks/webgd_community/menus/Commons.php'; require_login(1); global $USER, $DB; $idPost = optional_param('post_id_comment', 0, PARAM_INT); $message = optional_param('comment', '', PARAM_TEXT); $webgbDao = new WebgdCommunityDao(); try { $transaction = $DB->start_delegated_transaction(); $postComment = new stdClass(); $postComment->userid = $USER->id; $postComment->postid = $idPost; $postComment->comentario = $message; $postComment->time = time(); $idPostComment = $webgbDao->insertRecordInTablePostComment($postComment); $transaction->allow_commit(); echo $idPostComment; } catch (Exception $e) { $transaction->rollback($e); }
<?php require_once dirname(__FILE__) . '/../../config.php'; global $USER, $CFG; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_once $CFG->dirroot . '/blocks/webgd_community/menus/Commons.php'; $ultimo_post = optional_param('ultimo_post', 0, PARAM_INT); $id_comunidade = optional_param('id_comunidade', 0, PARAM_INT); require_login(1); $retorno = array('ultimo_post' => $ultimo_post, 'mensagem' => '', 'atualizar' => '0'); $novo_ultimo = $ultimo_post; $webgbDao = new WebgdCommunityDao(); if ($communities = $webgbDao->getAllCommunityPostSince($id_comunidade, $ultimo_post)) { foreach ($communities as $community) { if ($USER->id == $community->userid) { $retorno['mensagem'] .= Commons::printListPost($community, 1, $id_comunidade, 1); //$retorno['mensagem'] .= "userid: ".$community->userid." id:".$community->id." "; } else { $retorno['mensagem'] .= Commons::printListPost($community, 0, $id_comunidade, 1); //$retorno['mensagem'] .= "userid: ".$community->userid." id:".$community->id." "; } if ($novo_ultimo == $ultimo_post) { $novo_ultimo = $community->id; } } } if ($novo_ultimo != $ultimo_post) { $retorno['atualizar'] = '1'; } $retorno['ultimo_post'] = $novo_ultimo; $retorno = json_encode($retorno);
require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; 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); $idText = optional_param('text', 0, PARAM_INTEGER); echo $OUTPUT->header('themeselector'); $webgdDao = new WebgdCommunityDao(); $community = $webgdDao->findCommunityById($idCommunity); $url = $CFG->wwwroot . '/blocks/webgd_community/view.php?community=' . $idCommunity; if ($idText) { $webgdCommunityDao = new WebgdCommunityDao(); if (!($textData = $webgdCommunityDao->searchTextById($idText))) { 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 . ' - Editar Texto', 2, 'titulo_comunidade') . '</a>'); } } else { echo $OUTPUT->heading('<span class="titulo_list">' . '<a href="' . $url . '" >' . $OUTPUT->heading($community->name . ' - Cadastrar Texto', 2, 'titulo_comunidade') . '</a>'); } $mform = new UpdateText(null, array('community' => $idCommunity, 'idText' => $idText, 'message' => $textData->message)); if ($data = $mform->get_data()) { if ($idText) { $msg = get_string('msgErro', 'block_webgd_community'); if ($arquivo = $webgdCommunityDao->searchTextById($idText)) {
<?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 Enquete'); $idQuestion = optional_param('question', 0, PARAM_INTEGER); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $msg = 'Enquete não Encontrado'; if ($question = $webgdCommunityDao->searchQuestionByCommunityById($idQuestion)) { $msg = 'Erro ao excluir enquete'; if ($webgdCommunityDao->deleteQuestionByCommunityById($question->id, $USER->id, $question->post)) { $msg = 'Enquete deletada com sucesso'; } } redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}", $msg, 10); echo $OUTPUT->footer();
public static function printTimelineComments($idpost, $automatico = 0) { global $CFG, $OUTPUT; $webgdCommunity = new WebgdCommunityDao(); $postComment = $webgdCommunity->postCommentById($idpost); $resposta = ""; foreach ($postComment as $comment) { $images = self::imageById($comment->userid); $resposta .= "<div class='conteudo_post'>\n <div class='titulo_post'>\n <span class='icone_user'>"; foreach ($images as $img) { $resposta .= $OUTPUT->user_picture($img, array('size' => 25, 'alttext' => false, 'link' => false)); } $resposta .= "</span> <span class='nome_criador'>" . html_writer::tag('a', $comment->firstname, array('href' => $CFG->wwwroot . '/user/profile.php?id=' . $comment->userid)) . "</span>\n " . get_string('publicouEm', 'block_webgd_community') . "\n <div class='data'>" . strftime('%d de %B de %Y às %H %M %S ', $comment->time) . "</div>\n </span>\n <div class='informacoes_post'>\n <span>" . Commons::make_links_blank($comment->comentario) . "</span>\n </div></div></div>"; } if ($automatico) { return $resposta; } else { echo $resposta; } }
<?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 dirname(__FILE__) . '/../../config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/ImageResources.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/CssResources.php'; require_once $CFG->dirroot . '/blocks/webgd_community/menus/Commons.php'; require_login(1); global $USER, $DB, $CFG; $PAGE->set_url('/course/index.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_pagelayout('standard'); $PAGE->requires->css(CssResources::LIST_HOME_COMMUNITY); echo $OUTPUT->header('themeselector'); $webgdCommunityDao = new WebgdCommunityDao(); if ($listCommunity = $webgdCommunityDao->getListCommunity()) { echo '<span class="titulo_list">' . $OUTPUT->heading(get_string('comunidades', 'block_webgd_community')) . '</span>'; echo '<div class="lista_home">'; echo '<span class="titulo_list"></span>'; foreach ($listCommunity as $community) { $participar = ""; $fechada = 0; if (!$webgdCommunityDao->findUserInCommunityById($community->id, $USER->id)) { if ($community->close_community == 1) { $participar = "<img class='botao_comunidade' src='" . $CFG->wwwroot . ImageResources::COMUNIDADE_FECHADA . "'>"; $fechada = 1; } else { $participar = "<div>" . html_writer::tag('a', "<img class='botao_comunidade' src='" . $CFG->wwwroot . ImageResources::PARTICIPAR_COMUNIDADE . "'>", array('href' => "view.php?community={$community->id}&confirm=1")) . "</div>"; } } else {
require_once $CFG->dirroot . '/blocks/webgd_community/form/IconeForm.php'; require_once $CFG->dirroot . '/blocks/webgd_community/commons/TableResouces.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/JsResources.php'; require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/CssResources.php'; require_login(1); global $USER; $PAGE->set_url('/course/index.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_pagelayout('standard'); $webgdDao = new WebgdCommunityDao(); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $idIcone = optional_param('glossario', 0, PARAM_INTEGER); echo $OUTPUT->header('themeselector'); if ($idIcone) { $webgdCommunityDao = new WebgdCommunityDao(); if (!$webgdCommunityDao->searchIconeByCommunityByIdByUser($idCommunity, $idIcone, $USER->id)) { redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}&option=2", 'icone não encontrado', 10); echo $OUTPUT->footer(); die; } else { echo $OUTPUT->heading('Editar Icone'); } } else { echo $OUTPUT->heading('Cadastrar Icone'); } $mform = new IconeForm(null, array('community' => $idCommunity, 'glossario' => $idIcone)); if ($data = $mform->get_data()) { $msg = ""; if ($idIcone) { $glossary = $webgdCommunityDao->searchIconeByCommunityById($idIcone);
$PAGE->set_url('/course/index.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_pagelayout('standard'); $PAGE->requires->css(CssResources::HOME_COMMUNITY); $idCommunity = optional_param('community', 0, PARAM_INTEGER); echo $OUTPUT->header(''); $mform = new ModuleForm(null, array('community' => $idCommunity)); if ($data = $mform->get_data()) { if ($data->id) { echo $OUTPUT->heading("Editar Comunidade"); } else { echo $OUTPUT->heading(get_string('adicionarComunidade', 'block_webgd_community')); } if ($data->id) { $msg = get_string('msgErro', 'block_webgd_community'); $webgdDao = new WebgdCommunityDao(); if ($communityDao = $webgdDao->findCommunityById($data->id)) { $communityDao->name = $data->nome; $communityDao->description = $data->conteudo; $communityDao->close_community = $data->close_community; $realfilename = $mform->get_new_filename('video'); // 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 if ($mform->save_file('video', $dst, true)) { $communuty->video = $dst; }
<?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 Video'); $idFile = optional_param('file', 0, PARAM_INTEGER); $idCommunity = optional_param('community', 0, PARAM_INTEGER); $webgdCommunityDao = new WebgdCommunityDao(); $msg = 'Video não encontrado'; if ($file = $webgdCommunityDao->searchMovieCommunityById($idCommunity, $idFile)) { if ($webgdCommunityDao->deleteMovieByIdUser($idFile, $USER->id)) { $msg = 'Video excluido com sucesso'; unlink($file->path); } } redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}", $msg, 10); echo $OUTPUT->footer();
require_once $CFG->dirroot . '/blocks/webgd_community/lib/class/dao/WebgdCommunityDao.php'; 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'); $webgdDao = new WebgdCommunityDao(); $community = $webgdDao->findCommunityById($idCommunity); $url = $CFG->wwwroot . '/blocks/webgd_community/view.php?community=' . $idCommunity; if ($idFile) { $webgdCommunityDao = new WebgdCommunityDao(); if (!$webgdCommunityDao->searchMovieCommunityById($idCommunity, $idFile)) { redirect("{$CFG->wwwroot}/blocks/webgd_community/view.php?community={$idCommunity}&option=7", 'Video 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 Vídeo</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'>Cadastar Vídeo</div><br/>"; } $mform = new CadastrarArquivoForm(null, array('community' => $idCommunity, 'file' => $idFile)); if ($data = $mform->get_data()) { if ($idFile) {
<?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); $idFile = optional_param('file', 0, PARAM_INTEGER); $webgdDao = new WebgdCommunityDao(); $fileBd = $webgdDao->searchPhotoById($idFile); if ($fileBd) { $file = $fileBd->path; $aux = explode('.', $file); $extensao = $aux[sizeof($aux) - 1]; header('Content-Type: image/' . $extensao); //header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); } else { echo 'Arquivo nao encontrado'; }