From 07cb5d313fa0f4b44fb35606124291db043daa1b Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 30 Sep 2023 09:18:08 +0200 Subject: [PATCH] categories okay maque CRUD --- core/module/course/course.php | 21 +++++++++++++++++-- core/module/course/view/category/category.php | 7 ++++++- core/module/course/view/index/index.php | 6 +++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/core/module/course/course.php b/core/module/course/course.php index 7addb61..2e12995 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -241,8 +241,25 @@ class course extends common */ public function category() { - self::$courseCategories = $this->getData(['category']); - var_dump(self::$courseCategories); + $categories = $this->getData(['category']); + ksort($categories); + foreach ($categories as $categoryId => $categoryTitle) { + self::$courseCategories[] = [ + $categoryId, + $categoryTitle, + template::button('courseEdit' . $categoryId, [ + 'href' => helper::baseUrl() . 'course/categoryEdit/' . $categoryId, + 'value' => template::ico('pencil'), + 'help' => 'Éditer' + ]), + template::button('courseDelete' . $categoryId, [ + 'class' => 'courseDelete buttonRed', + 'href' => helper::baseUrl() . 'course/categoryDelete/' . $categoryId, + 'value' => template::ico('trash'), + 'help' => 'Supprimer' + ]) + ]; + } // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Catégorie'), diff --git a/core/module/course/view/category/category.php b/core/module/course/view/category/category.php index 21daaee..3cad89a 100644 --- a/core/module/course/view/category/category.php +++ b/core/module/course/view/category/category.php @@ -14,4 +14,9 @@ ]); ?> - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/core/module/course/view/index/index.php b/core/module/course/view/index/index.php index de38ef2..5d7b7cb 100644 --- a/core/module/course/view/index/index.php +++ b/core/module/course/view/index/index.php @@ -21,4 +21,8 @@ ]); ?> - \ No newline at end of file + + + + +