ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilPageActivationDBRepository.php
Go to the documentation of this file.
1
<?
php
2
3
/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
8
class
ilPageActivationDBRepository
9
{
13
protected
$db
;
14
18
public
function
__construct
(\
ilDBInterface
$db
= null)
19
{
20
global
$DIC
;
21
22
$this->db = (is_null(
$db
))
23
? $DIC->database()
24
:
$db
;
25
}
26
35
public
function
get
(
string
$parent_type, array $ids,
bool
$check_scheduled_activation =
false
,
string
$lang
=
""
)
36
{
37
$db
=
$this->db
;
38
39
// language must be set at least to "-"
40
if
($lang ==
""
) {
41
$lang =
"-"
;
42
}
43
$set =
$db
->queryF(
44
"SELECT page_id, active, activation_start, activation_end, show_activation_info FROM page_object WHERE "
.
45
$db
->in(
"page_id"
, $ids,
false
,
"integer"
) .
46
" AND parent_type = %s AND lang = %s"
,
47
[
"text"
,
"text"
],
48
[$parent_type,
$lang
]
49
);
50
$active = [];
51
$now =
ilUtil::now
();
52
while
($rec =
$db
->fetchAssoc($set)) {
53
if
(!$rec[
"active"
] && $check_scheduled_activation) {
54
if
($now >= $rec[
"activation_start"
] &&
55
$now <= $rec[
"activation_end"
]) {
56
$active[$rec[
"page_id"
]] = [
57
"active"
=>
true
,
58
"start"
=> $rec[
"activation_start"
],
59
"end"
=> $rec[
"activation_end"
],
60
"show_info"
=> (bool) $rec[
"show_activation_info"
]
61
];
62
}
else
{
63
$active[$rec[
"page_id"
]] = [
64
"active"
=>
false
,
65
"start"
=> $rec[
"activation_start"
],
66
"end"
=> $rec[
"activation_end"
],
67
"show_info"
=> (bool) $rec[
"show_activation_info"
]
68
];
69
}
70
}
else
{
71
$active[$rec[
"page_id"
]] = [
72
"active"
=> (bool) $rec[
"active"
],
73
"start"
=> null,
74
"end"
=> null,
75
"show_info"
=>
false
76
];
77
}
78
}
79
return
$active;
80
}
81
}
$DIC
global $DIC
Definition:
saml.php:7
ilUtil\now
static now()
Return current timestamp in Y-m-d H:i:s format.
Definition:
class.ilUtil.php:3899
ilPageActivationDBRepository\$db
$db
Definition:
class.ilPageActivationDBRepository.php:13
ilPageActivationDBRepository
Definition:
class.ilPageActivationDBRepository.php:8
ilPageActivationDBRepository\__construct
__construct(\ilDBInterface $db=null)
Constructor.
Definition:
class.ilPageActivationDBRepository.php:18
ilDBInterface
$lang
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition:
langwiz.php:349
php
Services
COPage
classes
class.ilPageActivationDBRepository.php
Generated on Thu Jan 16 2025 19:02:20 for ILIAS by
1.8.13 (using
Doxyfile
)