ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\COPage\Page\PageManager Class Reference
+ Inheritance diagram for ILIAS\COPage\Page\PageManager:
+ Collaboration diagram for ILIAS\COPage\Page\PageManager:

Public Member Functions

 __construct (PageDBRepository $repo, \ILIAS\COPage\Dom\DomUtil $dom_util, ProfileAdapter $profile)
 
 get (string $parent_type, int $id=0, int $old_nr=0, string $lang="-")
 
 lookupParentId (int $a_id, string $a_type)
 
 writeParentId (string $a_parent_type, int $a_pg_id, int $a_par_id)
 
 writeActive (int $page_id, string $parent_type, bool $active)
 
 lookupContainsDeactivatedElements (int $page_id, string $parent_type, string $lang="-")
 
 preloadActivationDataByParentId (int $parent_id)
 
 lookupActive (int $page_id, string $parent_type, bool $check_scheduled_activation=false, string $lang="-")
 
 isScheduledActivation (int $page_id, string $parent_type, string $lang="-")
 
 lookupActivationData (int $page_id, string $parent_type, string $lang="-")
 
 getParentObjectContributors (string $parent_type, int $parent_id, string $lang="-")
 
 getPageContributors (string $parent_type, int $page_id, string $lang="-")
 
 content (\DOMDocument $dom)
 
 contentFromXml ($xml)
 
 get (string $parent_type, int $id=0, int $old_nr=0, string $lang="-")
 
 lookupParentId (int $a_id, string $a_type)
 
 writeParentId (string $a_parent_type, int $a_pg_id, int $a_par_id)
 
 writeActive (int $page_id, string $parent_type, bool $active)
 
 lookupContainsDeactivatedElements (int $page_id, string $parent_type, string $lang="-")
 
 preloadActivationDataByParentId (int $parent_id)
 
 lookupActive (int $page_id, string $parent_type, bool $check_scheduled_activation=false, string $lang="-")
 
 isScheduledActivation (int $page_id, string $parent_type, string $lang="-")
 
 lookupActivationData (int $page_id, string $parent_type, string $lang="-")
 
 getParentObjectContributors (string $parent_type, int $parent_id, string $lang="-")
 
 getPageContributors (string $parent_type, int $page_id, string $lang="-")
 

Protected Member Functions

 getActivationData (int $page_id, string $parent_type, string $lang)
 
 activationDataKey (int $page_id, string $parent_type, string $lang)
 

Protected Attributes

ILIAS COPage Dom DomUtil $dom_util
 
PageDBRepository $repo
 
ProfileAdapter $profile
 
array $activation_data = []
 

Detailed Description

Definition at line 25 of file class.PageManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\Page\PageManager::__construct ( PageDBRepository  $repo,
\ILIAS\COPage\Dom\DomUtil  $dom_util,
ProfileAdapter  $profile 
)

Definition at line 33 of file class.PageManager.php.

37 {
38 $this->repo = $repo;
39 $this->dom_util = $dom_util;
40 $this->profile = $profile;
41 }
ILIAS COPage Dom DomUtil $dom_util

References ILIAS\COPage\Page\PageManager\$dom_util, ILIAS\COPage\Page\PageManager\$profile, ILIAS\COPage\Page\PageManager\$repo, and ILIAS\Repository\profile().

+ Here is the call graph for this function:

Member Function Documentation

◆ activationDataKey()

ILIAS\COPage\Page\PageManager::activationDataKey ( int  $page_id,
string  $parent_type,
string  $lang 
)
protected

Definition at line 149 of file class.PageManager.php.

149 : string
150 {
151 return $page_id . ":" . $parent_type . ":" . $lang;
152 }

◆ content()

ILIAS\COPage\Page\PageManager::content ( \DOMDocument  $dom)

Definition at line 245 of file class.PageManager.php.

245 : PageContentManager
246 {
247 return new PageContentManager($dom);
248 }

◆ contentFromXml()

ILIAS\COPage\Page\PageManager::contentFromXml (   $xml)

Definition at line 250 of file class.PageManager.php.

250 : PageContentManager
251 {
252 $error = "";
253 $dom = $this->dom_util->docFromString($xml, $error);
254 return new PageContentManager($dom);
255 }
ilErrorHandling $error
Definition: class.ilias.php:69

◆ get()

