ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPCSectionGUI Class Reference

Class ilPCSectionGUI. More...

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

Public Member Functions

 ilPCSectionGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor @access public. More...
 
executeCommand ()
 execute command More...
 
 insert ()
 Insert new section form. More...
 
 edit ($a_insert=false)
 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
 ilPageContentGUI ($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
 
 $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$

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

Member Function Documentation

◆ _getCharacteristics()

static ilPCSectionGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

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

52 {
54
55 if ($a_style_id > 0 &&
56 ilObject::_lookupType($a_style_id) == "sty")
57 {
58 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
59 $style = new ilObjStyleSheet($a_style_id);
60 $chars = $style->getCharacteristics("section");
61 $new_chars = array();
62 foreach ($chars as $char)
63 {
64 if ($chars[$char] != "") // keep lang vars for standard chars
65 {
66 $new_chars[$char] = $chars[$char];
67 }
68 else
69 {
70 $new_chars[$char] = $char;
71 }
72 asort($new_chars);
73 }
74 $chars = $new_chars;
75 }
76 return $chars;
77 }
Class ilObjStyleSheet.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getStandardCharacteristics()
Get standard characteristics.
$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 34 of file class.ilPCSectionGUI.php.

35 {
36 global $lng;
37
38 return array("Block" => $lng->txt("cont_Block"),
39 "Mnemonic" => $lng->txt("cont_Mnemonic"),
40 "Remark" => $lng->txt("cont_Remark"),
41 "Example" => $lng->txt("cont_Example"),
42 "Additional" => $lng->txt("cont_Additional"),
43 "Special" => $lng->txt("cont_Special"),
44 "Excursus" => $lng->txt("cont_Excursus"),
45 "AdvancedKnowledge" => $lng->txt("cont_AdvancedKnowledge"));
46 }

References ilPageContentGUI\$lng.

Referenced by _getCharacteristics(), and ilPCSectionGUI().

+ Here is the caller graph for this function:

◆ create()

ilPCSectionGUI::create ( )

Create new Section.

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

215 {
216 $form = $this->initForm(true);
217 $form->checkInput();
218
219 $this->content_obj = new ilPCSection($this->getPage());
220 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
221
222 $this->setValuesFromForm($form);
223
224
225 $this->updated = $this->pg_obj->update();
226 if ($this->updated === true)
227 {
228 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
229 }
230 else
231 {
232 $this->insert();
233 }
234 }
insert()
Insert new section form.
initForm($a_insert=false)
Init editing form.
setValuesFromForm($form)
Set values from form.
Class ilPCSection.

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

+ Here is the call graph for this function:

◆ edit()

ilPCSectionGUI::edit (   $a_insert = false)

Edit section form.

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

114 {
115 global $ilCtrl, $tpl, $lng;
116
117 $this->displayValidationError();
118
119 $form = $this->initForm($a_insert);
120
121 $html = $form->getHTML();
122 $tpl->setContent($html);
123 }
displayValidationError()
display validation errors
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18

References $html, $ilCtrl, ilPageContentGUI\$lng, 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 82 of file class.ilPCSectionGUI.php.

83 {
84 $this->getCharacteristicsOfCurrentStyle("section"); // scorm-2004
85
86 // get next class that processes or forwards current command
87 $next_class = $this->ctrl->getNextClass($this);
88
89 // get current command
90 $cmd = $this->ctrl->getCmd();
91
92 switch($next_class)
93 {
94 default:
95 $ret =& $this->$cmd();
96 break;
97 }
98
99 return $ret;
100 }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ ilPCSectionGUI()

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

Constructor @access public.

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

25 {
26 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
27
29 }
setCharacteristics($a_chars)
Set Characteristics.

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

+ Here is the call graph for this function:

◆ initForm()

ilPCSectionGUI::initForm (   $a_insert = false)

Init editing form.

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

129 {
130 global $lng, $ilCtrl;
131
132 // edit form
133 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
134 $form = new ilPropertyFormGUI();
135 $form->setFormAction($ilCtrl->getFormAction($this));
136 if ($a_insert)
137 {
138 $form->setTitle($this->lng->txt("cont_insert_section"));
139 }
140 else
141 {
142 $form->setTitle($this->lng->txt("cont_update_section"));
143 }
144
145 // characteristic selection
146 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
147 $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
148 "characteristic");
149
150 $chars = $this->getCharacteristics();
151 if (is_object($this->content_obj))
152 {
153 if ($chars[$a_seleted_value] == "" && ($this->content_obj->getCharacteristic() != ""))
154 {
155 $chars = array_merge(
156 array($this->content_obj->getCharacteristic() => $this->content_obj->getCharacteristic()),
157 $chars);
158 }
159 }
160
161 $selected = ($a_insert)
162 ? "Block"
163 : $this->content_obj->getCharacteristic();
164
165 foreach($chars as $k => $char)
166 {
167 $html = '<div class="ilCOPgEditStyleSelectionItem"><div class="ilc_section_'.$k.'" style="'.self::$style_selector_reset.'">'.
168 $char.'</div></div>';
169 $char_prop->addOption($k, $char, $html);
170 }
171
172 $char_prop->setValue($selected);
173 $form->addItem($char_prop);
174
175 // active from
176 $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_from"), "active_from");
177 if (!$a_insert && ($from = $this->content_obj->getActiveFrom()) != "")
178 {
179 $dt_prop->setDate(new ilDateTime($from, IL_CAL_UNIX));
180 }
181 $dt_prop->setMode(ilDateTimeInputGUI::MODE_INPUT);
182 $dt_prop->setShowTime(true);
183 $form->addItem($dt_prop);
184
185 // active to
186 $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_active_to"), "active_to");
187 if (!$a_insert && ($to = $this->content_obj->getActiveTo()) != "")
188 {
189 $dt_prop->setDate(new ilDateTime($to, IL_CAL_UNIX));
190 }
191 $dt_prop->setMode(ilDateTimeInputGUI::MODE_INPUT);
192 $dt_prop->setShowTime(true);
193 $form->addItem($dt_prop);
194
195 // save/cancel buttons
196 if ($a_insert)
197 {
198 $form->addCommandButton("create_section", $lng->txt("save"));
199 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
200 }
201 else
202 {
203 $form->addCommandButton("update", $lng->txt("save"));
204 $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
205 }
206
207 return $form;
208 }
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
getCharacteristics()
Get characteristics.
This class represents a property form user interface.

