ILIAS  release_8 Revision v8.23
ilPCLearningHistory Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 init ()
 
 setNode (php4DOMElement $a_node)
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 Create learning history node. More...
 
 setFrom (string $a_val)
 
 getFrom ()
 
 setTo (string $a_val)
 
 getTo ()
 
 setClasses (array $a_val)
 
 getClasses ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 getNode ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getOnloadCode (string $a_mode)
 
 setHierId (string $a_hier_id)
 
 getHierId ()
 
 lookupHierId ()
 
 readHierId ()
 
 setPcId (string $a_pcid)
 
 getPCId ()
 
 setFileDownloadLink (string $a_download_link)
 
 getFileDownloadLink ()
 
 setProfileBackUrl (string $url)
 
 getProfileBackUrl ()
 
 setFullscreenLink (string $a_fullscreen_link)
 
 getFullscreenLink ()
 
 setSourcecodeDownloadScript (string $script_name)
 
 getSourcecodeDownloadScript ()
 
 readPCId ()
 
 writePCId (string $a_pc_id)
 
 setEnabled (string $value)
 Set Enabled value for page content component. More...
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 createPageContentNode (bool $a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model as needed for the front-end editor. More...
 

Static Public Member Functions

static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 
static beforePageDelete (ilPageObject $a_page)
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $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 (string $ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId (string $ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static sortHierIds (array $a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId (string $a, string $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, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 Handle copied content. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterRepositoryCopy (ilPageObject $page, array $mapping, int $source_ref_id)
 After repository (container) copy action. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
static deleteHistoryLowerEqualThan (string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
 Overwrite in derived classes, if old history entries are being deleted. More...
 

Protected Member Functions

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

Protected Attributes

php4DOMElement $lhist_node
 
ilObjUser $user
 
- Protected Attributes inherited from ilPageContent
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 

Additional Inherited Members

- Data Fields inherited from ilPageContent
string $hier_id = ""
 
php4DOMElement $node = null
 
php4DOMDocument $dom = null
 
string $page_lang = ""
 

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 Learning history page content

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ afterPageHistoryEntry()

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

After page history entry has been created.

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

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

124  : void {
125  }

◆ afterPageUpdate()

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

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

104  : void {
105  }

◆ beforePageDelete()

static ilPCLearningHistory::beforePageDelete ( ilPageObject  $a_page)
static

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

109  : void {
110  }

◆ create()

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

Create learning history node.

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

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

45  : void
46  {
47  $this->node = $this->createPageContentNode();
48  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
49  $this->lhist_node = $this->dom->create_element("LearningHistory");
50  $this->lhist_node = $this->node->append_child($this->lhist_node);
51  }
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
const IL_INSERT_AFTER
createPageContentNode(bool $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 ( )

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

88  : array
89  {
90  $classes = [];
91  // delete properties
92  $children = $this->lhist_node->child_nodes();
93  foreach ($children as $iValue) {
94  $classes[] = $iValue->get_attribute("Name");
95  }
96  return $classes;
97  }

◆ getFrom()

ilPCLearningHistory::getFrom ( )

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

58  : string
59  {
60  return (string) $this->lhist_node->get_attribute("From");
61  }

◆ getLangVars()

static ilPCLearningHistory::getLangVars ( )
static

Get lang vars needed for editing.

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

130  : array
131  {
132  return array("ed_insert_learning_history", "pc_learning_history");
133  }

◆ getPresentation()

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

Get presentation.

Exceptions
ilCtrlException
ilDateTimeException

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

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

Referenced by modifyPageContentPostXsl().

186  : string {
187  $user_id = 0;
188  if ($a_mode === "preview" || $a_mode === "presentation" || $a_mode === "print") {
189  if ($this->getPage()->getParentType() === "prtf") {
190  $user_id = ilObject::_lookupOwner($this->getPage()->getPortfolioId());
191  }
192  }
193  if ($user_id > 0) {
194  $tpl = new ilTemplate("tpl.pc_lhist.html", true, true, "Services/LearningHistory");
195  $hist_gui = new ilLearningHistoryGUI();
196  $hist_gui->setUserId($user_id);
197  $from_unix = ($from != "")
198  ? (new ilDateTime($from . " 00:00:00", IL_CAL_DATETIME))->get(IL_CAL_UNIX)
199  : null;
200  $to_unix = ($to != "")
201  ? (new ilDateTime($to . " 23:59:59", IL_CAL_DATETIME))->get(IL_CAL_UNIX)
202  : null;
203  $classes = (is_array($classes))
204  ? array_filter($classes, static function ($i): bool {
205  return ($i != "");
206  })
207  : [];
208  if (count($classes) === 0) {
209  $classes = null;
210  }
211  $tpl->setVariable("LHIST", $hist_gui->getEmbeddedHTML($from_unix, $to_unix, $classes, $a_mode));
212  return $tpl->get();
213  }
214 
216  }
const IL_CAL_DATETIME
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
const IL_CAL_UNIX
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTo()

ilPCLearningHistory::getTo ( )

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

68  : string
69  {
70  return (string) $this->lhist_node->get_attribute("To");
71  }

◆ init()

ilPCLearningHistory::init ( )

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

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

28  : void
29  {
30  global $DIC;
31 
32  $this->user = $DIC->user();
33  $this->setType("lhist");
34  }
setType(string $a_type)
Set Type.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCLearningHistory::modifyPageContentPostXsl ( string  $a_output,
string  $a_mode,
bool  $a_abstract_only = false 
)

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

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

139  : string {
140  $start = strpos($a_output, "{{{{{LearningHistory");
141  $end = 0;
142  if (is_int($start)) {
143  $end = strpos($a_output, "}}}}}", $start);
144  }
145 
146  while ($end > 0) {
147  $param = substr($a_output, $start + 5, $end - $start - 5);
148  $param = str_replace(' xmlns:xhtml="http://www.w3.org/1999/xhtml"', "", $param);
149  $param = explode("#", $param);
150  $from = $param[1];
151  $to = $param[2];
152  $classes = explode(";", $param[3]);
153  $classes = array_map(static function ($i) {
154  return trim($i);
155  }, $classes);
156 
157 
158  $a_output = substr($a_output, 0, $start) .
159  $this->getPresentation($from, $to, $classes, $a_mode) .
160  substr($a_output, $end + 5);
161 
162  if (strlen($a_output) > $start + 5) {
163  $start = strpos($a_output, "{{{{{LearningHistory", $start + 5);
164  } else {
165  $start = false;
166  }
167  $end = 0;
168  if (is_int($start)) {
169  $end = strpos($a_output, "}}}}}", $start);
170  }
171  }
172 
173  return $a_output;
174  }
getPresentation(string $from, string $to, array $classes, string $a_mode)
Get presentation.
$param
Definition: xapitoken.php:46
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ setClasses()

ilPCLearningHistory::setClasses ( array  $a_val)

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

References ILIAS\LTI\ToolProvider\$key.

73  : void
74  {
75  // delete properties
76  $children = $this->lhist_node->child_nodes();
77  foreach ($children as $iValue) {
78  $this->lhist_node->remove_child($iValue);
79  }
80  // set classes
81  foreach ($a_val as $key => $class) {
82  $prop_node = $this->dom->create_element("LearningHistoryProvider");
83  $prop_node = $this->lhist_node->append_child($prop_node);
84  $prop_node->set_attribute("Name", $class);
85  }
86  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ setFrom()

ilPCLearningHistory::setFrom ( string  $a_val)

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

53  : void
54  {
55  $this->lhist_node->set_attribute("From", $a_val);
56  }

◆ setNode()

ilPCLearningHistory::setNode ( php4DOMElement  $a_node)

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

References php4DOMNode\first_child().

36  : void
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  }
+ Here is the call graph for this function:

◆ setTo()

ilPCLearningHistory::setTo ( string  $a_val)

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

63  : void
64  {
65  $this->lhist_node->set_attribute("To", $a_val);
66  }

Field Documentation

◆ $lhist_node

php4DOMElement ilPCLearningHistory::$lhist_node
protected

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

◆ $user

ilObjUser ilPCLearningHistory::$user
protected

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


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