ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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, $a_abstract_only=false)
 
- 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...
 
 setProfileBackUrl ($url)
 
 getProfileBackUrl ()
 
 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, $a_abstract_only=false)
 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
 $profile_back_url
 
 $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

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

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

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.

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

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  }
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
const IL_INSERT_AFTER
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
+ 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.

References $i.

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: metadata.php:24

◆ 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

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 229 of file class.ilPCLearningHistory.php.

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

Referenced by modifyPageContentPostXsl().

229  : string
230  {
231  if ($a_mode == "preview" || $a_mode == "presentation" || $a_mode == "print") {
232  if ($this->getPage()->getParentType() == "prtf") {
233  $user_id = ilObject::_lookupOwner($this->getPage()->getPortfolioId());
234  }
235  }
236  if ($user_id > 0) {
237  $tpl = new ilTemplate("tpl.pc_lhist.html", true, true, "Services/LearningHistory");
238  $hist_gui = new ilLearningHistoryGUI();
239  $hist_gui->setUserId($user_id);
240  $from_unix = ($from != "")
241  ? (new ilDateTime($from . " 00:00:00", IL_CAL_DATETIME))->get(IL_CAL_UNIX)
242  : null;
243  $to_unix = ($to != "")
244  ? (new ilDateTime($to . " 23:59:59", IL_CAL_DATETIME))->get(IL_CAL_UNIX)
245  : null;
246  $classes = (is_array($classes))
247  ? array_filter($classes, function ($i) {
248  return ($i != "");
249  })
250  : null;
251  if (count($classes) == 0) {
252  $classes = null;
253  }
254  $tpl->setVariable("LHIST", $hist_gui->getEmbeddedHtml($from_unix, $to_unix, $classes, $a_mode));
255  return $tpl->get();
256  }
257 
258  return ilPCLearningHistoryGUI::getPlaceHolderPresentation();
259  }
const IL_CAL_DATETIME
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
const IL_CAL_UNIX
static _lookupOwner($a_id)
lookup object owner
$i
Definition: metadata.php:24
+ 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.

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

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

26  {
27  global $DIC;
28 
29  $this->user = $DIC->user();
30  $this->setType("lhist");
31  }
setType($a_type)
Set Type.
user()
Definition: user.php:4
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCLearningHistory::modifyPageContentPostXsl (   $a_html,
  $a_mode,
  $a_abstract_only = false 
)

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

References $i, $lng, $param, and getPresentation().

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

References $i.

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  }
$i
Definition: metadata.php:24

◆ 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.

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: