ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLMNavigationStatus Class Reference

Checks current navigation request status. More...

+ Collaboration diagram for ilLMNavigationStatus:

Public Member Functions

 __construct (ilObjUser $user, int $request_obj_id, ilLMTree $lm_tree, ilObjLearningModule $lm, ilSetting $lm_set, string $cmd, int $focus_id)
 Constructor. More...
 
 isChapterWithoutActivePage ()
 Has current chapter no avtive page? More...
 
 isDeactivatedPage ()
 Has current chapter no avtive page? More...
 
 getCurrentPage ()
 Has current chapter no avtive page? More...
 

Protected Member Functions

 determineStatus ()
 Determine status. More...
 

Protected Attributes

 $current_page_id = null
 
 $chapter_has_no_active_page = false
 
 $deactivated_page = false
 
 $lm
 
 $lm_tree
 
 $user
 
 $lm_set
 
 $cmd
 
 $focus_id
 
 $requested_obj_id
 

Detailed Description

Checks current navigation request status.

  • determines the current page (request may e.g. pass a chapter id, in this case the next page is searched)
  • determines if all pages of a chapter are deactivated
  • determines if the current page is deactivated
Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 13 of file class.ilLMNavigationStatus.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMNavigationStatus::__construct ( ilObjUser  $user,
int  $request_obj_id,
ilLMTree  $lm_tree,
ilObjLearningModule  $lm,
ilSetting  $lm_set,
string  $cmd,
int  $focus_id 
)

Constructor.

Parameters
ilObjUser$user
$request_obj_id
ilLMTree$lm_tree
ilObjLearningModule$lm
ilSetting$lm_set
string$cmd
int$focus_id

Definition at line 76 of file class.ilLMNavigationStatus.php.

84 {
85 $this->user = $user;
86 $this->requested_obj_id = (int) $request_obj_id;
87 $this->lm_tree = $lm_tree;
88 $this->lm = $lm;
89 $this->lm_set = $lm_set;
90 $this->cmd = $cmd;
91 $this->focus_id = $focus_id;
92
93 $this->determineStatus();
94 }
user()
Definition: user.php:4

References $cmd, $focus_id, $lm, $lm_set, $lm_tree, $user, determineStatus(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ determineStatus()

ilLMNavigationStatus::determineStatus ( )
protected

Determine status.

Definition at line 130 of file class.ilLMNavigationStatus.php.

131 {
133
134 $this->chapter_has_no_active_page = false;
135 $this->deactivated_page = false;
136
137 // determine object id
138 if ($this->requested_obj_id == 0) {
139
140 $obj_id = $this->lm_tree->getRootId();
141
142 if ($this->cmd == "resume") {
143 if ($user->getId() != ANONYMOUS_USER_ID && ((int) $this->focus_id == 0)) {
144 $last_accessed_page = ilObjLearningModuleAccess::_getLastAccessedPage($this->lm->getRefId(), $user->getId());
145 // if last accessed page was final page do nothing, start over
146 if ($last_accessed_page &&
147 $last_accessed_page != $this->lm_tree->getLastActivePage()) {
148 $obj_id = $last_accessed_page;
149 }
150 }
151 }
152
153 } else {
154 $obj_id = $this->requested_obj_id;
155 $active = ilLMPage::_lookupActive(
156 $obj_id,
157 $this->lm->getType(),
158 $this->lm_set->get("time_scheduled_page_activation")
159 );
160
161 if (!$active &&
162 ilLMPageObject::_lookupType($obj_id) == "pg") {
163 $this->deactivated_page = true;
164 }
165 }
166
167 // obj_id not in tree -> it is a unassigned page -> return page id
168 if (!$this->lm_tree->isInTree($obj_id)) {
169 $this->current_page_id = $obj_id;
170 return null;
171 }
172
173 $curr_node = $this->lm_tree->getNodeData($obj_id);
174
175 $active = ilLMPage::_lookupActive(
176 $obj_id,
177 $this->lm->getType(),
178 $this->lm_set->get("time_scheduled_page_activation")
179 );
180
181 if ($curr_node["type"] == "pg" &&
182 $active) { // page in tree -> return page id
183 $page_id = $curr_node["obj_id"];
184 } else { // no page -> search for next page and return its id
185 $succ_node = true;
186 $active = false;
187 $page_id = $obj_id;
188 while ($succ_node && !$active) {
189 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, "pg");
190 $page_id = $succ_node["obj_id"];
191 $active = ilLMPage::_lookupActive(
192 $page_id,
193 $this->lm->getType(),
194 $this->lm_set->get("time_scheduled_page_activation")
195 );
196 }
197
198 if ($succ_node["type"] != "pg") {
199 $this->chapter_has_no_active_page = true;
200 $this->current_page_id = 0;
201 return null;
202 }
203
204 // if public access get first public page in chapter
205 if ($user->getId() == ANONYMOUS_USER_ID &&
206 $this->lm->getPublicAccessMode() == 'selected') {
207 $public = ilLMObject::_isPagePublic($page_id);
208
209 while ($public === false && $page_id > 0) {
210 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, 'pg');
211 $page_id = $succ_node['obj_id'];
212 $public = ilLMObject::_isPagePublic($page_id);
213 }
214 }
215
216 // check whether page found is within "clicked" chapter
217 if ($this->lm_tree->isInTree($page_id)) {
218 $path = $this->lm_tree->getPathId($page_id);
219 if (!in_array($this->requested_obj_id, $path)) {
220 $this->chapter_has_no_active_page = true;
221 }
222 }
223 }
224
225 $this->current_page_id = $page_id;
226 }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _isPagePublic($a_node_id, $a_check_public_mode=false)
static _getLastAccessedPage($a_ref_id, $a_user_id="")
get last accessed page
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status

