ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPCResources Class Reference

Class ilPCResources. More...

+ Inheritance diagram for ilPCResources:
+ Collaboration diagram for ilPCResources:

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set node. More...
 
 create (&$a_pg_obj, $a_hier_id, $a_pc_id="")
 Create resources node in xml. More...
 
 setResourceListType ($a_type)
 Set Type of Resource List (currently only one) More...
 
 setItemGroupRefId ($a_ref_id)
 Set Item Group Ref Id. More...
 
 getResourceListType ()
 Get Resource Lis Type. More...
 
 getItemGroupRefId ()
 Get item group ref id. More...
 
 getMainType ()
 Get main type. 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 modifyItemGroupRefIdsByMapping ($a_page, $mappings)
 Modify ref ids by mapping. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static resolveResources (ilPageObject $page, $ref_mappings)
 Resolve resources. 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
 
 $res_node
 
- Data Fields inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 

Additional Inherited Members

- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 
- Protected Attributes inherited from ilPageContent
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Detailed Description

Class ilPCResources.

Resources content object (see ILIAS DTD). Inserts Repository Resources of a Container Object,

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 17 of file class.ilPCResources.php.

Member Function Documentation

◆ create()

ilPCResources::create ( $a_pg_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Create resources node in xml.

Parameters
object$a_pg_objPage Object
string$a_hier_idHierarchical ID

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

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

46  {
47  $this->node = $this->createPageContentNode();
48  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
49  $this->res_node = $this->dom->create_element("Resources");
50  $this->res_node = $this->node->append_child($this->res_node);
51  }
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:

◆ getItemGroupRefId()

ilPCResources::getItemGroupRefId ( )

Get item group ref id.

Returns
int ref id

Definition at line 110 of file class.ilPCResources.php.

111  {
112  if (is_object($this->res_node)) {
113  $children = $this->res_node->child_nodes();
114  if (is_object($children[0]) && $children[0]->node_name() == "ItemGroup") {
115  return (int) $children[0]->get_attribute("RefId");
116  }
117  }
118  return false;
119  }

◆ getLangVars()

static ilPCResources::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

Definition at line 169 of file class.ilPCResources.php.

References array.

170  {
171  return array("pc_res");
172  }
Create styles array
The data for the language used.

◆ getMainType()

ilPCResources::getMainType ( )

Get main type.

Returns
int ref id

Definition at line 126 of file class.ilPCResources.php.

127  {
128  if (is_object($this->res_node)) {
129  $children = $this->res_node->child_nodes();
130  if (is_object($children[0])) {
131  return $children[0]->node_name();
132  }
133  }
134  return false;
135  }

◆ getResourceListType()

ilPCResources::getResourceListType ( )

Get Resource Lis Type.

Returns
string resource type group

Definition at line 94 of file class.ilPCResources.php.

95  {
96  if (is_object($this->res_node)) {
97  $children = $this->res_node->child_nodes();
98  if (is_object($children[0]) && $children[0]->node_name() == "ResourceList") {
99  return $children[0]->get_attribute("Type");
100  }
101  }
102  return false;
103  }

◆ init()

ilPCResources::init ( )

Init page content component.

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

References ilPageContent\setType().

26  {
27  $this->setType("repobj");
28  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

◆ modifyItemGroupRefIdsByMapping()

static ilPCResources::modifyItemGroupRefIdsByMapping (   $a_page,
  $mappings 
)
static

Modify ref ids by mapping.

Parameters

Definition at line 143 of file class.ilPCResources.php.

References $dom.

Referenced by ilObjItemGroup\fixContainerItemGroupRefsAfterCloning().

144  {
145  $dom = $a_page->getDom();
146 
147  if ($dom instanceof php4DOMDocument) {
148  $dom = $dom->myDOMDocument;
149  }
150 
151  $xpath_temp = new DOMXPath($dom);
152  $igs = $xpath_temp->query("//Resources/ItemGroup");
153 
154  $updated = false;
155  foreach ($igs as $ig_node) {
156  $ref_id = $ig_node->getAttribute("RefId");
157  if ($mappings[$ref_id] > 0) {
158  $ig_node->setAttribute("RefId", $mappings[$ref_id]);
159  $updated = true;
160  }
161  }
162  return $updated;
163  }
+ Here is the caller graph for this function:

◆ resolveResources()

static ilPCResources::resolveResources ( ilPageObject  $page,
  $ref_mappings 
)
static

Resolve resources.

Parameters
ilPageObject$page

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

Referenced by ilPageObject\resolveResources().

180  {
181  return self::modifyItemGroupRefIdsByMapping($page, $ref_mappings);
182  }
+ Here is the caller graph for this function:

◆ setItemGroupRefId()

ilPCResources::setItemGroupRefId (   $a_ref_id)

Set Item Group Ref Id.

Parameters
int$a_ref_iditem group ref id

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

References $i.

77  {
78  if (!empty($a_ref_id)) {
79  $children = $this->res_node->child_nodes();
80  for ($i=0; $i<count($children); $i++) {
81  $this->res_node->remove_child($children[$i]);
82  }
83  $list_node = $this->dom->create_element("ItemGroup");
84  $list_node = $this->res_node->append_child($list_node);
85  $list_node->set_attribute("RefId", $a_ref_id);
86  }
87  }
$i
Definition: disco.tpl.php:19

◆ setNode()

ilPCResources::setNode (   $a_node)

Set node.

Definition at line 33 of file class.ilPCResources.php.

34  {
35  parent::setNode($a_node); // this is the PageContent node
36  $this->res_node = $a_node->first_child(); // this is the Resources node
37  }

◆ setResourceListType()

ilPCResources::setResourceListType (   $a_type)

Set Type of Resource List (currently only one)

Parameters
string$a_typeResource Type Group

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

References $a_type, and $i.

59  {
60  if (!empty($a_type)) {
61  $children = $this->res_node->child_nodes();
62  for ($i=0; $i<count($children); $i++) {
63  $this->res_node->remove_child($children[$i]);
64  }
65  $list_node = $this->dom->create_element("ResourceList");
66  $list_node = $this->res_node->append_child($list_node);
67  $list_node->set_attribute("Type", $a_type);
68  }
69  }
$a_type
Definition: workflow.php:92
$i
Definition: disco.tpl.php:19

Field Documentation

◆ $dom

ilPCResources::$dom

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

Referenced by modifyItemGroupRefIdsByMapping().

◆ $res_node

ilPCResources::$res_node

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


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