<?php
if(!$model->isAllowed())
    User::blockAction('Você não pode visualizar esta ata.');

$this->PageTitle = false;

$this->widget('zii.widgets.CDetailView', array(
    'data' => $model,
    'attributes' => array(
    ),
));

$Funcionarios = array();
$AtasFuncionarios = AtasFuncionarios::model()->findAll("ATA_REL_IDATA = " . $model->ATA_IDATA);
foreach ($AtasFuncionarios as $AtasFuncionarios) {
    $Funcionarios[] = $AtasFuncionarios->Funcionario;
}
$ListaFuncionarios = '';
if (!empty($Funcionarios)) {
    $ListaFuncionarios = explode(',', implode(', ', array_unique($Funcionarios)));
    natcasesort($ListaFuncionarios);
}

$this->renderPartial('_menu', array('model' => $model, 'page' => 'visualizar'));
?>
<h1>Atas &raquo; Visualizar &raquo; <?php echo $model->ATA_ASSUNTO; ?></h1>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="solicitacoes-view">
    <tr class="odd">
        <td width="10%"><strong>Código</strong></td>
        <td><?php echo $model->ATA_IDATA; ?></td>
        <td><strong>Assunto</strong></td>
        <td><?php echo $model->ATA_ASSUNTO; ?></td>
        <td><strong>Data</strong></td>
        <td><?php echo $model->ATA_DATA; ?></td>
    </tr>
    <tr class="even">
        <td><strong>Autor</strong></td>
        <td><?php echo $model->Usuario; ?></td>
        <?php if(!empty($model->ATA_DATAPROXIMAREUNIAO)) { ?>
            <td><strong>Data Próxima Reunião</strong></td>
            <td><?php echo $model->ATA_DATAPROXIMAREUNIAO; ?></td>
        <?php } else {?>
            <td class="cinza">Data Próxima Reunião</td>
            <td class="cinza">Não informado</td>
        <?php } ?>

        <?php if(!empty($model->ATA_HORARIO)) { ?>
            <td><strong>Horário</strong></td>
            <td><?php echo $model->ATA_HORARIO; ?></td>
        <?php } else { ?>
            <td class="cinza">Horário</td>
            <td class="cinza">Não informado</td>
        <?php } ?>
    </tr>
    <tr class="odd">
        <td><strong>Participantes</strong></td>
        <td colspan="5"><?php echo implode(', ', $ListaFuncionarios); ?></td>
    </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="solicitacoes-view">
    <tr class="even">
        <td width="10%"><strong>Conteúdo</strong></td>
        <td width="90%">
            <?php echo $model->ATA_CONTEUDO; ?>
            <?php 
            $this->renderPartial('_aprovacao', array(
                'model' => $model,
                'model_aprovacao' => $model_aprovacao
                )
            ); 
            ?>
        </td>

    </tr>
</table>
<p></p>
<?php
$AtasEdicao = AtasEdicao::model()->findAll(array('condition' => 'ATE_IDATA = ' . $model->ATA_IDATA, 'order' => 'ATE_DATAEDICAO DESC'));
if (!empty($AtasEdicao)) {
?>
<h1>Ratificações</h1>
<?php } ?>
<?php foreach ($AtasEdicao as $AtasEdicao) { ?>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="solicitacoes-view">
        <tr class="odd">
            <td width="10%"><strong>Data</strong></td>
            <td><?php echo $AtasEdicao->ATE_DATAEDICAO; ?></td>
            <td width="10%"><strong>Autor</strong></td>
            <td><?php echo $AtasEdicao->Participantes; ?></td>
        </tr>
        <tr class="even">
            <td><strong>Conteúdo</strong></td>
            <td colspan="3"><?php echo $AtasEdicao->ATE_CONTEUDO; ?></td>
        </tr>
    </table>
    <p></p>
<?php } ?>