classes.php 1.4 KB

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