ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPCAMDPageList 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 ilPCAMDPageList:
+ Collaboration diagram for ilPCAMDPageList:

Public Member Functions

 init ()
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 setData (array $a_fields_data, ?int $a_mode=null)
 
 getMode ()
 
 getFieldValues (?int $a_data_id=null)
 Get filter field values. More...
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj, ?PageManagerInterface $page_manager=null, ?ObjectAdapterInterface $object_adapter=null)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 getDomNode ()
 
 getDomDoc ()
 
 setDomNode (DOMNode $node)
 
 getChildNode ()
 
 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...
 
 getNewPageContentNode ()
 
 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 getLangVars ()
 
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)
 
static migrateField (int $a_field_id, array $mapping)
 Migrate search/filter values on advmd change. More...
 
- Static Public Member Functions inherited from ilPageContent
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 Attributes

ILIAS Wiki InternalDomainService $wiki_domain
 
ilDBInterface $db
 
ilLanguage $lng
 
- Protected Attributes inherited from ilPageContent
DOMDocument $dom_doc
 
ILIAS COPage InternalDomainService $domain
 
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 
ILIAS COPage Dom DomUtil $dom_util
 
PageManagerInterface $page_manager = null
 
ObjectAdapterInterface $object = null
 

Additional Inherited Members

- Data Fields inherited from ilPageContent
string $hier_id = ""
 
DOMNode $dom_node = null
 
string $page_lang = ""
 
- Protected Member Functions inherited from ilPageContent
 getPageManager ()
 
 setType (string $a_type)
 Set Type. More...
 
 hasNode ()
 
 createInitialChildNode (string $hier_id, string $pc_id, string $child, array $child_attributes=[])
 

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 Class ilPCAMDPageList

Advanced MD page list content object (see ILIAS DTD)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Member Function Documentation

◆ create()

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

Definition at line 47 of file class.ilPCAMDPageList.php.

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

51  : void {
52  $this->createPageContentNode();
53  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
54  $amdpl_node = $this->dom_doc->createElement("AMDPageList");
55  $amdpl_node = $this->getDomNode()->appendChild($amdpl_node);
56  }
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:

◆ getFieldValues()

ilPCAMDPageList::getFieldValues ( ?int  $a_data_id = null)

Get filter field values.

Definition at line 96 of file class.ilPCAMDPageList.php.

References $db, $ilDB, $res, and ilPageContent\getChildNode().

Referenced by handleCopiedContent().

98  : array {
99  $ilDB = $this->db;
100 
101  $res = array();
102 
103  if (!$a_data_id) {
104  if (is_object($this->getChildNode())) {
105  $a_data_id = $this->getChildNode()->getAttribute("Id");
106  }
107  }
108 
109  if ($a_data_id) {
110  $set = $ilDB->query("SELECT * FROM pg_amd_page_list" .
111  " WHERE id = " . $ilDB->quote($a_data_id, "integer"));
112  while ($row = $ilDB->fetchAssoc($set)) {
113  $res[$row["field_id"]] = unserialize((string) $row["sdata"], ["allowed_classes" => false]);
114  }
115  }
116  return $res;
117  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLangVars()

static ilPCAMDPageList::getLangVars ( )
static

Definition at line 42 of file class.ilPCAMDPageList.php.

42  : array
43  {
44  return array("ed_insert_amd_page_list", "pc_amdpl");
45  }

◆ getMode()

ilPCAMDPageList::getMode ( )

Definition at line 85 of file class.ilPCAMDPageList.php.

References ilPageContent\getChildNode().

85  : int
86  {
87  if (is_object($this->getChildNode())) {
88  return (int) $this->getChildNode()->getAttribute("Mode");
89  }
90  return 0;
91  }
+ Here is the call graph for this function:

◆ handleCopiedContent()

static ilPCAMDPageList::handleCopiedContent ( DOMDocument  $a_domdoc,
bool  $a_self_ass = true,
bool  $a_clone_mobs = false,
int  $new_parent_id = 0,
int  $obj_copy_id = 0 
)
static

Definition at line 118 of file class.ilPCAMDPageList.php.

References $db, $DIC, $ilDB, ilAdvancedMDRecord\_getSelectedRecordsByObject(), getFieldValues(), ilADTFactory\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), ilPageContent\getPage(), and null.

