Exemplo n.º 1
0
function Main()
{
    header('Content-Type: text/html; charset=utf-8');
    if (!isset($_COOKIE['siacc_lang'])) {
        $_COOKIE['siacc_lang'] = '1';
    }
    $mensagem = $_GET["m"];
    $tpl = file_get_contents("tpl/index.html");
    $rs = null;
    if (!Comuns::ArrayObj("select Codigo, Nome from sisidiomas /*where publicado = 1*/", $rs)) {
        echo $rs;
    }
    $cmb = new ComboBox("selIdioma", $rs, "Codigo", "Nome");
    $tpl = str_replace("<!--selIdioma-->", $cmb->RenderHTML($_COOKIE['siacc_lang']), $tpl);
    if (isset($mensagem) && $mensagem != "") {
        $msg = '<div id="errologin">' . base64_decode($mensagem) . '</div>';
        $tpl = str_replace("<!--Mensagem-->", $msg, $tpl);
    } else {
        $tpl = str_replace("<!--Mensagem-->", "", $tpl);
    }
    if (strpos(strtolower($_SERVER['HTTP_HOST']), "localhost") === false) {
        $tpl = str_replace("<!--analytics-->", Comuns::GOOGLE_ANALYTICS, $tpl);
    } else {
        $tpl = str_replace("<!--analytics-->", "", $tpl);
    }
    echo Comuns::Idioma($tpl, "login");
}
Exemplo n.º 2
0
function Main()
{
    $html = "";
    if ($_GET['id']) {
        $idioma = $_GET['id'];
        $sql = "select e.Codigo, e.Expressao, t.Expressao as Traducao ";
        $sql .= "from sisexpressoes e left outer join sistraducoes t on t.CodExpressao = e.Codigo and t.CodIdioma = :pCodIdioma ";
        $sql .= "order by e.Expressao";
        $cnn = Conexao2::getInstance();
        $cmd = $cnn->prepare($sql);
        $cmd->bindParam(":pCodIdioma", $idioma, PDO::PARAM_INT);
        $cmd->execute();
        $total = 0;
        $feito = 0;
        if ($cmd->errorCode() == Comuns::QUERY_OK) {
            $html = '<table class="listadados">';
            $html .= '<tr class="head"><th>@lng[Expressão]</th><th>@lng[Tradução]</th></tr>';
            while ($expressao = $cmd->fetch(PDO::FETCH_OBJ)) {
                $html .= '<tr>';
                $html .= '  <td><label>' . $expressao->Expressao . '</label></td>';
                $html .= '  <td>';
                $html .= '    <input type="text" name="exp_' . $expressao->Codigo . '" id="exp_' . $expressao->Codigo . '" value="' . ($expressao->Traducao == null ? '' : $expressao->Traducao) . '" class="campo campomedio" onblur="javascript:fntGravaTraducao(' . $expressao->Codigo . ');" /></td>';
                $html .= '    <input type="hidden" name="h_exp_' . $expressao->Codigo . '" id="h_exp_' . $expressao->Codigo . '" value="' . ($expressao->Traducao == null ? '' : $expressao->Traducao) . '" />';
                $html .= '  </td>';
                $html .= '</tr>';
                $total++;
                $feito += $expressao->Traducao == null ? 0 : 1;
            }
            $html .= '</table>';
            $html = '<div class="info-percentual">@lng[Percentual traduzido:] ' . $feito / $total * 100 . '%</div>' . $html;
        } else {
            $msg = $cmd->errorInfo();
            $html = $msg[2];
        }
    }
    $usu = unserialize($_SESSION['usu']);
    $tpl = file_get_contents("tpl/frm-idiomas.html");
    $idiomas = null;
    Comuns::ArrayObj("select Codigo, Nome from sisidiomas order by Nome", $idiomas);
    $cmbIdiomas = new ComboBox("selIdioma", $idiomas, "Codigo", "Nome", "0", "@lng[Selecione]");
    $cmbIdiomas->cssClass("campo");
    $cmbIdiomas->setSelectedValue($_GET['id'] ? $_GET['id'] : "0");
    $cmbIdiomas->Eventos(array("onchange" => "fntBuscaTraducoes()"));
    $botoes = Botao::BotaoNovo("fntAddExpressao();", "@lng[Adicionar expressão]");
    $botoes .= Botao::BotaoPesquisar("fntBuscaTraducoes();", "@lng[Buscar traduções]");
    $tpl = str_replace("<!--telatopo-->", Comuns::GeraTopoPagina($usu), $tpl);
    $tpl = str_replace("<!--itens-toolbar-->", $botoes, $tpl);
    $tpl = str_replace("<!--selIdioma-->", $cmbIdiomas->RenderHTML(), $tpl);
    $tpl = str_replace("<!--expressoes-->", $html, $tpl);
    header('Content-Type: text/html; charset=iso-8859-1');
    echo Comuns::Idioma($tpl);
}
Exemplo n.º 3
0
function fntTelaNovoUsuario()
{
    $tpl = file_get_contents("tpl/frm-add-usuario.html");
    $sql = "SELECT Codigo, CONCAT(NomeCompleto, CASE WHEN Sigla IS NOT NULL THEN concat(' (', Sigla, ')') ELSE '' END) AS Nome ";
    $sql .= "FROM mesinstituicao ORDER BY NomeCompleto;";
    $sqlIdi = "select Codigo, Nome from sisidiomas where publicado = 1";
    $dsIns = null;
    $dsIdi = null;
    if (!Comuns::ArrayObj($sql, $dsIns)) {
        echo $dsIns;
    }
    if (!Comuns::ArrayObj($sqlIdi, $dsIdi)) {
        echo $dsIdi;
    }
    $comboIns = new ComboBox("selInstituicao", $dsIns, "Codigo", "Nome", "0", "@lng[Selecione]");
    $comboIns->cssClass("campo req");
    $htmlCombo = $comboIns->RenderHTML();
    $comboIdi = new ComboBox("selIdioma", $dsIdi, "Codigo", "Nome");
    $comboIdi->cssClass("campo req");
    $htmlComboIdi = $comboIdi->RenderHTML(1);
    $tpl = str_replace("<!--selInstituicao-->", $htmlCombo, $tpl);
    $tpl = str_replace("<!--selIdioma-->", $htmlComboIdi, $tpl);
    echo Comuns::Idioma($tpl);
}
Exemplo n.º 4
0
function Main()
{
    $codTPL = $_GET["t"];
    $codPagina = $_GET["p"];
    $codMax = $_GET["m"];
    $mensagem = $_GET['msg'];
    if (!is_numeric($codTPL)) {
        $msg = "@lng[A URL acesada é inválida]";
        header("Location:index.php?msg=" . base64_encode($msg));
    }
    if (!is_numeric($codPagina)) {
        $codPagina = 1;
    }
    $u = unserialize($_SESSION['usu']);
    $cnn = new Conexao();
    $sql = "SELECT Arquivo FROM mestemplates WHERE Codigo = 2;";
    $rs = $cnn->Consulta($sql);
    $tpl = file_get_contents(mysql_result($rs, 0, "Arquivo"));
    $tpl = str_replace("<!--telatopo-->", Comuns::GeraTopoPagina($u), $tpl);
    $tpl = str_replace("<!--Mensagem-->", isset($mensagem) && $mensagem != "" ? base64_decode($mensagem) : "", $tpl);
    $sql = "SELECT Classe, jsLoad, linkNovoRegistro, QtdPadListagem FROM mestemplates WHERE Codigo = " . $codTPL . ";";
    $rs = $cnn->Consulta($sql);
    if ($rs != 0) {
        // Classe que será instanciada
        $classe = mysql_result($rs, 0, 0);
        $frm = new $classe();
        if (!is_numeric($codMax)) {
            $codMax = mysql_result($rs, 0, 3);
            // Quantidade padrão para listagem: 15 (exceto listam de Caso que é 10)
        }
        Log::RegistraLog("Acessou a tela de " . $frm->RetornaDescricaoTela('lista'));
        $where = fntConstroiWhere($codTPL, $_GET);
        $lista = $frm->ListaTabela($codPagina, $codMax, $_SESSION['usu'], $where);
        $tpl = str_replace("##Lista##", $lista, $tpl);
        $tpl = str_replace("##CodTpl##", $codTPL, $tpl);
        if (is_null(mysql_result($rs, 0, 2)) || trim(mysql_result($rs, 0, 2)) == "") {
            $tpl = str_replace("##linkNovo##", "cadastro.php?t=" . $codTPL, $tpl);
        } else {
            $tpl = str_replace("##linkNovo##", mysql_result($rs, 0, 2), $tpl);
        }
        $tpl = str_replace("##FuncoesJS##", mysql_result($rs, 0, 1), $tpl);
        $cnnFiltros = Conexao2::getInstance();
        $sqlFiltro = "select TipoFiltro, NomeCampoTela, DscCampoTela, ComandoFill, CampoSelValue, CampoSelText, CSSClassCampoTela ";
        $sqlFiltro .= "from mestemplatesfiltros where CodTemplate = " . $codTPL . ";";
        $cmd = $cnnFiltros->prepare($sqlFiltro);
        $cmd->execute();
        $tplFiltro = "";
        if ($cmd->errorCode() == Comuns::QUERY_OK) {
            if ($cmd->rowCount() > 0) {
                while ($linha = $cmd->fetch(PDO::FETCH_OBJ)) {
                    $tplFiltro .= '<label id="lbl' . $linha->NomeCampoTela . '" for="' . $linha->NomeCampoTela . '">';
                    $tplFiltro .= '    @lng[' . $linha->DscCampoTela . ']<br />';
                    switch ($linha->TipoFiltro) {
                        case "TEXTO":
                            $tplFiltro .= '    <input type="text" name="' . $linha->NomeCampoTela . '" id="' . $linha->NomeCampoTela . '" class="' . $linha->CSSClassCampoTela . '" value="' . ($_GET[$linha->NomeCampoTela] ? $_GET[$linha->NomeCampoTela] : "") . '" />';
                            break;
                        case "COMBO":
                            $arr = null;
                            Comuns::ArrayObj($linha->ComandoFill, $arr);
                            $combo = new ComboBox($linha->NomeCampoTela, $arr, $linha->CampoSelValue, $linha->CampoSelText);
                            $combo->cssClass($linha->CSSClassCampoTela);
                            $combo->setDefaultValue("");
                            $combo->setDefaultText("@lng[Todos]");
                            $tplFiltro .= $combo->RenderHTML();
                            break;
                        default:
                            $tplFiltro .= '    <input type="text" name="' . $linha->NomeCampoTela . '" id="' . $linha->NomeCampoTela . '" class="' . $linha->CSSClassCampoTela . '" value="' . ($_GET[$linha->NomeCampoTela] ? $_GET[$linha->NomeCampoTela] : "") . '" />';
                    }
                    $tplFiltro .= '</label><br /><br />';
                }
                $tpl = str_replace("##Filtros##", $tplFiltro, $tpl);
            } else {
                $tpl = str_replace("##Filtros##", "@lng[Esta tela não possui filtros para serem aplicados]", $tpl);
            }
        } else {
            $msg = $cmd->errorInfo();
            echo $msg[2];
        }
    }
    //header('Content-Type: text/html; charset=iso-8859-1');
    echo Comuns::Idioma($tpl);
}
Exemplo n.º 5
0
 public function FormNovo()
 {
     $tpl = Comuns::BuscaForm($this->form);
     if ($tpl) {
         /* Instituições */
         $sql = "SELECT Codigo, CONCAT(NomeCompleto, CASE WHEN Sigla IS NOT NULL THEN concat(' (', Sigla, ')') ELSE '' END) AS Nome ";
         $sql .= "FROM mesinstituicao ORDER BY NomeCompleto;";
         $rs = null;
         if (!Comuns::ArrayObj($sql, $rs)) {
             echo $rs;
         }
         $cmbIns = new ComboBox("selInstituicao", $rs, "Codigo", "Nome", "0", "@lng[Selecione]");
         $cmbIns->cssClass("campo requerido");
         /* Idiomas */
         $sql = "select Codigo, Nome from sisidiomas where publicado = 1;";
         $rs = null;
         if (!Comuns::ArrayObj($sql, $rs)) {
             echo $rs;
         }
         $cmbIdioma = new ComboBox("selIdioma", $rs, "Codigo", "Nome");
         $cmbIdioma->setSelectedValue(1);
         $cmbIdioma->cssClass("campo requerido");
         /*
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->execute();
         
         if ($cmd->errorCode() != Comuns::QUERY_OK)
         {
         	$msg = $cmd->errorInfo();
         	echo($msg[2]);
         }
         
         $rs = $cmd->fetchAll(PDO::FETCH_OBJ);
         */
         $tpl = str_replace("##txtCodigo##", "", $tpl);
         $tpl = str_replace("##txtNome##", "", $tpl);
         $tpl = str_replace("##txtUsuario##", "", $tpl);
         $tpl = str_replace("##txtEmail##", "", $tpl);
         $tpl = str_replace("##selInstituicao##", $cmbIns->RenderHTML(), $tpl);
         $tpl = str_replace("##selIdioma##", $cmbIdioma->RenderHTML(), $tpl);
         $tpl = str_replace("##txtSenha##", "", $tpl);
         $tpl = str_replace("##selAtivo-##", "", $tpl);
         $tpl = str_replace("##selAtivo1##", "", $tpl);
         $tpl = str_replace("##selAtivo2##", "", $tpl);
     } else {
         $tpl = "@lng[Erro ao criar a tela de cadastro de usuário].";
     }
     return $tpl;
 }