public function gestionAgendaActivite()
 {
     $this->load->model("Activite");
     $this->load->model("Agenda");
     $data['listAgenda'] = Agenda::getAll();
     $this->load->view("gestionAgendaActivite", $data);
 }
 public function gestion()
 {
     $this->load->helper("Date_helper");
     $semaines = week2period(date("Y"), date("W"));
     $this->load->model("Agenda");
     $x = Agenda::getAll();
     $data['listAgenda'] = $x;
     $tab = [];
     foreach ($x as $y) {
         // Pour chaque ligne de la table agenda
         $z = true;
         $date = date('d-m-Y', strtotime($y->dateDebutActivite()));
         $dateFin = date('d-m-Y', strtotime($y->dateFinActivite()));
         while ($z == true) {
             /// tant que les deux dates ne sont pas égales
             if ($date == $dateFin) {
                 $z = false;
             }
             $p = new \DateTime($date);
             if ($p->format('N') == $y->jour()) {
                 $tab[] = str_replace('-', '', $date) . substr($y->horaireDebutActivite(), 0, 2) . substr($y->horaireFinActivite(), 0, 2);
             }
             //date sous format 311220160809 -> 31-12-2016-08h-09h
             //jddayofweek(gregoriantojd($mois,$jour,$annee));
             $date = date('d-m-Y', strtotime($date . ' + 1 days'));
             // On incrémente le jour
         }
         //            $tab[]=$date;
         //            $date=date('d-m-Y', strtotime($date. ' + 1 days'));
         //            $tab[]=$date;
         //            $tab[]=$dateFin;
     }
     $data['semaines'] = $semaines;
     $data['test'] = $tab;
     $this->load->view("gestionAgendaActivite", $data);
 }
Esempio n. 3
0
	    <h3 class="panel-title">Listagem</h3>
	  </div>
		<table class="table table-bordered table-striped table-hover">
		<thead>
			<tr>
				<th>#</th>
				<th>Evento</th>
				<th>Data</th>
				<th>Hora</th>
				<th>Ações</th>
			</tr>
		</thead>
		<tbody>
			<?php 
$agenda = new Agenda();
$eventos = $agenda->getAll();
if (isset($_GET['acao']) && $_GET['acao'] == 'delete') {
    $eventoId = $_GET['id'];
    $agenda->delete($eventoId);
    header('Location: index.php');
    die;
}
?>

			<?php 
foreach ($eventos as $evento) {
    ?>
				<tr>
					<td><?php 
    echo $evento->id;
    ?>