124  : void {
125  global $DIC;
126 
127  $ilDB = $DIC->database();
128  $old_id = 0;
129  $node = null;
130 
131  // #15688
132 
133  $xpath = new DOMXPath($a_domdoc);
134  $nodes = $xpath->query("//AMDPageList");
135  foreach ($nodes as $node) {
136  $old_id = $node->getAttribute("Id");
137  break;
138  }
139 
140  if ($old_id) {
141  $new_id = $ilDB->nextId("pg_amd_page_list");
142 
143  $set = $ilDB->query("SELECT * FROM pg_amd_page_list" .
144  " WHERE id = " . $ilDB->quote($old_id, "integer"));
145  while ($row = $ilDB->fetchAssoc($set)) {
146  $fields = array(
147  "id" => array("integer", $new_id)
148  ,"field_id" => array("integer", $row["field_id"])
149  ,"sdata" => array("text", $row["sdata"])
150  );
151  $ilDB->insert("pg_amd_page_list", $fields);
152  }
153 
154  $node->setAttribute("Id", $new_id);
155  }
156  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ init()

ilPCAMDPageList::init ( )

Definition at line 32 of file class.ilPCAMDPageList.php.

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

32  : void
33  {
34  global $DIC;
35 
36  $this->db = $DIC->database();
37  $this->lng = $DIC->language();
38  $this->setType("amdpl");
39  $this->wiki_domain = $DIC->wiki()->internal()->domain();
40  }
setType(string $a_type)
Set Type.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ migrateField()

static ilPCAMDPageList::migrateField ( int  $a_field_id,
array  $mapping 
)
static

Migrate search/filter values on advmd change.

In the mapping, keys are indices of old options, and values indices of associated new options.

Parameters
int$a_field_id
string[]$mapping

Definition at line 274 of file class.ilPCAMDPageList.php.

References $data, $DIC, and $ilDB.

Referenced by ilAdvancedMDFieldDefinitionSelect\update().

277  : void {
278  global $DIC;
279 
280  $ilDB = $DIC->database();
281 
282  // this does only work for select and select multi
283 
284  $set = $ilDB->query("SELECT * FROM pg_amd_page_list" .
285  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
286  while ($row = $ilDB->fetchAssoc($set)) {
287  $data = unserialize(unserialize((string) $row["sdata"], ["allowed_classes" => false]), ["allowed_classes" => false]);
288  if (!is_array($data)) {
289  continue;
290  }
291  $updated_data = $data;
292  foreach ($mapping as $old_option => $new_option) {
293  if (!in_array($old_option, $data)) {
294  continue;
295  }
296  $idx = array_search($old_option, $data);
297  if ($new_option !== '') {
298  $updated_data[$idx] = $new_option;
299  } else {
300  unset($updated_data[$idx]);
301  }
302  }
303 
304  $serialized_updated_data = serialize(empty($updated_data) ? '' : serialize($updated_data));
305 
306  $fields = array(
307  "sdata" => array("text", $serialized_updated_data)
308  );
309  $primary = array(
310  "id" => array("integer", $row["id"]),
311  "field_id" => array("integer", $row["field_id"])
312  );
313  $ilDB->update("pg_amd_page_list", $fields, $primary);
314  }
315  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ modifyPageContentPostXsl()

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

Definition at line 209 of file class.ilPCAMDPageList.php.

References $parts, getLanguage(), ilPageContent\getPage(), ILIAS\Repository\int(), and null.

213  : string {
214  if ($this->getPage()->getParentType() !== "wpg") {
215  return $a_output;
216  }
217  $end = 0;
218  $wiki_id = $this->getPage()->getWikiId();
219  $pm = $this->wiki_domain->page()->page($this->getPage()->getWikiRefId());
220 
221  $start = strpos($a_output, "[[[[[AMDPageList;");
222  if (is_int($start)) {
223  $end = strpos($a_output, "]]]]]", $start);
224  }
225  while ($end > 0) {
226  $parts = explode(";", substr($a_output, $start + 17, $end - $start - 17));
227 
228  $list_id = (int) $parts[0];
229  $list_mode = (count($parts) === 2)
230  ? (int) $parts[1]
231  : 0;
232 
233  $ltpl = new ilTemplate("tpl.wiki_amd_page_list.html", true, true, "components/ILIAS/Wiki");
234 
235  $pages = $this->findPages($list_id);
236  if (count($pages)) {
237  $ltpl->setCurrentBlock("page_bl");
238  foreach ($pages as $page_id => $page_title) {
239  // see ilWikiUtil::makeLink()
240  $frag = new stdClass();
241  $frag->mFragment = null;
242  $frag->mTextform = $page_title;
243 
244  $href = $pm->getPermaLink($page_id, $this->getPage()->getLanguage());
245  $ltpl->setVariable("PAGE", "<a href='" . $href . "'>" . $page_title . "</a>");
246  $ltpl->parseCurrentBlock();
247  }
248  } else {
249  $ltpl->touchBlock("no_hits_bl");
250  }
251 
252  $ltpl->setVariable("LIST_MODE", $list_mode ? "ol" : "ul");
253 
254  $a_output = substr($a_output, 0, $start) .
255  $ltpl->get() .
256  substr($a_output, $end + 5);
257 
258  $start = strpos($a_output, "[[[[[AMDPageList;", $start + 5);
259  $end = 0;
260  if (is_int($start)) {
261  $end = strpos($a_output, "]]]]]", $start);
262  }
263  }
264 
265  return $a_output;
266  }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getLanguage()
+ Here is the call graph for this function:

◆ setData()

ilPCAMDPageList::setData ( array  $a_fields_data,
?int  $a_mode = null 
)

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

References $db, $ilDB, and ilPageContent\getChildNode().

61  : void {
62  $ilDB = $this->db;
63 
64  $data_id = $this->getChildNode()->getAttribute("Id");
65  if ($data_id) {
66  $ilDB->manipulate("DELETE FROM pg_amd_page_list" .
67  " WHERE id = " . $ilDB->quote($data_id, "integer"));
68  } else {
69  $data_id = $ilDB->nextId("pg_amd_page_list");
70  $this->getChildNode()->setAttribute("Id", $data_id);
71  }
72 
73  $this->getChildNode()->setAttribute("Mode", (int) $a_mode);
74 
75  foreach ($a_fields_data as $field_id => $field_data) {
76  $fields = array(
77  "id" => array("integer", $data_id)
78  ,"field_id" => array("integer", $field_id)
79  ,"sdata" => array("text", serialize($field_data))
80  );
81  $ilDB->insert("pg_amd_page_list", $fields);
82  }
83  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilPCAMDPageList::$db
protected

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

Referenced by getFieldValues(), handleCopiedContent(), and setData().

◆ $lng

ilLanguage ilPCAMDPageList::$lng
protected

Definition at line 30 of file class.ilPCAMDPageList.php.

◆ $wiki_domain

ILIAS Wiki InternalDomainService ilPCAMDPageList::$wiki_domain
protected

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


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