<!--Cabecalho -->
<?php $this->load->view('commons/cabecalho'); ?>
<!--Header -->
<?php $this->load->view('commons/header'); ?>
<!--Opcao -->



<br>
<div class="row">
    <h4 style="margin-left: 7%; font-size: 30pt;"><b>Cursos Matriculados</b></h4>
    <div class="col s11">
<?php echo $this->session->flashdata('erro-matricula'); ?>
<?php echo $this->session->flashdata('sucesso-transacao'); ?>
<?php echo $this->session->flashdata('sucesso-saldo'); ?>
<?php echo $this->session->flashdata('erro-acesso'); ?>
</div>        
    <div class="tentativa">
        
    </div>
    <table class=" col s11 tbl-curso-matriculado striped" >
        <thead>
            <tr>

                <th>Curso</th>
                <th>Carga Horária</th>
                <th>Data da Matrícula</th>
                <th>Nota</th>
                <th></th>
            </tr>
        </thead>

        <tbody>
            <?php if ($cursos != NULL) { ?>
                <?php foreach ($cursos as $value) { ?>
                    <?php if ($value->concluido != 2 && $value->concluido != 3) { ?>
                        <tr class="<?php echo $this->criptografia->codifica($value->id_historico) ?> ">
                            <td> <?php echo $value->nome ?></td>                       
                            <td><?php echo $value->carga_horaria ?> Horas</td>
                            <td><?php echo date("d/m/Y", strtotime($value->primeiro_dia)) ?></td>
                            <?php if ($value->nota == NULL || $value->nota == 0) { ?>
                                <td>Falta Avaliar</td>
                            <?php } else { ?>
                                <td><?php echo $value->nota ?></td>
                            <?php } ?>
                            <?php if ($value->concluido == 0) { ?>
                                <?php $url = $this->url->urlamigavel($value->nome); ?>
                                <td><a href="<?php echo base_url('acessar/' . $this->criptografia->codifica($value->id_historico)) ?>"  class="waves-effect waves-light btn btn-curso btn-matricular-curso" style="width: 100%;">&nbsp;Acessar&nbsp;</a></td>

                            <?php } else { ?>
                                <td><a href="<?php echo base_url('acessar/' . $this->criptografia->codifica($value->id_historico)) ?>"  class="waves-effect waves-light btn disabled btn-curso btn-matricular-curso" style="width: 100%;">&nbsp;Acessar&nbsp;</a></td>
                            <?php } ?>
                            <?php if ($value->certificado == 0) { ?> 
                            <td><a href="<?php echo base_url('detalhescertificados/' . $this->criptografia->codifica($value->id_historico)); ?>" class="waves-effect waves-light btn btn-curso btn-matricular-curso teal lighten-3" style="width: 100%;">&nbsp;Certificado&nbsp;</a></td>
                            <?php } else { ?>
                            <?php if ($cpf == false) { ?>
                            <td><a href="" data-target="cpf" class=" modal-trigger waves-effect waves-light btn btn-curso btn-matricular-curso teal lighten-2" style="width: 100%;">&nbsp;Certificado&nbsp;</a></td>
                           <?php } else { ?>
                            <td><a href="<?php echo base_url('certificado/' . $this->criptografia->codifica($value->id_historico)); ?>" target="_blanck" class="waves-effect waves-light btn btn-curso btn-matricular-curso teal lighten-2" style="width: 100%;">&nbsp;Certificado&nbsp;</a></td>
                            <?php } 
                            
                            } ?>
                            <?php if ($value->concluido == 0 && $value->certificado == 0) { ?> 
                                <td><button class=" cancela waves-effect waves-light btn btn-botao" data-id="<?php echo $this->criptografia->codifica($value->id_historico) ?>" style="width: 100%; background-color: #d9534f">&nbsp;&nbsp;X&nbsp;&nbsp;</button></td>
                            <?php } else { ?>
                                <td></td>
                            <?php } ?>
                        </tr>
                    <?php } ?>
                <?php } ?>      
            <?php } else { ?>
                <tr><td><i class="fa fa-info-circle"></i> Não encotramos nenhum resultado. <a href="<?php echo base_url('cursos'); ?>"><b>Matricule-se agora!</b></a></td></tr>
            <?php } ?>    
        </tbody> 
    </table>
    <?php if ($cursos != NULL) { ?>
        <?php foreach ($cursos as $value) { ?>
            <?php if ($value->concluido != 2 && $value->concluido != 3) { ?>
                <div class="<?php echo $this->criptografia->codifica($value->id_historico) ?>">
                    <div class="collection opcao-m ">
                        <div class="collection-item txt-centro">
                            <?php echo $value->nome ?> <br>
                            <?php if ($value->carga_horaria == 0) { ?>
                                <p><b>Carga Horária:</b> <?php echo $value->carga ?> Horas</p>
                            <?php } else { ?>
                                <p><b>Carga Horária:</b> <?php echo $value->carga_horaria ?> Horas </p>
                            <?php } ?>
                            <p><b>Data:</b> <?php echo date("d/m/Y", strtotime($value->primeiro_dia)) ?></p>
                            <?php if ($value->nota == NULL || $value->nota == 0) { ?>
                                <p><b>Nota:</b> Falta Avaliar</p>
                            <?php } else { ?>
                                <p><b>Nota:</b> <?php echo $value->nota ?></p>
                            <?php } ?>
                            <?php if ($value->concluido == 0) { ?>
                                <a href="<?php echo base_url('acessar/'  . $this->criptografia->codifica($value->id_historico) ) ?>"  class="waves-effect waves-light btn btn-curso btn-matricular-curso" style="width: 100%;">&nbsp;Acessar&nbsp;</a><br><br>
                            <?php } else { ?>
                                <a href="<?php echo base_url('acessar/' . $this->criptografia->codifica($value->id_historico)) ?>"  class="waves-effect waves-light btn disabled btn-curso btn-matricular-curso" style="width: 100%;">&nbsp;Acessar&nbsp;</a><br><br>
                            <?php } ?>
                            <?php if ($value->certificado == 0) { ?>
                            <a href="<?php echo base_url('detalhescertificados/' . $this->criptografia->codifica($value->id_historico)); ?>" class="waves-effect waves-light btn btn-curso btn-matricular-curso teal lighten-3" style="width: 100%;">&nbsp;Certificado&nbsp;</a>
                            <?php }  else { ?>
                            <?php if ($cpf == false) { ?>
                            <a href="" data-target="cpf" class=" modal-trigger waves-effect waves-light btn btn-curso btn-matricular-curso teal lighten-2" style="width: 100%;">&nbsp;Certificado&nbsp;</a>
                            <?php } else { ?>
                            <a href="<?php echo base_url('certificado/' . $this->criptografia->codifica($value->id_historico)); ?>" target="_blanck" class="waves-effect waves-light btn btn-curso btn-matricular-curso teal lighten-2" style="width: 100%;">&nbsp;Certificado&nbsp;</a>
                            <?php } 
                            }?>
                            <?php if ($value->concluido == 0 && $value->certificado == 0) { ?> 
                                <br><br><button class=" cancela waves-effect waves-light btn btn-botao" data-id="<?php echo $this->criptografia->codifica($value->id_historico) ?>" style="width: 100%; background-color: #d9534f">&nbsp;&nbsp;X&nbsp;&nbsp;</button>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            <?php }
            ?>
        <?php } ?>
    <?php } else { ?>
    <p class="hide-on-large-only" style="margin-left: 8%;"><i class="fa fa-info-circle "></i> Não encotramos nenhum resultado. <a href="<?php echo base_url('cursos'); ?>"><b>Matricule-se agora!</b></a></p>
    <?php } ?>    
</div>
<br>
<nav  style="width: 92%; margin-left: 7%; background-color: #f2f2f2; color: black;">&nbsp;&nbsp;<i class="fa fa-info-circle"></i> A nota mínima para aprovação é 50 </nav>

<br><br><br>
<?php $this->load->view('commons/rodape'); ?>
