ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPageActivationDBRepository Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilPageActivationDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db=null)
 
 get (string $parent_type, array $ids, bool $check_scheduled_activation=false, string $lang="")
 Get activation data for a set of page ids. More...
 

Protected Member Functions

 getData (string $parent_type, array $ids, bool $check_scheduled_activation=false, string $lang="")
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilPageActivationDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ilPageActivationDBRepository::__construct ( \ilDBInterface  $db = null)

Definition at line 26 of file class.ilPageActivationDBRepository.php.

References $db, and $DIC.

27  {
28  global $DIC;
29 
30  $this->db = (is_null($db))
31  ? $DIC->database()
32  : $db;
33  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ get()

ilPageActivationDBRepository::get ( string  $parent_type,
array  $ids,
bool  $check_scheduled_activation = false,
string  $lang = "" 
)

Get activation data for a set of page ids.

Definition at line 38 of file class.ilPageActivationDBRepository.php.

References getData().

43  : array {
44 
45 
46  // language must be set at least to "-"
47  if ($lang == "") {
48  $lang = "-";
49  }
50 
51  $active = [];
52 
53  // for special languages initialize with master language
54  if ($lang != "-") {
55  foreach ($this->getData($parent_type, $ids, $check_scheduled_activation, "-") as $k => $v) {
56  $active[$k] = $v;
57  }
58  }
59 
60  foreach ($this->getData($parent_type, $ids, $check_scheduled_activation, $lang) as $k => $v) {
61  $active[$k] = $v;
62  }
63 
64  return $active;
65  }
$lang
Definition: xapiexit.php:26
getData(string $parent_type, array $ids, bool $check_scheduled_activation=false, string $lang="")
+ Here is the call graph for this function:

◆ getData()

ilPageActivationDBRepository::getData ( string  $parent_type,
array  $ids,
bool  $check_scheduled_activation = false,
string  $lang = "" 
)
protected

Definition at line 67 of file class.ilPageActivationDBRepository.php.

References $db, $lang, ilDBInterface\fetchAssoc(), ilDBInterface\in(), ilUtil\now(), and ilDBInterface\queryF().

Referenced by get().

72  : array {
73  $db = $this->db;
74  $set = $db->queryF(
75  "SELECT page_id, active, activation_start, activation_end, show_activation_info FROM page_object WHERE " .
76  $db->in("page_id", $ids, false, "integer") .
77  " AND parent_type = %s AND lang = %s",
78  ["text", "text"],
79  [$parent_type, $lang]
80  );
81  $active = [];
82  $now = ilUtil::now();
83  while ($rec = $db->fetchAssoc($set)) {
84  if (!$rec["active"] && $check_scheduled_activation) {
85  if ($now >= $rec["activation_start"] &&
86  $now <= $rec["activation_end"]) {
87  $active[$rec["page_id"]] = [
88  "active" => true,
89  "start" => $rec["activation_start"],
90  "end" => $rec["activation_end"],
91  "show_info" => (bool) $rec["show_activation_info"]
92  ];
93  } else {
94  $active[$rec["page_id"]] = [
95  "active" => false,
96  "start" => $rec["activation_start"],
97  "end" => $rec["activation_end"],
98  "show_info" => (bool) $rec["show_activation_info"]
99  ];
100  }
101  } else {
102  $active[$rec["page_id"]] = [
103  "active" => (bool) $rec["active"],
104  "start" => null,
105  "end" => null,
106  "show_info" => false
107  ];
108  }
109  }
110  return $active;
111  }
fetchAssoc(ilDBStatement $statement)
static now()
Return current timestamp in Y-m-d H:i:s format.
queryF(string $query, array $types, array $values)
in(string $field, array $values, bool $negate=false, string $type="")
$lang
Definition: xapiexit.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilPageActivationDBRepository::$db
protected

Definition at line 24 of file class.ilPageActivationDBRepository.php.

Referenced by __construct(), and getData().


The documentation for this class was generated from the following file: