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

@ilCtrl_Calls 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 @access public.

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

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: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _getCharacteristics()

static ilPCSectionGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

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

61 {
63
64 if ($a_style_id > 0 &&
65 ilObject::_lookupType($a_style_id) == "sty") {
66 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
67 $style = new ilObjStyleSheet($a_style_id);
68 $chars = $style->getCharacteristics("section");
69 $new_chars = array();
70 foreach ($chars as $char) {
71 if ($chars[$char] != "") { // keep lang vars for standard chars
72 $new_chars[$char] = $chars[$char];
73 } else {
74 $new_chars[$char] = $char;
75 }
76 asort($new_chars);
77 }
78 $chars = $new_chars;
79 }
80 return $chars;
81 }
Class ilObjStyleSheet.
static _lookupType($a_id, $a_reference=false)
lookup object type
$style
Definition: example_012.php:70

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

Referenced by ilPageEditorGUI\initCharacteristicForm().

+ 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.

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 "Excursus" => $lng->txt("cont_Excursus"),
54 "AdvancedKnowledge" => $lng->txt("cont_AdvancedKnowledge"));
55 }

References $DIC, and ilPageContentGUI\$lng.

Referenced by __construct(), and _getCharacteristics().

+ Here is the caller graph for this function:

◆ create()

ilPCSectionGUI::create ( )

Create new Section.

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

271 {
272 $form = $this->initForm(true);
273 if ($form->checkInput()) {
274 $this->content_obj = new ilPCSection($this->getPage());
275 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
276
277 $this->setValuesFromForm($form);
278
279 $this->updated = $this->pg_obj->update();
280 if ($this->updated === true) {
281 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
282 }
283 }
284
285 $this->insert($form);
286 }
initForm($a_insert=false)
Init editing form.
setValuesFromForm($form)
Set values from form.
insert(ilPropertyFormGUI $a_form=null)
Insert new section form.
Class ilPCSection.
if(isset($_POST['submit'])) $form

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

+ Here is the call graph for this function:

◆ edit()

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

Edit section form.

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

123 {
125
126 $this->displayValidationError();
127
128 if (!$a_form) {
129 $a_form = $this->initForm($a_insert);
130 }
131
132 $tpl->setContent($a_form->getHTML());
133 }
displayValidationError()
display validation errors

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

Referenced by insert(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCSectionGUI::executeCommand ( )

execute command

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

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

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

+ 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.

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

References ilPageContentGUI\$ctrl, $form, $from, $html, $ilCtrl, $l, ilPageContentGUI\$lng, $options, $si, ilLinkInputGUI\BOTH, ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getPageConfig(), and IL_CAL_UNIX.

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

+ 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 114 of file class.ilPCSectionGUI.php.

115 {
116 $this->edit(true, $a_form);
117 }
edit($a_insert=false, ilPropertyFormGUI $a_form=null)
Edit section form.

References edit().

Referenced by create().

+ 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 312 of file class.ilPCSectionGUI.php.

313 {
314 $this->content_obj->setCharacteristic($_POST["characteristic"]);
315
316 $from = $form->getItemByPostVar("active_from")->getDate();
317 if ($from) {
318 $this->content_obj->setActiveFrom($from->get(IL_CAL_UNIX));
319 } else {
320 $this->content_obj->setActiveFrom(0);
321 }
322
323 $to = $form->getItemByPostVar("active_to")->getDate();
324 if ($to) {
325 $this->content_obj->setActiveTo($to->get(IL_CAL_UNIX));
326 } else {
327 $this->content_obj->setActiveTo(0);
328 }
329
330 if ($this->getPageConfig()->getEnablePermissionChecks()) {
331 $this->content_obj->setPermissionRefId($_POST["permission_ref_id"]);
332 $this->content_obj->setPermission($_POST["permission"]);
333 }
334
335 if ($_POST["link_mode"] == "ext" && $_POST["link"] != "") {
336 $this->content_obj->setExtLink($_POST["link"]);
337 } elseif ($_POST["link_mode"] == "int" && $_POST["link"] != "") {
338 // $_POST["link"] is "crs|96", "chap|2", "term|1", "wpage|1"
339 // var_dump($_POST);
340 $la = $form->getItemByPostVar("link")->getIntLinkAttributes();
341 // echo "<br>";
342 // var_dump($la); exit;
343 if ($la["Type"] != "") {
344 $this->content_obj->setIntLink($la["Type"], $la["Target"], $la["TargetFrame"]);
345 }
346 } else {
347 $this->content_obj->setNoLink();
348 }
349 }
$_POST["username"]

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

Referenced by create(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCSectionGUI::update ( )

Update Section.

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

292 {
293 $form = $this->initForm(false);
294 if ($form->checkInput()) {
295 $this->setValuesFromForm($form);
296
297 $this->updated = $this->pg_obj->update();
298 if ($this->updated === true) {
299 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
300 }
301 }
302
303 $this->pg_obj->addHierIDs();
304 $this->edit(false, $form);
305 }

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

+ Here is the call graph for this function:

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