コード例 #1
0
function Main()
{
    header('Content-Type: text/html; charset=iso-8859-1');
    $arrInfos = split('_', $_POST['chave']);
    $fe = new Fechamento();
    $fe->setCodcaso($_SESSION['casores']);
    $contUnico = 1;
    if ($arrInfos[1] != 'perg' && $arrInfos[1] != 'grupo-perg') {
        $res = new Resolucao();
        $res->setCodcaso($_SESSION['casores']);
        $respostas = $res->BuscaRespostas($arrInfos[3]);
        $alternativas = $fe->RetornaConteudosDoItemDaMontagem($arrInfos[3], $arrInfos[1]);
        if ($alternativas) {
            $htmlInterativas .= '<div><strong>' . Montagem::RetornaDescricaoItem($_SESSION['casores'], 1, $arrInfos[3]) . '</strong></div>';
            $htmlInterativas .= '<div class="det-etapa-int">';
            $htmlInterativas .= '<table class="listadados">';
            $htmlInterativas .= '<tr class="head">';
            $htmlInterativas .= '<td class="td-col-alt">@lng[Alternativa]</td>';
            $htmlInterativas .= '<td class="td-col-correto">@lng[Gabarito]</td>';
            $htmlInterativas .= '<td class="td-col-escolha">@lng[Você marcou]</td>';
            $htmlInterativas .= '<td class="td-col-jus">&nbsp;</td>';
            $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
            $htmlInterativas .= '</tr>';
            $contAlt = 1;
            foreach ($alternativas as $alternativa) {
                $htmlInterativas .= '<tr class="norm">';
                $htmlInterativas .= '<td class="dado td-col-alt">' . $alternativa->Titulo . '</td>';
                $htmlInterativas .= '<td class="td-col-correto">' . ($alternativa->Correto == 1 ? Comuns::IMG_STATUS_CERTO : Comuns::IMG_STATUS_ERRADO) . '</td>';
                $htmlInterativas .= '<td class="td-col-escolha">' . ((intval($respostas) & intval($alternativa->ValorOpt)) > 0 ? Comuns::IMG_ITEM_PINO : '') . '</td>';
                $htmlInterativas .= '<td class="td-col-jus">' . trim(strip_tags(nl2br($alternativa->Justificativa)) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'j\', \'' . $contUnico . '\', \'' . $contAlt . '\');">@lng[Ver detalhes]</a>' : '') . '</td>';
                $htmlInterativas .= '<td class="td-col-compl">' . trim(strip_tags(nl2br($alternativa->ConteudoAdicional)) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'c\', \'' . $contUnico . '\', \'' . $contAlt . '\');">@lng[Ver complemento]</a>' : '') . '</td>';
                $htmlInterativas .= '</tr>';
                if (trim(strip_tags($alternativa->Justificativa)) != '') {
                    $htmlInterativas .= '<tr style="display:none;" id="jus-' . $contUnico . '-' . $contAlt . '">';
                    $htmlInterativas .= '<td colspan="5" class="apre-just"><div class="cont-just">' . $alternativa->Justificativa . '</div></td>';
                    $htmlInterativas .= '</tr>';
                }
                if (trim(strip_tags($alternativa->ConteudoAdicional)) != '') {
                    $htmlInterativas .= '<tr style="display:none;" id="contadi-' . $contUnico . '-' . $contAlt . '">';
                    $htmlInterativas .= '<td colspan="5" class="apre-compl"><div class="cont-compl">' . $alternativa->ConteudoAdicional . '</div></td>';
                    $htmlInterativas .= '</tr>';
                }
                $contAlt++;
                $contUnico++;
            }
            $htmlInterativas .= '</table>';
            $htmlInterativas .= '</div>';
        } else {
            die($fe->getErro() . ' Alternativas');
        }
        $htmlInterativas .= '<div class="espacador"></div>';
    } else {
        if ($arrInfos[1] == 'perg') {
            $res = new Resolucao();
            $res->setCodcaso($_SESSION['casores']);
            $itens = $res->BuscaConteudosAgrupador($arrInfos[3]);
            if ($itens) {
                foreach ($itens as $p) {
                    // Chave, TipoConteudo, ChavePai, Organizador, ContReferencia, ValorOpt, Ordem
                    $perg = new Pergunta();
                    $perg->Carregar($p->ContReferencia);
                    if (!is_null($perg->getTextoExplicacaoGeral()) && $perg->getTextoExplicacaoGeral() != '') {
                        $boolExplicacao = true;
                    } else {
                        $boolExplicacao = false;
                    }
                    $htmlInterativas .= '<div>@lng[Etapa:] <strong>' . $perg->getTexto() . '</strong>' . ($boolExplicacao ? '<span style="float:right;"><a href="javascript:void(0);" onclick="javascript:fntMostraOculta(\'exp-' . $perg->getCodigo() . '\');"><img src="img/info.gif" alt="@lng[Mais informações]" title="@lng[Mais informações]" /></a></span>' : '') . '</div>';
                    if ($boolExplicacao) {
                        $htmlInterativas .= '<div class="explicacao-item" id="exp-' . $perg->getCodigo() . '" style="display:none;">' . $perg->getTextoExplicacaoGeral() . '</div>';
                    }
                    $respostas = $res->BuscaRespostas($arrInfos[3], $perg->getCodigo());
                    $alternativas = $fe->RetornaAlternativasDaPergunta($perg->getCodigo());
                    if ($alternativas) {
                        $htmlInterativas .= '<div class="det-etapa-int">';
                        $htmlInterativas .= '<table class="listadados">';
                        $htmlInterativas .= '<tr class="head">';
                        $htmlInterativas .= '<td class="td-col-alt">@lng[Alternativa]</td>';
                        $htmlInterativas .= '<td class="td-col-correto">@lng[Gabarito]</td>';
                        $htmlInterativas .= '<td class="td-col-escolha">@lng[Você marcou]</td>';
                        $htmlInterativas .= '<td class="td-col-jus">&nbsp;</td>';
                        $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                        $htmlInterativas .= '</tr>';
                        $contAlt = 1;
                        foreach ($alternativas as $alternativa) {
                            $htmlInterativas .= '<tr class="norm">';
                            $htmlInterativas .= '<td class="dado td-col-alt">' . $alternativa->Alternativa . '</td>';
                            $htmlInterativas .= '<td class="td-col-correto">' . ($alternativa->Correto == 1 ? Comuns::IMG_STATUS_CERTO : Comuns::IMG_STATUS_ERRADO) . '</td>';
                            $htmlInterativas .= '<td class="td-col-escolha">' . ((intval($respostas) & intval($alternativa->ValorOpt)) > 0 ? Comuns::IMG_ITEM_PINO : '') . '</td>';
                            $htmlInterativas .= '<td class="td-col-jus">' . (!is_null($alternativa->Explicacao) && strip_tags(trim(nl2br($alternativa->Explicacao))) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'j\', \'' . $contUnico . '\', \'' . $contAlt . '\');">@lng[Ver detalhes]</a>' : '') . '</td>';
                            $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                            $htmlInterativas .= '</tr>';
                            if (trim(strip_tags($alternativa->Explicacao)) != '') {
                                $htmlInterativas .= '<tr style="display:none;" id="jus-' . $contUnico . '-' . $contAlt . '">';
                                $htmlInterativas .= '<td colspan="5" class="apre-just"><div class="cont-just">' . $alternativa->Explicacao . '</div></td>';
                                $htmlInterativas .= '</tr>';
                            }
                            $contAlt++;
                            $contUnico++;
                        }
                        $htmlInterativas .= '</table>';
                        $htmlInterativas .= '</div>';
                    } else {
                        die($fe->getErro() . ' Alternativas pergunta');
                    }
                    $htmlInterativas .= '<div class="espacador"></div>';
                }
            } else {
                $htmlInterativas = "Erro linha 34";
            }
        } else {
            if ($arrInfos[1] == 'grupo-perg') {
                $res = new Resolucao();
                $res->setCodcaso($_SESSION['casores']);
                $agrupadores = $res->BuscaConteudosAgrupador($arrInfos[3]);
                if ($agrupadores) {
                    foreach ($agrupadores as $agrup) {
                        $grupo = new GrupoPergunta();
                        if ($grupo->Carrega($agrup->ContReferencia)) {
                            $perguntas = $grupo->getPerguntas();
                            if (!is_null($grupo->getExplicacao()) && trim(strip_tags($grupo->getExplicacao())) != '') {
                                $boolExplicacao = true;
                            } else {
                                $boolExplicacao = false;
                            }
                        } else {
                            die($grupo->getErro());
                        }
                        $htmlInterativas .= '<div class="item-interativo">@lng[Etapa:] <strong>' . $grupo->getTexto() . '</strong>' . ($boolExplicacao ? '<span style="float:right"><a href="javascript:void(0);" onclick="javascript:fntMostraOculta(\'exp-' . $grupo->getCodgrupo() . '\');"><img src="img/info.gif" alt="@lng[Mais informações]" title="@lng[Mais informações]" /></a></span>' : '') . '</div>';
                        if ($boolExplicacao) {
                            $htmlInterativas .= '<div class="explicacao-item" id="exp-' . $grupo->getCodgrupo() . '" style="display:none;">' . $grupo->getExplicacao() . '</div>';
                        }
                        foreach ($perguntas as $perg) {
                            $p = new Pergunta();
                            $p->Carregar($perg);
                            $respostas = $res->BuscaRespostas($arrInfos[3], $perg);
                            $alternativas = $fe->RetornaAlternativasDaPergunta($perg);
                            if ($alternativas) {
                                $htmlInterativas .= '<div class="sub-etapa">' . $p->getTexto() . '</div>';
                                $htmlInterativas .= '<div class="det-etapa-int">';
                                $htmlInterativas .= '<table class="listadados">';
                                $htmlInterativas .= '<tr class="head">';
                                $htmlInterativas .= '<td class="td-col-alt">@lng[Alternativa]</td>';
                                $htmlInterativas .= '<td class="td-col-correto">@lng[Gabarito]</td>';
                                $htmlInterativas .= '<td class="td-col-escolha">@lng[Você marcou]</td>';
                                $htmlInterativas .= '<td class="td-col-jus">&nbsp;</td>';
                                $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                                $htmlInterativas .= '</tr>';
                                $contAlt = 1;
                                foreach ($alternativas as $alternativa) {
                                    $htmlInterativas .= '<tr class="norm">';
                                    $htmlInterativas .= '<td class="dado td-col-alt">' . $alternativa->Alternativa . '</td>';
                                    $htmlInterativas .= '<td class="td-col-correto">' . ($alternativa->Correto == 1 ? Comuns::IMG_STATUS_CERTO : Comuns::IMG_STATUS_ERRADO) . '</td>';
                                    $htmlInterativas .= '<td class="td-col-escolha">' . ((intval($respostas) & intval($alternativa->ValorOpt)) > 0 ? Comuns::IMG_ITEM_PINO : '') . '</td>';
                                    $htmlInterativas .= '<td class="td-col-jus">' . (trim(strip_tags(nl2br($alternativa->Explicacao))) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'j\', \'' . $contUnico . '\', \'' . $contAlt . '\');">@lng[Ver detalhes]</a>' : '') . '</td>';
                                    $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                                    $htmlInterativas .= '</tr>';
                                    if (trim(strip_tags($alternativa->Explicacao)) != '') {
                                        if (!is_null($alternativa->Explicacao)) {
                                            $htmlInterativas .= '<tr style="display:none;" id="jus-' . $contUnico . '-' . $contAlt . '">';
                                            $htmlInterativas .= '<td colspan="5" class="apre-just"><div class="cont-just">' . $alternativa->Explicacao . '</div></td>';
                                            $htmlInterativas .= '</tr>';
                                        }
                                    }
                                    $contAlt++;
                                    $contUnico++;
                                }
                                $htmlInterativas .= '</table>';
                                $htmlInterativas .= '</div>';
                            } else {
                                die($fe->getErro() . ' alternativas grupo pergunta');
                            }
                            $htmlInterativas .= '<div class="espacador"></div>';
                        }
                    }
                } else {
                    $htmlInterativas = "Erro linha 122";
                }
            }
        }
    }
    echo Comuns::Idioma($htmlInterativas);
}
コード例 #2
0
ファイル: vwresumo.php プロジェクト: GoPlaceIn/siacc
function Main()
{
    if (isset($_SESSION['casores']) && $_SESSION['casores'] > 0) {
        $u = unserialize($_SESSION['usu']);
        $intCodCaso = $_SESSION['casores'];
        $intResolucao = Resolucao::BuscaUltimaResolucaoCaso($intCodCaso, $u->getCodigo(), 3);
        $_SESSION['codresolucao'] = $intResolucao;
        $tpl = file_get_contents("tpl/aluno/resumo.html");
        $fe = new Fechamento();
        $fe->setCodcaso($intCodCaso);
        $fe->setCodresolucao($intResolucao);
        $basicos = $fe->RetornaDadosBasicos();
        if ($basicos !== false) {
            $strNome = split(' ', $basicos->NomeCompleto);
            $tpl = str_replace('<!--titulocaso-->', $basicos->Caso, $tpl);
            $tpl = str_replace('<!--NomeUsuario-->', $strNome[0], $tpl);
            $tpl = str_replace('<!--DataInicial-->', date("d/m/Y H:i:s", strtotime($basicos->DataInicio)), $tpl);
            $tpl = str_replace('<!--DataFinal-->', date("d/m/Y H:i:s", strtotime($basicos->DataFim)), $tpl);
            $tpl = str_replace('<!--NumAcessos-->', $basicos->NumAcessos, $tpl);
            $tpl = str_replace('<!--ConteudosVistos-->', $basicos->ConteudosVistos, $tpl);
            $trajetoria = $fe->RetornaTrajetoria();
            if ($trajetoria) {
                $caminho = '<table><tr><td class="dado">@lng[Item]</td><td class="dado">@lng[Data/Hora]</td></tr>';
                foreach ($trajetoria as $etapa) {
                    $caminho .= '<tr>';
                    $caminho .= '<td><img src="img/' . $etapa->TipoConteudo . '_mini.png" />' . $etapa->Conteudo . '</td><td>' . date("d/m/Y H:i:s", strtotime($etapa->DataHora)) . '</td>';
                    $caminho .= '</tr>';
                }
                $caminho .= '</table>';
                $tpl = str_replace('<!--ListaTrajeto-->', $caminho, $tpl);
                $interativas = $fe->RetornaEtapasInterativas();
                if ($interativas) {
                    $intNumCertas = 0;
                    $intNumErradas = 0;
                    $intNumTotalAlt = 0;
                    $tpl = str_replace('<!--NumEtapasInterativas-->', count($interativas), $tpl);
                    $contInt = 1;
                    $contUnico = 1;
                    $res = new Resolucao();
                    foreach ($interativas as $item) {
                        //$res = new Resolucao();
                        //$respostas = $res->BuscaRespostas($item->ChaveItem);
                        if ($item->TipoConteudo != 'perg' && $item->TipoConteudo != 'grupo-perg') {
                            $htmlInterativas .= '<div class="item-interativo">@lng[Etapa:] <strong>' . $item->Conteudo . '</strong></div>';
                            $htmlInterativas .= '<div class="det-etapa-int">@lng[Número de tentivas de resposta:] <span class="dado">' . $item->Tentativas . '</span></div>';
                            $respostas = $res->BuscaRespostas($item->ChaveItem);
                            $alternativas = $fe->RetornaConteudosDoItemDaMontagem($item->ChaveItem, $item->TipoConteudo);
                            if ($alternativas) {
                                $htmlInterativas .= '<div class="det-etapa-int">';
                                $htmlInterativas .= '<table class="listadados">';
                                $htmlInterativas .= '<tr class="head">';
                                $htmlInterativas .= '<td class="td-col-alt">@lng[Alternativa]</td>';
                                $htmlInterativas .= '<td class="td-col-correto">@lng[Gabarito]</td>';
                                $htmlInterativas .= '<td class="td-col-escolha">@lng[Você marcou]</td>';
                                $htmlInterativas .= '<td class="td-col-jus">&nbsp;</td>';
                                $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                                $htmlInterativas .= '</tr>';
                                $contAlt = 1;
                                foreach ($alternativas as $alternativa) {
                                    $htmlInterativas .= '<tr class="norm">';
                                    $htmlInterativas .= '<td class="dado td-col-alt">' . $alternativa->Titulo . '</td>';
                                    $htmlInterativas .= '<td class="td-col-correto">' . ($alternativa->Correto == 1 ? Comuns::IMG_STATUS_CERTO : Comuns::IMG_STATUS_ERRADO) . '</td>';
                                    $htmlInterativas .= '<td class="td-col-escolha">' . ((intval($respostas) & intval($alternativa->ValorOpt)) > 0 ? Comuns::IMG_ITEM_PINO : '') . '</td>';
                                    $htmlInterativas .= '<td class="td-col-jus">' . (strip_tags($alternativa->Justificativa) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'j\', \'' . $contInt . '\', \'' . $contAlt . '\');">@lng[Ver detalhes]</a>' : '') . '</td>';
                                    $htmlInterativas .= '<td class="td-col-compl">' . (strip_tags($alternativa->ConteudoAdicional) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'c\', \'' . $contInt . '\', \'' . $contAlt . '\');">@lng[Ver complemento]</a>' : '') . '</td>';
                                    $htmlInterativas .= '</tr>';
                                    if (strip_tags($alternativa->Justificativa) != '') {
                                        $htmlInterativas .= '<tr style="display:none;" id="jus-' . $contInt . '-' . $contAlt . '">';
                                        $htmlInterativas .= '<td colspan="5" class="apre-just"><div class="cont-just">' . $alternativa->Justificativa . '</div></td>';
                                        $htmlInterativas .= '</tr>';
                                    }
                                    if (strip_tags($alternativa->ConteudoAdicional) != '') {
                                        $htmlInterativas .= '<tr style="display:none;" id="contadi-' . $contInt . '-' . $contAlt . '">';
                                        $htmlInterativas .= '<td colspan="5" class="apre-compl"><div class="cont-compl">' . $alternativa->ConteudoAdicional . '</div></td>';
                                        $htmlInterativas .= '</tr>';
                                    }
                                    // Contabilização das respostas certas ou erradas
                                    if ($alternativa->Correto == 1) {
                                        if ((intval($respostas) & intval($alternativa->ValorOpt)) > 0) {
                                            $intNumCertas++;
                                        } else {
                                            $intNumErradas++;
                                        }
                                    } else {
                                        if ((intval($respostas) & intval($alternativa->ValorOpt)) > 0) {
                                            $intNumErradas++;
                                        } else {
                                            $intNumCertas++;
                                        }
                                    }
                                    $contAlt++;
                                    $contUnico++;
                                }
                                $intNumTotalAlt += $contAlt;
                                $htmlInterativas .= '</table>';
                                $htmlInterativas .= '</div>';
                            } else {
                                die($fe->getErro() . ' Alternativas');
                            }
                            $htmlInterativas .= '<div class="espacador"></div>';
                        } else {
                            if ($item->TipoConteudo == 'perg') {
                                $perg = new Pergunta();
                                $perg->Carregar($item->CodPergunta);
                                if (!is_null($perg->getTextoExplicacaoGeral()) && $perg->getTextoExplicacaoGeral() != '') {
                                    $boolExplicacao = true;
                                } else {
                                    $boolExplicacao = false;
                                }
                                $htmlInterativas .= '<div class="item-interativo">@lng[Etapa:] <strong>' . $item->Conteudo . '</strong>' . ($boolExplicacao ? '<span style="float:right;"><a href="javascript:void(0);" onclick="javascript:fntMostraOculta(\'exp-' . $perg->getCodigo() . '\');"><img src="img/info.gif" alt="@lng[Mais informações]" title="@lng[Mais informações]" /></a></span>' : '') . '</div>';
                                if ($boolExplicacao) {
                                    $htmlInterativas .= '<div class="explicacao-item" id="exp-' . $perg->getCodigo() . '" style="display:none;">' . $perg->getTextoExplicacaoGeral() . '</div>';
                                }
                                $htmlInterativas .= '<div class="det-etapa-int">@lng[Número de tentivas de resposta:] <span class="dado">' . $item->Tentativas . '</span></div>';
                                $respostas = $res->BuscaRespostas($item->ChaveItem, $item->CodPergunta);
                                $alternativas = $fe->RetornaAlternativasDaPergunta($item->CodPergunta);
                                if ($alternativas) {
                                    $htmlInterativas .= '<div class="det-etapa-int">';
                                    $htmlInterativas .= '<table class="listadados">';
                                    $htmlInterativas .= '<tr class="head">';
                                    $htmlInterativas .= '<td class="td-col-alt">@lng[Alternativa]</td>';
                                    $htmlInterativas .= '<td class="td-col-correto">@lng[Gabarito]</td>';
                                    $htmlInterativas .= '<td class="td-col-escolha">@lng[Você marcou]</td>';
                                    $htmlInterativas .= '<td class="td-col-jus">&nbsp;</td>';
                                    $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                                    $htmlInterativas .= '</tr>';
                                    $contAlt = 1;
                                    foreach ($alternativas as $alternativa) {
                                        $htmlInterativas .= '<tr class="norm">';
                                        $htmlInterativas .= '<td class="dado td-col-alt">' . $alternativa->Alternativa . '</td>';
                                        $htmlInterativas .= '<td class="td-col-correto">' . ($alternativa->Correto == 1 ? Comuns::IMG_STATUS_CERTO : Comuns::IMG_STATUS_ERRADO) . '</td>';
                                        $htmlInterativas .= '<td class="td-col-escolha">' . ((intval($respostas) & intval($alternativa->ValorOpt)) > 0 ? Comuns::IMG_ITEM_PINO : '') . '</td>';
                                        $htmlInterativas .= '<td class="td-col-jus">' . (strip_tags($alternativa->Explicacao) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'j\', \'' . $contInt . '\', \'' . $contAlt . '\');">@lng[Ver detalhes]</a>' : '') . '</td>';
                                        $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                                        $htmlInterativas .= '</tr>';
                                        if (strip_tags($alternativa->Explicacao) != '') {
                                            $htmlInterativas .= '<tr style="display:none;" id="jus-' . $contInt . '-' . $contAlt . '">';
                                            $htmlInterativas .= '<td colspan="5" class="apre-just"><div class="cont-just">' . $alternativa->Explicacao . '</div></td>';
                                            $htmlInterativas .= '</tr>';
                                        }
                                        // Contabilização das respostas certas ou erradas
                                        if ($alternativa->Correto == 1) {
                                            if ((intval($respostas) & intval($alternativa->ValorOpt)) > 0) {
                                                $intNumCertas++;
                                            } else {
                                                $intNumErradas++;
                                            }
                                        } else {
                                            if ((intval($respostas) & intval($alternativa->ValorOpt)) > 0) {
                                                $intNumErradas++;
                                            } else {
                                                $intNumCertas++;
                                            }
                                        }
                                        $contAlt++;
                                        $contUnico++;
                                    }
                                    $intNumTotalAlt == $contAlt;
                                    $htmlInterativas .= '</table>';
                                    $htmlInterativas .= '</div>';
                                } else {
                                    die($fe->getErro() . ' Alternativas pergunta');
                                }
                                $htmlInterativas .= '<div class="espacador"></div>';
                            } else {
                                if ($item->TipoConteudo == 'grupo-perg') {
                                    $res->setCodcaso($intCodCaso);
                                    $agrupadores = $res->BuscaConteudosAgrupador($item->ChaveItem);
                                    if ($agrupadores) {
                                        foreach ($agrupadores as $agrup) {
                                            $grupo = new GrupoPergunta();
                                            if ($grupo->Carrega($agrup->ContReferencia)) {
                                                $perguntas = $grupo->getPerguntas();
                                                if (!is_null($grupo->getExplicacao()) && strip_tags($grupo->getExplicacao()) != '') {
                                                    $boolExplicacao = true;
                                                } else {
                                                    $boolExplicacao = false;
                                                }
                                            } else {
                                                die($grupo->getErro());
                                            }
                                            $htmlInterativas .= '<div class="item-interativo">Etapa: <strong>' . $grupo->getTexto() . '</strong>' . ($boolExplicacao ? '<span style="float:right"><a href="javascript:void(0);" onclick="javascript:fntMostraOculta(\'exp-' . $grupo->getCodgrupo() . '\');"><img src="img/info.gif" alt="@lng[Mais informações]" title="@lng[Mais informações]" /></a></span>' : '') . '</div>';
                                            if ($boolExplicacao) {
                                                $htmlInterativas .= '<div class="explicacao-item" id="exp-' . $grupo->getCodgrupo() . '" style="display:none;">' . $grupo->getExplicacao() . '</div>';
                                            }
                                            $htmlInterativas .= '<div class="det-etapa-int">@lng[Número de tentivas de resposta:] <span class="dado">' . $item->Tentativas . '</span></div>';
                                            foreach ($perguntas as $perg) {
                                                $p = new Pergunta();
                                                $p->Carregar($perg);
                                                $respostas = $res->BuscaRespostas($item->ChaveItem, $perg);
                                                $alternativas = $fe->RetornaAlternativasDaPergunta($perg);
                                                if ($alternativas) {
                                                    $htmlInterativas .= '<div class="sub-etapa">' . $p->getTexto() . '</div>';
                                                    $htmlInterativas .= '<div class="det-etapa-int">';
                                                    $htmlInterativas .= '<table class="listadados">';
                                                    $htmlInterativas .= '<tr class="head">';
                                                    $htmlInterativas .= '<td class="td-col-alt">@lng[Alternativa]</td>';
                                                    $htmlInterativas .= '<td class="td-col-correto">@lng[Gabarito]</td>';
                                                    $htmlInterativas .= '<td class="td-col-escolha">@lng[Você marcou]</td>';
                                                    $htmlInterativas .= '<td class="td-col-jus">&nbsp;</td>';
                                                    $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                                                    $htmlInterativas .= '</tr>';
                                                    $contAlt = 1;
                                                    foreach ($alternativas as $alternativa) {
                                                        $htmlInterativas .= '<tr class="norm">';
                                                        $htmlInterativas .= '<td class="dado td-col-alt">' . $alternativa->Alternativa . '</td>';
                                                        $htmlInterativas .= '<td class="td-col-correto">' . ($alternativa->Correto == 1 ? Comuns::IMG_STATUS_CERTO : Comuns::IMG_STATUS_ERRADO) . '</td>';
                                                        $htmlInterativas .= '<td class="td-col-escolha">' . ((intval($respostas) & intval($alternativa->ValorOpt)) > 0 ? Comuns::IMG_ITEM_PINO : '') . '</td>';
                                                        $htmlInterativas .= '<td class="td-col-jus">' . (strip_tags($alternativa->Explicacao) != '' ? '<a href="javascript:void(0);" onclick="javascript:fntDetItem(\'j\', \'' . $contUnico . '\', \'' . $contAlt . '\');">@lng[Ver detalhes]</a>' : '') . '</td>';
                                                        $htmlInterativas .= '<td class="td-col-compl">&nbsp;</td>';
                                                        $htmlInterativas .= '</tr>';
                                                        if (strip_tags($alternativa->Explicacao) != '') {
                                                            $htmlInterativas .= '<tr style="display:none;" id="jus-' . $contUnico . '-' . $contAlt . '">';
                                                            $htmlInterativas .= '<td colspan="5" class="apre-just"><div class="cont-just">' . $alternativa->Explicacao . '</div></td>';
                                                            $htmlInterativas .= '</tr>';
                                                        }
                                                        // Contabilização das respostas certas ou erradas
                                                        if ($alternativa->Correto == 1) {
                                                            if ((intval($respostas) & intval($alternativa->ValorOpt)) > 0) {
                                                                $intNumCertas++;
                                                            } else {
                                                                $intNumErradas++;
                                                            }
                                                        } else {
                                                            if ((intval($respostas) & intval($alternativa->ValorOpt)) > 0) {
                                                                $intNumErradas++;
                                                            } else {
                                                                $intNumCertas++;
                                                            }
                                                        }
                                                        $contAlt++;
                                                        $contUnico++;
                                                    }
                                                    $htmlInterativas .= '</table>';
                                                    $htmlInterativas .= '</div>';
                                                } else {
                                                    die($fe->getErro() . ' alternativas grupo pergunta');
                                                }
                                                $htmlInterativas .= '<div class="espacador"></div>';
                                            }
                                        }
                                    } else {
                                        die($res->getErro() . " agrupadores");
                                    }
                                }
                            }
                        }
                        $contInt++;
                    }
                    $dblNota = round($intNumCertas / $intNumTotalAlt * 10, 2);
                    $tpl = str_replace('<!--DescricaoInterativas-->', $htmlInterativas, $tpl);
                    $tpl = str_replace('<!--DescricaoNota-->', $dblNota, $tpl);
                } else {
                    die($fe->getErro() . ' Interativas');
                }
            } else {
                die($fe->getErro() . ' Trajetórias');
            }
        } else {
            die($fe->getErro() . ' Basicos');
        }
        echo $tpl;
    } else {
        $msg = base64_encode("@lng[Caso não informado]");
        header("Location:aluno.php?msg=" . $msg);
    }
}
コード例 #3
0
ファイル: resolucao.class.php プロジェクト: GoPlaceIn/siacc
 private function RenderPergunta($chaveagrupador, $codpergunta, $confs, $bolListagemSimples = false)
 {
     //Log::RegistraLog("Chamou o renderPergunta passando o pergunta " . $codpergunta);
     $pergunta = new Pergunta();
     if ($pergunta->Carregar($codpergunta)) {
         $respostas = $this->BuscaRespostas($chaveagrupador, $codpergunta);
         $html .= '<div class="pergunta">';
         $html .= '  <div id="pergunta-texto">';
         $html .= '    <img id="img_perg_' . $codpergunta . '" src="img/question.png" alt="@lng[Pergunta]" title="@lng[Pergunta]" class="img-pergunta atualizar-resp">' . $pergunta->getTexto();
         $html .= '  </div>';
         $alternativas = $pergunta->getAlternativas();
         $cont = 1;
         $letra = 65;
         $agrupar = true;
         foreach ($alternativas as $alt) {
             switch ($pergunta->getTipo()->getCodigo()) {
                 case 1:
                     $html .= '<div class="alt-img">';
                     $html .= '  <div class="alt-img-radio">';
                     $html .= '    ' . chr($letra) . ') <input type="' . ($bolListagemSimples ? 'checkbox' : 'radio') . '" name="rdoAlternativa_' . $pergunta->getCodigo() . '[]" id="rdoAlt_' . $pergunta->getCodigo() . '_' . $cont . '" value="' . $alt->getCodBinario() . '" ' . ((intval($alt->getCodBinario()) & intval($respostas)) > 0 ? 'checked="checked"' : '') . ' class="opcao-resposta" />';
                     $html .= '  </div>';
                     $html .= '  <div id="img"><img src="' . $alt->getImagem() . '" alt="' . $alt->getTexto() . '" title="' . $alt->getTexto() . '" /></div>';
                     $html .= '</div>';
                     break;
                 case 2:
                     $html .= '<div class="alt-txt">';
                     $html .= '  ' . chr($letra) . ') <input type="checkbox" name="rdoAlternativa_' . $pergunta->getCodigo() . '[]" id="rdoAlt_' . $pergunta->getCodigo() . '_' . $cont . '" value="' . $alt->getCodBinario() . '" ' . ((intval($alt->getCodBinario()) & intval($respostas)) > 0 ? 'checked="checked"' : '') . ' class="opcao-resposta" />' . $alt->getTexto();
                     $html .= '</div>';
                     break;
                 case 3:
                     $html .= '<div class="alt-txt">';
                     $html .= '  ' . chr($letra) . ') <input type="' . ($bolListagemSimples ? 'checkbox' : 'radio') . '" name="rdoAlternativa' . ($agrupar ? '_' . $pergunta->getCodigo() : '') . '[]" id="rdoAlt_' . $pergunta->getCodigo() . '_' . $cont . '" value="' . $alt->getCodBinario() . '" ' . ((intval($alt->getCodBinario()) & intval($respostas)) > 0 ? 'checked="checked"' : '') . ' class="opcao-resposta" />' . $alt->getTexto();
                     $html .= '</div>';
                     break;
             }
             $cont++;
             $letra++;
         }
         $html .= '</div>';
     } else {
         $html = "Erro: " . $pergunta->msg_erro;
     }
     return $html;
 }
