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

Class ilPCSectionGUI. More...

+ Inheritance diagram for ilPCSectionGUI:
+ Collaboration diagram for ilPCSectionGUI:

Public Member Functions

 __construct (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 insert (ilPropertyFormGUI $a_form=null)
 Insert new section form. More...
 
 edit ($a_insert=false, ilPropertyFormGUI $a_form=null)
 Edit section form. More...
 
 initForm ($a_insert=false)
 Init editing form. More...
 
 create ()
 Create new Section. More...
 
 update ()
 Update Section. More...
 
 setValuesFromForm ($form)
 Set values from form. 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...
 

Static Public Member Functions

static _getStandardCharacteristics ()
 Get standard characteristics. More...
 
static _getCharacteristics ($a_style_id)
 Get characteristics. More...
 
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 

Additional Inherited Members

- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $ilias
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- 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;"
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- Protected Attributes inherited from ilPageContentGUI
 $log
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

Class ilPCSectionGUI.

User Interface for Section Editing

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilPCSectionGUI: ilPropertyFormGUI

Definition at line 19 of file class.ilPCSectionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor public.

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

References _getStandardCharacteristics(), and ilPageContentGUI\setCharacteristics().

27  {
28  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
29 
31  }
static _getStandardCharacteristics()
Get standard characteristics.
setCharacteristics($a_chars)
Set Characteristics.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getCharacteristics()

static ilPCSectionGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

Definition at line 53 of file class.ilPCSectionGUI.php.

References $style, _getStandardCharacteristics(), ilObject\_lookupType(), and array.

Referenced by ilPageEditorGUI\initCharacteristicForm().

54  {
56 
57  if ($a_style_id > 0 &&
58  ilObject::_lookupType($a_style_id) == "sty")
59  {
60  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
61  $style = new ilObjStyleSheet($a_style_id);
62  $chars = $style->getCharacteristics("section");
63  $new_chars = array();
64  foreach ($chars as $char)
65  {
66  if ($chars[$char] != "") // keep lang vars for standard chars
67  {
68  $new_chars[$char] = $chars[$char];
69  }
70  else
71  {
72  $new_chars[$char] = $char;
73  }
74  asort($new_chars);
75  }
76  $chars = $new_chars;
77  }
78  return $chars;
79  }
$style
Definition: example_012.php:70
static _getStandardCharacteristics()
Get standard characteristics.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilObjStyleSheet.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getStandardCharacteristics()

static ilPCSectionGUI::_getStandardCharacteristics ( )
static

Get standard characteristics.

Definition at line 36 of file class.ilPCSectionGUI.php.

References ilPageContentGUI\$lng, and array.

Referenced by __construct(), and _getCharacteristics().

37  {
38  global $lng;
39 
40  return array("Block" => $lng->txt("cont_Block"),
41  "Mnemonic" => $lng->txt("cont_Mnemonic"),
42  "Remark" => $lng->txt("cont_Remark"),
43  "Example" => $lng->txt("cont_Example"),
44  "Additional" => $lng->txt("cont_Additional"),
45  "Special" => $lng->txt("cont_Special"),
46  "Excursus" => $lng->txt("cont_Excursus"),
47  "AdvancedKnowledge" => $lng->txt("cont_AdvancedKnowledge"));
48  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ create()

ilPCSectionGUI::create ( )

Create new Section.

Definition at line 280 of file class.ilPCSectionGUI.php.

References ilPageContentGUI\getPage(), initForm(), insert(), and setValuesFromForm().

281  {
282  $form = $this->initForm(true);
283  if($form->checkInput())
284  {
285  $this->content_obj = new ilPCSection($this->getPage());
286  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
287 
288  $this->setValuesFromForm($form);
289 
290  $this->updated = $this->pg_obj->update();
291  if ($this->updated === true)
292  {
293  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
294  }
295  }
296 
297  $this->insert($form);
298  }
setValuesFromForm($form)
Set values from form.
initForm($a_insert=false)
Init editing form.
Class ilPCSection.
insert(ilPropertyFormGUI $a_form=null)
Insert new section form.
+ Here is the call graph for this function:

◆ edit()

ilPCSectionGUI::edit (   $a_insert = false,
ilPropertyFormGUI  $a_form = null 
)

Edit section form.

Definition at line 121 of file class.ilPCSectionGUI.php.

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initForm().

Referenced by insert(), and update().

122  {
123  global $tpl;
124 
125  $this->displayValidationError();
126 
127  if(!$a_form)
128  {
129  $a_form = $this->initForm($a_insert);
130  }
131 
132  $tpl->setContent($a_form->getHTML());
133  }
initForm($a_insert=false)
Init editing form.
displayValidationError()
display validation errors
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCSectionGUI::executeCommand ( )

execute command

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

References $cmd, $ret, ilPageContentGUI\getCharacteristicsOfCurrentStyle(), and initForm().

85  {
86  $this->getCharacteristicsOfCurrentStyle("section"); // scorm-2004
87 
88  // get next class that processes or forwards current command
89  $next_class = $this->ctrl->getNextClass($this);
90 
91  // get current command
92  $cmd = $this->ctrl->getCmd();
93 
94  switch($next_class)
95  {
96  case "ilpropertyformgui":
97  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
98  $form = $this->initForm(true);
99  $this->ctrl->forwardCommand($form);
100  break;
101 
102  default:
103  $ret = $this->$cmd();
104  break;
105  }
106 
107  return $ret;
108  }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
initForm($a_insert=false)
Init editing form.
$cmd
Definition: sahs_server.php:35
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ initForm()

ilPCSectionGUI::initForm (   $a_insert = false)

Init editing form.

Definition at line 138 of file class.ilPCSectionGUI.php.

References $html, $ilCtrl, $l, ilPageContentGUI\$lng, $options, $si, array, ilLinkInputGUI\BOTH, ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getPageConfig(), IL_CAL_UNIX, ilLinkInputGUI\setAllowedLinkTypes(), ilDateTimeInputGUI\setDate(), ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setParent().

Referenced by create(), edit(), executeCommand(), and update().

139  {
140  global $lng, $ilCtrl;
141 
142  // edit form
143  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
144  $form = new ilPropertyFormGUI();
145  $form->setFormAction($ilCtrl->getFormAction($this));
146  if ($a_insert)
147  {
148  $form->setTitle($this->lng->txt("cont_insert_section"));
149  }
150  else
151  {
152  $form->setTitle($this->lng->txt("cont_update_section"));
153  }
154 
155  // characteristic selection
156  require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
157  $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
158  "characteristic");
159 
160  $chars = $this->getCharacteristics();
161  if (is_object($this->content_obj))
162  {
163  if ($chars[$a_seleted_value] == "" && ($this->content_obj->getCharacteristic() != ""))
164  {
165  $chars = array_merge(
166  array($this->content_obj->getCharacteristic() => $this->content_obj->getCharacteristic()),
167  $chars);
168  }
169  }
170 
171  $selected = ($a_insert)
172  ? "Block"
173  : $this->content_obj->getCharacteristic();
174 
175  foreach($chars as $k => $char)
176  {
177  $html = '<div class="ilCOPgEditStyleSelectionItem"><div class="ilc_section_'.$k.'" style="'.self::$style_selector_reset.'">'.
178  $char.'</div></div>';
179  $char_prop->addOption($k, $char, $html);
180  }
181 
182  $char_prop->setValue($selected);
183  $form->addItem($char_prop);
184 
185  // link input
186  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
187  $ac = new ilLinkInputGUI($this->lng->txt('cont_link'), 'link');
189  $ac->setRequired(false);
190  $ac->setInfo($this->lng->txt("copg_sec_link_info"));
191  $ac->setInternalLinkDefault($this->getPageConfig()->getIntLinkHelpDefaultType(),
192  $this->getPageConfig()->getIntLinkHelpDefaultId());
193  $link_types = array();
194  foreach ($this->getPageConfig()->getIntLinkFilters() as $f)
195  {
196  $link_types[] = $f;
197  }
198  $ac->setInternalLinkFilterTypes($link_types);
199  $ac->setFilterWhiteList(
200  $this->getPageConfig()->getIntLinkFilterWhiteList());
201 
202  if (!$a_insert)
203  {
204  $l = $this->content_obj->getLink();
205  if ($l["LinkType"] == "IntLink")
206  {
207  $ac->setValueByIntLinkAttributes($l["Type"], $l["Target"], $l["TargetFrame"]);
208  }
209  if ($l["LinkType"] == "ExtLink")
210  {
211  $ac->setValue($l["Href"]);
212  }
213  }
214  $form->addItem($ac);
215 
216  // activation
217 
218  // active from
219  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_from"), "active_from");
220  if (!$a_insert && ($from = $this->content_obj->getActiveFrom()) != "")
221  {
222  $dt_prop->setDate(new ilDateTime($from, IL_CAL_UNIX));
223  }
224  $dt_prop->setShowTime(true);
225  $form->addItem($dt_prop);
226 
227  // active to
228  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_to"), "active_to");
229  if (!$a_insert && ($to = $this->content_obj->getActiveTo()) != "")
230  {
231  $dt_prop->setDate(new ilDateTime($to, IL_CAL_UNIX));
232  }
233  $dt_prop->setShowTime(true);
234  $form->addItem($dt_prop);
235 
236  // rep selector
237  if ($this->getPageConfig()->getEnablePermissionChecks())
238  {
239  include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
240  $rs = new ilRepositorySelector2InputGUI($lng->txt("cont_permission_object"), "permission_ref_id");
241  $rs->setParent($this);
242  $form->addItem($rs);
243 
244  // permission
245  $options = array(
246  "read" => $lng->txt("read"),
247  "write" => $lng->txt("write"),
248  "visible" => $lng->txt("visible"),
249  );
250  $si = new ilSelectInputGUI($lng->txt("permission"), "permission");
251  $si->setInfo($lng->txt("cont_permission_object_desc"));
252  $si->setOptions($options);
253  $form->addItem($si);
254 
255  if (!$a_insert)
256  {
257  $si->setValue($this->content_obj->getPermission());
258  $rs->setValue($this->content_obj->getPermissionRefId());
259  }
260  }
261 
262  // save/cancel buttons
263  if ($a_insert)
264  {
265  $form->addCommandButton("create_section", $lng->txt("save"));
266  $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
267  }
268  else
269  {
270  $form->addCommandButton("update", $lng->txt("save"));
271  $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
272  }
273  return $form;
274  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
const IL_CAL_UNIX
setDate(ilDateTime $a_date=NULL)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
getPageConfig()
Get Page Config.
This class represents a date/time property in a property form.
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
setParent($a_val)
Set Parent GUI object.
if(!is_array($argv)) $options
Date and time handling
getCharacteristics()
Get characteristics.
Create styles array
The data for the language used.
global $l
Definition: afr.php:30
This class represents an advanced selection list property in a property form.
$html
Definition: example_001.php:87
This class represents a external and/or internal link in a property form.
setAllowedLinkTypes($a_val)
Set allowed link types (BOTH, INT, EXT)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCSectionGUI::insert ( ilPropertyFormGUI  $a_form = null)

Insert new section form.

Definition at line 113 of file class.ilPCSectionGUI.php.

References edit().

Referenced by create().

114  {
115  $this->edit(true, $a_form);
116  }
edit($a_insert=false, ilPropertyFormGUI $a_form=null)
Edit section form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValuesFromForm()

ilPCSectionGUI::setValuesFromForm (   $form)

Set values from form.

Parameters
object$formform object

Definition at line 326 of file class.ilPCSectionGUI.php.

References $_POST, ilPageContentGUI\getPageConfig(), and IL_CAL_UNIX.

Referenced by create(), and update().

327  {
328  $this->content_obj->setCharacteristic($_POST["characteristic"]);
329 
330  $from = $form->getItemByPostVar("active_from")->getDate();
331  if ($from)
332  {
333  $this->content_obj->setActiveFrom($from->get(IL_CAL_UNIX));
334  }
335  else
336  {
337  $this->content_obj->setActiveFrom(0);
338  }
339 
340  $to = $form->getItemByPostVar("active_to")->getDate();
341  if ($to)
342  {
343  $this->content_obj->setActiveTo($to->get(IL_CAL_UNIX));
344  }
345  else
346  {
347  $this->content_obj->setActiveTo(0);
348  }
349 
350  if ($this->getPageConfig()->getEnablePermissionChecks())
351  {
352  $this->content_obj->setPermissionRefId($_POST["permission_ref_id"]);
353  $this->content_obj->setPermission($_POST["permission"]);
354  }
355 
356  if ($_POST["link_mode"] == "ext" && $_POST["link"] != "")
357  {
358  $this->content_obj->setExtLink($_POST["link"]);
359  }
360  else if ($_POST["link_mode"] == "int" && $_POST["link"] != "")
361  {
362  // $_POST["link"] is "crs|96", "chap|2", "term|1", "wpage|1"
363 // var_dump($_POST);
364  $la = $form->getItemByPostVar("link")->getIntLinkAttributes();
365 // echo "<br>";
366 // var_dump($la); exit;
367  if ($la["Type"] != "")
368  {
369  $this->content_obj->setIntLink($la["Type"], $la["Target"], $la["TargetFrame"]);
370  }
371  }
372  else
373  {
374  $this->content_obj->setNoLink();
375  }
376  }
const IL_CAL_UNIX
getPageConfig()
Get Page Config.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCSectionGUI::update ( )

Update Section.

Definition at line 303 of file class.ilPCSectionGUI.php.

References edit(), initForm(), and setValuesFromForm().

304  {
305  $form = $this->initForm(false);
306  if($form->checkInput())
307  {
308  $this->setValuesFromForm($form);
309 
310  $this->updated = $this->pg_obj->update();
311  if ($this->updated === true)
312  {
313  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
314  }
315  }
316 
317  $this->pg_obj->addHierIDs();
318  $this->edit(false, $form);
319  }
edit($a_insert=false, ilPropertyFormGUI $a_form=null)
Edit section form.
setValuesFromForm($form)
Set values from form.
initForm($a_insert=false)
Init editing form.
+ Here is the call graph for this function:

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