References $html, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\getCharacteristics(), IL_CAL_UNIX, and ilDateTimeInputGUI\MODE_INPUT.

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

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

◆ insert()

ilPCSectionGUI::insert ( )

Insert new section form.

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

106 {
107 $this->edit(true);
108 }
edit($a_insert=false)
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 263 of file class.ilPCSectionGUI.php.

264 {
265 $this->content_obj->setCharacteristic($_POST["characteristic"]);
266
267 if ($_POST["active_from"]["date"] != "" &&
268 $from = $form->getItemByPostVar("active_from")->getDate())
269 {
270 $this->content_obj->setActiveFrom($from->get(IL_CAL_UNIX));
271 }
272 else
273 {
274 $this->content_obj->setActiveFrom(0);
275 }
276
277 if ($_POST["active_to"]["date"] != "" &&
278 $to = $form->getItemByPostVar("active_to")->getDate())
279 {
280 $this->content_obj->setActiveTo($to->get(IL_CAL_UNIX));
281 }
282 else
283 {
284 $this->content_obj->setActiveTo(0);
285 }
286
287 }
$_POST['username']
Definition: cron.php:12

References $_POST, and IL_CAL_UNIX.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ update()

ilPCSectionGUI::update ( )

Update Section.

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

240 {
241 $form = $this->initForm(false);
242 $form->checkInput();
243
244 $this->setValuesFromForm($form);
245
246 $this->updated = $this->pg_obj->update();
247 if ($this->updated === true)
248 {
249 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
250 }
251 else
252 {
253 $this->pg_obj->addHierIDs();
254 $this->edit();
255 }
256 }

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

+ Here is the call graph for this function:

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