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

<div class="container"> 
    <div class="row">

        <form method="GET" action="<?= base_url('curso') ?>">

            <div class="row">
                <div class="input-field col m8 s12">
                    <i class="material-icons prefix">search</i>  
                    <input id="curso-p" type="text" class="validate curso-p" name="nome" required="">
                    <label for="curso-p">Digite uma palavra</label>
                </div>
                <button class="btn waves-effect waves-light btn-curso btn-end" type="submit" style="margin-top: 25px;">Pesquisar</button>
            </div>

        </form>
    </div>
    <div class="opcao-d">    
        <div class="row">
            <div class="col s12">
                <?php echo $this->session->flashdata('matriculado-l-erro'); ?>
                    <?php echo $this->session->flashdata('sucesso-escolha'); ?>

            </div>
            <?php foreach ($curso as $value) { ?>
                <div class="col s12 m4 ">

                    <div class="card">
                        <div class="card-image">
                            <img src="<?php echo base_url('assets/img/' . $value->img) ?>" alt="Imagem do Curso <?= $value->nome ?>" title="Imagem do Curso <?= $value->nome ?>">
                        </div>
                        <div class="card-content" style="width: 100%; height: 140px">
                            <span class="card-title txt-centro">CURSOS NA ÁREA DE <?= $value->nome ?></span>
                            <?php $url = $this->url->urlamigavel($value->nome) ?>
                        </div>
                        <a href="<?php echo base_url('cursos/' . $url) ?>" class="waves-effect waves-light btn btn-ver" style="width: 80%;">VER CURSOS</a> <br>
                    </div>
                </div>
            <?php } ?>
        </div>
    </div>
</div>
<?php 
$this->load->library('user_agent');
if($this->agent->is_mobile()) {  
?>
<div class="collection opcao-m">
    <?php echo $this->session->flashdata('sucesso-escolha'); ?>
    <?php foreach ($curso as $value) { ?>
        <?php $url = $this->url->urlamigavel($value->nome) ?>
        <form method="POST" action="<?= base_url('cursos/' . $url) ?>" class="collection-item txt-centro">
            CURSOS NA ÁREA DE <?= $value->nome ?><br><br>
            <input   type="hidden" name="txtCurso" value="<?= $value->nome ?>"> 
            <button class="waves-effect waves-light btn btn-ver" type="submit">VER CURSOS</button>
            <br>
        </form>
    <?php } ?>
</div>
<?php } ?>
<!--Opcao -->
<br><br>
<?php if (isset($_SESSION['aluno']) == FALSE) { ?> 
<?php $this->load->view('commons/opcao'); ?>
<?php }  ?>
<?php $this->load->view('commons/rodape'); ?>
