ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
5 require_once("./Services/COPage/classes/class.ilPageContent.php");
6 
17 {
21  protected $ctrl;
22 
26  protected $lng;
27 
28  //class of placeholder
29 
30  public $q_node; // node of Paragraph element
32  public $height;
33 
37  public function init()
38  {
39  global $DIC;
40 
41  $this->ctrl = $DIC->ctrl();
42  $this->lng = $DIC->language();
43  $this->setType("plach");
44  }
45 
46 
50  public function setNode($a_node)
51  {
52  parent::setNode($a_node); // this is the PageContent node
53  $this->q_node = $a_node->first_child(); //... and this the PlaceHolder
54  }
55 
59  public function create(&$a_pg_obj, $a_hier_id, $a_pc_id = "")
60  {
61  $this->createPageContentNode();
62  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
63  $this->q_node = $this->dom->create_element("PlaceHolder");
64  $this->q_node = $this->node->append_child($this->q_node);
65  }
66 
72  public function setContentClass($a_class)
73  {
74  if (is_object($this->q_node)) {
75  $this->q_node->set_attribute("ContentClass", $a_class);
76  }
77  }
78 
84  public function getContentClass()
85  {
86  if (is_object($this->q_node)) {
87  return $this->q_node->get_attribute("ContentClass", $a_class);
88  }
89  return false;
90  }
91 
97  public function setHeight($a_height)
98  {
99  if (is_object($this->q_node)) {
100  $this->q_node->set_attribute("Height", $a_height);
101  }
102  }
103 
104 
110  public function getHeight()
111  {
112  if (is_object($this->q_node)) {
113  return $this->q_node->get_attribute("Height", $a_class);
114  }
115  return false;
116  }
117 
123  public function getClass()
124  {
125  return "";
126  }
127 
132  public static function getLangVars()
133  {
134  return array("question_placeh","media_placeh","text_placeh",
135  "ed_insert_plach","question_placehl","media_placehl","text_placehl",
136  "verification_placeh", "verification_placehl");
137  }
138 
139 
143  public function modifyPageContentPostXsl($a_html, $a_mode, $a_abstract_only = false)
144  {
145  $ilCtrl = $this->ctrl;
146  $lng = $this->lng;
147 
148  //
149  // Note: this standard output is "overwritten", e.g. by ilPortfolioPageGUI::postOutputProcessing
150  //
151 
152  $c_pos = 0;
153  $start = strpos($a_html, "{{{{{PlaceHolder#");
154  if (is_int($start)) {
155  $end = strpos($a_html, "}}}}}", $start);
156  }
157  $i = 1;
158  while ($end > 0) {
159  $param = substr($a_html, $start + 17, $end - $start - 17);
160  $param = explode("#", $param);
161 
162  $html = $param[2];
163  switch ($param[2]) {
164  case "Text":
165  $html = $lng->txt("cont_text_placeh");
166  break;
167 
168  case "Media":
169  $html = $lng->txt("cont_media_placeh");
170  break;
171 
172  case "Question":
173  $html = $lng->txt("cont_question_placeh");
174  break;
175 
176  case "Verification":
177  $html = $lng->txt("cont_verification_placeh");
178  break;
179  }
180 
181  $h2 = substr($a_html, 0, $start) .
182  $html .
183  substr($a_html, $end + 5);
184  $a_html = $h2;
185  $i++;
186 
187  $start = strpos($a_html, "{{{{{PlaceHolder#", $start + 5);
188  $end = 0;
189  if (is_int($start)) {
190  $end = strpos($a_html, "}}}}}", $start);
191  }
192  }
193  return $a_html;
194  }
195 
199  public function getModel()
200  {
201  $model = new \stdClass();
202  $model->contentClass = $this->getContentClass();;
203  return $model;
204  }
205 
209  public function getCssFiles($a_mode)
210  {
212  }
213 
214 }
static getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
getContentClass()
Get Content Class.
getClass()
Get characteristic of PlaceHolder.
setType($a_type)
Set Type.
static getLangVars()
Get lang vars needed for editing.
Class ilPageContent.
init()
Init page content component.
setContentClass($a_class)
Set Content Class.
$param
Definition: xapitoken.php:29
global $DIC
Definition: goto.php:24
const IL_INSERT_AFTER
setNode($a_node)
Set node.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
Class ilPlaceHolder.
getCssFiles($a_mode)
Get css files.
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create PlaceHolder Element.
modifyPageContentPostXsl($a_html, $a_mode, $a_abstract_only=false)
setHeight($a_height)
Set Height.
$i
Definition: metadata.php:24