terms.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. $cidReset = true;
  4. require_once __DIR__.'/../inc/global.inc.php';
  5. if (api_get_setting('allow_terms_conditions') !== 'true') {
  6. api_not_allowed(true);
  7. }
  8. api_block_anonymous_users();
  9. $language = api_get_interface_language();
  10. $language = api_get_language_id($language);
  11. $term = LegalManager::get_last_condition($language);
  12. if (!$term) {
  13. // look for the default language
  14. $language = api_get_setting('platformLanguage');
  15. $language = api_get_language_id($language);
  16. $term = LegalManager::get_last_condition($language);
  17. }
  18. $termExtraFields = new ExtraFieldValue('terms_and_condition');
  19. $values = $termExtraFields->getAllValuesByItem($term['id']);
  20. foreach ($values as $value) {
  21. if (!empty($value['value'])) {
  22. $term['content'] .= '<h3>'.get_lang($value['display_text']).'</h3><br />'.$value['value'].'<br />';
  23. }
  24. }
  25. $term['date_text'] = get_lang('PublicationDate').': '.
  26. api_get_local_time(
  27. $term['date'],
  28. null,
  29. null,
  30. false,
  31. true,
  32. true
  33. );
  34. $socialMenuBlock = '';
  35. $allowSocial = api_get_setting('allow_social_tool') === 'true';
  36. if ($allowSocial) {
  37. // Block Social Menu
  38. $socialMenuBlock = SocialManager::show_social_menu('personal-data');
  39. }
  40. $tpl = new Template(null);
  41. $actions = Display::url(
  42. Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM),
  43. api_get_path(WEB_CODE_PATH).'social/personal_data.php'
  44. );
  45. $tpl->assign('actions', Display::toolbarAction('toolbar', [$actions]));
  46. // Block Social Avatar
  47. SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
  48. if (api_get_setting('allow_social_tool') === 'true') {
  49. $tpl->assign('social_menu_block', $socialMenuBlock);
  50. } else {
  51. $tpl->assign('social_menu_block', '');
  52. }
  53. $tpl->assign('term', $term);
  54. $socialLayout = $tpl->get_template('social/terms.tpl');
  55. $tpl->display($socialLayout);