ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 
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 
144  public function modifyPageContentPostXsl($a_html, $a_mode, $a_abstract_only = false)
145  {
147  $lng = $this->lng;
148 
149  //
150  // Note: this standard output is "overwritten", e.g. by ilPortfolioPageGUI::postOutputProcessing
151  //
152 
153  $c_pos = 0;
154  $start = strpos($a_html, "{{{{{PlaceHolder#");
155  if (is_int($start)) {
156  $end = strpos($a_html, "}}}}}", $start);
157  }
158  $i = 1;
159  while ($end > 0) {
160  $param = substr($a_html, $start + 17, $end - $start - 17);
161  $param = explode("#", $param);
162 
163  $html = $param[2];
164  switch ($param[2]) {
165  case "Text":
166  $html = $lng->txt("cont_text_placeh");
167  break;
168 
169  case "Media":
170  $html = $lng->txt("cont_media_placeh");
171  break;
172 
173  case "Question":
174  $html = $lng->txt("cont_question_placeh");
175  break;
176 
177  case "Verification":
178  $html = $lng->txt("cont_verification_placeh");
179  break;
180  }
181 
182  $h2 = substr($a_html, 0, $start) .
183  $html .
184  substr($a_html, $end + 5);
185  $a_html = $h2;
186  $i++;
187 
188  $start = strpos($a_html, "{{{{{PlaceHolder#", $start + 5);
189  $end = 0;
190  if (is_int($start)) {
191  $end = strpos($a_html, "}}}}}", $start);
192  }
193  }
194  return $a_html;
195  }
196 
200  public function getCssFiles($a_mode)
201  {
203  }
204 
205 }
static getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
create(&$a_pg_obj, $a_hier_id)
Create PlaceHolder Element.
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.
global $ilCtrl
Definition: ilias.php:18
setContentClass($a_class)
Set Content Class.
$param
Definition: xapitoken.php:31
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.
$DIC
Definition: xapitoken.php:46
getCssFiles($a_mode)
Get css files.
modifyPageContentPostXsl($a_html, $a_mode, $a_abstract_only=false)
setHeight($a_height)
Set Height.
$i
Definition: metadata.php:24