ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
 
 $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
 $error
 
 $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 $DIC, _getStandardCharacteristics(), and ilPageContentGUI\setCharacteristics().

27  {
28  global $DIC;
29 
30  $this->tpl = $DIC["tpl"];
31  $this->lng = $DIC->language();
32  $this->ctrl = $DIC->ctrl();
33  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
34 
36  }
global $DIC
Definition: saml.php:7
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 71 of file class.ilPCSectionGUI.php.

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

Referenced by ilPageEditorGUI\initCharacteristicForm().

72  {
74 
75  if ($a_style_id > 0 &&
76  ilObject::_lookupType($a_style_id) == "sty") {
77  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
78  $style = new ilObjStyleSheet($a_style_id);
79  $chars = $style->getCharacteristics("section");
80  $new_chars = array();
81  foreach ($chars as $char) {
82  if ($chars[$char] != "") { // keep lang vars for standard chars
83  $new_chars[$char] = $chars[$char];
84  } else {
85  $new_chars[$char] = $char;
86  }
87  asort($new_chars);
88  }
89  $chars = $new_chars;
90  }
91  return $chars;
92  }
$style
Definition: example_012.php:70
static _getStandardCharacteristics()
Get standard characteristics.
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 41 of file class.ilPCSectionGUI.php.

References $DIC, and ilPageContentGUI\$lng.

Referenced by __construct(), and _getCharacteristics().

42  {
43  global $DIC;
44 
45  $lng = $DIC->language();
46 
47  return array("Block" => $lng->txt("cont_Block"),
48  "Mnemonic" => $lng->txt("cont_Mnemonic"),
49  "Remark" => $lng->txt("cont_Remark"),
50  "Example" => $lng->txt("cont_Example"),
51  "Additional" => $lng->txt("cont_Additional"),
52  "Special" => $lng->txt("cont_Special"),
53 
54  "Attention" => $lng->txt("cont_Attention"),
55  "Background" => $lng->txt("cont_Background"),
56  "Confirmation" => $lng->txt("cont_Confirmation"),
57  "Information" => $lng->txt("cont_Information"),
58  "Interaction" => $lng->txt("cont_Interaction"),
59  "Link" => $lng->txt("cont_Link"),
60  "Literature" => $lng->txt("cont_Literature"),
61  "Separator" => $lng->txt("cont_Separator"),
62  "StandardCenter" => $lng->txt("cont_StandardCenter"),
63 
64  "Excursus" => $lng->txt("cont_Excursus"),
65  "AdvancedKnowledge" => $lng->txt("cont_AdvancedKnowledge"));
66  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ create()

ilPCSectionGUI::create ( )

Create new Section.

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

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

282  {
283  $form = $this->initForm(true);
284  if ($form->checkInput()) {
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  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
293  }
294  }
295 
296  $this->insert($form);
297  }
setValuesFromForm($form)
Set values from form.
initForm($a_insert=false)
Init editing form.
Class ilPCSection.
if(isset($_POST['submit'])) $form
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 133 of file class.ilPCSectionGUI.php.

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

Referenced by insert(), and update().

134  {
135  $tpl = $this->tpl;
136 
137  $this->displayValidationError();
138 
139  if (!$a_form) {
140  $a_form = $this->initForm($a_insert);
141  }
142 
143  $tpl->setContent($a_form->getHTML());
144  }
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 97 of file class.ilPCSectionGUI.php.

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

98  {
99  $this->getCharacteristicsOfCurrentStyle("section"); // scorm-2004
100 
101  // get next class that processes or forwards current command
102  $next_class = $this->ctrl->getNextClass($this);
103 
104  // get current command
105  $cmd = $this->ctrl->getCmd();
106 
107  switch ($next_class) {
108  case "ilpropertyformgui":
109  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
110  $form = $this->initForm(true);
111  $this->ctrl->forwardCommand($form);
112  break;
113 
114  default:
115  $ret = $this->$cmd();
116  break;
117  }
118 
119  return $ret;
120  }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
initForm($a_insert=false)
Init editing form.
if(isset($_POST['submit'])) $form
$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 149 of file class.ilPCSectionGUI.php.

References ilPageContentGUI\$ctrl, $f, $form, $from, $html, $ilCtrl, $l, ilPageContentGUI\$lng, PHPMailer\PHPMailer\$options, $si, 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().

