classes.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.classes
  5. *
  6. * @author Julio Montoya <gugli100@gmail.com>
  7. */
  8. $cidReset = true;
  9. require_once __DIR__.'/../inc/global.inc.php';
  10. api_block_anonymous_users();
  11. $this_section = SECTION_COURSES;
  12. $interbreadcrumb[] = ['url' => 'classes.php', 'name' => get_lang('Classes')];
  13. if (isset($_GET['id'])) {
  14. $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Groups')];
  15. }
  16. $content = '';
  17. $usergroup = new UserGroup();
  18. $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
  19. if (!empty($usergroup_list)) {
  20. $content .= Display::tag('h1', get_lang('My classes'));
  21. foreach ($usergroup_list as $group_id) {
  22. if (isset($_GET['id']) && $_GET['id'] != $group_id) {
  23. continue;
  24. }
  25. $data = $usergroup->get($group_id);
  26. $content .= Display::tag('h2', $data['name']);
  27. $content .= Display::div($data['description']);
  28. }
  29. } else {
  30. if (api_is_platform_admin()) {
  31. Display::addFlash(
  32. Display::return_message(
  33. Display::url(
  34. get_lang('Add classes'),
  35. api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add'
  36. ),
  37. 'normal',
  38. false
  39. )
  40. );
  41. }
  42. }
  43. Display::display_header('', 'Classes');
  44. echo $content;
  45. Display::display_footer();