ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 
 $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
 $error
 
 $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.

References $DIC.

38  {
39  global $DIC;
40 
41  $this->lng = $DIC->language();
42  $this->pg_obj = $a_pg_obj;
43  $this->content_obj = $a_content_obj;
44  $this->hier_id = $a_hier_id;
45  $this->pc_id = $a_pc_id;
46 
47  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
48  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ cancel()

ilPCPlaceHolderGUI::cancel ( )

Cancel.

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

352  {
353  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
354  }

◆ create()

ilPCPlaceHolderGUI::create ( )
protected

create new table in dom and update page in db

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

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

87  {
88  if ($_POST["plach_height"]=="" ||
89  !preg_match("/[0-9]+/", $_POST["plach_height"])) {
90  return $this->insert();
91  }
92 
93  $this->content_obj = new ilPCPlaceHolder($this->getPage());
94  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
95  $this->content_obj->setHeight($_POST["plach_height"] . "px");
96  $this->content_obj->setContentClass($_POST['plach_type']);
97  $this->updated = $this->pg_obj->update();
98  if ($this->updated === true) {
99  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
100  } else {
101  $this->insert();
102  }
103  }
Class ilPlaceHolder.
$_POST["username"]
+ Here is the call graph for this function:

◆ edit()

ilPCPlaceHolderGUI::edit ( )

Handle Editing.

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

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

Referenced by saveProperties().

109  {
110  if ($this->getPageConfig()->getEnablePCType("PlaceHolder")) {
111  $this->edit_object();
112  } else {
113  $this->forward_edit();
114  }
115  }
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 140 of file class.ilPCPlaceHolderGUI.php.

References propertyGUI().

Referenced by edit(), and saveProperties().

141  {
142  $this->propertyGUI(
143  "saveProperties",
144  $this->content_obj->getContentClass(),
145  $this->content_obj->getHeight(),
146  "save"
147  );
148  }
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 53 of file class.ilPCPlaceHolderGUI.php.

References $ret.

54  {
55  // get next class that processes or forwards current command
56  $next_class = $this->ctrl->getNextClass($this);
57  // get current command
58  $cmd = $this->ctrl->getCmd();
59 
60  switch ($next_class) {
61  case 'ilpcmediaobjectgui': //special handling
62  include_once("./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
63  $media_gui = new ilPCMediaObjectGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
64  $ret = $this->ctrl->forwardCommand($media_gui);
65  break;
66 
67  default:
68  $ret = $this->$cmd();
69  break;
70  }
71 
72  return $ret;
73  }
Class ilPCMediaObjectGUI.
$ret
Definition: parser.php:6

◆ forward_edit()

ilPCPlaceHolderGUI::forward_edit ( )
protected

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

References textCOSelectionGUI().

Referenced by edit().

151  {
152  switch ($this->content_obj->getContentClass()) {
153  case self::TYPE_MEDIA:
154  include_once("./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
155  $this->ctrl->setCmdClass("ilpcmediaobjectgui");
156  $this->ctrl->setCmd("insert");
157  $media_gui = new ilPCMediaObjectGUI($this->pg_obj, null);
158  $this->ctrl->forwardCommand($media_gui);
159  break;
160 
161  case self::TYPE_TEXT:
162  $this->textCOSelectionGUI();
163  break;
164 
165  case self::TYPE_QUESTION:
166  include_once("./Services/COPage/classes/class.ilPCQuestionGUI.php");
167  $this->ctrl->setCmdClass("ilpcquestiongui");
168  $this->ctrl->setCmd("insert");
169  $question_gui = new ilPCQuestionGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
170  $question_gui->setSelfAssessmentMode(true);
171  $this->ctrl->forwardCommand($question_gui);
172  break;
173 
174  case self::TYPE_VERIFICATION:
175  include_once("./Services/COPage/classes/class.ilPCVerificationGUI.php");
176  $this->ctrl->setCmdClass("ilpcverificationgui");
177  $this->ctrl->setCmd("insert");
178  $cert_gui = new ilPCVerificationGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
179  $this->ctrl->forwardCommand($cert_gui);
180  break;
181 
182  default:
183  break;
184  }
185  }
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 356 of file class.ilPCPlaceHolderGUI.php.

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

Referenced by propertyGUI().

357  {
358  // custom config?
359  if (method_exists($this->getPageConfig(), "getAvailablePlaceholderTypes")) {
360  $types = $this->getPageConfig()->getAvailablePlaceholderTypes();
361  } else {
362  $types = array(self::TYPE_TEXT, self::TYPE_MEDIA, self::TYPE_QUESTION);
363  }
364 
365  include_once("./Services/Certificate/classes/class.ilCertificate.php");
366  if (!ilCertificate::isActive()) {
367  // we remove type verification if certificates are deactivated and this
368  // is not the currently selected value
369  if (($key = array_search(self::TYPE_VERIFICATION, $types)) !== false &&
370  self::TYPE_VERIFICATION != $a_selected_type) {
371  unset($types[$key]);
372  }
373  }
374  return $types;
375  }
getPageConfig()
Get Page Config.
Create styles array
The data for the language used.
$key
Definition: croninfo.php:18
+ 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 132 of file class.ilPCPlaceHolderGUI.php.

References $styleid.

Referenced by insertPCText().

133  {
134  return $this->styleid;
135  }
+ Here is the caller graph for this function:

◆ getTypeCaptions()

ilPCPlaceHolderGUI::getTypeCaptions ( )
protected

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

References ilPageContentGUI\$lng, and array.

Referenced by propertyGUI().

378  {
379  $lng = $this->lng;
380 
381  return array(
382  self::TYPE_TEXT => $lng->txt("cont_ed_plachtext"),
383  self::TYPE_MEDIA => $lng->txt("cont_ed_plachmedia"),
384  self::TYPE_QUESTION => $lng->txt("cont_ed_plachquestion"),
385  self::TYPE_VERIFICATION => $lng->txt("cont_ed_plachverification")
386  );
387  }
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 78 of file class.ilPCPlaceHolderGUI.php.

References propertyGUI().

Referenced by create().

79  {
80  $this->propertyGUI("create", self::TYPE_TEXT, "100px", "insert");
81  }
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 275 of file class.ilPCPlaceHolderGUI.php.

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

276  {
277  switch ($_POST['pctext_type']) {
278  case 0: //Paragraph / Text
279 
280  // js editing? -> redirect to js page editor
281  // if ($ilSetting->get("enable_js_edit", 1) && ilPageEditorGUI::_doJSEditing())
283  $ret_class = $this->ctrl->getReturnClass($this);
284  $this->ctrl->setParameterByClass($ret_class, "pl_hier_id", $this->hier_id);
285  $this->ctrl->setParameterByClass($ret_class, "pl_pc_id", $this->pc_id);
286  $this->ctrl->redirectByClass(
287  $ret_class,
288  "insertJSAtPlaceholder"
289  );
290  }
291 
292  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
293  $this->ctrl->setCmdClass("ilpcparagraphgui");
294  $this->ctrl->setCmd("insert");
295  $paragraph_gui = new ilPCParagraphGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
296  $paragraph_gui->setStyleId($this->getStyleId());
297  $paragraph_gui->setPageConfig($this->getPageConfig());
298  $this->ctrl->forwardCommand($paragraph_gui);
299  break;
300 
301  case 1: //DataTable
302  include_once("./Services/COPage/classes/class.ilPCDataTableGUI.php");
303  $this->ctrl->setCmdClass("ilpcdatatablegui");
304  $this->ctrl->setCmd("insert");
305  $dtable_gui = new ilPCDataTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
306  $this->ctrl->forwardCommand($dtable_gui);
307  break;
308 
309  case 2: //Advanced Table
310  include_once("./Services/COPage/classes/class.ilPCTableGUI.php");
311  $this->ctrl->setCmdClass("ilpctablegui");
312  $this->ctrl->setCmd("insert");
313  $atable_gui = new ilPCTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
314  $this->ctrl->forwardCommand($atable_gui);
315  break;
316 
317  case 3: //Advanced List
318  include_once("./Services/COPage/classes/class.ilPCListGUI.php");
319  $this->ctrl->setCmdClass("ilpclistgui");
320  $this->ctrl->setCmd("insert");
321  $list_gui = new ilPCListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
322  $this->ctrl->forwardCommand($list_gui);
323  break;
324 
325  case 4: //File List
326  include_once("./Services/COPage/classes/class.ilPCFileListGUI.php");
327  $this->ctrl->setCmdClass("ilpcfilelistgui");
328  $this->ctrl->setCmd("insert");
329  $file_list_gui = new ilPCFileListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
330  $file_list_gui->setStyleId($this->getStyleId());
331  $this->ctrl->forwardCommand($file_list_gui);
332  break;
333 
334  case 5: //Tabs
335  include_once("./Services/COPage/classes/class.ilPCTabsGUI.php");
336  $this->ctrl->setCmdClass("ilpctabsgui");
337  $this->ctrl->setCmd("insert");
338  $tabs_gui = new ilPCTabsGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
339  $tabs_gui->setStyleId($this->getStyleId());
340  $this->ctrl->forwardCommand($tabs_gui);
341  break;
342 
343  default:
344  break;
345  }
346  }
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 213 of file class.ilPCPlaceHolderGUI.php.

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

Referenced by edit_object(), and insert().

214  {
215  $lng = $this->lng;
216 
217  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
218  $this->form_gui = new ilPropertyFormGUI();
219  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
220  $this->form_gui->setTitle($lng->txt("cont_ed_plachprop"));
221 
222  $ttype_input = new ilRadioGroupInputGUI($lng->txt("type"), "plach_type");
223  $type_captions = $this->getTypeCaptions();
224  foreach ($this->getAvailableTypes($a_type) as $type) {
225  $ttype_input->addOption(new ilRadioOption($type_captions[$type], $type));
226  }
227  $ttype_input->setRequired(true);
228  $this->form_gui->addItem($ttype_input);
229 
230  $theight_input = new ilTextInputGUI($lng->txt("height"), "plach_height");
231  $theight_input->setSize(4);
232  $theight_input->setMaxLength(3);
233  $theight_input->setTitle($lng->txt("height") . " (px)");
234  $theight_input->setRequired(true);
235  $this->form_gui->addItem($theight_input);
236 
237  $theight_input->setValue(preg_replace("/px/", "", $a_height));
238  $ttype_input->setValue($a_type);
239 
240  $this->form_gui->addCommandButton($a_action, $lng->txt($a_mode));
241  $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
242  $this->tpl->setContent($this->form_gui->getHTML());
243  }
This class represents an option in a radio group.
This class represents a property form user interface.
$type
$a_type
Definition: workflow.php:92
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 191 of file class.ilPCPlaceHolderGUI.php.

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

192  {
193  if ($_POST["plach_height"]=="" ||
194  !preg_match("/[0-9]+/", $_POST["plach_height"])) {
195  return $this->edit_object();
196  }
197 
198  $this->content_obj->setContentClass($_POST['plach_type']);
199  $this->content_obj->setHeight($_POST["plach_height"] . "px");
200 
201  $this->updated = $this->pg_obj->update();
202  if ($this->updated === true) {
203  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
204  } else {
205  $this->pg_obj->addHierIDs();
206  $this->edit();
207  }
208  }
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 122 of file class.ilPCPlaceHolderGUI.php.

123  {
124  $this->styleid = $a_styleid;
125  }

◆ textCOSelectionGUI()

ilPCPlaceHolderGUI::textCOSelectionGUI ( )
protected

Text Item Selection.

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

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

Referenced by forward_edit().

249  {
250  $lng = $this->lng;
251 
252  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
253  $this->form_gui = new ilPropertyFormGUI();
254  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
255  $this->form_gui->setTitle($lng->txt("cont_ed_select_pctext"));
256 
257  // Select Question Type
258  $ttype_input = new ilRadioGroupInputGUI($lng->txt("cont_ed_textitem"), "pctext_type");
259  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_par"), 0));
260  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_dtable"), 1));
261  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_atable"), 2));
262  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_list"), 3));
263  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_flist"), 4));
264  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_tabs"), 5));
265  $this->form_gui->addItem($ttype_input);
266 
267  $this->form_gui->addCommandButton("insertPCText", $lng->txt("insert"));
268  $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
269  $this->tpl->setContent($this->form_gui->getHTML());
270  }
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: