summaryrefslogtreecommitdiff
path: root/public/app/routes/backend.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/routes/backend.php')
-rw-r--r--public/app/routes/backend.php44
1 files changed, 38 insertions, 6 deletions
diff --git a/public/app/routes/backend.php b/public/app/routes/backend.php
index 9b90cf1..700fa14 100644
--- a/public/app/routes/backend.php
+++ b/public/app/routes/backend.php
@@ -1,9 +1,41 @@
<?php
-Route::add('/admin/info', // generaly you need to hide phpinfo()
- function() { // so, remove this route on production
- // Authenticate::session(); // or require authentication
- phpinfo(); },
- 'get'
-);
+use app\controllers\Auth;
+use app\models\cms\Course_model;
+// admin lessons
+// ---
+Route::add('/admin/lessons', function () {
+ Auth::allowRoles([1, 2, 3]); // allow few admin-panel roles
+ Render::view('admin/skeleton', [
+ 'title' => 'Διαχείριση Μαθημάτων',
+ 'action' => 'lessons',
+ ]);
+});
+
+
+// admin cateogies
+// ---
+Route::add('/admin/categories', function () {
+ Auth::allowRoles([1, 2, 3]);
+ Render::view('admin/skeleton', [
+ 'title' => 'Διαχείριση Κατηγοριών',
+ 'action' => 'categories',
+ ]);
+});
+
+
+Route::add('/admin/api/categories', function () {
+ Auth::allowRoles([1, 2, 3]);
+ $tree = proxy(
+ [\app\models\cms\Course_model::class, 'category_tree'],
+ [], CACHE_ROOT_TTL
+ );
+
+ $breadcrumbs = proxy(
+ [\app\models\cms\Course_model::class, 'breadcrumbs'],
+ [$tree], CACHE_ROOT_TTL
+ );
+ // $breadcrumbs = Course_model::breadcrumbs($tree);
+ Render::json($breadcrumbs);
+}); \ No newline at end of file