summaryrefslogtreecommitdiff
path: root/public/app/models/cms
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-25 03:40:09 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-25 03:40:09 +0300
commit65d07ba64d45c77d2db16272710ec5702b34d641 (patch)
tree4578793e288cd1a6dc08f87ab44d0e3568904c12 /public/app/models/cms
parent13753d58d6aceaea8f246040518d50f2eb06a8d9 (diff)
downloadclassroom-65d07ba64d45c77d2db16272710ec5702b34d641.tar.gz
classroom-65d07ba64d45c77d2db16272710ec5702b34d641.tar.bz2
classroom-65d07ba64d45c77d2db16272710ec5702b34d641.zip
front-end: putting everything together
Diffstat (limited to 'public/app/models/cms')
-rw-r--r--public/app/models/cms/Course_model.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/public/app/models/cms/Course_model.php b/public/app/models/cms/Course_model.php
index 3d0ac1c..d8a8a0e 100644
--- a/public/app/models/cms/Course_model.php
+++ b/public/app/models/cms/Course_model.php
@@ -6,6 +6,10 @@ use \Registry;
class Course_model {
+ /** COURSES
+ * -------------------------------------------------------------------------
+ */
+
/** get all categories
*
* raw table data (simplest SELECT)
@@ -19,6 +23,21 @@ class Course_model {
);
}
+ /** courses struct
+ *
+ * a super array with almost any info needed about courses
+ *
+ * @return (array) ['tree' => ..., 'breadcrumbs' => ... ]
+ */
+ public static function courses_struct()
+ {
+ $tree = self::category_tree();
+ return [
+ 'tree' => $tree,
+ 'breadcrumbs' => self::breadcrumbs($tree)
+ ];
+ }
+
/** constuct a category_tree
*
@@ -216,6 +235,32 @@ class Course_model {
}
+
+
+ /** LESSONS
+ * -------------------------------------------------------------------------
+ */
+
+
+ /** lessons of course
+ *
+ * @param $course_id
+ */
+
+ public static function lessons_of_course($id)
+ {
+ // TODO: order results in some way
+
+ return Registry::use('database')->runQuery(
+ "SELECT lesson.*, lesson_privilege.privilege_id FROM lesson
+ LEFT JOIN lesson_privilege ON lesson_privilege.lesson_id = lesson.id
+ WHERE lesson.status = 1 AND lesson.course_id = :id",
+ [':id' => $id]
+ );
+ }
+
+
+
/** files
* return all files
* @param void