ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
5 require_once("./Services/COPage/classes/class.ilPageContent.php");
6 
18 {
22  protected $user;
23 
24  public $dom;
25 
29  public function init()
30  {
31  global $DIC;
32 
33  $this->user = $DIC->user();
34  $this->setType("vrfc");
35  }
36 
40  public function setNode($a_node)
41  {
42  parent::setNode($a_node); // this is the PageContent node
43  $this->vrfc_node = $a_node->first_child(); // this is the verification node
44  }
45 
52  public function create(&$a_pg_obj, $a_hier_id, $a_pc_id = "")
53  {
54  $this->node = $this->createPageContentNode();
55  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
56  $this->vrfc_node = $this->dom->create_element("Verification");
57  $this->vrfc_node = $this->node->append_child($this->vrfc_node);
58  }
59 
66  public function setData($a_type, $a_id)
67  {
69 
70  $this->vrfc_node->set_attribute("Type", $a_type);
71  $this->vrfc_node->set_attribute("Id", $a_id);
72  $this->vrfc_node->set_attribute("User", $ilUser->getId());
73  }
74 
80  public function getData()
81  {
82  if (is_object($this->vrfc_node)) {
83  return array("id"=>$this->vrfc_node->get_attribute("Id"),
84  "type"=>$this->vrfc_node->get_attribute("Type"),
85  "user"=>$this->vrfc_node->get_attribute("User"));
86  }
87  }
88 
93  public static function getLangVars()
94  {
95  return array("pc_vrfc",
96  "ed_insert_verification");
97  }
98 
99  public static function isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
100  {
101  // try to find verification in portfolio page
102  $a_page->buildDom();
103  $dom = $a_page->getDom();
104  if ($dom instanceof php4DOMDocument) {
105  $dom = $dom->myDOMDocument;
106  }
107  $xpath_temp = new DOMXPath($dom);
108  $nodes = $xpath_temp->query("//PageContent/Verification");
109  foreach ($nodes as $node) {
110  if ($node->getAttribute("Type") == $a_type &&
111  $node->getAttribute("Id") == $a_id) {
112  return true;
113  }
114  }
115 
116  return false;
117  }
118 }
buildDom($a_force=false)
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create verification node in xml.
global $DIC
Definition: saml.php:7
init()
Init page content component.
static isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
static getLangVars()
Get lang vars needed for editing.
setType($a_type)
Set Type.
user()
Definition: user.php:4
Class ilPageContent.
setData($a_type, $a_id)
Set verification data.
$a_type
Definition: workflow.php:92
Class ilPCVerification.
$ilUser
Definition: imgupload.php:18
Page for user portfolio.
const IL_INSERT_AFTER
setNode($a_node)
Set node.
Create styles array
The data for the language used.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
getDom()
Deprecated php4DomDocument.
getData()
Get verification data.