Пример #1
0
include "src/classes/Users.class.php";
include "src/classes/Contratos.class.php";
//$tpl->TESTE = $emp->getServicos()[2]->children();
redirectByPermission(3);
// SETAR PERMISSÃO DA PÁGINA
$tpl = new Template('html_libs/template.html');
$tpl->addFile('SECONDMENU', 'html_libs/ger_secondMenu.html');
if (!isset($_GET['form'])) {
    $tpl->addFile('CONTEUDO', 'html_libs/ger_addContrato.html');
    $sql = "SELECT id FROM daee_contratos WHERE ativo = 1";
    $query = mysql_query($sql);
    while ($res = mysql_fetch_array($query)) {
        $tpl->CONTID = $res['id'];
        $cont = new Contrato($res['id']);
        $autos = $cont->isAutos() ? "Autos " : "Processo ";
        $num = $cont->isAutos() ? number_format($cont->get('numero'), 0, ',', '.') : $cont->get('numero');
        $nome = $cont->get('nome');
        $servico = $cont->get('empresa')->getServicos()[$cont->get('servico')]->children();
        //$tpl->CONTNOME	= $autos." n°".$num." - ".$nome."::".$servico;
        $tpl->CONTNOME = $cont->geraNome();
        $tpl->CONTCONT = $cont->get('contrato');
        $tpl->CONTEMP = $cont->get('empresa')->getNome();
        $tpl->CONTLICIT = $cont->get('comlicit') == 1 ? "Sim" : "Não";
        $de = $cont->get('data');
        $ate = $cont->get('vigencia');
        $tpl->CONTVIG = $de == "0000-00-00" ? "--" : $de . " a " . $ate;
        $tpl->CONTEM = ExplodeDateTime($cont->get('criado'));
        $tpl->CONTUDD = $cont->get('unidade')->getSigla();
        $tpl->block('EACH_CONTRATO');
    }
} else {