ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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, ILIAS\GlobalScreen\Provider\__construct(), _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  }
static _getStandardCharacteristics()
Get standard characteristics.
setCharacteristics($a_chars)
Set Characteristics.
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ 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 _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  }
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  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ create()

ilPCSectionGUI::create ( )

Create new Section.

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

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

287  {
288  $form = $this->initForm(true);
289  if ($form->checkInput()) {
290  $this->content_obj = new ilPCSection($this->getPage());
291  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
292 
293  $this->setValuesFromForm($form);
294 
295  $this->updated = $this->pg_obj->update();
296  if ($this->updated === true) {
297  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
298  }
299  }
300 
301  $this->insert($form);
302  }
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 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 $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.
$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, Vendor\Package\$f, $ilCtrl, ilPageContentGUI\$lng, $si, ilLinkInputGUI\BOTH, ilLinkInputGUI\EXT, ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getPageConfig(), IL_CAL_UNIX, ilLinkInputGUI\setAllowedLinkTypes(), ilDateTimeInputGUI\setDate(), 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');
197  if ($this->getPageConfig()->getEnableInternalLinks()) {
199  } else {
200  $ac->setAllowedLinkTypes(ilLinkInputGUI::EXT);
201  }
202  $ac->setRequired(false);
203  $ac->setInfo($this->lng->txt("copg_sec_link_info"));
204  $ac->setInternalLinkDefault(
205  $this->getPageConfig()->getIntLinkHelpDefaultType(),
206  $this->getPageConfig()->getIntLinkHelpDefaultId()
207  );
208  $link_types = array();
209  foreach ($this->getPageConfig()->getIntLinkFilters() as $f) {
210  $link_types[] = $f;
211  }
212  $ac->setInternalLinkFilterTypes($link_types);
213  $ac->setFilterWhiteList(
214  $this->getPageConfig()->getIntLinkFilterWhiteList()
215  );
216 
217  if (!$a_insert) {
218  $l = $this->content_obj->getLink();
219  if ($l["LinkType"] == "IntLink") {
220  $ac->setValueByIntLinkAttributes($l["Type"], $l["Target"], $l["TargetFrame"]);
221  }
222  if ($l["LinkType"] == "ExtLink") {
223  $ac->setValue($l["Href"]);
224  }
225  }
226  $form->addItem($ac);
227 
228  // activation
229 
230  // active from
231  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_from"), "active_from");
232  if (!$a_insert && ($from = $this->content_obj->getActiveFrom()) != "") {
233  $dt_prop->setDate(new ilDateTime($from, IL_CAL_UNIX));
234  }
235  $dt_prop->setShowTime(true);
236  $form->addItem($dt_prop);
237 
238  // active to
239  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_to"), "active_to");
240  if (!$a_insert && ($to = $this->content_obj->getActiveTo()) != "") {
241  $dt_prop->setDate(new ilDateTime($to, IL_CAL_UNIX));
242  }
243  $dt_prop->setShowTime(true);
244  $form->addItem($dt_prop);
245 
246  // rep selector
247  if ($this->getPageConfig()->getEnablePermissionChecks()) {
248  include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
249  $rs = new ilRepositorySelector2InputGUI($lng->txt("cont_permission_object"), "permission_ref_id");
250  $rs->setParent($this);
251  $form->addItem($rs);
252 
253  // permission
254  $options = array(
255  "read" => $lng->txt("read"),
256  "write" => $lng->txt("write"),
257  "visible" => $lng->txt("visible"),
258  "no_read" => $lng->txt("cont_no_read")
259  );
260  $si = new ilSelectInputGUI($lng->txt("permission"), "permission");
261  $si->setInfo($lng->txt("cont_permission_object_desc"));
262  $si->setOptions($options);
263  $form->addItem($si);
264 
265  if (!$a_insert) {
266  $si->setValue($this->content_obj->getPermission());
267  $rs->setValue($this->content_obj->getPermissionRefId());
268  }
269  }
270 
271  // save/cancel buttons
272  if ($a_insert) {
273  $form->addCommandButton("create_section", $lng->txt("save"));
274  $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
275  } else {
276  $form->addCommandButton("update", $lng->txt("save"));
277  $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
278  }
279  return $form;
280  }
This class represents a property form user interface.
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
setParent($a_val)
Set Parent GUI object.
setDate(ilDateTime $a_date=null)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
getCharacteristics()
Get characteristics.
This class represents an advanced selection list property in a property form.
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 328 of file class.ilPCSectionGUI.php.

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

Referenced by create(), and update().

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

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

308  {
309  $form = $this->initForm(false);
310  if ($form->checkInput()) {
311  $this->setValuesFromForm($form);
312 
313  $this->updated = $this->pg_obj->update();
314  if ($this->updated === true) {
315  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
316  }
317  }
318 
319  $this->pg_obj->addHierIDs();
320  $this->edit(false, $form);
321  }
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: