summaryrefslogtreecommitdiff
path: root/html/app/views/simple/index.php
blob: 9860db0138d1691b07d79bbc643204ad66e62fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
// init app
// -----------------------------------------------------------------------------
include 'pythia.php';

// 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);
$posts = $wiki->latest_published_posts(0, 7);    // 0 = no category ; 7 = posts limit

// format posts array; inject breadcrumbs
// ---
$posts_formated = [];
foreach($posts as $post) {
    $posts_formated[] = [
        'id' => $post['id'],
        'title' => $post['title'],
        'category' => $breadcrumbs[ $post['category_id'] ]['breadcrumb'],
        'intro' => $post['intro'] ?? false,
        'date' => Render::date_box($post['creation_date'])
    ];
}

// optional fields to be printed into post-list
// ---
$fieldset = [
    'date',
    'intro',
    'category'
];

// 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' => 0,
                        'title' => '',
                        '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' => []
                    ]);     ////////////////////////////////////////////////////
                ?>

            </div><!-- /side-bar -->

            <div class="col-xl-10 col-lg-9 col-sm-8 content">

                <!-- ARTICLES LIST -->
                <div class="content--wrapper">

                    <h2>
                        Welcome to Wiki!
                    </h2>


                    <p>Ίσως κάποιο εισαγωγικό κείμενο, στατικό ή δυναμικό.
                        Pellentesque non mauris ut orci volutpat sollicitudin ut vel ligula. Nullam et leo eu ante ornare ultrices a a leo. Proin non accumsan ex, sit amet finibus purus.
                    </p><p>
                        Vestibulum posuere maximus nisl eget consequat. Etiam venenatis lectus sed libero vestibulum viverra. Sed nec nibh ac nulla venenatis tincidunt eu ut diam. Sed tincidunt, arcu sit amet pharetra ornare, libero nunc placerat nunc, at dictum dui diam sit amet metus. Sed venenatis vehicula nisl at hendrerit.
                    </p>


                    <h3>Τελευταίες Δημοσιεύσεις</h3>

                    <?php    // list of posts/articles
                        ////////////////////////////////////////////////////////
                        Render::template("sections/articles_list.php", [
                            'articles' => $posts_formated,
                            'fieldset' => $fieldset
                        ]);         
                        ////////////////////////////////////////////////////////
                    ?>

                </div>

 
            </div><!-- /content -->

        </div>

    </div> <!-- /main-content wiki -->

    <script src="/wiki/js/wiki.js"></script>
</body>
</html>