$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) { $participar = "<img class='botao_comunidade' src='" . $CFG->wwwroot . ImageResources::COMUNIDADE_FECHADA . "'>"; } } Commons::printListHomeCommunity($community, $participar, $fechada); } echo '<div>'; } else { echo get_string('nenhumaComunidadeRegistrada', 'block_webgd_community'); } echo $OUTPUT->footer();