150  {
151  $lng = $this->lng;
153 
154  // edit form
155  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
156  $form = new ilPropertyFormGUI();
157  $form->setFormAction($ilCtrl->getFormAction($this));
158  if ($a_insert) {
159  $form->setTitle($this->lng->txt("cont_insert_section"));
160  } else {
161  $form->setTitle($this->lng->txt("cont_update_section"));
162  }
163 
164  // characteristic selection
165  require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
166  $char_prop = new ilAdvSelectInputGUI(
167  $this->lng->txt("cont_characteristic"),
168  "characteristic"
169  );
170 
171  $chars = $this->getCharacteristics();
172  if (is_object($this->content_obj)) {
173  if ($chars[$a_seleted_value] == "" && ($this->content_obj->getCharacteristic() != "")) {
174  $chars = array_merge(
175  array($this->content_obj->getCharacteristic() => $this->content_obj->getCharacteristic()),
176  $chars
177  );
178  }
179  }
180 
181  $selected = ($a_insert)
182  ? "Block"
183  : $this->content_obj->getCharacteristic();
184 
185  foreach ($chars as $k => $char) {
186  $html = '<div class="ilCOPgEditStyleSelectionItem"><div class="ilc_section_' . $k . '" style="' . self::$style_selector_reset . '">' .
187  $char . '</div></div>';
188  $char_prop->addOption($k, $char, $html);
189  }
190 
191  $char_prop->setValue($selected);
192  $form->addItem($char_prop);
193 
194  // link input
195  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
196  $ac = new ilLinkInputGUI($this->lng->txt('cont_link'), 'link');
198  $ac->setRequired(false);
199  $ac->setInfo($this->lng->txt("copg_sec_link_info"));
200  $ac->setInternalLinkDefault(
201  $this->getPageConfig()->getIntLinkHelpDefaultType(),
202  $this->getPageConfig()->getIntLinkHelpDefaultId()
203  );
204  $link_types = array();
205  foreach ($this->getPageConfig()->getIntLinkFilters() as $f) {
206  $link_types[] = $f;
207  }
208  $ac->setInternalLinkFilterTypes($link_types);
209  $ac->setFilterWhiteList(
210  $this->getPageConfig()->getIntLinkFilterWhiteList()
211  );
212 
213  if (!$a_insert) {
214  $l = $this->content_obj->getLink();
215  if ($l["LinkType"] == "IntLink") {
216  $ac->setValueByIntLinkAttributes($l["Type"], $l["Target"], $l["TargetFrame"]);
217  }
218  if ($l["LinkType"] == "ExtLink") {
219  $ac->setValue($l["Href"]);
220  }
221  }
222  $form->addItem($ac);
223 
224  // activation
225 
226  // active from
227  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_from"), "active_from");
228  if (!$a_insert && ($from = $this->content_obj->getActiveFrom()) != "") {
229  $dt_prop->setDate(new ilDateTime($from, IL_CAL_UNIX));
230  }
231  $dt_prop->setShowTime(true);
232  $form->addItem($dt_prop);
233 
234  // active to
235  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_to"), "active_to");
236  if (!$a_insert && ($to = $this->content_obj->getActiveTo()) != "") {
237  $dt_prop->setDate(new ilDateTime($to, IL_CAL_UNIX));
238  }
239  $dt_prop->setShowTime(true);
240  $form->addItem($dt_prop);
241 
242  // rep selector
243  if ($this->getPageConfig()->getEnablePermissionChecks()) {
244  include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
245  $rs = new ilRepositorySelector2InputGUI($lng->txt("cont_permission_object"), "permission_ref_id");
246  $rs->setParent($this);
247  $form->addItem($rs);
248 
249  // permission
250  $options = array(
251  "read" => $lng->txt("read"),
252  "write" => $lng->txt("write"),
253  "visible" => $lng->txt("visible"),
254  );
255  $si = new ilSelectInputGUI($lng->txt("permission"), "permission");
256  $si->setInfo($lng->txt("cont_permission_object_desc"));
257  $si->setOptions($options);
258  $form->addItem($si);
259 
260  if (!$a_insert) {
261  $si->setValue($this->content_obj->getPermission());
262  $rs->setValue($this->content_obj->getPermissionRefId());
263  }
264  }
265 
266  // save/cancel buttons
267  if ($a_insert) {
268  $form->addCommandButton("create_section", $lng->txt("save"));
269  $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
270  } else {
271  $form->addCommandButton("update", $lng->txt("save"));
272  $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
273  }
274  return $form;
275  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
$from
const IL_CAL_UNIX
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(isset($_POST['submit'])) $form
setDate(ilDateTime $a_date=null)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
Date and time handling
getCharacteristics()
Get characteristics.
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 125 of file class.ilPCSectionGUI.php.

References edit().

Referenced by create().

126  {
127  $this->edit(true, $a_form);
128  }
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 323 of file class.ilPCSectionGUI.php.

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

Referenced by create(), and update().

324  {
325  $this->content_obj->setCharacteristic($_POST["characteristic"]);
326 
327  $from = $form->getItemByPostVar("active_from")->getDate();
328  if ($from) {
329  $this->content_obj->setActiveFrom($from->get(IL_CAL_UNIX));
330  } else {
331  $this->content_obj->setActiveFrom(0);
332  }
333 
334  $to = $form->getItemByPostVar("active_to")->getDate();
335  if ($to) {
336  $this->content_obj->setActiveTo($to->get(IL_CAL_UNIX));
337  } else {
338  $this->content_obj->setActiveTo(0);
339  }
340 
341  if ($this->getPageConfig()->getEnablePermissionChecks()) {
342  $this->content_obj->setPermissionRefId($_POST["permission_ref_id"]);
343  $this->content_obj->setPermission($_POST["permission"]);
344  }
345 
346  if ($_POST["link_mode"] == "ext" && $_POST["link"] != "") {
347  $this->content_obj->setExtLink($_POST["link"]);
348  } elseif ($_POST["link_mode"] == "int" && $_POST["link"] != "") {
349  // $_POST["link"] is "crs|96", "chap|2", "term|1", "wpage|1"
350  // var_dump($_POST);
351  $la = $form->getItemByPostVar("link")->getIntLinkAttributes();
352  // echo "<br>";
353  // var_dump($la); exit;
354  if ($la["Type"] != "") {
355  $this->content_obj->setIntLink($la["Type"], $la["Target"], $la["TargetFrame"]);
356  }
357  } else {
358  $this->content_obj->setNoLink();
359  }
360  }
$from
const IL_CAL_UNIX
getPageConfig()
Get Page Config.
if(isset($_POST['submit'])) $form
$_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 302 of file class.ilPCSectionGUI.php.

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

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

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