<?php
if (isloggedin()) {
   header('Location: '. $CFG->wwwroot .'/my');
}
?>

<?php echo $OUTPUT->doctype() ?>
<html <?php echo $OUTPUT->htmlattributes(); ?>>
<head>
    <title><?php echo $OUTPUT->page_title(); ?></title>
    <link rel="shortcut icon" href="<?php echo $OUTPUT->favicon(); ?>" />
    <?php echo $OUTPUT->standard_head_html() ?>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    <link rel="stylesheet" href="<?php echo $CFG->wwwroot;?>/theme/qualisaude/style/capa/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="<?php echo $CFG->wwwroot;?>/theme/qualisaude/style/capa/reset.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $CFG->wwwroot;?>/theme/qualisaude/style/capa/class.css" />
<!--    <link rel="stylesheet" type="text/css" href="--><?php //echo $CFG->wwwroot;?><!--/theme/qualisaude/style/capa/font-awesome.min.css" />-->
    <link rel="stylesheet" type="text/css" href="<?php echo $CFG->wwwroot;?>/theme/qualisaude/style/capa/style.css" />
</head>
<?php
$bgCapa = rand(1,1);
?>
<body <?php echo $OUTPUT->body_attributes(); ?>>

<?php //require_once(dirname(__FILE__) . '/includes/header.php'); ?>

<section id="inicial" style="background-image:url('<?php echo($OUTPUT->image_url('bg/bg-capa'.$bgCapa, 'theme'));  ?>'); background-size: cover; background-position: bottom;">

    <section id="logos" class="container">
        <div class="row-fluid">

            <div class="col-lg-4">
                <figure>
<!--                    <a target="_top" href="--><?php //echo $CFG->wwwroot;?><!--"><img src="--><?php //echo($OUTPUT->image_url('logos/logo-b', 'theme')); ?><!--" class="img-responsive logo-capa"></a>-->
                    <a target="_blank" href="https://sigaa.ufrn.br/sigaa/public/programa/apresentacao.jsf?lc=pt_BR&id=8084" ><img src="<?php echo($OUTPUT->image_url('logos/logo-b', 'theme')); ?>" class="img-responsive logo-capa"></a>
                </figure>
            </div>
            <div class="col-lg-8">
                <div class="menu-principal pull-right margin-top-15">
                    <?php echo theme_qualisaude_infolink(); ?>
                </div>
            </div>

        </div>
    </section>

    <div id="content-stage" class="container">


<!--        <section id="titulo">-->
<!--            <div class="row-fluid">-->
<!--                <div class="col-lg-12">-->
<!--                    <h1>mandacaru</h1>-->
<!--                    <h2>ACADÊMICO</h2>-->
<!--                </div>-->
<!--            </div>-->
<!--        </section>-->

        <section id="formulario">
            <div class="row-fluid">
                <div class="col-md-5">
                    <h3 class="showcase">Mestrado Profissional</h3>
                    <h1 class="showcase">Gestão da qualidade em Serviços de Saúde</h1>
                </div>
                <div class="col-md-5 col-lg-offset-2 margin-top-20">
                    <div class="box-login-capa">
                        <h2 class="">Acesso</h2>
                        <form method="post" id="login" action="<?php echo $CFG->wwwroot;?>/login/index.php" autocomplete="off" >
                            <input id="anchor" type="hidden" name="anchor" value="">
                            <input type="hidden" name="logintoken" value="<?php echo s(\core\session\manager::get_login_token()); ?>" />
                            <script>document.getElementById('anchor').value = location.hash;</script>
                            <input type="text" id="username" name="username" placeholder="Usuário" class="form-control">
                            <input type="password" id="password" name="password" placeholder="Senha" class="form-control margin-top-10" autocomplete="off">
                            <button type="submit" class="btn margin-top-10" id="loginbtn">Entrar</button>
                            <div class="rememberpass m-t-1">
                                <input type="checkbox" name="rememberusername" id="rememberusername" value="1">
                                <label for="rememberusername">Lembrar identificação de usuário</label>
                            </div>

                            <a href="<?php echo $CFG->wwwroot;?>/login/forgot_password.php" class="recovery pull-right">Esqueci minha senha</a>

                        </form>
                    </div>
                </div>

            </div>
        </section>


    </div>
    <!-- content-stage -->
</section>

