ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPCLearningHistory Class Reference

Learning history page content. More...

+ Inheritance diagram for ilPCLearningHistory:
+ Collaboration diagram for ilPCLearningHistory:

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set node. More...
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, $a_pc_id="")
 Create learning history node. More...
 
 setFrom ($a_val)
 Set from. More...
 
 getFrom ()
 Get from. More...
 
 setTo ($a_val)
 Set to. More...
 
 getTo ()
 Get to. More...
 
 setClasses ($a_val)
 Set classes. More...
 
 getClasses ()
 Get classes. More...
 
 modifyPageContentPostXsl ($a_html, $a_mode)
 Modify page content after xsl. More...
 
- Public Member Functions inherited from ilPageContent
 __construct ($a_pg_obj)
 Constructor. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 init ()
 Init object. More...
 
 getType ()
 Get type of page content. More...
 
 setNode ($a_node)
 Set xml node of page content. More...
 
getNode ()
 Get xml node of page content. More...
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 Get on load code. More...
 
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure. More...
 
 getHierId ()
 Get hierarchical id. More...
 
 lookupHierId ()
 Get hierarchical id from dom. More...
 
 readHierId ()
 Read PC Id. More...
 
 setPcId ($a_pcid)
 Set PC Id. More...
 
 getPCId ()
 Get PC Id. More...
 
 setFileDownloadLink ($a_download_link)
 Set file download link. More...
 
 getFileDownloadLink ()
 Get file download link. More...
 
 setFullscreenLink ($a_fullscreen_link)
 Set fullscreen link. More...
 
 getFullscreenLink ()
 Get fullscreen link. More...
 
 setSourcecodeDownloadScript ($script_name)
 Set sourcecode download script. More...
 
 getSourcecodeDownloadScript ()
 Get sourcecode download script. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. More...
 
 setEnabled ($value)
 Set Enabled value for page content component. More...
 
 enable ()
 Enable page content. More...
 
 disable ()
 Disable page content. More...
 
 isEnabled ()
 Check whether page content is enabled. More...
 
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl ($a_output, $a_mode)
 Modify page content after xsl. More...
 

Static Public Member Functions

