|
|
|
@ -234,12 +234,13 @@ echo UserManager::getUserSubscriptionTab(3); |
|
|
|
|
|
|
|
|
|
/* List all categories */ |
|
|
|
|
if ('true' === api_get_setting('allow_group_categories')) { |
|
|
|
|
$defaultCategory = [ |
|
|
|
|
'iid' => null, |
|
|
|
|
'description' => '', |
|
|
|
|
'title' => get_lang('Default groups'), |
|
|
|
|
]; |
|
|
|
|
$categories = array_merge([$defaultCategory], $categories); |
|
|
|
|
if (empty($categories)) { |
|
|
|
|
$defaultCategoryId = GroupManager::create_category( |
|
|
|
|
get_lang('Default groups') |
|
|
|
|
); |
|
|
|
|
$defaultCategory = GroupManager::get_category($defaultCategoryId); |
|
|
|
|
$categories = [$defaultCategory]; |
|
|
|
|
} |
|
|
|
|
$course = api_get_course_entity(); |
|
|
|
|
foreach ($categories as $index => $category) { |
|
|
|
|
$categoryId = $category['iid']; |
|
|
|
@ -264,13 +265,15 @@ if ('true' === api_get_setting('allow_group_categories')) { |
|
|
|
|
// Edit |
|
|
|
|
$actions .= '<a |
|
|
|
|
href="group_category.php?'.api_get_cidreq().'&id='.$categoryId.'" title="'.get_lang('Edit').'">'. |
|
|
|
|
Display::getMdiIcon('edit', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit this category')).'</a>'; |
|
|
|
|
Display::getMdiIcon('pencil', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit this category')).'</a>'; |
|
|
|
|
|
|
|
|
|
// Delete |
|
|
|
|
$actions .= Display::url( |
|
|
|
|
Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')), |
|
|
|
|
Display::getMdiIcon(ActionIcon::DELETE, count($categories) == 1 ? 'ch-tool-icon-disabled' : 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')), |
|
|
|
|
'group.php?'.api_get_cidreq().'&action=delete_category&category_id='.$categoryId, |
|
|
|
|
[ |
|
|
|
|
count($categories) == 1 ? [ |
|
|
|
|
'onclick' => 'javascript:alert('."'".addslashes(api_htmlentities(get_lang('You cannot delete the last category'), ENT_QUOTES))."'".'); return false;', |
|
|
|
|
] : [ |
|
|
|
|
'onclick' => 'javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES))."'".')) return false;', |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|