Beispiel #1
0
     $idusuario = $logado->getUsr_id();
     $participante = $frqParticipante->verificarParticipante($idquestao, $idusuario);
     print "<pre>";
     print_r($participante);
     print "</pre>";
     break;
 case "incrementarVisualizacoes":
     $idfrq = $_POST["idfrq"];
     if ($forumController->incrementarVisualizacoes($idfrq)) {
         echo "1";
     } else {
         echo "0";
     }
     break;
 case "selectRangeByQuestao":
     $frrController = new ForumRespostaController();
     $usrController = new UsuarioController();
     $idfrq = $_GET["idfrq"];
     $min = $_GET["min"];
     $respostas = $frrController->selectRangeByQuestao($idfrq, $min);
     $lista = [];
     foreach ($respostas as $frr) {
         $usr = $usrController->select($frr->getFrr_usuario());
         $usrImagem = file_exists("imgp/" . $usr->getUsr_imagem()) ? $usr->getUsr_imagem() : "default.png";
         $resp = ["id" => $frr->getFrr_id(), "questao" => utf8_encode($frr->getFrr_questao()), "usuario" => ["id" => $usr->getUsr_id(), "nome" => utf8_encode($usr->getUsr_nome()), "imagem" => $usrImagem], "resposta" => utf8_encode($frr->getFrr_resposta()), "data" => DatasFuncao::dataTimeBR($frr->getFrr_data()), "anexo" => $frr->getFrr_anexo()];
         array_push($lista, $resp);
     }
     echo json_encode($lista);
     break;
 case "selectForumResposta":
     $frr = $respostasController->select($_GET["idfrr"]);
 public function getQuestao($idQuestao)
 {
     $userController = new UsuarioController();
     $forumController = new ForumQuestaoController();
     $frqController = new ForumQuestaoParticipanteController();
     $viewController = new ForumViewController();
     $respostasController = new ForumRespostaController();
     $logado = unserialize($_SESSION['USR']);
     $id = $logado['id'];
     $resp = $forumController->select($idQuestao);
     $usuario = $userController->select($resp->getFrq_usuario());
     $respostas = $respostasController->totalByQuestao($resp->getFrq_id());
     $frqId = $resp->getFrq_id();
     $frqQuestao = utf8_encode($resp->getFrq_questao());
     $frqUsuario = utf8_encode($usuario->getUsr_nome());
     $frqData = DatasFuncao::dataTimeBRExibicao($resp->getFrq_data());
     $usrNome = utf8_encode($logado["nome"]);
     $marginRight = "";
     if ($viewController->verificaUsuarioByQuestao($id, $idQuestao) == 0) {
         $view = new ForumView();
         $view->setFrv_questao($idQuestao);
         $view->setFrv_usuario($id);
         $view->setFrv_data(date('Y-m-d h:i:s'));
         $viewController->insert($view);
     }
     if (file_exists("imgp/" . $userController->buscaFotoByIdUsuario($id))) {
         $usrFoto = $userController->buscaFotoByIdUsuario($id);
     } else {
         $usrFoto = "default.png";
     }
     if (file_exists("imgp/" . $usuario->getUsr_imagem())) {
         $foto = $usuario->getUsr_imagem();
     } else {
         $foto = 'default.png';
     }
     if (count($respostas) > 4) {
         $marginRight = "margin_right";
     }
     $html = "<div id=\"box_topico\" class=\"row\">";
     $html .= "<p class=\"foto_aluno col-xs-1 col-md-1 col-lg-1\">";
     $html .= "<img src=\"imgp/{$foto}\">";
     $html .= "</p>";
     $html .= "<div class=\"col-xs-11 col-md-11 col-lg-11\">";
     $html .= "<p class=\"dados_aluno\">";
     $html .= "<span class=\"aluno_nome\">{$frqUsuario}</span>";
     $html .= "<span class=\"aluno_data\">Postado dia {$frqData}</span>";
     $html .= "</p>";
     $html .= "<p>";
     $html .= "<span class=\"resp_aluno\">{$frqQuestao}</span>";
     $html .= "</p>";
     $html .= "</div>";
     $html .= "</div>";
     $html .= "<div id=\"box_Respostas_container\">";
     $html .= "<div id=\"box_Respostas\">";
     $html .= "<div id=\"fbCarregandoFrr\" class=\"alert alert-warning\">Carregando respostas...</div>";
     $html .= "</div>";
     $html .= "<div id=\"containerCarregarRespostas\" style=\"display:none;\">";
     $html .= "<button id=\"btnCarregarFrr\" data-min=\"5\" type=\"button\" class=\"btn\">Carregar mais</button>";
     $html .= "</div>";
     $html .= "</div>";
     $html .= "<div id=\"box_nova_resposta\">";
     $html .= "<div id=\"campo_resp\">";
     $html .= "<p class=\"foto_aluno col-xs-1 col-md-1 col-lg-1\">";
     $html .= "<img src=\"imgp/{$usrFoto}\">";
     $html .= "</p>";
     $html .= "<div class=\"col-xs-11 col-md-11 col-lg-11\">";
     $html .= "<div class=\"dados_aluno\">";
     $html .= "<form id=\"formNovaResposta\" class=\"form\">";
     $html .= "<input type=\"hidden\" name=\"acao\" value=\"NovaRespostaQuestao\" />";
     $html .= "<input type=\"hidden\" name=\"usuario\" value=\"{$id}\" />";
     $html .= "<input type=\"hidden\" name=\"questao\" value=\"{$frqId}\" />";
     $html .= "<textarea id=\"resp_forum\" name=\"resposta\" placeholder=\"Digite aqui sua resposta!\"></textarea>";
     $html .= "</form>";
     $html .= "<button class=\"btn btn-primary\" id=\"btn_pronto\" idAluno=\"{$id}\">Responder</button>";
     $html .= "<div style=\"clear:both;\"></div>";
     $html .= "</div>";
     $html .= "</div>";
     $html .= "</div>";
     $html .= "</div>";
     echo $html;
 }