ILIAS\COPage\Page\PageManager::get ( string  $parent_type,
int  $id = 0,
int  $old_nr = 0,
string  $lang = "-" 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 43 of file class.PageManager.php.

49 return \ilPageObjectFactory::getInstance(
50 $parent_type,
51 $id,
52 $old_nr,
53 $lang
54 );
55 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)

References $id.

◆ getActivationData()

ILIAS\COPage\Page\PageManager::getActivationData ( int  $page_id,
string  $parent_type,
string  $lang 
)
protected

Definition at line 134 of file class.PageManager.php.

134 : ?array
135 {
136 $lang = $lang === "" ? "-" : $lang;
137 $key = $this->activationDataKey($page_id, $parent_type, $lang);
138 if (isset($this->activation_data[$key])) {
139 return $this->activation_data[$key];
140 }
141
142 $record = $this->repo->getActivationData($page_id, $parent_type, $lang);
143 if ($record !== null) {
144 $this->activation_data[$key] = $record;
145 }
146 return $record;
147 }
activationDataKey(int $page_id, string $parent_type, string $lang)

◆ getPageContributors()

ILIAS\COPage\Page\PageManager::getPageContributors ( string  $parent_type,
int  $page_id,
string  $lang = "-" 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 201 of file class.PageManager.php.

205 : array {
206 $contributors = [];
207 $contributor_data = $this->repo->getPageContributorData(
208 $parent_type,
209 $page_id,
210 $lang
211 );
212
213 foreach ($contributor_data["pages"] as $page) {
214 if ($lang === "") {
215 $contributors[$page["last_change_user"]][$page["lang"]] = 1;
216 } else {
217 $contributors[$page["last_change_user"]] = 1;
218 }
219 }
220
221 foreach ($contributor_data["history"] as $page) {
222 if ($lang === "") {
223 $contributors[$page["user_id"]][$page["lang"]] =
224 ($contributors[$page["user_id"]][$page["lang"]] ?? 0) + $page["cnt"];
225 } else {
226 $contributors[$page["user_id"]] =
227 ($contributors[$page["user_id"]] ?? 0) + $page["cnt"];
228 }
229 }
230
231 $result = [];
232 foreach ($contributors as $user_id => $pages) {
233 $name = \ilObjUser::_lookupName((int) $user_id);
234 $result[] = [
235 "user_id" => $user_id,
236 "pages" => $pages,
237 "lastname" => $name["lastname"],
238 "firstname" => $name["firstname"]
239 ];
240 }
241
242 return $result;
243 }
static _lookupName(int $a_user_id)

References $page.

◆ getParentObjectContributors()

ILIAS\COPage\Page\PageManager::getParentObjectContributors ( string  $parent_type,
int  $parent_id,
string  $lang = "-" 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 154 of file class.PageManager.php.

158 : array {
159 $contributors = [];
160 $contributor_data = $this->repo->getParentObjectContributorData(
161 $parent_type,
162 $parent_id,
163 $lang
164 );
165
166 foreach ($contributor_data["pages"] as $page) {
167 if ($lang === "") {
168 $contributors[$page["last_change_user"]][$page["page_id"]][$page["lang"]] = 1;
169 } else {
170 $contributors[$page["last_change_user"]][$page["page_id"]] = 1;
171 }
172 }
173
174 foreach ($contributor_data["history"] as $page) {
175 if ($lang === "") {
176 $contributors[$page["user_id"]][$page["page_id"]][$page["lang"]] =
177 ($contributors[$page["user_id"]][$page["page_id"]][$page["lang"]] ?? 0) + $page["cnt"];
178 } else {
179 $contributors[$page["user_id"]][$page["page_id"]] =
180 ($contributors[$page["user_id"]][$page["page_id"]] ?? 0) + $page["cnt"];
181 }
182 }
183
184 $result = [];
185 foreach ($contributors as $user_id => $pages) {
186 if (!$this->profile->exists((int) $user_id)) {
187 continue;
188 }
189 $name = \ilObjUser::_lookupName((int) $user_id);
190 $result[] = [
191 "user_id" => $user_id,
192 "pages" => $pages,
193 "lastname" => $name["lastname"],
194 "firstname" => $name["firstname"]
195 ];
196 }
197
198 return $result;
199 }

References $page.

◆ isScheduledActivation()

ILIAS\COPage\Page\PageManager::isScheduledActivation ( int  $page_id,
string  $parent_type,
string  $lang = "-" 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 112 of file class.PageManager.php.

116 : bool {
117 $record = $this->getActivationData($page_id, $parent_type, $lang);
118 return $record !== null && !$record["active"] && $record["activation_start"] != "";
119 }
getActivationData(int $page_id, string $parent_type, string $lang)

◆ lookupActivationData()

ILIAS\COPage\Page\PageManager::lookupActivationData ( int  $page_id,
string  $parent_type,
string  $lang = "-" 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 121 of file class.PageManager.php.

125 : array {
126 return $this->getActivationData($page_id, $parent_type, $lang) ?? [
127 "active" => 1,
128 "activation_start" => null,
129 "activation_end" => null,
130 "show_activation_info" => 0
131 ];
132 }

◆ lookupActive()

ILIAS\COPage\Page\PageManager::lookupActive ( int  $page_id,
string  $parent_type,
bool  $check_scheduled_activation = false,
string  $lang = "-" 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 92 of file class.PageManager.php.

97 : bool {
98 $record = $this->getActivationData($page_id, $parent_type, $lang);
99 if ($record === null) {
100 return true;
101 }
102
103 if (!$record["active"] && $check_scheduled_activation) {
104 $now = \ilUtil::now();
105 if ($now >= $record["activation_start"] && $now <= $record["activation_end"]) {
106 return true;
107 }
108 }
109 return (bool) $record["active"];
110 }
static now()
Return current timestamp in Y-m-d H:i:s format.

◆ lookupContainsDeactivatedElements()

ILIAS\COPage\Page\PageManager::lookupContainsDeactivatedElements ( int  $page_id,
string  $parent_type,
string  $lang = "-" 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 72 of file class.PageManager.php.

76 : bool {
77 $lang = $lang === "" ? "-" : $lang;
78 return $this->repo->lookupContainsDeactivatedElements($page_id, $parent_type, $lang);
79 }

◆ lookupParentId()

ILIAS\COPage\Page\PageManager::lookupParentId ( int  $a_id,
string  $a_type 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 57 of file class.PageManager.php.

57 : int
58 {
59 return $this->repo->lookupParentId($a_id, $a_type);
60 }

◆ preloadActivationDataByParentId()

ILIAS\COPage\Page\PageManager::preloadActivationDataByParentId ( int  $parent_id)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 81 of file class.PageManager.php.

81 : void
82 {
83 foreach ($this->repo->getActivationDataByParentId($parent_id) as $record) {
84 $this->activation_data[$this->activationDataKey(
85 (int) $record["page_id"],
86 (string) $record["parent_type"],
87 (string) $record["lang"]
88 )] = $record;
89 }
90 }

◆ writeActive()

ILIAS\COPage\Page\PageManager::writeActive ( int  $page_id,
string  $parent_type,
bool  $active 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

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

67 : void
68 {
69 $this->repo->writeActive($page_id, $parent_type, $active);
70 }

◆ writeParentId()

ILIAS\COPage\Page\PageManager::writeParentId ( string  $a_parent_type,
int  $a_pg_id,
int  $a_par_id 
)

Implements ILIAS\COPage\Page\PageManagerInterface.

Definition at line 62 of file class.PageManager.php.

62 : void
63 {
64 $this->repo->writeParentId($a_parent_type, $a_pg_id, $a_par_id);
65 }

Field Documentation

◆ $activation_data

array ILIAS\COPage\Page\PageManager::$activation_data = []
protected

Definition at line 31 of file class.PageManager.php.

◆ $dom_util

ILIAS COPage Dom DomUtil ILIAS\COPage\Page\PageManager::$dom_util
protected

Definition at line 27 of file class.PageManager.php.

Referenced by ILIAS\COPage\Page\PageManager\__construct().

◆ $profile

ProfileAdapter ILIAS\COPage\Page\PageManager::$profile
protected

Definition at line 29 of file class.PageManager.php.

Referenced by ILIAS\COPage\Page\PageManager\__construct().

◆ $repo

PageDBRepository ILIAS\COPage\Page\PageManager::$repo
protected

Definition at line 28 of file class.PageManager.php.

Referenced by ILIAS\COPage\Page\PageManager\__construct().


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