categories okay maque CRUD

This commit is contained in:
Fred Tempez 2023-09-30 09:18:08 +02:00
parent d8b551e8a0
commit 07cb5d313f
3 changed files with 30 additions and 4 deletions

View File

@ -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'),

View File

@ -14,4 +14,9 @@
]); ?>
</div>
</div>
<?php echo template::table([12], $module::$courseCategories, ['Titre']); ?>
<?php if($module::$courseCategories): ?>
<?php echo template::table([5,5,1,1], $module::$courseCategories, ['Id', 'Titre', '', '']); ?>
<?php else: ?>
<?php echo template::speech('Aucune catégorie'); ?>
<?php endif; ?>

View File

@ -21,4 +21,8 @@
]); ?>
</div>
</div>
<?php if($module::$courses): ?>
<?php echo template::table([3 , 3, 4, 1, 1], $module::$courses, ['Titre court', 'Auteur', 'Description', '', '']); ?>
<?php else: ?>
<?php echo template::speech('Aucun Cours'); ?>
<?php endif; ?>