public function emploiDuTemps($id) { $this->load->helper("Date_helper"); $semaines = week2period(date("Y"), date("W")); $this->load->model("Agenda"); $x = Agenda::getById($id); $data['listAgenda'] = $x; $tab = []; foreach ($x as $y) { $z = true; $date = date('d-m-Y', strtotime($y->dateDebutActivite())); $dateFin = date('d-m-Y', strtotime($y->dateFinActivite())); while ($z == true) { 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); } //jddayofweek(gregoriantojd($mois,$jour,$annee)); $date = date('d-m-Y', strtotime($date . ' + 1 days')); } // $tab[]=$date; // $date=date('d-m-Y', strtotime($date. ' + 1 days')); // $tab[]=$date; // $tab[]=$dateFin; } $data['semaines'] = $semaines; $data['test'] = $tab; $this->load->view("gestionInscription enfant", $data); }
public function inscriptionActivite() { $this->load->model("Activite"); $this->load->model("Enfant"); $data['nomEnfant'] = ""; $data['prenomEnfant'] = ""; $this->load->helper("Date_helper"); $semaines = week2period(date("Y"), date("W")); $data['semaines'] = $semaines; $this->load->view('inscriptionActivite', $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); }