From e9b2ca7c06875069fa03379258625490872cc33d Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Tue, 31 Jul 2018 18:29:53 +0200 Subject: W 2.4 graphic update table sort engine update --- public/w/index.php | 87 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 32 deletions(-) (limited to 'public/w/index.php') diff --git a/public/w/index.php b/public/w/index.php index 9229bb9..8b5069f 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -4,16 +4,14 @@ // _____________________________________________________ R E Q U I R E ________________________________________________________________ require('../../vendor/autoload.php'); -use Michelf\Markdown; -use Michelf\MarkdownExtra; - require('../../fn/fn.php'); -require('../../class/class.w.config.php'); -require('../../class/class.w.art.php'); -require('../../class/class.w.app.php'); -require('../../class/class.w.aff.php'); -require('../../class/class.w.media.php'); -require('../../class/class.w.record.php'); + +function my_autoloader($class) +{ + require('../../class/class.w.' . strtolower($class) . '.php'); +} +spl_autoload_register('my_autoloader'); + // ________________________________________________________ I N S T A L _________________________________________________ @@ -173,19 +171,18 @@ if (isset($_GET['id'])) { $app->setbdd($config); if ($app->exist($_GET['id'])) { $art = $app->get($_GET['id']); - if (isset($_GET['edit']) && $_GET['edit'] == 1) { - $aff->arthead($art, $config->cssread(), 1); - } else { - $aff->arthead($art, $config->cssread(), 0); + if (!isset($_GET['edit'])) { + $_GET['edit'] = 0; } + $aff->arthead($art, $config->cssread(), $_GET['edit']); } else { - $aff->head($_GET['id'], 'w'); + $aff->head($_GET['id'], ''); } } elseif (isset($_GET['aff'])) { $aff->head($_GET['aff'], $_GET['aff']); } else { - $aff->head('home', 'w'); + $aff->head('home', 'home'); } @@ -197,7 +194,7 @@ if (isset($_GET['id'])) { // _____________________________________________________ A L E R T _______________________________________________________________ if (isset($_GET['message'])) { - echo '

' . $_GET['message'] . '

'; + echo '' . $_GET['message'] . ''; } @@ -221,11 +218,15 @@ if (isset($_GET['id'])) { $art = $app->get($_GET['id']); if (isset($_GET['edit']) and $_GET['edit'] == 1 and $app->session() >= $app::EDITOR) { - $aff->edit($art, $app, $app->getlister(['id', 'titre'], 'id')); - $aff->copy($art, $app->getlister(['id', 'titre'], 'id')); + echo '
'; + $aff->edit($art, $app, $app->getlister(['id', 'titre'])); + $aff->copy($art, $app->getlister(['id', 'titre'])); $aff->aside($app); + echo '
'; } else { + echo '
'; $aff->lecture($art, $app); + echo '
'; } } else { @@ -237,7 +238,7 @@ if (isset($_GET['id'])) { header('Location: ?id=' . $_GET['id'] . '&edit=1'); } } else { - echo '

This article does not exist yet

'; + echo 'This article does not exist yet'; if ($app->session() >= $app::EDITOR) { echo '
'; @@ -254,7 +255,7 @@ if (isset($_GET['id'])) { } elseif (isset($_GET['lien'])) { $app->setbdd($config); echo '

' . $_GET['lien'] . '

'; - $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien'], 'id'), $_GET['lien'], $app); + $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien']), $_GET['lien'], $app); } elseif (isset($_GET['aff']) && $app->session() >= $app::EDITOR) { if ($_GET['aff'] == 'admin' && $app->session() >= $app::ADMIN) { @@ -292,27 +293,49 @@ if (isset($_GET['id'])) { echo ''; + } elseif ($_GET['aff'] == 'map') { + $app->setbdd($config); + $aff->map($app, $config->domain()); } else { header('Location: ./'); } } else { - $app->setbdd($config); - if (isset($_GET['tri'])) { - $tri = strip_tags($_GET['tri']); - } else { - $tri = 'id'; - } - if (isset($_GET['desc'])) { - $desc = strip_tags($_GET['desc']); - } else { - $desc = 'ASC'; + $aff->header(); + + echo '
'; + + + $app->setbdd($config); + $opt = new Opt(Art::classvarlist()); + $opt->hydrate($_GET); + $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure']); + $table = $app->getlisteropt($opt); + $app->listcalclien($table); + $opt->settaglist($table); + $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure', 'liento']); + + $aff->option($app, $opt); + + $filtertagor = $app->filtertagor($table, $opt->tagor()); + $filtersecure = $app->filtersecure($table, $opt->secure()); + + $filter = array_intersect($filtertagor, $filtersecure); + $table2 = []; + foreach ($table as $art) { + if (in_array($art->id(), $filter)) { + $table2[] = $art; + } } - $aff->home2table($app, $app->getlister(['id', 'titre', 'intro', 'lien', 'datecreation', 'datemodif'], $tri, $desc)); + $app->artlistsort($table2, $opt->sortby(), $opt->order()); + + + + $aff->home2table($app, $table2); - //var_dump($app->getlister(['id', 'lien'])); + echo '
'; } -- cgit v1.2.3