static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry ($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
 After page history entry has been created. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container. More...
 
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content. More...
 
static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry ($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
 After page history entry has been created. More...
 

Data Fields

 $dom
 
- Data Fields inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 

Protected Member Functions

 getPresentation ($from, $to, $classes, $a_mode)
 Get presentation. More...
 
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 

Protected Attributes

 $user
 
- Protected Attributes inherited from ilPageContent
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Detailed Description

Learning history page content.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..com

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

Member Function Documentation

◆ afterPageHistoryEntry()

static ilPCLearningHistory::afterPageHistoryEntry (   $a_page,
DOMDocument  $a_old_domdoc,
  $a_old_xml,
  $a_old_nr 
)
static

After page history entry has been created.

Parameters
object$a_pagepage object
DOMDocument$a_old_domdocold dom document
string$a_old_xmlold xml
integer$a_old_nrhistory number

Reimplemented from ilPageContent.

Definition at line 163 of file class.ilPCLearningHistory.php.

164 {
165 }

◆ afterPageUpdate()

static ilPCLearningHistory::afterPageUpdate (   $a_page,
DOMDocument  $a_domdoc,
  $a_xml,
  $a_creation 
)
static

After page has been updated (or created)

Parameters
object$a_pagepage object
DOMDocument$a_domdocdom document
string$a_xmlxml
bool$a_creationtrue on creation, otherwise false

Reimplemented from ilPageContent.

Definition at line 142 of file class.ilPCLearningHistory.php.

143 {
144 }

◆ beforePageDelete()

static ilPCLearningHistory::beforePageDelete (   $a_page)
static

Before page is being deleted.

Parameters
object$a_pagepage object

Reimplemented from ilPageContent.

Definition at line 151 of file class.ilPCLearningHistory.php.

152 {
153 }

◆ create()

ilPCLearningHistory::create ( ilPageObject  $a_pg_obj,
string  $a_hier_id,
  $a_pc_id = "" 
)

Create learning history node.

Parameters
ilPageObject$a_pg_obj
string$a_hier_id
string$a_pc_id

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

50 {
51 $this->node = $this->createPageContentNode();
52 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
53 $this->lhist_node = $this->dom->create_element("LearningHistory");
54 $this->lhist_node = $this->node->append_child($this->lhist_node);
55 }
const IL_INSERT_AFTER
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
insertContent(&$a_cont_obj, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
insert a content node before/after a sibling or as first child of a parent

References ilPageContent\createPageContentNode(), IL_INSERT_AFTER, and ilPageObject\insertContent().

+ Here is the call graph for this function:

◆ getClasses()

ilPCLearningHistory::getClasses ( )

Get classes.

Returns
array classes

Definition at line 122 of file class.ilPCLearningHistory.php.

123 {
124 $classes = [];
125 // delete properties
126 $children = $this->lhist_node->child_nodes();
127 for ($i = 0; $i < count($children); $i++) {
128 $classes[] = $children[$i]->get_attribute("Name");
129 }
130 return $classes;
131 }
$i
Definition: disco.tpl.php:19

References $i.

◆ getFrom()

ilPCLearningHistory::getFrom ( )

Get from.

Returns
string from

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

73 {
74 return $this->lhist_node->get_attribute("From");
75 }

◆ getLangVars()

static ilPCLearningHistory::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

Reimplemented from ilPageContent.

Definition at line 171 of file class.ilPCLearningHistory.php.

172 {
173 return array("ed_insert_learning_history", "pc_learning_history");
174 }

◆ getPresentation()

ilPCLearningHistory::getPresentation (   $from,
  $to,
  $classes,
  $a_mode 
)
protected

Get presentation.

Parameters
int$fromunix timestamp
int$tounix timestamp
array$classes
string$mode
Returns
string
Exceptions
ilCtrlException

Definition at line 232 of file class.ilPCLearningHistory.php.

232 : string
233 {
234 if ($a_mode == "preview" || $a_mode == "presentation" || $a_mode == "print") {
235 if ($this->getPage()->getParentType() == "prtf") {
236 $user_id = ilObject::_lookupOwner($this->getPage()->getPortfolioId());
237 }
238 }
239 if ($user_id > 0) {
240 $tpl = new ilTemplate("tpl.pc_lhist.html", true, true, "Services/LearningHistory");
241 $hist_gui = new ilLearningHistoryGUI();
242 $hist_gui->setUserId($user_id);
243 $from_unix = ($from != "")
244 ? (new ilDateTime($from . " 00:00:00", IL_CAL_DATETIME))->get(IL_CAL_UNIX)
245 : null;
246 $to_unix = ($to != "")
247 ? (new ilDateTime($to . " 23:59:59", IL_CAL_DATETIME))->get(IL_CAL_UNIX)
248 : null;
249 $classes = (is_array($classes))
250 ? array_filter($classes, function ($i) {
251 return ($i != "");
252 })
253 : null;
254 if (count($classes) == 0) {
255 $classes = null;
256 }
257 $tpl->setVariable("LHIST", $hist_gui->getEmbeddedHtml($from_unix, $to_unix, $classes, $a_mode));
258 return $tpl->get();
259 }
260
261 return ilPCLearningHistoryGUI::getPlaceHolderPresentation();
262 }
$tpl
Definition: ilias.php:10
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
Learning history main GUI class.
static _lookupOwner($a_id)
lookup object owner
special template class to simplify handling of ITX/PEAR
$from

References $from, $i, $tpl, ilObject\_lookupOwner(), ilPageContent\getPage(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by modifyPageContentPostXsl().

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

◆ getTo()

ilPCLearningHistory::getTo ( )

Get to.

Returns
string to

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

93 {
94 return $this->lhist_node->get_attribute("To");
95 }

◆ init()

ilPCLearningHistory::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

26 {
27 global $DIC;
28
29 $this->user = $DIC->user();
30 $this->setType("lhist");
31 }
user()
Definition: user.php:4
setType($a_type)
Set Type.
global $DIC
Definition: saml.php:7

References $DIC, ilPageContent\setType(), and user().

+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCLearningHistory::modifyPageContentPostXsl (   $a_html,
  $a_mode 
)

Modify page content after xsl.

Parameters
string$a_output
Returns
string

Reimplemented from ilPageContent.

Definition at line 182 of file class.ilPCLearningHistory.php.

183 {
185 $ilPluginAdmin = $this->plugin_admin;
186
187 $start = strpos($a_html, "{{{{{LearningHistory");
188 if (is_int($start)) {
189 $end = strpos($a_html, "}}}}}", $start);
190 }
191
192 while ($end > 0) {
193 $param = substr($a_html, $start + 5, $end - $start - 5);
194 $param = str_replace(' xmlns:xhtml="http://www.w3.org/1999/xhtml"', "", $param);
195 $param = explode("#", $param);
196 $from = $param[1];
197 $to = $param[2];
198 $classes = explode(";", $param[3]);
199 $classes = array_map(function ($i) {
200 return trim($i);
201 }, $classes);
202
203
204 $a_html = substr($a_html, 0, $start) .
205 $this->getPresentation($from, $to, $classes, $a_mode) .
206 substr($a_html, $end + 5);
207
208 if (strlen($a_html) > $start + 5) {
209 $start = strpos($a_html, "{{{{{LearningHistory", $start + 5);
210 } else {
211 $start = false;
212 }
213 $end = 0;
214 if (is_int($start)) {
215 $end = strpos($a_html, "}}}}}", $start);
216 }
217 }
218
219 return $a_html;
220 }
getPresentation($from, $to, $classes, $a_mode)
Get presentation.
$lng
$start
Definition: bench.php:8

References $end, $from, $i, $lng, $start, and getPresentation().

+ Here is the call graph for this function:

◆ setClasses()

ilPCLearningHistory::setClasses (   $a_val)

Set classes.

Parameters
array$a_valclasses

Definition at line 102 of file class.ilPCLearningHistory.php.

103 {
104 // delete properties
105 $children = $this->lhist_node->child_nodes();
106 for ($i = 0; $i < count($children); $i++) {
107 $this->lhist_node->remove_child($children[$i]);
108 }
109 // set classes
110 foreach ($a_val as $key => $class) {
111 $prop_node = $this->dom->create_element("LearningHistoryProvider");
112 $prop_node = $this->lhist_node->append_child($prop_node);
113 $prop_node->set_attribute("Name", $class);
114 }
115 }
$key
Definition: croninfo.php:18

References $i, and $key.

◆ setFrom()

ilPCLearningHistory::setFrom (   $a_val)

Set from.

Parameters
string$a_valfrom

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

63 {
64 $this->lhist_node->set_attribute("From", $a_val);
65 }

◆ setNode()

ilPCLearningHistory::setNode (   $a_node)

Set node.

Reimplemented from ilPageContent.

Definition at line 36 of file class.ilPCLearningHistory.php.

37 {
38 parent::setNode($a_node); // this is the PageContent node
39 $this->lhist_node = $a_node->first_child(); // this is the skill node
40 }

◆ setTo()

ilPCLearningHistory::setTo (   $a_val)

Set to.

Parameters
string$a_valto

Definition at line 82 of file class.ilPCLearningHistory.php.

83 {
84 $this->lhist_node->set_attribute("To", $a_val);
85 }

Field Documentation

◆ $dom

ilPCLearningHistory::$dom

Definition at line 20 of file class.ilPCLearningHistory.php.

◆ $user

ilPCLearningHistory::$user
protected

Definition at line 18 of file class.ilPCLearningHistory.php.


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