legal_list.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Entity\Repository\LegalRepository;
  4. /**
  5. * Sessions list script.
  6. *
  7. * @package chamilo.admin
  8. */
  9. $cidReset = true;
  10. require_once __DIR__.'/../inc/global.inc.php';
  11. $this_section = SECTION_PLATFORM_ADMIN;
  12. api_protect_admin_script();
  13. $interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
  14. $tool_name = get_lang('TermsAndConditions');
  15. Display::display_header($tool_name);
  16. $parameters['sec_token'] = Security::get_token();
  17. // action menu
  18. echo '<div class="actions">';
  19. echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_add.php">';
  20. echo Display::return_icon(
  21. 'edit.png',
  22. get_lang('EditTermsAndConditions')
  23. );
  24. echo get_lang('EditTermsAndConditions').'</a>&nbsp;&nbsp;';
  25. echo '</div>';
  26. $em = Database::getManager();
  27. /** @var LegalRepository $legalTermsRepo */
  28. $legalTermsRepo = $em->getRepository('ChamiloCoreBundle:Legal');
  29. $legalCount = $legalTermsRepo->countAllActiveLegalTerms();
  30. $languages = api_get_languages();
  31. $available_languages = count($languages['folder']);
  32. if ($legalCount != $available_languages) {
  33. echo Display::return_message(get_lang('YouShouldCreateTermAndConditionsForAllAvailableLanguages'), 'warning');
  34. }
  35. $table = new SortableTable('conditions', 'count_mask', 'get_legal_data_mask', 2);
  36. $table->set_additional_parameters($parameters);
  37. $table->set_header(0, get_lang('Version'), false, 'width="15px"');
  38. $table->set_header(1, get_lang('Language'), false, 'width="30px"');
  39. $table->set_header(2, get_lang('Content'), false);
  40. $table->set_header(3, get_lang('Changes'), false, 'width="60px"');
  41. $table->set_header(4, get_lang('Type'), false, 'width="60px"');
  42. $table->set_header(5, get_lang('Date'), false, 'width="50px"');
  43. $table->display();
  44. // this 2 "mask" function are here just because the SortableTable
  45. function get_legal_data_mask($id, $params = null, $row = null)
  46. {
  47. return LegalManager::get_legal_data($id, $params, $row);
  48. }
  49. function count_mask()
  50. {
  51. return LegalManager::count();
  52. }
  53. Display :: display_footer();