Exemple #1
0
         $object->time = time();
         $DB->insert_record(TableResouces::$TABLE_PAGE_COMMUNITY_ANSWER_QUESTION_USER, $object);
         $transaction->allow_commit();
         $msg = "Enquete Respondida com sucesso";
     } catch (Exception $e) {
         $transaction->rollback($e);
     }
     redirect($CFG->wwwroot . "/blocks/webgd_community/view.php?&community={$idCommunity}", $msg, 10);
 } else {
     $perguntas = $webgdCommunityDao->searchAskQuestionByCommunityById($question->id);
     echo "{$question->name} <br>";
     if ($question->attachmentquestion != '' && $question->attachmentquestion != '0') {
         echo "<div><video controls preload='none'>\n                                <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $idQuestion . "&q=1' type='video/webm'>\n                                <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $idQuestion . "&q=1' type='video/mpeg'>\n                                <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $idQuestion . "&q=1' type='video/mp4'>\n                                <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $idQuestion . "&q=1' type='video/ogg'>\n                            </video></div>";
     }
     echo '<form method="POST" action="">';
     $totalRespondidas = $webgdCommunityDao->getTotalRespondidasEnquete($question->id);
     foreach ($perguntas as $pergunta) {
         $nrRespondidas = $webgdCommunityDao->getTotalRespondidasEnqueteByPergunta($pergunta->id);
         if ($totalRespondidas == 0) {
             //evitando divisão por zero
             $porcentagem = 0;
         } else {
             $porcentagem = $nrRespondidas * 100 / $totalRespondidas;
         }
         echo '<hr><input type="radio" name="resposta" value="' . $pergunta->id . '"> <progress max="100" value="' . $porcentagem . '"></progress> ' . $pergunta->name_question . '<br>';
         if ($pergunta->video != '' && $pergunta->video != '0') {
             echo "<br><div><video controls preload='none'>\n                                    <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $pergunta->id . "' type='video/webm'>\n                                    <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $pergunta->id . "' type='video/mpeg'>\n                                    <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $pergunta->id . "' type='video/mp4'>\n                                    <source src='" . $CFG->wwwroot . '/blocks/webgd_community/menus/question/showMovieQuestion.php?file=' . $pergunta->id . "' type='video/ogg'>\n                                </video></div>";
         }
     }
     echo "<input type='hidden' value='" . $idCommunity . "' name='community'>";
     echo "<input type='hidden' value='" . $idQuestion . "' name='question'>";