ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPCPlaceHolderGUI Class Reference

Class ilPCPlaceHolderGUI. More...

+ Inheritance diagram for ilPCPlaceHolderGUI:
+ Collaboration diagram for ilPCPlaceHolderGUI:

Public Member Functions

 __construct ($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 edit ()
 Handle Editing. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 cancel ()
 Cancel. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 display validation errors More...
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions ($a_type)
 Get table templates. More...
 

Data Fields

 $pg_obj
 
 $content_obj
 
 $hier_id
 
 $pc_id
 
const TYPE_TEXT = "Text"
 
const TYPE_QUESTION = "Question"
 
const TYPE_MEDIA = "Media"
 
const TYPE_VERIFICATION = "Verification"
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $ilias
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 

Protected Member Functions

 insert ()
 Handle Insert. More...
 
 create ()
 create new table in dom and update page in db More...
 
 edit_object ()
 Handle Editing Private Methods. More...
 
 forward_edit ()
 
 saveProperties ()
 save placeholder properties in db and return to page edit screen More...
 
 propertyGUI ($a_action, $a_type, $a_height, $a_mode)
 Object Property GUI. More...
 
 textCOSelectionGUI ()
 Text Item Selection. More...
 
 insertPCText ()
 Forwards Text Item Selection to GUI classes. More...
 
 getAvailableTypes ($a_selected_type="")
 
 getTypeCaptions ()
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 

Protected Attributes

 $styleid
 
- Protected Attributes inherited from ilPageContentGUI
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Static Public Attributes inherited from ilPageContentGUI
static $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

Class ilPCPlaceHolderGUI.

User Interface for Place Holder Management

Author
Hendrik Holtmann holtm.nosp@m.ann@.nosp@m.me.co.nosp@m.m
Version
Id
class.ilPCListGUI.php 17506 2008-09-24 13:48:46Z akill

ilPCPlaceHolderGUI: ilPCMediaObjectGUI

Definition at line 20 of file class.ilPCPlaceHolderGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCPlaceHolderGUI::__construct (   $a_pg_obj,
  $a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor public.

Definition at line 37 of file class.ilPCPlaceHolderGUI.php.

38  {
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;
43 
44  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
45  }

Member Function Documentation

◆ cancel()

ilPCPlaceHolderGUI::cancel ( )

Cancel.

Definition at line 359 of file class.ilPCPlaceHolderGUI.php.

360  {
361  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
362  }

◆ create()

ilPCPlaceHolderGUI::create ( )
protected

create new table in dom and update page in db

Definition at line 84 of file class.ilPCPlaceHolderGUI.php.

References $_POST, ilPageContentGUI\getPage(), and insert().

85  {
86  if ($_POST["plach_height"]=="" ||
87  !preg_match("/[0-9]+/",$_POST["plach_height"]))
88  {
89  return $this->insert();
90  }
91 
92  $this->content_obj = new ilPCPlaceHolder($this->getPage());
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)
98  {
99  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
100  }
101  else
102  {
103  $this->insert();
104  }
105  }
Class ilPlaceHolder.
$_POST["username"]
+ Here is the call graph for this function:

◆ edit()

ilPCPlaceHolderGUI::edit ( )

Handle Editing.

Definition at line 110 of file class.ilPCPlaceHolderGUI.php.

References edit_object(), forward_edit(), and ilPageContentGUI\getPageConfig().

Referenced by saveProperties().

111  {
112  if($this->getPageConfig()->getEnablePCType("PlaceHolder"))
113  {
114  $this->edit_object();
115  }
116  else
117  {
118  $this->forward_edit();
119  }
120  }
getPageConfig()
Get Page Config.
edit_object()
Handle Editing Private Methods.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_object()

ilPCPlaceHolderGUI::edit_object ( )
protected

Handle Editing Private Methods.

Definition at line 145 of file class.ilPCPlaceHolderGUI.php.

References propertyGUI().

Referenced by edit(), and saveProperties().

146  {
147  $this->propertyGUI("saveProperties",
148  $this->content_obj->getContentClass(),
149  $this->content_obj->getHeight(),
150  "save");
151  }
propertyGUI($a_action, $a_type, $a_height, $a_mode)
Object Property GUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCPlaceHolderGUI::executeCommand ( )

execute command

Definition at line 50 of file class.ilPCPlaceHolderGUI.php.

References $cmd, and $ret.

51  {
52  // get next class that processes or forwards current command
53  $next_class = $this->ctrl->getNextClass($this);
54  // get current command
55  $cmd = $this->ctrl->getCmd();
56 
57  switch($next_class)
58  {
59  case 'ilpcmediaobjectgui': //special handling
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);
63  break;
64 
65  default:
66  $ret = $this->$cmd();
67  break;
68  }
69 
70  return $ret;
71  }
$cmd
Definition: sahs_server.php:35
Class ilPCMediaObjectGUI.
$ret
Definition: parser.php:6

◆ forward_edit()

ilPCPlaceHolderGUI::forward_edit ( )
protected