<!-- Main Moodle Main Contents -->
<div id="page" class="container">
    <div id="page-content" class="row">
        <?php
        /* ########################### Notícias ########################### */
        echo <<<HTML
        <div class="col-lg-6">
            <h2 class="titulo">Sobre o mestrado</h2>
            <p>O Mestrado Profissional Gestão da Qualidade em Serviços de Saúde (Mestrado QualiSaúde) é um curso de pós-graduação stricto sensu da Universidade Federal do Rio Grande do Norte ofertado desde 2014 em colaboração com a Universidad de Murcia. O programa tem enfoque internacional, sendo também ofertado nessa universidade espanhola colaboradora desde 1999 e no Instituto Nacional de Salud Pública do México desde 2013.</p>
       
        </div>
HTML;
        echo('<div class="col-lg-6">'.$OUTPUT->site_frontpage_news().'</div>');
        ?>
        <?php
        /* ########################### Lista de cursos ########################### */
        if(!empty($OUTPUT->blocks_for_region('side-pre'))){
            $class = "col-md-9";
        }
        else{
            $class ="col-md-12";
        }

        global $DB;
        $course_link = $CFG->wwwroot.'/course/view.php?id=';


//        echo "<section id=\"list-course\" class=\"col-lg-12 col-md-12 col-xs-12\">\n";
//
//        echo "<a href=\"asa\" class=\"btn-todos\">todos os cursos</a>";
//        echo("    <h2 style='margin-top:30px;'>Cursos Disponiveis</h2>");
//        echo "    <div class=\"tab-content row-fluid\">\n";
//        echo "        <div role=\"tabpanel\" class=\"tab-pane fade in active\">\n";
//        echo "            <ul class='my-courses'>\n";
//
//        $courses_list = $DB->get_records('course', array('visible'=>1));
//
//        require_once($CFG->libdir.'/coursecatlib.php');
//        foreach($courses_list as $course){
//            if( $course->id == 1 ):
//                continue;
//            endif;
//
//            $category = $DB->get_record('course_categories',array('id'=>$course->category));
//            $course->categoryName = $category->name;
//
//            $courseInList = new course_in_list($course);
//            $contentimages = $contentfiles = '';
//            foreach ($courseInList->get_course_overviewfiles() as $file) {
//
//                $isimage = $file->is_valid_image();
//                $url = file_encode_url("$CFG->wwwroot/pluginfile.php",
//                    '/'. $file->get_contextid(). '/'. $file->get_component(). '/'.
//                    $file->get_filearea(). $file->get_filepath(). $file->get_filename(), !$isimage);
//                if ($isimage) {
//                    $contentimages .= html_writer::tag('div',
//                        html_writer::empty_tag('img', array('src' => $url)),
//                        array('class' => 'courseimage'));
//                } else {
//                    $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
//                    $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')).
//                        html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
//                    $contentfiles .= html_writer::tag('span',
//                        html_writer::link($url, $filename),
//                        array('class' => 'coursefile fp-filename-icon'));
//                }
//            }
//            $content_img = $contentimages. $contentfiles;
//
//
//            echo "<li class=\"col-lg-3 col-md-3 col-sm-6 col-xs-12 my-course\">
//                            <div class=\"box-list-course\">
//                                <a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">
//                                    {$content_img}
//                                </a>
//                                <span class='categoryName'>{$course->categoryName}</span>
//                                <h3 class='coursename'><a href=\"$CFG->wwwroot/course/view.php?id=$course->id\" title='Diciplina - $course->fullname'>{$course->fullname}</a></h3>
//                                <div class=\"summary\">
//                                    $course->summary
//                                </div>
//                            </div>
//                           </li>";
//            }
//            echo "            </ul>\n";
//            echo "        </div>";
//            echo "    </div>";
//            echo "</section>\n";

    ?>

        <div style="display: none;" id="<?php //echo $regionbsid; ?>" class="<?php //echo $class; ?>">
            <?php
            echo $OUTPUT->course_content_header();
            echo $OUTPUT->main_content();
            echo $OUTPUT->course_content_footer();
            ?>
        </div>
    </div>
</div>

<?php  require_once(dirname(__FILE__) . '/includes/footer.php');  ?>
<!-- footer -->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script type="text/javascript" src="<?php echo $CFG->wwwroot;?>/theme/qualisaude/javascript/bootstrap.min.js"></script>

</body>
</html>
