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