Exemplo n.º 1
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 {
            if ($community->close_community == 1) {