ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 getHTML (array $params)
 Get HTML. 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...
 
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. 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
 redirectToParent ($hier_id="")
 Redirect to parent. More...
 
 getParentReturn ($hier_id="")
 
- 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.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getCharacteristics()

static ilPCSectionGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

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

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

Referenced by ILIAS\COPage\Editor\Components\Section\SectionStyleSelector\getStyleSelector(), and ilPageEditorGUI\initCharacteristicForm().

118  {
120  $chars = $std_chars;
121  if ($a_style_id > 0 &&
122  ilObject::_lookupType($a_style_id) == "sty") {
123  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
124  $style = new ilObjStyleSheet($a_style_id);
125  $chars = $style->getCharacteristics("section");
126  $new_chars = array();
127  foreach ($chars as $char) {
128  if (($std_chars[$char] ?? "") != "") { // keep lang vars for standard chars
129  $new_chars[$char] = $std_chars[$char];
130  } else {
131  $new_chars[$char] = $char;
132  }
133  asort($new_chars);
134  }
135  $chars = $new_chars;
136  }
137  return $chars;
138  }
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 86 of file class.ilPCSectionGUI.php.

References $DIC, and ilPageContentGUI\$lng.

Referenced by __construct(), and _getCharacteristics().

87  {
88  global $DIC;
89 
90  $lng = $DIC->language();
91 
92  return array("Block" => $lng->txt("cont_Block"),
93  "Mnemonic" => $lng->txt("cont_Mnemonic"),
94  "Remark" => $lng->txt("cont_Remark"),
95  "Example" => $lng->txt("cont_Example"),
96  "Additional" => $lng->txt("cont_Additional"),
97  "Special" => $lng->txt("cont_Special"),
98 
99  "Attention" => $lng->txt("cont_Attention"),
100  "Background" => $lng->txt("cont_Background"),
101  "Citation" => $lng->txt("cont_Citation"),
102  "Confirmation" => $lng->txt("cont_Confirmation"),
103  "Information" => $lng->txt("cont_Information"),
104  "Interaction" => $lng->txt("cont_Interaction"),
105  "Link" => $lng->txt("cont_Link"),
106  "Literature" => $lng->txt("cont_Literature"),
107  "Separator" => $lng->txt("cont_Separator"),
108  "StandardCenter" => $lng->txt("cont_StandardCenter"),
109 
110  "Excursus" => $lng->txt("cont_Excursus"),
111  "AdvancedKnowledge" => $lng->txt("cont_AdvancedKnowledge"));
112  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ create()

ilPCSectionGUI::create ( )

Create new Section.

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

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

332  {
333  $form = $this->initForm(true);
334  if ($form->checkInput()) {
335  $this->content_obj = new ilPCSection($this->getPage());
336  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
337 
338  $this->setValuesFromForm($form);
339 
340  $this->updated = $this->pg_obj->update();
341  if ($this->updated === true) {
342  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
343  }
344  }
345 
346  $this->insert($form);
347  }
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 179 of file class.ilPCSectionGUI.php.

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

Referenced by insert(), and update().

180  {
181  $tpl = $this->tpl;
182 
183  $this->displayValidationError();
184 
185  if (!$a_form) {
186  $a_form = $this->initForm($a_insert);
187  }
188 
189  $tpl->setContent($a_form->getHTML());
190  }
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 143 of file class.ilPCSectionGUI.php.

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

144  {
145  $this->getCharacteristicsOfCurrentStyle("section"); // scorm-2004
146 
147  // get next class that processes or forwards current command
148  $next_class = $this->ctrl->getNextClass($this);
149 
150  // get current command
151  $cmd = $this->ctrl->getCmd();
152 
153  switch ($next_class) {
154  case "ilpropertyformgui":
155  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
156  $form = $this->initForm(true);
157  $this->ctrl->forwardCommand($form);
158  break;
159 
160  default:
161  $ret = $this->$cmd();
162  break;
163  }
164 
165  return $ret;
166  }
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:

◆ getHTML()

ilPCSectionGUI::getHTML ( array  $params)

Get HTML.

Parameters
array$params
Returns
string

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

References ilPageContentGUI\getCharacteristicsOfCurrentStyle(), and initForm().

44  {
45  $this->getCharacteristicsOfCurrentStyle("section");
46 
47  if ($params["form"] == true) {
48  $insert = (bool) !($this->content_obj);
49  $form = $this->initForm($insert);
50  $form->setShowTopButtons(false);
51 
52  $from = $form->getItemByPostVar("active_from");
53  $from->setSideBySide(false);
54  $on_load_code1 = $from->getOnloadCode();
55  $to = $form->getItemByPostVar("active_to");
56  $to->setSideBySide(false);
57  $on_load_code2 = $to->getOnloadCode();
58 
59  $rep_sel = $form->getItemByPostVar("permission_ref_id");
60  $on_load_code3 = "";
61  if ($rep_sel) {
62  $exp = $rep_sel->getExplorerGUI();
63  $this->ctrl->setParameterByClass("ilformpropertydispatchgui", "postvar", "permission_ref_id");
64  $on_load_code3 = $exp->getOnloadCode();
65  $this->ctrl->setParameterByClass("ilformpropertydispatchgui", "postvar", "");
66  }
67 
68  $html = $params["ui_wrapper"]->getRenderedForm(
69  $form,
70  $params["buttons"]
71  );
72 
73  $html .= "<script>" .
74  implode("\n", array_merge($on_load_code1, $on_load_code2)) .
75  "\n" . $on_load_code3 .
76  "</script>";
77 
78  return $html;
79  }
80  return "";
81  }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
initForm($a_insert=false)
Init editing form.
+ Here is the call graph for this function:

◆ initForm()

ilPCSectionGUI::initForm (   $a_insert = false)

Init editing form.

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

References ilPageContentGUI\$ctrl, Vendor\Package\$f, 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(), getHTML(), and update().

196  {
197  $lng = $this->lng;
198  $ilCtrl = $this->ctrl;
199 
200  // edit form
201  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
202  $form = new ilPropertyFormGUI();
203  $form->setFormAction($ilCtrl->getFormAction($this));
204  if ($a_insert) {
205  $form->setTitle($this->lng->txt("cont_insert_section"));
206  } else {
207  $form->setTitle($this->lng->txt("cont_update_section"));
208  }
209 
210  // characteristic selection
211  require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
212  $char_prop = new ilAdvSelectInputGUI(
213  $this->lng->txt("cont_characteristic"),
214  "characteristic"
215  );
216  $chars = $this->getCharacteristics();
217  if (is_object($this->content_obj)) {
218  if ($chars[$a_seleted_value] == "" && ($this->content_obj->getCharacteristic() != "")) {
219  $chars = array_merge(
220  array($this->content_obj->getCharacteristic() => $this->content_obj->getCharacteristic()),
221  $chars
222  );
223  }
224  }
225 
226  $selected = ($a_insert)
227  ? "Block"
228  : $this->content_obj->getCharacteristic();
229 
230  foreach ($chars as $k => $char) {
231  $html = '<div class="ilCOPgEditStyleSelectionItem"><div class="ilc_section_' . $k . '" style="' . self::$style_selector_reset . '">' .
232  $char . '</div></div>';
233  $char_prop->addOption($k, $char, $html);
234  }
235 
236  $char_prop->setValue($selected);
237  $form->addItem($char_prop);
238 
239  // link input
240  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
241  $ac = new ilLinkInputGUI($this->lng->txt('cont_link'), 'link');
242  if ($this->getPageConfig()->getEnableInternalLinks()) {
244  } else {
245  $ac->setAllowedLinkTypes(ilLinkInputGUI::EXT);
246  }
247  $ac->setRequired(false);
248  $ac->setInfo($this->lng->txt("copg_sec_link_info"));
249  $ac->setInternalLinkDefault(
250  $this->getPageConfig()->getIntLinkHelpDefaultType(),
251  $this->getPageConfig()->getIntLinkHelpDefaultId()
252  );
253  $link_types = array();
254  foreach ($this->getPageConfig()->getIntLinkFilters() as $f) {
255  $link_types[] = $f;
256  }
257  $ac->setInternalLinkFilterTypes($link_types);
258  $ac->setFilterWhiteList(
259  $this->getPageConfig()->getIntLinkFilterWhiteList()
260  );
261 
262  if (!$a_insert) {
263  $l = $this->content_obj->getLink();
264  if ($l["LinkType"] == "IntLink") {
265  $ac->setValueByIntLinkAttributes($l["Type"], $l["Target"], $l["TargetFrame"]);
266  }
267  if ($l["LinkType"] == "ExtLink") {
268  $ac->setValue($l["Href"]);
269  }
270  }
271  $form->addItem($ac);
272 
273  // activation
274 
275  // active from
276  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_from"), "active_from");
277  if (!$a_insert && ($from = $this->content_obj->getActiveFrom()) != "") {
278  $dt_prop->setDate(new ilDateTime($from, IL_CAL_UNIX));
279  }
280  $dt_prop->setShowTime(true);
281  $form->addItem($dt_prop);
282 
283  // active to
284  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_to"), "active_to");
285  if (!$a_insert && ($to = $this->content_obj->getActiveTo()) != "") {
286  $dt_prop->setDate(new ilDateTime($to, IL_CAL_UNIX));
287  }
288  $dt_prop->setShowTime(true);
289  $form->addItem($dt_prop);
290 
291  // rep selector
292  if ($this->getPageConfig()->getEnablePermissionChecks()) {
293  include_once("./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
294  $rs = new ilRepositorySelector2InputGUI($lng->txt("cont_permission_object"), "permission_ref_id");
295  $rs->setParent($this);
296  $form->addItem($rs);
297 
298  // permission
299  $options = array(
300  "read" => $lng->txt("read"),
301  "write" => $lng->txt("write"),
302  "visible" => $lng->txt("visible"),
303  "no_read" => $lng->txt("cont_no_read")
304  );
305  $si = new ilSelectInputGUI($lng->txt("permission"), "permission");
306  $si->setInfo($lng->txt("cont_permission_object_desc"));
307  $si->setOptions($options);
308  $form->addItem($si);
309 
310  if (!$a_insert) {
311  $si->setValue($this->content_obj->getPermission());
312  $rs->setValue($this->content_obj->getPermissionRefId());
313  }
314  }
315 
316  // save/cancel buttons
317  if ($a_insert) {
318  $form->addCommandButton("create_section", $lng->txt("save"));
319  $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
320  } else {
321  $form->addCommandButton("update", $lng->txt("save"));
322  $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
323  }
324  return $form;
325  }
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.
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 (LIST, 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 171 of file class.ilPCSectionGUI.php.

References edit().

Referenced by create().

172  {
173  $this->edit(true, $a_form);
174  }
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 373 of file class.ilPCSectionGUI.php.

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

Referenced by create(), and update().

374  {
375  $this->content_obj->setCharacteristic($_POST["characteristic"]);
376 
377  $from = $form->getItemByPostVar("active_from")->getDate();
378  if ($from) {
379  $this->content_obj->setActiveFrom($from->get(IL_CAL_UNIX));
380  } else {
381  $this->content_obj->setActiveFrom(0);
382  }
383 
384  $to = $form->getItemByPostVar("active_to")->getDate();
385  if ($to) {
386  $this->content_obj->setActiveTo($to->get(IL_CAL_UNIX));
387  } else {
388  $this->content_obj->setActiveTo(0);
389  }
390 
391  if ($this->getPageConfig()->getEnablePermissionChecks()) {
392  $this->content_obj->setPermissionRefId($_POST["permission_ref_id"]);
393  $this->content_obj->setPermission($_POST["permission"]);
394  }
395 
396  if ($_POST["link_mode"] == "ext" && $_POST["link"] != "") {
397  $this->content_obj->setExtLink($_POST["link"]);
398  } elseif ($_POST["link_mode"] == "int" && $_POST["link"] != "") {
399  // $_POST["link"] is "crs|96", "chap|2", "term|1", "wpage|1"
400  // var_dump($_POST);
401  $la = $form->getItemByPostVar("link")->getIntLinkAttributes();
402  // echo "<br>";
403  // var_dump($la); exit;
404  if ($la["Type"] != "") {
405  $this->content_obj->setIntLink($la["Type"], $la["Target"], $la["TargetFrame"]);
406  }
407  } else {
408  $this->content_obj->setNoLink();
409  }
410  }
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 352 of file class.ilPCSectionGUI.php.

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

353  {
354  $form = $this->initForm(false);
355  if ($form->checkInput()) {
356  $this->setValuesFromForm($form);
357 
358  $this->updated = $this->pg_obj->update();
359  if ($this->updated === true) {
360  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
361  }
362  }
363 
364  $this->pg_obj->addHierIDs();
365  $this->edit(false, $form);
366  }
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: