<button id="voltar-eventos" class="btn waves-effect waves-light back-button">Voltar</button>

<?php 
require 'UfmsDAO.php';
$tipoEventos = UfmsDAO::getTipoEventos();
$disciplinas = UfmsDAO::getDisciplinas();
?>

<div class="mdl-card mdl-shadow--4dp mdl-cell--12-col">
    <div class="mdl-cell--12-col">
        <form class="col s12" id="add-evento-form" method="post" enctype="multipart/form-data"
              action="action-add-evento.php">
            <div class="row">
                <div class="input-field col s12">
                    <input id="evento-name" name="evento-name" type="text" class="validate">
                    <label for="evento-name">Nome do Evento</label>
                </div>
            </div>
            <div class="row">
                <div class="input-field col s12">
                    <textarea id="descricao-evento" name="descricao-evento" class="materialize-textarea"></textarea>
                    <label for="descricao-evento">Descrição do Evento</label>
                </div>
            </div>
            <div class="row">
                <div class="input-field col s12">
                    <label for="data-limite">Data Limite</label>
                    <input type="date" class="datepicker" id="data-limite" name="data-limite">
                </div>
            </div>
            <div class="row">
            $response = 'File size is exceeding maximum allowed size.';
        }
        //upload file
        if ($valid) {
            $nomeEvento = $_POST['evento-name'];
            $descricaoEvento = $_POST['descricao-evento'];
            $eventoTimeStamp = date("Y-m-d", time());
            $dataLimiteEvento = $_POST['data-limite'];
            $selectTipoEvento = $_POST['tipo-evento'];
            $selectDisciplina = $_POST['disciplina'];
            $dataLimiteFormatted = date("Y-m-d", strtotime($dataLimiteEvento));
            $anexoNameFormatted = str_replace(' ', '_', $name);
            $targetPath = '../uploads' . DIRECTORY_SEPARATOR . $anexoNameFormatted;
            $dbPath = '/uploads' . DIRECTORY_SEPARATOR . $anexoNameFormatted;
            session_start();
            //$dbPathFormatted = str_replace(' ', '_', $dbPath);
            if (isset($nomeEvento) && isset($descricaoEvento) && isset($dataLimiteFormatted) && isset($selectTipoEvento) && isset($selectDisciplina)) {
                require "UfmsDAO.php";
                require "../server/GCMHandler.php";
                $inserted = UfmsDAO::adicionarEvento(utf8_decode($nomeEvento), utf8_decode($descricaoEvento), $eventoTimeStamp, $dataLimiteFormatted, utf8_decode($selectTipoEvento), utf8_decode($selectDisciplina));
                if ($inserted > 0) {
                    move_uploaded_file($tmpName, $targetPath);
                    UfmsDAO::adicionarAnexo($dbPath, $inserted);
                    GCMHandler::sendGCMMessage($nomeEvento, $descricaoEvento, $inserted, $selectDisciplina);
                    echo "<script>\n                     location.href='index.php';\n\n                     </script>";
                    $_SESSION['evento-added'] = 1;
                }
            }
        }
    }
}
Exemple #3
0
       width="100%">
    <thead>
    <tr>
        <th class="mdl-data-table__cell--non-numeric">Nome do Evento</th>
        <th>Descrição</th>
        <th>Data Criado</th>
        <!--<th>Data Limite</th>-->
        <th>Tipo de Evento</th>
        <th>Disciplina</th>
    </tr>

    </thead>
    <tbody>
    <?php 
require "UfmsDAO.php";
$eventos = UfmsDAO::getAllEventos();
foreach ($eventos as $row) {
    echo '
          <tr>
           <td class="mdl-data-table__cell--non-numeric">' . utf8_encode($row['app_nome_evento']) . '</td>
           <td>' . utf8_encode(substr($row['app_descricao_evento'], 0, 20)) . '...</td>
           <td>' . date("d/m/Y", strtotime($row['app_evento_timestamp'])) . '</td>
           <td>' . utf8_encode($row['app_descricao_tipo_evento']) . '</td>
           <td>' . $row['app_titulo_disciplina'] . '</td>
         </tr>';
}
?>

    </tbody>
</table>
Exemple #4
0
 public static function adicionarAnexo($eventoPath, $eventoKey)
 {
     try {
         $db = UfmsDAO::connect();
         $sql = 'INSERT INTO app_evento_uploads (app_upload_path, app_evento_key) VALUES (?, ?);';
         $stmt = $db->prepare($sql);
         $stmt->execute(array($eventoPath, $eventoKey));
         self::disconnect();
         return true;
     } catch (PDOException $e) {
         self::disconnect();
         echo $e->getMessage();
         return false;
     }
 }
Exemple #5
0
                    <i class="material-icons">more_vert</i>
                </button>
                <ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" for="btn3">
                    <li class="mdl-menu__item">Lorem</li>
                    <li class="mdl-menu__item" disabled>Ipsum</li>
                    <li class="mdl-menu__item">Dolor</li>
                </ul>
            </section>
            <section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
                <div class="mdl-card mdl-cell mdl-cell--12-col">
                    <div class="mdl-card__supporting-text mdl-grid mdl-grid--no-spacing">
                        <h4 class="mdl-cell mdl-cell--12-col">Eventos</h4>

                        <?php 
require "UfmsDAO.php";
$eventos = UfmsDAO::getEventosOverview();
foreach ($eventos as $row) {
    echo '
                               <div class="section__circle-container mdl-cell mdl-cell--2-col mdl-cell--1-col-phone">
                                  <div class="section__circle-container__circle mdl-color--primary eventos-home-section"><h5>' . substr(utf8_encode($row['app_nome_evento']), 0, 1) . '</h5></div>
                                 </div>
                                <div
                                    class="section__text mdl-cell mdl-cell--10-col-desktop mdl-cell--6-col-tablet mdl-cell--3-col-phone">
                                    <h5><strong>' . utf8_encode($row['app_nome_evento']) . '</strong></h5>
                                    <p>' . utf8_encode($row['app_descricao_evento']) . '</p>
                                </div>
                                ';
}
?>

                    </div>