ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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: shib_login.php:22

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  // language must be set at least to "-"
45  if ($lang == "") {
46  $lang = "-";
47  }
48 
49  $active = [];
50 
51  // for special languages initialize with master language
52  if ($lang != "-") {
53  foreach ($this->getData($parent_type, $ids, $check_scheduled_activation, "-") as $k => $v) {
54  $active[$k] = $v;
55  }
56  }
57 
58  foreach ($this->getData($parent_type, $ids, $check_scheduled_activation, $lang) as $k => $v) {
59  $active[$k] = $v;
60  }
61 
62  return $active;
63  }
$lang
Definition: xapiexit.php:25
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 65 of file class.ilPageActivationDBRepository.php.

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

Referenced by get().

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