ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPCPlaceHolder.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{
22 protected $ctrl;
23
27 protected $lng;
28
29 //class of placeholder
30
31 public $q_node; // node of Paragraph element
33 public $height;
34
38 public function init()
39 {
40 global $DIC;
41
42 $this->ctrl = $DIC->ctrl();
43 $this->lng = $DIC->language();
44 $this->setType("plach");
45 }
46
47
51 public function setNode($a_node)
52 {
53 parent::setNode($a_node); // this is the PageContent node
54 $this->q_node = $a_node->first_child(); //... and this the PlaceHolder
55 }
56
60 public function create(&$a_pg_obj, $a_hier_id)
61 {
62 $this->createPageContentNode();
63 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER);
64 $this->q_node = $this->dom->create_element("PlaceHolder");
65 $this->q_node = $this->node->append_child($this->q_node);
66 }
67
73 public function setContentClass($a_class)
74 {
75 if (is_object($this->q_node)) {
76 $this->q_node->set_attribute("ContentClass", $a_class);
77 }
78 }
79
85 public function getContentClass()
86 {
87 if (is_object($this->q_node)) {
88 return $this->q_node->get_attribute("ContentClass", $a_class);
89 }
90 return false;
91 }
92
98 public function setHeight($a_height)
99 {
100 if (is_object($this->q_node)) {
101 $this->q_node->set_attribute("Height", $a_height);
102 }
103 }
104
105
111 public function getHeight()
112 {
113 if (is_object($this->q_node)) {
114 return $this->q_node->get_attribute("Height", $a_class);
115 }
116 return false;
117 }
118
124 public function getClass()
125 {
126 return "";
127 }
128
133 public static function getLangVars()
134 {
135 return array("question_placeh","media_placeh","text_placeh",
136 "ed_insert_plach","question_placehl","media_placehl","text_placehl",
137 "verification_placeh", "verification_placehl");
138 }
139
140
147 public function modifyPageContentPostXsl($a_html, $a_mode)
148 {
151
152 //
153 // Note: this standard output is "overwritten", e.g. by ilPortfolioPageGUI::postOutputProcessing
154 //
155
156 $c_pos = 0;
157 $start = strpos($a_html, "{{{{{PlaceHolder#");
158 if (is_int($start)) {
159 $end = strpos($a_html, "}}}}}", $start);
160 }
161 $i = 1;
162 while ($end > 0) {
163 $param = substr($a_html, $start + 17, $end - $start - 17);
164 $param = explode("#", $param);
165
166 $html = $param[2];
167 switch ($param[2]) {
168 case "Text":
169 $html = $lng->txt("cont_text_placeh");
170 break;
171
172 case "Media":
173 $html = $lng->txt("cont_media_placeh");
174 break;
175
176 case "Question":
177 $html = $lng->txt("cont_question_placeh");
178 break;
179
180 case "Verification":
181 $html = $lng->txt("cont_verification_placeh");
182 break;
183 }
184
185 $h2 = substr($a_html, 0, $start) .
186 $html .
187 substr($a_html, $end + 5);
188 $a_html = $h2;
189 $i++;
190
191 $start = strpos($a_html, "{{{{{PlaceHolder#", $start + 5);
192 $end = 0;
193 if (is_int($start)) {
194 $end = strpos($a_html, "}}}}}", $start);
195 }
196 }
197 return $a_html;
198 }
199}
An exception for terminatinating execution or to throw for unit testing.
const IL_INSERT_AFTER
Class ilPlaceHolder.
static getLangVars()
Get lang vars needed for editing.
getContentClass()
Get Content Class.
setContentClass($a_class)
Set Content Class.
init()
Init page content component.
setNode($a_node)
Set node.
modifyPageContentPostXsl($a_html, $a_mode)
Modify page content after xsl.
setHeight($a_height)
Set Height.
getClass()
Get characteristic of PlaceHolder.
create(&$a_pg_obj, $a_hier_id)
Create PlaceHolder Element.
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.
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
$start
Definition: bench.php:8