Definition at line 153 of file class.ilPCPlaceHolderGUI.php.

References textCOSelectionGUI().

Referenced by edit().

154  {
155  switch ($this->content_obj->getContentClass())
156  {
157  case self::TYPE_MEDIA:
158  include_once("./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
159  $this->ctrl->setCmdClass("ilpcmediaobjectgui");
160  $this->ctrl->setCmd("insert");
161  $media_gui = new ilPCMediaObjectGUI($this->pg_obj, null);
162  $this->ctrl->forwardCommand($media_gui);
163  break;
164 
165  case self::TYPE_TEXT:
166  $this->textCOSelectionGUI();
167  break;
168 
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);
176  break;
177 
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);
184  break;
185 
186  default:
187  break;
188  }
189  }
Class ilPCMediaObjectGUI.
Class ilPCVerificationGUI.
Class ilPCQuestionGUI.
textCOSelectionGUI()
Text Item Selection.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableTypes()

ilPCPlaceHolderGUI::getAvailableTypes (   $a_selected_type = "")
protected

Definition at line 364 of file class.ilPCPlaceHolderGUI.php.

References array, ilPageContentGUI\getPageConfig(), and ilCertificate\isActive().

Referenced by propertyGUI().

365  {
366  // custom config?
367  if(method_exists($this->getPageConfig(), "getAvailablePlaceholderTypes"))
368  {
369  $types = $this->getPageConfig()->getAvailablePlaceholderTypes();
370  }
371  else
372  {
373  $types = array(self::TYPE_TEXT, self::TYPE_MEDIA, self::TYPE_QUESTION);
374  }
375 
376  include_once("./Services/Certificate/classes/class.ilCertificate.php");
378  {
379  // we remove type verification if certificates are deactivated and this
380  // is not the currently selected value
381  if (($key = array_search(self::TYPE_VERIFICATION, $types)) !== false &&
382  self::TYPE_VERIFICATION != $a_selected_type)
383  {
384  unset($types[$key]);
385  }
386  }
387  return $types;
388  }
getPageConfig()
Get Page Config.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleId()

ilPCPlaceHolderGUI::getStyleId ( )

Get Style Id.

Returns
int Style Id

Definition at line 137 of file class.ilPCPlaceHolderGUI.php.

References $styleid.

Referenced by insertPCText().

138  {
139  return $this->styleid;
140  }
+ Here is the caller graph for this function:

◆ getTypeCaptions()

ilPCPlaceHolderGUI::getTypeCaptions ( )
protected

Definition at line 390 of file class.ilPCPlaceHolderGUI.php.

References ilPageContentGUI\$lng, and array.

Referenced by propertyGUI().

391  {
392  global $lng;
393 
394  return array(
395  self::TYPE_TEXT => $lng->txt("cont_ed_plachtext"),
396  self::TYPE_MEDIA => $lng->txt("cont_ed_plachmedia"),
397  self::TYPE_QUESTION => $lng->txt("cont_ed_plachquestion"),
398  self::TYPE_VERIFICATION => $lng->txt("cont_ed_plachverification")
399  );
400  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ insert()

ilPCPlaceHolderGUI::insert ( )
protected

Handle Insert.

Definition at line 76 of file class.ilPCPlaceHolderGUI.php.

References propertyGUI().

Referenced by create().

77  {
78  $this->propertyGUI("create", self::TYPE_TEXT, "100px", "insert");
79  }
propertyGUI($a_action, $a_type, $a_height, $a_mode)
Object Property GUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPCText()

ilPCPlaceHolderGUI::insertPCText ( )
protected

Forwards Text Item Selection to GUI classes.

Definition at line 283 of file class.ilPCPlaceHolderGUI.php.

References $_POST, ilPageEditorGUI\_doJSEditing(), ilPageContentGUI\getPageConfig(), and getStyleId().

284  {
285  switch ($_POST['pctext_type'])
286  {
287  case 0: //Paragraph / Text
288 
289  // js editing? -> redirect to js page editor
290  // if ($ilSetting->get("enable_js_edit", 1) && ilPageEditorGUI::_doJSEditing())
292  {
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");
298  }
299 
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());
305  $paragraph_gui->setPageConfig($this->getPageConfig());
306  $this->ctrl->forwardCommand($paragraph_gui);
307  break;
308 
309  case 1: //DataTable
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);
315  break;
316 
317  case 2: //Advanced Table
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);
323  break;
324 
325  case 3: //Advanced List
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);
331  break;
332 
333  case 4: //File List
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);
340  break;
341 
342  case 5: //Tabs
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);
347  $tabs_gui->setStyleId($this->getStyleId());
348  $this->ctrl->forwardCommand($tabs_gui);
349  break;
350 
351  default:
352  break;
353  }
354  }
Class ilPCListGUI.
getPageConfig()
Get Page Config.
static _doJSEditing()
checks if current user has activated js editing and if browser is js capable
Class ilPCTableGUI.
Class ilPCListGUI.
Class ilPCTableGUI.
Class ilPCTabsGUI.
$_POST["username"]
Class ilPCParagraphGUI.
+ Here is the call graph for this function:

