示例#1
0
function docs_url($tree, $branch = false)
{
    // Get next branch
    if (!$branch) {
        $branch = current($tree);
    }
    if ($branch['type'] === 'file') {
        return $branch['url'];
    } else {
        if (!empty($branch['tree'])) {
            return docs_url($branch['tree']);
        } else {
            // Try next folder...
            $branch = next($tree);
            if ($branch) {
                return docs_url($tree, $branch);
            } else {
                echo '<strong>Daux.io Config Error:</strong><br>Unable to find the first page in the /docs folder. Double check you have at least one file in the root of of the /docs folder. Also make sure you do not have any empty folders. Visit the docs to <a href="http://daux.io">learn more</a> about how the default routing works.';
                exit;
            }
        }
    }
}
示例#2
0
文件: index.php 项目: dongcheng/daux
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including
negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.
*/
require_once 'libs/functions.php';
$options = get_options();
$tree = get_tree($options['docs_path'], $base_url);
// If a language is set in the config, rewrite urls based on the language
if (!isset($language) || $language === null) {
    $homepage_url = homepage_url($tree);
    $docs_url = docs_url($tree);
} else {
    $homepage_url = "/";
}
$docs_url = docs_url($tree);
$url_params = url_params();
if (count($options['languages']) > 0 && count($url_params) > 0 && strlen($url_params[0]) > 0) {
    $language = array_shift($url_params);
    $base_path = "docs/" . $language;
} else {
    $language = null;
    $base_path = "docs";
}
$tree = get_tree($base_path, $base_url, '', true, $language);
$page = load_page($tree, $url_params);
// If a timezone has been set in the config file, override the default PHP timezone for this application.
if (isset($options['timezone'])) {
    date_default_timezone_set($options['timezone']);
}
// Redirect to docs, if there is no homepage
示例#3
0
 function makePdf($data)
 {
     setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
     date_default_timezone_set('America/Sao_Paulo');
     $files = array();
     $this->pdf = new PDF_mc_table();
     $this->pdf->AddPage();
     $this->pdf->AliasNbPages();
     $isPromo = substr($data['professor']['nivel']['nome_nivel'], -1) > substr($data['progressao']['nome_nivel_seguinte'], -1) ? '[ X ] Promoção [ ] Progressão' : '[  ] Promoção [ X ] Progressão';
     $isPromo2 = substr($data['professor']['nivel']['nome_nivel'], -1) > substr($data['progressao']['nome_nivel_seguinte'], -1) ? 'Promoção' : 'Progressão';
     $this->pdf->SetFill(false);
     //Primeira pagina
     //HEADER
     $this->pdf->SetHeader();
     //TITLE
     $this->pdf->SetTitleDoc(specialChars('ANEXO IV DA RESOLUÇÃO Nº 175-CONSAD, de 09 de novembro de 2015.'));
     $this->pdf->SetTitleDoc(specialChars('REQUERIMENTO'));
     $this->pdf->SetFont('Arial', '', 11);
     $this->pdf->Ln(28);
     $this->pdf->SetWidths(array(180));
     $this->pdf->BorderlessRow(array(specialChars("Ilustríssimo/a Senhor/a\nChefia imediata\n\n\n\n" . $data['professor']['nome'] . ", matrícula SIAPE nº " . $data['professor']['siape'] . ", requeiro a Vossa Senhoria, concessão de " . $isPromo2 . ", conforme Resolução 175-CONSAD, de 09 de novembro de 2015   que regulamenta os procedimentos do processo de avaliação de desempenho acadêmico da Carreira de Magistério Superior na Universidade Federal do Maranhão (UFMA), anexando ao presente Requerimento:")));
     $this->pdf->SetWidths(array(10, 20, 150));
     $this->pdf->BorderlessRow(array("", "I.", specialChars("Declaração do tempo de serviço expedida pelo SIstema Integrado de Gestão de Recursos Humanos (SIGRH);")));
     $this->pdf->BorderlessRow(array("", "II.", specialChars("Declaração de última progressão funcional expedida pelo SIGRH, quando houver;")));
     $this->pdf->BorderlessRow(array("", "III.", specialChars("Relatório Individual de Trabalho Docente no interstício, com a documentação comprobatória anexada;")));
     $this->pdf->BorderlessRow(array("", "IV.", specialChars("Relatório de Avaliação De Desempenho Didático gerado pelo SIGAA;")));
     $this->pdf->BorderlessRow(array("", "V.", specialChars("Memorial, quando for o caso;")));
     $this->pdf->BorderlessRow(array("", "VI.", specialChars("Tese Acadêmica, quando for o caso;")));
     $this->pdf->Ln();
     $this->pdf->Cell(0, 7, specialChars("Termos em que,"), 0, 0, 'R');
     $this->pdf->Ln();
     $this->pdf->Cell(0, 7, specialChars("Solicito Deferimento,"), 0, 0, 'R');
     $this->pdf->Ln(14);
     $this->pdf->Cell(0, 7, specialChars("São Luís, " . strftime('%d de %B de %Y', strtotime(date('m/d/y')))), 0, 0, 'R');
     $this->pdf->Ln(28);
     $this->pdf->Cell(0, 7, specialChars('_____________________________________'), 0, 0, 'C');
     $this->pdf->Ln();
     $this->pdf->Cell(0, 7, specialChars('Assinatura do Docente'), 0, 0, 'C');
     $this->pdf->Ln();
     $this->pdf->AddPage('L');
     $this->pdf->SetTitle("Relatorio Progressao");
     $this->pdf->SetLeftMargin(15);
     $this->pdf->SetRightMargin(15);
     $this->pdf->SetFillColor(200, 200, 200);
     //HEADER
     $this->pdf->SetHeader();
     $this->pdf->SetTitleDoc(specialChars('ANEXO V DA RESOLUÇÃO Nº 175-CONSAD, de 09 de novembro de 2015.'));
     $this->pdf->SetTitleDoc(specialChars('RELATÓRIO INDIVIDUAL DE TRABALHO DOCENTE'));
     $this->pdf->SetWidths(array(267));
     $this->pdf->SetAligns(array('C'));
     $this->pdf->BorderlessRow(array(specialChars('Para pontuação autodeclarada do docente (com menção da página do processo composto pelos documentos comprobatórios, com coluna de validação pela CAD ou CIT')));
     $this->pdf->Ln(7);
     $this->pdf->SetFont('Arial', '', 11);
     //demais campos
     $initFormArray = array(array('campo' => 'Processo Nº', 'valor' => ''), array('campo' => 'Nome do docente', 'valor' => $data['professor']['nome']), array('campo' => 'Subunidade Academica', 'valor' => $data['professor']['nome_depto']), array('campo' => 'Unidade Academica', 'valor' => $data['professor']['nome_unid_academica']), array('campo' => 'Matrícula SIAPE', 'valor' => $data['professor']['siape']), array('campo' => 'Classe e Nível atual', 'valor' => $data['professor']['nivel']['nome_nivel']), array('campo' => 'Classe e Nível requerido', 'valor' => $data['progressao']['nome_nivel_seguinte']), array('campo' => 'Objetivo do processo', 'valor' => $isPromo));
     foreach ($initFormArray as $linha) {
         $this->pdf->SetFont('Arial', '', 11);
         $this->pdf->Cell(60, 7, specialChars($linha['campo']), 1, 0, 'L');
         $this->pdf->SetFont('Arial', 'B', 11);
         $this->pdf->Cell(0, 7, specialChars($linha['valor']), 1, 0, 'L');
         $this->pdf->Ln();
     }
     //Hora de preencher!
     $totalPoints = 0;
     $numAnexos = 0;
     $possuiPendente = false;
     $itensPendentes = array();
     foreach ($data['estruturaProducoes'] as $eixo) {
         if (!is_array($eixo['subeixos'])) {
             continue;
         }
         $this->pdf->SetFont('Arial', 'B', 11);
         $nomeEixo = str_replace('.', ')', $eixo['nome_eixo']);
         $this->pdf->SetWidths(array(267));
         $this->pdf->SetAligns(array('L'));
         $this->pdf->BorderlessRow(array(specialChars($nomeEixo)));
         $this->pdf->Ln(7);
         foreach ($eixo['subeixos'] as $subeixo) {
             //SUBEIXO
             $this->pdf->SetWidths(array(147, 40, 40, 40));
             $this->pdf->SetFont('Arial', 'B', 11);
             $this->pdf->SetAligns(array('C', 'C', 'C', 'C'));
             $this->pdf->SetFill(true);
             $this->pdf->Row(array(specialChars($subeixo['nome_subeixo']), specialChars("Pontuação Autodeclarada"), specialChars("Documentação Anexada"), specialChars("Contagem da Comissão (CAD ou CIT)")));
             $this->pdf->SetFill(false);
             $this->pdf->SetFont('Arial', '', 11);
             $this->pdf->SetAligns(array('L', 'C', 'C', 'C'));
             $totalSubeixoPoints = 0;
             if (!is_array($subeixo['itens'])) {
                 continue;
             }
             foreach ($subeixo['itens'] as $item) {
                 $explodeNome = explode(' ', $item['nome_item'], 2);
                 $categoria = $explodeNome[0];
                 $descricao = $explodeNome[1];
                 if ($item['regra']['fk_tipoclass'] == 1) {
                     $pontos = $item['regra']['formula_regra'];
                     $pontos = str_replace('=', '', $pontos);
                     $pontos = str_replace('(', '', $pontos);
                     $pontos = str_replace(')', '', $pontos);
                     $pontos = str_replace('valor_informado', '', $pontos);
                     $pontos = str_replace('qualis_informado', '', $pontos);
                     $pontos = str_replace('classif_informado', '', $pontos);
                     if (isset($pontos[0]) && $pontos[0] == '*') {
                         $explodedPontos = explode('*', $pontos, 2);
                         $pontos = $explodedPontos[1];
                     } else {
                         if (isset($pontos[0]) && $pontos[0] == '/') {
                             $explodedPontos = explode('/', $pontos, 2);
                             $pontos = $explodedPontos[1];
                         }
                     }
                     $pontuacao = 0;
                     $quantidade = 0;
                     if ($item['producoes']['itemPoints'] > 0) {
                         $arquivos = '';
                         $pontuacao = $item['producoes']['itemPoints'];
                         $totalSubeixoPoints += $pontuacao;
                         foreach ($item['producoes'] as $prod) {
                             $quantidade += $prod['quantidade_producao'];
                             if (isset($prod['documento_producao'])) {
                                 array_push($files, array('item' => $item['nome_item'], 'path' => uploads_path() . '\\' . $prod['documento_producao'], 'alias' => $prod['nome_producao']));
                                 $numAnexos++;
                                 $arquivos .= "Anexo " . $numAnexos . "\n";
                             } else {
                                 if (isset($prod['quantidade_producao'])) {
                                     array_push($files, array('item' => $item['nome_item'], 'path' => 'pendente', 'alias' => $prod['nome_producao']));
                                     $possuiPendente = true;
                                     $numAnexos++;
                                     $arquivos .= "Anexo " . $numAnexos . "\n";
                                 }
                             }
                         }
                         $this->pdf->Row(array(specialChars($item['nome_item']), $pontuacao, $arquivos, ''));
                     } else {
                         $this->pdf->Row(array(specialChars($item['nome_item']), '', '', ''));
                     }
                 } else {
                     //Descrição do item somente
                     $this->pdf->SetWidths(array(267));
                     $this->pdf->Row(array(specialChars($item['nome_item'])));
                     //Pontuação para cada classificacação
                     foreach ($item['regra']['classificacao'] as $keyclass => $class) {
                         if ($class['regraclass']['valor'] <= 0) {
                             continue;
                         }
                         $limit = '';
                         if (isset($class['regraclass']['pontuacao_maxima'])) {
                             $limit = '	(limitado a ' . $class['regraclass']['pontuacao_maxima'] . ' pontos)';
                         }
                         //Agora preciso contar quantas produções existem com exatamente esta classificação
                         $quantidade = 0;
                         $pontuacao = 0;
                         $arquivos = '';
                         $regraId = $item['regra']['id_item'];
                         foreach ($item['producoes'] as $prod) {
                             if ($prod['id_item'] == $regraId && $prod['id_classificacao'] == $class['id_classificacao']) {
                                 $quantidade++;
                                 if (isset($prod['documento_producao'])) {
                                     array_push($files, array('item' => $item['nome_item'] . ' ' . $class['nome_classificacao'], 'path' => uploads_path() . '\\' . $prod['documento_producao'], 'alias' => $prod['nome_producao']));
                                     $numAnexos++;
                                     $arquivos .= "Anexo " . $numAnexos . "\n";
                                 } else {
                                     array_push($files, array('item' => $item['nome_item'] . ' ' . $class['nome_classificacao'], 'path' => 'pendente', 'alias' => $prod['nome_producao']));
                                     $numAnexos++;
                                     $possuiPendente = true;
                                     $arquivos .= "Anexo " . $numAnexos . "\n";
                                 }
                             }
                         }
                         if ($quantidade == 0) {
                             $this->pdf->SetWidths(array(147, 40, 40, 40));
                             $this->pdf->Row(array(specialChars($class['nome_classificacao'] . $limit), '', '', ''));
                             continue;
                         }
                         $pontuacao = $quantidade * $class['regraclass']['valor'];
                         if (isset($class['regraclass']['pontuacao_maxima']) && $pontuacao > $class['regraclass']['pontuacao_maxima']) {
                             $pontuacao = $class['regraclass']['pontuacao_maxima'];
                         }
                         $totalSubeixoPoints += $pontuacao;
                         $this->pdf->SetWidths(array(147, 40, 40, 40));
                         $this->pdf->Row(array(specialChars($class['nome_classificacao'] . $limit), $pontuacao, $arquivos, ''));
                     }
                     $this->pdf->SetWidths(array(147, 40, 40, 40));
                 }
             }
             if ($totalSubeixoPoints > $subeixo['pontmax_subeixo']) {
                 $totalSubeixoPoints = $subeixo['pontmax_subeixo'];
             }
             $totalPoints += $totalSubeixoPoints;
             $codSubeixo = explode(' ', $subeixo['nome_subeixo'], 2);
             $this->pdf->SetWidths(array(147, 40, 40, 40));
             $this->pdf->SetFill(true);
             $this->pdf->Row(array(specialChars('PONTUAÇÃO TOTAL EIXO ' . $codSubeixo[0]), $totalSubeixoPoints, '', ''));
             $this->pdf->SetFill(false);
             $this->pdf->Ln(7);
         }
         $this->pdf->Ln(7);
     }
     $this->pdf->Row(array(specialChars('PONTUAÇÃO TOTAL '), $totalPoints, '', ''));
     $this->pdf->Ln(7);
     $this->pdf->SetFont('Arial', '', 12);
     $this->pdf->SetWidths(array(267));
     $this->pdf->SetAligns('L');
     $this->pdf->BorderlessRow(array(specialChars('Data e Local : ' . date('d/m/y') . ', São Luís')));
     $this->pdf->Ln(7);
     $this->pdf->SetAligns('C');
     $this->pdf->BorderlessRow(array(specialChars('____________________________________________')));
     $this->pdf->Ln(4);
     $this->pdf->BorderlessRow(array(specialChars('Assinatura do Docente')));
     $this->pdf->Ln(7);
     //Lista de Anexos
     if ($possuiPendente) {
         $this->pdf->AddPage();
         $this->pdf->SetHeader();
         $this->pdf->SetTitleDoc(specialChars('LISTA DE ANEXOS'));
         $this->pdf->SetFont('Arial', 'B', 12);
         $this->pdf->SetWidths(array(15, 45, 110, 20));
         $this->pdf->SetAligns('L', 'L', 'L', 'L');
         $this->pdf->Row(array(specialChars("Num"), specialChars("Nome"), specialChars("Item"), specialChars("Status")));
         $this->pdf->SetFont('Arial', '', 12);
         $this->pdf->SetAligns('L', 'L', 'L', 'L');
         for ($i = 0; $i < count($files); $i++) {
             $status = $files[$i]['path'] == "pendente" ? "pendente" : "anexado";
             $this->pdf->Row(array($i + 1, specialChars($files[$i]['alias']), specialChars($files[$i]['item']), specialChars($status)));
         }
     }
     //var_dump(count($files));
     for ($i = 0; $i < count($files); $i++) {
         if ($files[$i]['path'] == 'pendente') {
             continue;
         }
         $pagecount = $this->pdf->setSourceFile($files[$i]['path']);
         //var_dump($files[$i]);
         for ($j = 0; $j < $pagecount; $j++) {
             $this->pdf->AddPage();
             $tplidx = $this->pdf->importPage($j + 1, '/MediaBox');
             $this->pdf->useTemplate($tplidx, 10, 10, 200);
             $this->pdf->SetFont('Arial', '', 13);
             $this->pdf->SetXY(160, 10);
             $this->pdf->Write(0, 'Anexo ' . ($i + 1));
         }
     }
     //var_dump($files);
     //phpinfo();
     ob_end_clean();
     $nomeArquivo = docs_url() . '\\' . $data['professor']['siape'] . $data['progressao']['id_prog_corrente'] . date('d-m-Y-h-i-s', time()) . '.pdf';
     $download = $data['professor']['siape'] . $data['progressao']['id_prog_corrente'] . date('d-m-Y-h-i-s', time()) . '.pdf';
     $this->pdf->Output('F', $nomeArquivo);
     //$this->pdf->Output('D',$download);
     return $download;
 }