ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 116 of file class.ilPCResources.php.

117  {
118  if (is_object($this->res_node))
119  {
120  $children = $this->res_node->child_nodes();
121  if (is_object($children[0]) && $children[0]->node_name() == "ItemGroup")
122  {
123  return (int) $children[0]->get_attribute("RefId");
124  }
125  }
126  return false;
127  }

◆ getLangVars()

static ilPCResources::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

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

References array.

183  {
184  return array("pc_res");
185  }
Create styles array
The data for the language used.

◆ getMainType()

ilPCResources::getMainType ( )

Get main type.

Returns
int ref id

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

135  {
136  if (is_object($this->res_node))
137  {
138  $children = $this->res_node->child_nodes();
139  if (is_object($children[0]))
140  {
141  return $children[0]->node_name();
142  }
143  }
144  return false;
145  }

◆ getResourceListType()

ilPCResources::getResourceListType ( )

Get Resource Lis Type.

Returns
string resource type group

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

99  {
100  if (is_object($this->res_node))
101  {
102  $children = $this->res_node->child_nodes();
103  if (is_object($children[0]) && $children[0]->node_name() == "ResourceList")
104  {
105  return $children[0]->get_attribute("Type");
106  }
107  }
108  return false;
109  }

◆ 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 153 of file class.ilPCResources.php.

References $ref_id.

Referenced by ilObjItemGroup\fixContainerItemGroupRefsAfterCloning().

154  {
155  $dom = $a_page->getDom();
156 
157  if ($dom instanceof php4DOMDocument)
158  {
159  $dom = $dom->myDOMDocument;
160  }
161 
162  $xpath_temp = new DOMXPath($dom);
163  $igs = $xpath_temp->query("//Resources/ItemGroup");
164 
165  $updated = false;
166  foreach ($igs as $ig_node)
167  {
168  $ref_id = $ig_node->getAttribute("RefId");
169  if ($mappings[$ref_id] > 0)
170  {
171  $ig_node->setAttribute("RefId", $mappings[$ref_id]);
172  $updated = true;
173  }
174  }
175  return $updated;
176  }
$ref_id
Definition: sahs_server.php:39
+ 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 192 of file class.ilPCResources.php.

Referenced by ilPageObject\resolveResources().

193  {
194  return self::modifyItemGroupRefIdsByMapping($page, $ref_mappings);
195  }
+ 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 78 of file class.ilPCResources.php.

79  {
80  if (!empty($a_ref_id))
81  {
82  $children = $this->res_node->child_nodes();
83  for ($i=0; $i<count($children); $i++)
84  {
85  $this->res_node->remove_child($children[$i]);
86  }
87  $list_node = $this->dom->create_element("ItemGroup");
88  $list_node = $this->res_node->append_child($list_node);
89  $list_node->set_attribute("RefId", $a_ref_id);
90  }
91  }

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

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

Field Documentation

◆ $dom

ilPCResources::$dom

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

◆ $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: