5 require_once(
"./Services/COPage/classes/class.ilPCPlaceHolder.php");
6 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
37 public function __construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id =
"")
39 $this->pg_obj = $a_pg_obj;
40 $this->content_obj = $a_content_obj;
41 $this->hier_id = $a_hier_id;
42 $this->pc_id = $a_pc_id;
53 $next_class = $this->ctrl->getNextClass($this);
55 $cmd = $this->ctrl->getCmd();
59 case 'ilpcmediaobjectgui':
60 include_once(
"./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
61 $media_gui =
new ilPCMediaObjectGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
62 $ret = $this->ctrl->forwardCommand($media_gui);
78 $this->
propertyGUI(
"create", self::TYPE_TEXT,
"100px",
"insert");
86 if (
$_POST[
"plach_height"]==
"" ||
87 !preg_match(
"/[0-9]+/",
$_POST[
"plach_height"]))
93 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
94 $this->content_obj->setHeight(
$_POST[
"plach_height"].
"px");
95 $this->content_obj->setContentClass(
$_POST[
'plach_type']);
96 $this->updated = $this->pg_obj->update();
97 if ($this->updated ===
true)
99 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
129 $this->styleid = $a_styleid;
148 $this->content_obj->getContentClass(),
149 $this->content_obj->getHeight(),
155 switch ($this->content_obj->getContentClass())
157 case self::TYPE_MEDIA:
158 include_once(
"./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
159 $this->ctrl->setCmdClass(
"ilpcmediaobjectgui");
160 $this->ctrl->setCmd(
"insert");
162 $this->ctrl->forwardCommand($media_gui);
165 case self::TYPE_TEXT:
169 case self::TYPE_QUESTION:
170 include_once(
"./Services/COPage/classes/class.ilPCQuestionGUI.php");
171 $this->ctrl->setCmdClass(
"ilpcquestiongui");
172 $this->ctrl->setCmd(
"insert");
173 $question_gui =
new ilPCQuestionGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
174 $question_gui->setSelfAssessmentMode(
true);
175 $this->ctrl->forwardCommand($question_gui);
178 case self::TYPE_VERIFICATION:
179 include_once(
"./Services/COPage/classes/class.ilPCVerificationGUI.php");
180 $this->ctrl->setCmdClass(
"ilpcverificationgui");
181 $this->ctrl->setCmd(
"insert");
182 $cert_gui =
new ilPCVerificationGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
183 $this->ctrl->forwardCommand($cert_gui);
197 if (
$_POST[
"plach_height"]==
"" ||
198 !preg_match(
"/[0-9]+/",
$_POST[
"plach_height"])) {
202 $this->content_obj->setContentClass(
$_POST[
'plach_type']);
203 $this->content_obj->setHeight(
$_POST[
"plach_height"].
"px");
205 $this->updated = $this->pg_obj->update();
206 if ($this->updated ===
true)
208 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
212 $this->pg_obj->addHierIDs();
220 protected function propertyGUI($a_action,$a_type,$a_height,$a_mode)
224 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
226 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
227 $this->form_gui->setTitle($lng->txt(
"cont_ed_plachprop"));
233 $ttype_input->addOption(
new ilRadioOption($type_captions[$type], $type));
235 $ttype_input->setRequired(
true);
236 $this->form_gui->addItem($ttype_input);
238 $theight_input =
new ilTextInputGUI($lng->txt(
"height"),
"plach_height");
240 $theight_input->setMaxLength(3);
241 $theight_input->setTitle($lng->txt(
"height").
" (px)");
242 $theight_input->setRequired(
true);
243 $this->form_gui->addItem($theight_input);
245 $theight_input->setValue(preg_replace(
"/px/",
"",$a_height));
246 $ttype_input->setValue($a_type);
248 $this->form_gui->addCommandButton($a_action, $lng->txt($a_mode));
249 $this->form_gui->addCommandButton(
"cancelCreate", $lng->txt(
"cancel"));
250 $this->tpl->setContent($this->form_gui->getHTML());
260 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
262 $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
263 $this->form_gui->setTitle($lng->txt(
"cont_ed_select_pctext"));
268 $ttype_input->addOption(
new ilRadioOption($lng->txt(
"cont_ed_dtable"), 1));
269 $ttype_input->addOption(
new ilRadioOption($lng->txt(
"cont_ed_atable"), 2));
270 $ttype_input->addOption(
new ilRadioOption($lng->txt(
"cont_ed_list"), 3));
271 $ttype_input->addOption(
new ilRadioOption($lng->txt(
"cont_ed_flist"), 4));
272 $ttype_input->addOption(
new ilRadioOption($lng->txt(
"cont_tabs"), 5));
273 $this->form_gui->addItem($ttype_input);
275 $this->form_gui->addCommandButton(
"insertPCText", $lng->txt(
"insert"));
276 $this->form_gui->addCommandButton(
"cancelCreate", $lng->txt(
"cancel"));
277 $this->tpl->setContent($this->form_gui->getHTML());
285 switch (
$_POST[
'pctext_type'])
293 $ret_class = $this->ctrl->getReturnClass($this);
294 $this->ctrl->setParameterByClass($ret_class,
"pl_hier_id", $this->hier_id);
295 $this->ctrl->setParameterByClass($ret_class,
"pl_pc_id", $this->pc_id);
296 $this->ctrl->redirectByClass($ret_class,
297 "insertJSAtPlaceholder");
300 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
301 $this->ctrl->setCmdClass(
"ilpcparagraphgui");
302 $this->ctrl->setCmd(
"insert");
303 $paragraph_gui =
new ilPCParagraphGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
304 $paragraph_gui->setStyleId($this->
getStyleId());
306 $this->ctrl->forwardCommand($paragraph_gui);
310 include_once(
"./Services/COPage/classes/class.ilPCDataTableGUI.php");
311 $this->ctrl->setCmdClass(
"ilpcdatatablegui");
312 $this->ctrl->setCmd(
"insert");
313 $dtable_gui =
new ilPCDataTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
314 $this->ctrl->forwardCommand($dtable_gui);
318 include_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
319 $this->ctrl->setCmdClass(
"ilpctablegui");
320 $this->ctrl->setCmd(
"insert");
321 $atable_gui =
new ilPCTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
322 $this->ctrl->forwardCommand($atable_gui);
326 include_once(
"./Services/COPage/classes/class.ilPCListGUI.php");
327 $this->ctrl->setCmdClass(
"ilpclistgui");
328 $this->ctrl->setCmd(
"insert");
329 $list_gui =
new ilPCListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
330 $this->ctrl->forwardCommand($list_gui);
334 include_once (
"./Services/COPage/classes/class.ilPCFileListGUI.php");
335 $this->ctrl->setCmdClass(
"ilpcfilelistgui");
336 $this->ctrl->setCmd(
"insert");
337 $file_list_gui =
new ilPCFileListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
338 $file_list_gui->setStyleId($this->
getStyleId());
339 $this->ctrl->forwardCommand($file_list_gui);
343 include_once (
"./Services/COPage/classes/class.ilPCTabsGUI.php");
344 $this->ctrl->setCmdClass(
"ilpctabsgui");
345 $this->ctrl->setCmd(
"insert");
346 $tabs_gui =
new ilPCTabsGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
348 $this->ctrl->forwardCommand($tabs_gui);
361 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
367 if(method_exists($this->
getPageConfig(),
"getAvailablePlaceholderTypes"))
369 return $this->
getPageConfig()->getAvailablePlaceholderTypes();
373 return array(self::TYPE_TEXT, self::TYPE_MEDIA, self::TYPE_QUESTION);
381 self::TYPE_TEXT => $lng->txt(
"cont_ed_plachtext"),
382 self::TYPE_MEDIA => $lng->txt(
"cont_ed_plachmedia"),
383 self::TYPE_QUESTION => $lng->txt(
"cont_ed_plachquestion"),
384 self::TYPE_VERIFICATION => $lng->txt(
"cont_ed_plachverification")