◆ propertyGUI()

ilPCPlaceHolderGUI::propertyGUI (   $a_action,
  $a_type,
  $a_height,
  $a_mode 
)
protected

Object Property GUI.

Definition at line 220 of file class.ilPCPlaceHolderGUI.php.

References $a_type, ilPageContentGUI\$lng, getAvailableTypes(), getTypeCaptions(), and ilTextInputGUI\setSize().

Referenced by edit_object(), and insert().

221  {
222  global $lng;
223 
224  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
225  $this->form_gui = new ilPropertyFormGUI();
226  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
227  $this->form_gui->setTitle($lng->txt("cont_ed_plachprop"));
228 
229  $ttype_input = new ilRadioGroupInputGUI($lng->txt("type"), "plach_type");
230  $type_captions = $this->getTypeCaptions();
231  foreach($this->getAvailableTypes($a_type) as $type)
232  {
233  $ttype_input->addOption(new ilRadioOption($type_captions[$type], $type));
234  }
235  $ttype_input->setRequired(true);
236  $this->form_gui->addItem($ttype_input);
237 
238  $theight_input = new ilTextInputGUI($lng->txt("height"),"plach_height");
239  $theight_input->setSize(4);
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);
244 
245  $theight_input->setValue(preg_replace("/px/","",$a_height));
246  $ttype_input->setValue($a_type);
247 
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());
251  }
This class represents an option in a radio group.
This class represents a property form user interface.
$a_type
Definition: workflow.php:93
This class represents a property in a property form.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
getAvailableTypes($a_selected_type="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveProperties()

ilPCPlaceHolderGUI::saveProperties ( )
protected

save placeholder properties in db and return to page edit screen

Definition at line 195 of file class.ilPCPlaceHolderGUI.php.

References $_POST, edit(), and edit_object().

196  {
197  if ($_POST["plach_height"]=="" ||
198  !preg_match("/[0-9]+/",$_POST["plach_height"])) {
199  return $this->edit_object();
200  }
201 
202  $this->content_obj->setContentClass($_POST['plach_type']);
203  $this->content_obj->setHeight($_POST["plach_height"]."px");
204 
205  $this->updated = $this->pg_obj->update();
206  if ($this->updated === true)
207  {
208  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
209  }
210  else
211  {
212  $this->pg_obj->addHierIDs();
213  $this->edit();
214  }
215  }
edit_object()
Handle Editing Private Methods.
$_POST["username"]
+ Here is the call graph for this function:

◆ setStyleId()

ilPCPlaceHolderGUI::setStyleId (   $a_styleid)

Set Style Id.

Parameters
int$a_styleidStyle Id

Definition at line 127 of file class.ilPCPlaceHolderGUI.php.

128  {
129  $this->styleid = $a_styleid;
130  }

◆ textCOSelectionGUI()

ilPCPlaceHolderGUI::textCOSelectionGUI ( )
protected

Text Item Selection.

Definition at line 256 of file class.ilPCPlaceHolderGUI.php.

References ilPageContentGUI\$lng, and ilRadioGroupInputGUI\addOption().

Referenced by forward_edit().

257  {
258  global $lng;
259 
260  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
261  $this->form_gui = new ilPropertyFormGUI();
262  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
263  $this->form_gui->setTitle($lng->txt("cont_ed_select_pctext"));
264 
265  // Select Question Type
266  $ttype_input = new ilRadioGroupInputGUI($lng->txt("cont_ed_textitem"), "pctext_type");
267  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_par"), 0));
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);
274 
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());
278  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a property in a property form.
addOption($a_option)
Add Option.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $content_obj

ilPCPlaceHolderGUI::$content_obj

Definition at line 23 of file class.ilPCPlaceHolderGUI.php.

◆ $hier_id

ilPCPlaceHolderGUI::$hier_id

Definition at line 24 of file class.ilPCPlaceHolderGUI.php.

◆ $pc_id

ilPCPlaceHolderGUI::$pc_id

Definition at line 25 of file class.ilPCPlaceHolderGUI.php.

◆ $pg_obj

ilPCPlaceHolderGUI::$pg_obj

Definition at line 22 of file class.ilPCPlaceHolderGUI.php.

◆ $styleid

ilPCPlaceHolderGUI::$styleid
protected

Definition at line 26 of file class.ilPCPlaceHolderGUI.php.

Referenced by getStyleId().

◆ TYPE_MEDIA

const ilPCPlaceHolderGUI::TYPE_MEDIA = "Media"

◆ TYPE_QUESTION

const ilPCPlaceHolderGUI::TYPE_QUESTION = "Question"

Definition at line 29 of file class.ilPCPlaceHolderGUI.php.

◆ TYPE_TEXT

const ilPCPlaceHolderGUI::TYPE_TEXT = "Text"

◆ TYPE_VERIFICATION

const ilPCPlaceHolderGUI::TYPE_VERIFICATION = "Verification"

The documentation for this class was generated from the following file: