/** * Construct a new forum index view * @param array $categories Array with forum categories and their boards * @param string $boardAction URL * @param string $topicAction URL * @return null */ public function __construct($category, $boardAction, $topicAction) { parent::__construct(self::TEMPLATE); $this->set('category', $category); $this->set('boardAction', $boardAction); $this->set('topicAction', $topicAction); }
/** * Construct a new forum index view * @param array $categories Array with forum categories and their boards * @param string $boardAction URL * @param string $topicAction URL * @return null */ public function __construct(array $categories, $categoryAction, $boardAction, $topicAction) { parent::__construct(self::TEMPLATE); $this->set('categories', $categories); $this->set('categoryAction', $categoryAction); $this->set('boardAction', $boardAction); $this->set('topicAction', $topicAction); }
/** * Constructs a new view for a forum board * @param integer $pages * @param integer $page * @param string $pageAction * @param array $topics * @param string $topicAction * @param string $topicAddAction * @param string $topicStickyAction * @param string $topicDeleteAction */ public function __construct($pages, $page, $pageAction, array $topics, $topicAction, $topicAddAction = null, $topicStickyAction = null, $topicDeleteAction = null) { parent::__construct(self::TEMPLATE); $this->set('pages', $pages); $this->set('page', $page); $this->set('pageAction', $pageAction); $this->set('topics', $topics); $this->set('topicAction', $topicAction); $this->set('topicAddAction', $topicAddAction); $this->set('topicStickyAction', $topicStickyAction); $this->set('topicDeleteAction', $topicDeleteAction); }
public function selectByQuestao($idQuestao) { $sql = "select * from forum_view where frv_questao = " . $idQuestao; //echo $sql; $result = $this->retrieve($sql); $lista = array(); while ($qr = mysqli_fetch_array($result)) { $view = new ForumView(); $view->setFrv_id($qr["frv_id"]); $view->setFrv_usuario($qr["frv_usuario"]); $view->setFrv_questao($qr["frv_questao"]); $view->setFrv_data($qr["frv_data"]); array_push($lista, $view); } return $lista; }
<p class="col-xs-2 col-md-2 col-lg-2 align-right">' . $totalRespostas . '</p> </div> <div style="clear:both"></div> </div>'; } } echo $html; break; case "listaRespostaQuestao": $dataFuncao = new DatasFuncao(); $l = unserialize($_SESSION['USR']); $logado = $userController->select($l['id']); $id = $logado->getUsr_id(); $resp = $forumController->select($_POST['resp']); if ($viewController->verificaUsuarioByQuestao($id, $_POST['resp']) == 0) { $view = new ForumView(); $view->setFrv_questao($_POST['resp']); $view->setFrv_usuario($id); $view->setFrv_data(date('Y-m-d h:i:s')); $viewController->insert($view); $htmlJquery = '<script text="<script type="text/javascript">atualizaVisitas(' . $_POST['resp'] . ')</script>'; } else { $htmlJquery = ''; } $usuario = $userController->select($resp->getFrq_usuario()); $respostas = $respostasController->selectByQuestao($resp->getFrq_id()); $data = $dataFuncao->dataTimeBRExibicao($resp->getFrq_data()); if (file_exists("imgp/" . $usuario->getUsr_imagem())) { $foto = $usuario->getUsr_imagem(); } else { $foto = 'default.png';
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; }