<?php 
echo "<div class='right-button-margin'>";
echo "<a href='cadastro_funcionario.php' class='btn btn-default pull-right'>Cadastro</a>";
echo "</div>";
echo "<div class='right-button-margin'>";
echo "<strong>Logado Como:  " . $logado . "!</strong>  <a href='logout.php' class='glyphicon glyphicon-log-out'> SAIR</a>";
echo "</div>";
include_once 'config/database.php';
include_once 'funcionario.php';
include_once 'cargo.php';
$database = new Database();
$db = $database->getConnection();
$funcionario = new Funcionario($db);
$cargo = new Cargo($db);
$stmt = $funcionario->readAll();
$stmt2 = $cargo->readAll();
$num = $stmt->rowCount();
//lista os funcionarios cadastrados
if ($num > 0) {
    echo "<table id='lista_func' class='table table-bordered table-hover'>";
    echo "<tr>";
    echo "<th class='width-30-pct'>Matricula</th>";
    echo "<th class='width-100-pct'>Nome</th>";
    echo "<th>Cargo</th>";
    echo "<th>Salario</th>";
    echo "<th style='text-align:center;'>Ação</th>";
    echo "</tr>";
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        $row2 = $stmt2->fetch(PDO::FETCH_ASSOC);
        extract($row);
        extract($row2);