コード例 #4
0
ファイル: vwpergunta.php プロジェクト: GoPlaceIn/siacc
function Main()
{
    $codigo = isset($_POST['txtCodigo']) ? base64_decode($_POST['txtCodigo']) : null;
    $txt = urldecode($_POST['txtDescricao']);
    $clsAtual = $_POST['selClasse'];
    $nivAtual = $_POST['selNivel'];
    $tipAtual = $_POST['selTipo'];
    $ativo = $_POST['selAtivo'];
    $act = isset($_POST['act']) ? base64_decode($_POST['act']) : null;
    $expGeral = $_POST['txtExplicacaoGeral'];
    $u = unserialize($_SESSION['usu']);
    // Ação veio vazio. Sendo assim monta o formulário.
    if (!$act) {
        // Busca o template
        $tpl = file_get_contents('tpl/perguntas-E1.html');
        $tpl = str_replace("<!--telatopo-->", Comuns::GeraTopoPagina($u), $tpl);
        $botoes = Botao::BotaoSalvar("fntGravaE1();", "@lng[Salvar pergunta e cadastrar/editar alternativas]");
        $botoes .= Botao::BotaoCancelar("fntNavega('listagem.php?t=8');", "@lng[Cancelar edição]");
        $tpl = str_replace("<!--itens-toolbar-->", $botoes, $tpl);
        $tpl = str_replace("<!--Mensagem-->", isset($mensagem) && $mensagem != "" ? base64_decode($mensagem) : "", $tpl);
        // Verifica se veio um registro informado via GET
        if (is_null($codigo)) {
            $codigo = isset($_GET['r']) ? base64_decode($_GET['r']) : null;
        }
        // Instancia classe
        $p = new Pergunta();
        // Se veio um código via GET, entende-se que o mesmo deva ser editado.
        if (!is_null($codigo)) {
            $p->Carregar($codigo);
        }
        $tipos = $p->tipos->ListaRecordSet();
        $classes = $p->classes->ListaRecordSet();
        $niveis = $p->niveis->ListaRecordSet();
        $strtipos = "";
        $strclasses = "";
        $strniveis = "";
        foreach ($tipos as $linhat) {
            $strtipos .= '<option ' . ($linhat->Codigo == ($p->getTipo() != null ? $p->getTipo()->getCodigo() : 0) ? 'selected="selected"' : '') . ' value="' . $linhat->Codigo . '">' . $linhat->Descricao . '</option>';
        }
        foreach ($classes as $linhac) {
            $strclasses .= '<option ' . ($linhac->Codigo == $p->getClasse() ? 'selected="selected"' : '') . ' value="' . $linhac->Codigo . '">' . $linhac->Descricao . '</option>';
        }
        foreach ($niveis as $linhan) {
            $strniveis .= '<option ' . ($linhan->Codigo == $p->getNivel() ? 'selected="selected"' : '') . ' value="' . $linhan->Codigo . '">' . $linhan->Descricao . '</option>';
        }
        $strAtivo = '<option ' . ($p->getAtivo() == 1 ? 'selected="selected"' : "") . ' value="1">@lng[Sim]</option><option ' . ($p->getAtivo() == 0 ? 'selected="selected"' : "") . ' value="0">@lng[Não]</option>';
        $tpl = str_replace("<!--txtCodigo-->", $p->getCodigo() == 0 ? "" : base64_encode($p->getCodigo()), $tpl);
        $tpl = str_replace("<!--TextoPergunta-->", $p->getTexto(), $tpl);
        $tpl = str_replace("<!--txtExplicacaoGeral-->", is_null($p->getTextoExplicacaoGeral()) ? "" : $p->getTextoExplicacaoGeral(), $tpl);
        $tpl = str_replace("<!--ListaClasses-->", $strclasses, $tpl);
        $tpl = str_replace("<!--ListaNiveis-->", $strniveis, $tpl);
        $tpl = str_replace("<!--ListaAtivo-->", $strAtivo, $tpl);
        $tpl = str_replace("<!--ListaTipos-->", $strtipos, $tpl);
    } else {
        if ($act == "ins") {
            $p = new Pergunta();
            if (!is_null($codigo)) {
                $p->setCodigo($codigo);
            }
            $p->setTexto($txt);
            $p->setClasse($clsAtual);
            $p->setNivel($nivAtual);
            $p->setTipo($tipAtual);
            $p->setAtivo($ativo);
            if ($expGeral != "") {
                $p->setTextoExplicacaoGeral($expGeral);
            }
            if ($p->getCodigo() === 0) {
                if ($p->AdicionaPergunta() === true) {
                    $_SESSION['perg'] = serialize($p);
                    header("Location:alternativas.php");
                } else {
                    $_SESSION['perg'] = "";
                    echo "@lng[Erro ao adicionar a pergunta:]";
                }
            } else {
                if ($p->AtualizaPergunta() === true) {
                    $_SESSION['perg'] = serialize($p);
                }
            }
        }
    }
    echo Comuns::Idioma($tpl);
}
コード例 #5
0
ファイル: vwalternativas.php プロジェクト: GoPlaceIn/siacc
function Main()
{
    $u = unserialize($_SESSION['usu']);
    if (isset($_SESSION['perg']) && !is_null($_SESSION['perg']) && $_SESSION['perg'] != "") {
        // Verifica se já tem uma sessão iniciada para uma pergunta. Se tiver...
        if (isset($_GET['p'])) {
            // Se tiver mas vier via GET algum código, limpa a sessão e recarrega os dados
            unset($_SESSION['perg']);
            $cod = base64_decode($_GET['p']);
            $p = new Pergunta();
            $p->Carregar($cod);
        } else {
            $p = new Pergunta();
            $p->Carregar($_SESSION['perg']);
        }
    } else {
        // Se não tiver sessão iniciada...
        if (isset($_GET['p'])) {
            // Deve vir obrigatoriamente um código informado via GET. Caso veio, instancia a pergunta
            $cod = base64_decode($_GET['p']);
            $p = new Pergunta();
            $p->Carregar($cod);
        } else {
            // Se não veio código é porque alguma coisa saiu errado ou o usuário não deveria estar acessando a página
            $msg = base64_encode("Algo saiu errado.");
            header("Location:listagem.php?t=8&m=" . $msg);
        }
    }
    $tpl = file_get_contents('tpl/alternativas.html');
    $tpl = str_replace("<!--telatopo-->", Comuns::GeraTopoPagina($u), $tpl);
    $botoes = Botao::BotaoSalvar("fntGravaAlternativa();", "@lng[Salvar a alternativa]");
    $botoes .= Botao::BotaoCancelar("fntNavega('listagem.php?t=8');", "@lng[Cancelar edição]");
    $botoes .= Botao::BotaoVoltar("fntNavega('vwpergunta.php?r=" . base64_encode($p->getCodigo()) . "');");
    $tpl = str_replace("<!--itens-toolbar-->", $botoes, $tpl);
    $tpl = str_replace("<!--Mensagem-->", isset($mensagem) && $mensagem != "" ? base64_decode($mensagem) : "", $tpl);
    $tipconsatual = 1;
    $valconsatual = -1;
    if (count($p->getAlternativas()) > 0) {
        $arquivotpl = 'tpl/alternativas-comp' . $p->getTipo()->getCodigo() . '.html';
        //$item_padrao = file_get_contents('tpl/alternativas-comp1.html');
        $item_padrao = file_get_contents($arquivotpl);
        $itens = '';
        foreach ($p->getAlternativas() as $alt) {
            $copia = $item_padrao;
            $copia = str_replace("<!--perg-->", base64_encode($p->getCodigo()), $copia);
            $copia = str_replace("<!--seq-->", base64_encode($alt->getSequencia()), $copia);
            $copia = str_replace("<!--correta-->", $alt->getCorreto() == 1 ? "SIM" : "NÃO", $copia);
            $copia = str_replace("<!--ordem-->", $alt->getSequencia(), $copia);
            $copia = str_replace("<!--ordem-ex-->", base64_encode($alt->getSequencia()), $copia);
            $copia = str_replace("<!--codunico-->", base64_encode($alt->getCodUnico()), $copia);
            $copia = str_replace("<!--excluir-->", "", $copia);
            if ($p->getTipo()->getCodigo() == 1) {
                $copia = str_replace("<!--img-preview-->", $alt->getImagem(), $copia);
            } else {
                $copia = str_replace("<!--textoalternativa-->", strlen($alt->getTexto()) > 100 ? substr($alt->getTexto(), 0, 97) . "..." : $alt->getTexto(), $copia);
            }
            $itens .= $copia;
            if (isset($_GET['s']) && $_GET['s'] != "") {
                // Se foi informado um segundo parâmetro, contendo a sequência da alternativa,
                // quer dizer que deve ser carregada a alternativa para edição.
                if (base64_decode($_GET['s']) == $alt->getCodUnico()) {
                    if ($p->getTipo()->getCodigo() == 1) {
                        $tpl = str_replace("<!--hidSeq-->", $alt->getSequencia(), $tpl);
                        //$tpl = str_replace("<!--nomeimg-->", $alt->getImagem(), $tpl);
                        $tpl = str_replace("<!--nomeimg-->", "", $tpl);
                        $tpl = str_replace("<!--txtTextoAdicional-->", $alt->getTexto(), $tpl);
                        $tpl = str_replace("<!--opcoescorreto-->", SimNao::SelectSimNao($alt->getCorreto()), $tpl);
                        $tpl = str_replace("<!--txtExplicacao-->", $alt->getExplicacao(), $tpl);
                        $tpl = str_replace("<!--hidocultar-->", "N", $tpl);
                    } else {
                        if ($p->getTipo()->getCodigo() == 2 || $p->getTipo()->getCodigo() == 3) {
                            $tpl = str_replace("<!--hidSeq-->", $alt->getSequencia(), $tpl);
                            $tpl = str_replace("<!--txtAlternativa-->", $alt->getTexto(), $tpl);
                            $tpl = str_replace("<!--selcorretotxt-->", SimNao::SelectSimNao($alt->getCorreto()), $tpl);
                            $tpl = str_replace("<!--txtJustTxt-->", $alt->getExplicacao(), $tpl);
                            $tpl = str_replace("<!--hidocultar-->", "N", $tpl);
                        }
                    }
                } else {
                    $tpl = str_replace("<!--hidocultar-->", "S", $tpl);
                }
            } else {
                $tpl = str_replace("<!--hidocultar-->", "S", $tpl);
            }
        }
        $itens .= '<div id="addAlt" class="box-alternativa box-zero-alternativa">';
        $itens .= '    <span style="line-height:43px;">@lng[Adiciona alternativa]</span>';
        $itens .= '</div>';
    } else {
        $itens = '<div id="addAlt" class="box-alternativa box-zero-alternativa">';
        $itens .= '    @lng[Nenhuma alternativa cadastrada]<br />';
        $itens .= '    @lng[Adiciona alternativa]';
        $itens .= '</div>';
    }
    // Se não foi informado nenhum registro, limpa o que ficou pra traz
    $tpl = str_replace("<!--hidSeq-->", "", $tpl);
    $tpl = str_replace("<!--nomeimg-->", "", $tpl);
    $tpl = str_replace("<!--txtTextoAdicional-->", "", $tpl);
    $tpl = str_replace("<!--txtExplicacao-->", "", $tpl);
    $tpl = str_replace("<!--opcoescorreto-->", SimNao::SelectSimNao(), $tpl);
    $tpl = str_replace("<!--txtAlternativa-->", "", $tpl);
    $tpl = str_replace("<!--selcorretotxt-->", SimNao::SelectSimNao(), $tpl);
    $tips = '<option value="0">@lng[Todos]</option>';
    foreach ($p->tipos->ListaRecordSet() as $tipo) {
        $tips .= '<option value="' . $tipo->Codigo . '">' . $tipo->Descricao . '</option>';
    }
    $cls = '<option value="0">@lng[Todos]</option>';
    foreach ($p->classes->ListaRecordSet() as $classe) {
        $cls .= '<option value="' . $classe->Codigo . '">' . $classe->Descricao . '</option>';
    }
    $tpl = str_replace('<!--descricao-->', $p->getTexto(), $tpl);
    $tpl = str_replace('<!--alternativas-->', $itens, $tpl);
    $tpl = str_replace('<!--tipo-->', $p->getTipo()->getDescricao(), $tpl);
    $tpl = str_replace('<!--hidtipo-->', $p->getTipo()->getCodigo(), $tpl);
    $tpl = str_replace("<!--classespergunta-->", $cls, $tpl);
    $tpl = str_replace("<!--tipospergunta-->", $tips, $tpl);
    $_SESSION['perg'] = $p->getCodigo();
    echo Comuns::Idioma($tpl);
}
コード例 #6
0
ファイル: caso.class.php プロジェクト: GoPlaceIn/siacc
 private function MontaConteudoPerguntas($codpergunta, $dica = true, $agrupar = false)
 {
     $perg = new Pergunta();
     $perg->Carregar($codpergunta);
     $conteudo .= '<div class="pergunta">';
     $conteudo .= '  <div id="pergunta-texto">';
     $conteudo .= '    <img id="img_perg_' . $codpergunta . '" src="img/question.png" alt="@lng[Pergunta]" title="@lng[Pergunta]" class="img-pergunta atualizar-resp">' . $perg->getTexto();
     $conteudo .= '  </div>';
     if ($dica) {
         switch ($perg->getTipo()->getCodigo()) {
             case 1:
             case 3:
                 $conteudo .= '<div id="pergunta-instr">@lng[Escolha uma das alternativas]</div>';
                 break;
             case 2:
                 $conteudo .= '<div id="pergunta-instr">@lng[Você pode escolher mais de uma alternativa se achar necessário]</div>';
                 break;
         }
     }
     $alternativas = $perg->getAlternativas();
     $cont = 1;
     $letra = 65;
     foreach ($alternativas as $alt) {
         switch ($perg->getTipo()->getCodigo()) {
             case 1:
                 $conteudo .= '<div class="alt-img">';
                 $conteudo .= '  <div class="alt-img-radio">';
                 $conteudo .= '    ' . chr($letra) . ') <input type="radio" name="rdoAlternativa' . ($agrupar ? '_' . $perg->getCodigo() : '') . '[]" id="rdoAlt_' . $cont . '" value="' . $alt->getCodUnico() . '" class="opcao-resposta" />';
                 $conteudo .= '  </div>';
                 $conteudo .= '  <div id="img"><img src="' . $alt->getImagem() . '" alt="' . $alt->getTexto() . '" title="' . $alt->getTexto() . '" /></div>';
                 $conteudo .= '</div>';
                 break;
             case 2:
                 $conteudo .= '<div class="alt-txt">';
                 $conteudo .= '  ' . chr($letra) . ') <input type="checkbox" name="rdoAlternativa' . ($agrupar ? '_' . $perg->getCodigo() : '') . '[]" id="rdoAlt_' . $cont . '" value="' . $alt->getCodUnico() . '" class="opcao-resposta" />' . $alt->getTexto();
                 $conteudo .= '</div>';
                 break;
             case 3:
                 $conteudo .= '<div class="alt-txt">';
                 $conteudo .= '  ' . chr($letra) . ') <input type="radio" name="rdoAlternativa' . ($agrupar ? '_' . $perg->getCodigo() : '') . '[]" id="rdoAlt_' . $cont . '" value="' . $alt->getCodUnico() . '" class="opcao-resposta" />' . $alt->getTexto();
                 $conteudo .= '</div>';
                 break;
         }
         $cont++;
         $letra++;
     }
     $conteudo .= '</div>';
     return $conteudo;
 }