summaryrefslogtreecommitdiff
path: root/public/app/views/simple/category.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/views/simple/category.php')
-rw-r--r--public/app/views/simple/category.php156
1 files changed, 0 insertions, 156 deletions
diff --git a/public/app/views/simple/category.php b/public/app/views/simple/category.php
deleted file mode 100644
index 15d8b5e..0000000
--- a/public/app/views/simple/category.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-// init app
-// -----------------------------------------------------------------------------
-include 'pythia.php';
-
-
-// read request parameters
-// -----------------------------------------------------------------------------
-$category_id = intval($_GET['id']);
-
-
-// Get all data needed
-// (so you don't have to make multiple requests to the wiki-database)
-// -----------------------------------------------------------------------------
-
-$categories = $wiki->category_tree();
-$breadcrumbs = Render::all_breadcrumbs($categories);
-
-// get ALL posts of category
-$posts = $wiki->latest_published_posts($category_id, 0);
-
-
-// special case:
-// -----------------------------------------------------------------------------
-// ONE post + NO subcaegories ..then redirect to the only post
-if (($breadcrumbs[ $category_id ]['childs'] == []) && (count($posts) == 1)) {
- header('Location: /wiki/post?id='. $posts[0]['id'], true, 302);
- die();
-}
-
-
-// find parent_ids of current category (to open the menu tree)
-$category_path = [];
-foreach($breadcrumbs[$category_id]['parents'] as $parent) {
- $category_path[] = intval($parent['id']);
-}
-$category_path[] = intval($category_id);
-
-
-// format $posts array
-// ---
-$posts_formated = [];
-foreach($posts as $post) {
- $date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $post['creation_date']);
- $posts_formated[] = [
- 'id' => $post['id'],
- 'title' => $post['title'],
- 'intro' => $post['intro'] ?? false,
- 'date' => Render::date_box($post['creation_date'])
- ];
-}
-
-
-// then render the page ...
-// -----------------------------------------------------------------------------
-?><!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>Wiki</title>
-
- <?php Render::template("sections/common_libs.php", [ 'admin' => false ]); ?>
-
-</head>
-<body>
- <?php include HEAD; ?>
-
- <div class="container-fluid main-content wiki">
-
- <div class="top-bar">
- <div class="breadcrumb">
- <?php // breadcrumbs
- ////////////////////////////////////////////////////////////
- Render::template("sections/breadcrumbs.php", [
- 'id' => $category_id,
- 'title' => $breadcrumbs[ $category_id ]['rec']['title'],
- 'parents' => $breadcrumbs[ $category_id ]['parents']
- ]); ////////////////////////////////////////////////////
- ?>
- </div>
-
- <div class="admin">
- <?php include "sections/admin-dropdown.php"; ?>
- </div>
-
- </div><!-- /top-bar -->
-
- <div class="row">
- <div class="col-xl-2 col-lg-3 col-sm-4 side-bar">
-
- <!-- <h3>Κατηγορίες</h3> -->
- <?php // categories hierarchical menu
- ////////////////////////////////////////////////////////////
- Render::template("sections/categories_menu.php", [
- 'categories' => $categories,
- 'open_path' => $category_path
- ]); ////////////////////////////////////////////////////
- ?>
-
- </div>
- <div class="col-xl-10 col-lg-9 col-sm-8 content">
-
- <div class="content--wrapper">
-
- <!-- Category Title -->
- <h2>
- <?=$breadcrumbs[ $category_id ]['rec']['title']?>
- </h2>
-
-
- <!-- Sub-Categories -->
-
- <?php if ($breadcrumbs[ $category_id ]['childs'] != []) : ?>
-
- <h3>Υποκατηγορίες</h3>
- <div class="category-childs">
-
- <?php foreach($breadcrumbs[ $category_id ]['childs'] as $key => $child) : ?>
-
- <a href="/wiki/category?id=<?=$child['id']?>">
- <?=$child['title']?>
- </a>
-
- <?php endforeach; ?>
-
- </div>
-
- <?php endif; ?>
-
-
- <!-- Articles List -->
-
- <?php if ($posts) : ?>
-
- <h3>Άρθρα / Δημοσιεύσεις</h3>
-
- <?php // list of posts/articles
- ////////////////////////////////////////////////////
- Render::template("sections/articles_list.php", [
- 'articles' => $posts_formated,
- 'fieldset' => ['intro', 'date']
- ]);
- ////////////////////////////////////////////////////
- ?>
- <?php endif; ?>
-
-
- </div>
-
- </div>
- </div>
- </div>
-
- <script src="/wiki/js/wiki.js"></script>
-</body>
-</html>