ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCVerification.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once("./Services/COPage/classes/class.ilPageContent.php");
6
18{
19 var $dom;
20
24 function init()
25 {
26 $this->setType("vrfc");
27 }
28
32 function setNode(&$a_node)
33 {
34 parent::setNode($a_node); // this is the PageContent node
35 $this->vrfc_node =& $a_node->first_child(); // this is the verification node
36 }
37
44 function create(&$a_pg_obj, $a_hier_id, $a_pc_id = "")
45 {
46 $this->node = $this->createPageContentNode();
47 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
48 $this->vrfc_node = $this->dom->create_element("Verification");
49 $this->vrfc_node = $this->node->append_child($this->vrfc_node);
50 }
51
58 function setData($a_type, $a_id)
59 {
60 global $ilUser;
61
62 $this->vrfc_node->set_attribute("Type", $a_type);
63 $this->vrfc_node->set_attribute("Id", $a_id);
64 $this->vrfc_node->set_attribute("User", $ilUser->getId());
65 }
66
72 function getData()
73 {
74 if (is_object($this->vrfc_node))
75 {
76 return array("id"=>$this->vrfc_node->get_attribute("Id"),
77 "type"=>$this->vrfc_node->get_attribute("Type"),
78 "user"=>$this->vrfc_node->get_attribute("User"));
79 }
80 }
81
86 static function getLangVars()
87 {
88 return array("pc_vrfc",
89 "ed_insert_verification");
90 }
91
92 public static function isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
93 {
94 // try to find verification in portfolio page
95 $a_page->buildDom();
96 $dom = $a_page->getDom();
97 if($dom instanceof php4DOMDocument)
98 {
99 $dom = $dom->myDOMDocument;
100 }
101 $xpath_temp = new DOMXPath($dom);
102 $nodes = $xpath_temp->query("//PageContent/Verification");
103 foreach($nodes as $node)
104 {
105 if($node->getAttribute("Type") == $a_type &&
106 $node->getAttribute("Id") == $a_id)
107 {
108 return true;
109 }
110 }
111
112 return false;
113 }
114}
115
116?>
const IL_INSERT_AFTER
Class ilPCVerification.
init()
Init page content component.
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create verification node in xml.
static isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
getData()
Get verification data.
static getLangVars()
Get lang vars needed for editing.
setNode(&$a_node)
Set node.
setData($a_type, $a_id)
Set verification data.
Class ilPageContent.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
setType($a_type)
Set Type.
buildDom($a_force=false)
getDom()
Deprecated php4DomDocument.
Page for user portfolio.
global $ilUser
Definition: imgupload.php:15