ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPCVerification.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 protected ilObjUser $user;
29
30 public function init(): void
31 {
32 global $DIC;
33
34 $this->user = $DIC->user();
35 $this->setType('vrfc');
36 }
37
38 public function create(
39 ilPageObject $a_pg_obj,
40 string $a_hier_id,
41 string $a_pc_id = ""
42 ): void {
43 $this->createInitialChildNode($a_hier_id, $a_pc_id, "Verification");
44 }
45
46 public function setData(
47 string $a_type,
48 int $a_id
49 ): void {
50 $this->getChildNode()->setAttribute('Type', $a_type);
51 $this->getChildNode()->setAttribute('Id', (string) $a_id);
52 $this->getChildNode()->setAttribute('User', (string) $this->user->getId());
53 }
54
58 public function getData(): ?array
59 {
60 if (is_object($this->getChildNode())) {
61 return [
62 'id' => $this->getChildNode()->getAttribute('Id'),
63 'type' => $this->getChildNode()->getattribute('Type'),
64 'user' => $this->getChildNode()->getAttribute('User')
65 ];
66 }
67
68 return null;
69 }
70
74 public static function getLangVars(): array
75 {
76 return [
77 'pc_vrfc',
78 'ed_insert_verification'
79 ];
80 }
81
82 public static function isInPortfolioPage(
83 ilPortfolioPage $a_page,
84 string $a_type,
85 int $a_id
86 ): bool {
87 // try to find verification in portfolio page
88 $a_page->buildDom();
89
90 $dom = $a_page->getDomDoc();
91
92 $xpath_temp = new DOMXPath($dom);
93 $nodes = $xpath_temp->query('//PageContent/Verification');
94 foreach ($nodes as $node) {
95 if ($node->getAttribute('Type') === $a_type && (int) $node->getAttribute('Id') === $a_id) {
96 return true;
97 }
98 }
99
100 return false;
101 }
102}
User class.
Class ilPCVerification Verification content object (see ILIAS DTD)
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
setData(string $a_type, int $a_id)
static isInPortfolioPage(ilPortfolioPage $a_page, string $a_type, int $a_id)
Content object of ilPageObject (see ILIAS DTD).
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])
setType(string $a_type)
Set Type.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
getDomDoc()
Get dom doc (DOMDocument)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26