From 2060e198b1f9ac41deee93848417121fb1c066f5 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Sun, 18 Mar 2018 03:48:04 +0100 Subject: classes fonctionnelles --- public/w/index.php | 117 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 41 deletions(-) (limited to 'public/w/index.php') diff --git a/public/w/index.php b/public/w/index.php index 99d8cb6..41137d0 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -24,21 +24,21 @@ head('article'); // 'datemodif' => new DateTimeImmutable(null, timezone_open("Europe/Paris")) // ]); -$arraytest = ([ - 'id' => 'articlet2', - 'titre' => 'titre', - 'soustitre' => 'soustitre', - 'intro' => 'intro', - 'tag' => 'sans tag,', - 'datecreation' => '2018-03-17 18:31:34', - 'datemodif' => '2018-03-17 18:31:34', - 'css' => 'display: inline:', - 'html' => 'coucou les loulous', - 'secure' => 0, - 'couleurtext' => '#000000', - 'couleurbkg' => '#ffffff', - 'couleurlien' => '#2a3599' -]); +// $arraytest = ([ +// 'id' => 'articlet2', +// 'titre' => 'titre', +// 'soustitre' => 'soustitre', +// 'intro' => 'intro', +// 'tag' => 'sans tag,', +// 'datecreation' => '2018-03-17 18:31:34', +// 'datemodif' => '2018-03-17 18:31:34', +// 'css' => 'display: inline:', +// 'html' => 'coucou les loulous', +// 'secure' => 0, +// 'couleurtext' => '#000000', +// 'couleurbkg' => '#ffffff', +// 'couleurlien' => '#2a3599' +// ]); // $art = new Art($arreytest); @@ -54,32 +54,67 @@ $arraytest = ([ // echo '

article exist :' . $app->exist('articlet') . '

'; // var_dump($app->exist('articlet')); - - -echo '
';
-$art = $app->get('articlet');
-
-var_dump($art);
-
-echo 'count : ' . $app->count();
-
- var_dump($app->exist('bouffffe'));
- var_dump($app->exist('bouffe'));
-
-
- $art2 = new Art($arraytest);
-
-//  $app->add($art2);
-
-$app->update($art2);
-
-var_dump($app->getlist());
-
-echo '
'; - - - - +$session = 2; + + +if (isset($_GET['id'])) { + + if ($session == 2) { + ?> + + exist($_GET['id'])) { + + if (isset($_POST['action']) and $_POST['action'] == 'update') { + $art = new Art($_POST); + var_dump($art); + $app->update($art); + header('Location: ?id=' . $art->id() . '&edit=1'); + + } + + $art = $app->get($_GET['id']); + + + + if (isset($_GET['display']) and $_GET['display'] == 1) { + $art->display($session); + } + if (isset($_GET['edit']) and $_GET['edit'] == 1) { + $art->edit($session); + } + } else { + if (isset($_POST['action'])) { + if ($_POST['action'] == 'new') { + $art = new Art($_GET); + $art->default(); + var_dump($art); + $app->add($art); + header('Location: ?id=' . $_GET['id'] . '&edit=1'); + } + } else { + echo '

Cet article n\'éxiste pas encore

'; + + if ($session >= 2) { + echo '
'; + } + echo 'retour maison'; + + } + + } +} else { + echo "

Bienvenue sur ce site.

"; + $app->menu($session); +} -- cgit v1.2.3