Beispiel #3
0
    require_once '_loadPaths.inc.php';
}
//echo '<pre>';
//print_r($_SESSION);
$path = $_SESSION['PATH_SYS'];
include_once $path['template'] . 'Template.php';
include_once $path['template'] . 'TemplateForumResposta.php';
include_once $path['controller'] . 'ForumQuestaoController.php';
include_once $path['controller'] . 'ForumRespostaController.php';
include_once $path['funcao'] . 'DatasFuncao.php';
$templateGeral = new Template();
$utils = new DatasFuncao();
//echo $utils->dataTimeBRExibicao('2015-10-10 10:10:10');
$templateResposta = new TemplateForumResposta();
$questaoController = new ForumQuestaoController();
$respostasController = new ForumRespostaController();
$templateResposta->updateQuestaoParticipante();
$templateResposta->updateQuestaoVisualizacao();
?>
<!DOCTYPE html>
<html lang="pt-br">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
        <title>Fórum Resposta</title>
        <!-- Bootstrap -->
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="css/style.css">
        <link rel="stylesheet" type="text/css" href="css/forumResposta.css">
Beispiel #4
0
 public function listaAlunos()
 {
     $forumController = new ForumQuestaoController();
     $viewController = new ForumViewController();
     $respController = new ForumRespostaController();
     $frqParticipante = new ForumQuestaoParticipanteController();
     $dataFuncao = new DatasFuncao();
     $idusr = unserialize($_SESSION["USR"])["id"];
     $idesc = unserialize($_SESSION["USR"])["escola"];
     $questoes = [];
     if ($idesc) {
         $questoes = $forumController->selectAprovadasByEscola($idesc);
     } else {
         $questoes = $forumController->selectAllAprovadas($idesc);
     }
     $cont = 0;
     function verificarAlteracaoQuestao($fqp, $frr)
     {
         $fqp_d = strtotime($fqp->getFqp_ultima_visualizacao());
         $frr_d = strtotime($frr->getFrr_data());
         if ($fqp_d - $frr_d < 0) {
             return true;
         } else {
             return false;
         }
     }
     foreach ($questoes as $key => $value) {
         $resp = $respController->totalByQuestao($value->getFrq_id());
         $labelNovo = "";
         if ($frqParticipante->verificarParticipante($value->getFrq_id(), $idusr)) {
             $fqp = $frqParticipante->getUltimaVisualizacao($value->getFrq_id(), $idusr);
             $frr = $respController->getMaisRecenteByQuestao($value->getFrq_id());
             if ($frr && verificarAlteracaoQuestao($fqp, $frr)) {
                 $labelNovo = "<span class=\"badge\">Novo</span>";
             }
         }
         if ($cont % 2 == 0) {
             $caixaGrande = "cx_rosa";
             $caixaPequena = "cx_brancaP";
         } else {
             $caixaGrande = "cx_branca";
             $caixaPequena = "cx_rosaP";
         }
         if (file_exists("imgp/" . $value->getFrq_usuario()->getUsr_imagem())) {
             $foto = $value->getFrq_usuario()->getUsr_imagem();
         } else {
             $foto = 'default.png';
         }
         $idfrq = $value->getFrq_id();
         $frq = utf8_encode($value->getFrq_questao());
         $usr = utf8_encode($value->getFrq_usuario()->getUsr_nome());
         $frt = utf8_encode($value->getFrq_topico()->getFrt_topico());
         $data = $dataFuncao->dataTimeBRExibicao($value->getFrq_data());
         $views = $value->getFrq_visualizacoes();
         echo '<a href="forumResposta.php?resp=' . $idfrq . '" id="caixaQuestao' . $idfrq . '">';
         echo '<div id="perg_box' . $idfrq . '" class="perg_box ' . $caixaGrande . ' row">';
         echo '<div class="perg_box_1 col-xs-12 col-md-7 col-lg-7">';
         echo '<p class="foto_aluno"><img src="imgp/' . $foto . '"></p>';
         echo '<p class="perg_aluno questaoTexto" id="' . $idfrq . '">' . $frq . ' ' . $labelNovo . '</p>';
         echo '<p class="nome_aluno">' . $usr . '</p>';
         echo '<p class="post_data">Tópico: ' . $frt . ' | Postado dia ' . $data . '</p>';
         echo '</div>';
         echo '<div class="perg_box_2 col-xs-12 col-md-5 col-lg-5">';
         echo '<p id="qtd_visu' . $idfrq . '" class="qtd_visu ' . $caixaPequena . '"><span>' . $views . '</span> visualizações</p>';
         echo '<p id="qtd_resp' . $idfrq . '" class="qtd_resp ' . $caixaPequena . '"><span>' . $resp . '</span> respostas</p>';
         echo '</div>';
         echo '</div>';
         echo '</a>';
         $cont++;
     }
 }