References $requested_obj_id, $user, ilObjContentObjectAccess\_getLastAccessedPage(), ilLMObject\_isPagePublic(), ilPageObject\_lookupActive(), and ilLMObject\_lookupType().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentPage()

ilLMNavigationStatus::getCurrentPage ( )

Has current chapter no avtive page?

Returns
int

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

References $current_page_id.

◆ isChapterWithoutActivePage()

ilLMNavigationStatus::isChapterWithoutActivePage ( )

Has current chapter no avtive page?

Returns
bool

Definition at line 101 of file class.ilLMNavigationStatus.php.

References $chapter_has_no_active_page.

◆ isDeactivatedPage()

ilLMNavigationStatus::isDeactivatedPage ( )

Has current chapter no avtive page?

Returns
bool

Definition at line 111 of file class.ilLMNavigationStatus.php.

References $deactivated_page.

Field Documentation

◆ $chapter_has_no_active_page

ilLMNavigationStatus::$chapter_has_no_active_page = false
protected

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

Referenced by isChapterWithoutActivePage().

◆ $cmd

ilLMNavigationStatus::$cmd
protected

Definition at line 54 of file class.ilLMNavigationStatus.php.

Referenced by __construct().

◆ $current_page_id

ilLMNavigationStatus::$current_page_id = null
protected

Definition at line 19 of file class.ilLMNavigationStatus.php.

Referenced by getCurrentPage().

◆ $deactivated_page

ilLMNavigationStatus::$deactivated_page = false
protected

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

Referenced by isDeactivatedPage().

◆ $focus_id

ilLMNavigationStatus::$focus_id
protected

Definition at line 59 of file class.ilLMNavigationStatus.php.

Referenced by __construct().

◆ $lm

ilLMNavigationStatus::$lm
protected

Definition at line 34 of file class.ilLMNavigationStatus.php.

Referenced by __construct().

◆ $lm_set

ilLMNavigationStatus::$lm_set
protected

Definition at line 49 of file class.ilLMNavigationStatus.php.

Referenced by __construct().

◆ $lm_tree

ilLMNavigationStatus::$lm_tree
protected

Definition at line 39 of file class.ilLMNavigationStatus.php.

Referenced by __construct().

◆ $requested_obj_id

ilLMNavigationStatus::$requested_obj_id
protected

Definition at line 64 of file class.ilLMNavigationStatus.php.

Referenced by determineStatus().

◆ $user

ilLMNavigationStatus::$user
protected

Definition at line 44 of file class.ilLMNavigationStatus.php.

Referenced by __construct(), and determineStatus().


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