ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjectActivationGUI Class Reference

Class ilObjectActivationGUI. More...

+ Collaboration diagram for ilObjectActivationGUI:

Public Member Functions

 __construct ($a_ref_id, $a_item_id)
 Constructor public. More...
 
 executeCommand ()
 
 getItemId ()
 
 cancel ()
 
 edit ()
 edit timings More...
 
 update ()
 update More...
 
 __setTabs ()
 

Protected Member Functions

 initFormEdit ()
 init form edit More...
 
 getValues ()
 get values More...
 

Protected Attributes

 $parent_ref_id
 
 $item_id
 
 $tpl
 
 $ctrl
 
 $lng
 

Detailed Description

Class ilObjectActivationGUI.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilCourseItemAdministrationGUI.php 33406 2012-02-28 16:26:59Z akill

ilObjectActivationGUI: ilConditionHandlerGUI

Definition at line 12 of file class.ilObjectActivationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectActivationGUI::__construct (   $a_ref_id,
  $a_item_id 
)

Constructor public.

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

References $ilCtrl, $ilErr, $lng, and $tpl.

25  {
26  global $tpl,$ilCtrl,$lng,$ilErr,$ilTabs;
27 
28  $this->tpl =& $tpl;
29  $this->ctrl =& $ilCtrl;
30  $this->lng =& $lng;
31  $this->lng->loadLanguageModule('crs');
32  $this->err =& $ilErr;
33  $this->tabs_gui =& $ilTabs;
34 
35  $this->parent_ref_id = $a_ref_id;
36  $this->item_id = $a_item_id;
37  $this->ctrl->saveParameter($this,'item_id');
38 
39  }
global $ilCtrl
Definition: ilias.php:18

Member Function Documentation

◆ __setTabs()

ilObjectActivationGUI::__setTabs ( )

Definition at line 327 of file class.ilObjectActivationGUI.php.

References $_GET, and $ilCtrl.

Referenced by executeCommand().

328  {
329  global $ilCtrl, $ilHelp;
330 
331  $this->tabs_gui->clearTargets();
332 
333  $ilHelp->setScreenIdComponent("obj");
334 
335  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_ref_id);
336  $back_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
337  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
338  $this->tabs_gui->setBackTarget($this->lng->txt('btn_back'), $back_link);
339 
340  $this->tabs_gui->addTarget("timings",
341  $this->ctrl->getLinkTarget($this,'edit'),
342  "edit", get_class($this));
343 
344  $this->ctrl->setParameterByClass('ilconditionhandlergui','item_id',$this->item_id);
345  $this->tabs_gui->addTarget("preconditions",
346  $this->ctrl->getLinkTargetByClass('ilConditionHandlerGUI','listConditions'),
347  "", "ilConditionHandlerGUI");
348  return true;
349  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ cancel()

ilObjectActivationGUI::cancel ( )

Definition at line 88 of file class.ilObjectActivationGUI.php.

89  {
90  $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', $this->parent_ref_id);
91  $this->ctrl->redirectByClass('ilrepositorygui');
92  }

◆ edit()

ilObjectActivationGUI::edit ( )

edit timings

public

Returns

Definition at line 100 of file class.ilObjectActivationGUI.php.

References $ilErr, $tpl, getItemId(), getValues(), and initFormEdit().

101  {
102  global $ilErr,$ilAccess,$tpl;
103 
104  // #19997 - see ilObjectListGUI::insertTimingsCommand()
105  if(!$ilAccess->checkAccess('write','',$this->parent_ref_id) &&
106  !$ilAccess->checkAccess('write','',$this->getItemId()))
107  {
108  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
109  }
110 
111  $this->initFormEdit();
112  $this->getValues();
113 
114  $tpl->setContent($this->form->getHTML());
115  }
+ Here is the call graph for this function:

◆ executeCommand()

ilObjectActivationGUI::executeCommand ( )

Definition at line 41 of file class.ilObjectActivationGUI.php.

References $_GET, $cmd, $tpl, __setTabs(), and ilUtil\sendFailure().

42  {
43  global $tpl;
44 
45  $this->__setTabs();
46 
47  $cmd = $this->ctrl->getCmd();
48 
49  // Check if item id is given and valid
50  if(!$this->item_id)
51  {
52  ilUtil::sendFailure($this->lng->txt("crs_no_item_id_given"),true);
53  $this->ctrl->returnToParent($this);
54  }
55 
56  $tpl->getStandardTemplate();
57 
58  switch($this->ctrl->getNextClass($this))
59  {
60  case 'ilconditionhandlergui':
61  // preconditions for single course items
62  include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
63  $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
64  $new_gui =& new ilConditionHandlerGUI($this,(int) $_GET['item_id']);
65  $this->ctrl->forwardCommand($new_gui);
66  $this->tabs_gui->setTabActive('preconditions');
67  break;
68 
69  default:
70  $this->tabs_gui->setTabActive('timings');
71  if(!$cmd)
72  {
73  $cmd = 'edit';
74  }
75  $this->$cmd();
76  $this->tabs_gui->setTabActive('timings');
77  break;
78  }
79 
80  $tpl->show();
81  }
class ilConditionHandlerGUI
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ getItemId()

ilObjectActivationGUI::getItemId ( )

Definition at line 83 of file class.ilObjectActivationGUI.php.

References $item_id.

Referenced by edit(), getValues(), initFormEdit(), and update().

+ Here is the caller graph for this function:

◆ getValues()

ilObjectActivationGUI::getValues ( )
protected

get values

protected

Returns

Definition at line 201 of file class.ilObjectActivationGUI.php.

References $data, $ilUser, ilObjectActivation\getItem(), getItemId(), IL_CAL_DATE, IL_CAL_FKT_DATE, IL_CAL_UNIX, and ilObjectActivation\TIMINGS_DEACTIVATED.

Referenced by edit().

202  {
203  global $ilUser;
204 
205  include_once "Services/Object/classes/class.ilObjectActivation.php";
206  $item_data = ilObjectActivation::getItem($this->getItemId());
207 
208  $data = array();
209 
210  if(!$item_data)
211  {
213  }
214  else
215  {
216  $data['timing_type'] = $item_data['timing_type'];
217  $data['visible'] = $item_data['visible'];
218  $data['changeable'] = $item_data['changeable'];
219 
220  // #14531
221  if($item_data['timing_start'] < 1)
222  {
223  $item_data['timing_start'] = time();
224  }
225  if($item_data['timing_end'] < 1)
226  {
227  $item_data['timing_end'] = time();
228  }
229 
230  $start = new ilDateTime($item_data['timing_start'],IL_CAL_UNIX);
231  $data['timing_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
232  $data['timing_start']['time'] = $start->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
233 
234  $end = new ilDateTime($item_data['timing_end'],IL_CAL_UNIX);
235  $data['timing_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
236  $data['timing_end']['time'] = $end->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
237 
238  $start = new ilDate(date('Y-m-d',$item_data['suggestion_start']),IL_CAL_DATE);
239  $data['sug_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
240 
241  $end = new ilDate(date('Y-m-d',$item_data['suggestion_end']),IL_CAL_DATE);
242  $data['sug_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
243 
244  $start = new ilDate(date('Y-m-d',$item_data['earliest_start']),IL_CAL_DATE);
245  $data['early_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
246 
247  $end = new ilDate(date('Y-m-d',$item_data['latest_end']),IL_CAL_DATE);
248  $data['late_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
249  }
250 
251  $this->form->setValuesByArray($data);
252  }
static getItem($a_ref_id)
Get item data.
const IL_CAL_UNIX
Class for single dates.
const IL_CAL_FKT_DATE
Date and time handling
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormEdit()

ilObjectActivationGUI::initFormEdit ( )
protected

init form edit

protected

Returns

Definition at line 123 of file class.ilObjectActivationGUI.php.

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilSubEnabledFormPropertyGUI\addSubItem(), ilRadioOption\addSubItem(), getItemId(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilDateTimeInputGUI\setShowTime(), ilObjectActivation\TIMINGS_ACTIVATION, ilObjectActivation\TIMINGS_DEACTIVATED, and ilObjectActivation\TIMINGS_PRESETTING.

Referenced by edit(), and update().

124  {
125  global $tree;
126 
127  include_once "Services/Object/classes/class.ilObjectActivation.php";
128 
129  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
130  $this->form = new ilPropertyFormGUI();
131  $this->form->setFormAction($this->ctrl->getFormAction($this));
132 
134  $this->form->setTitle($title.': '.$this->lng->txt('crs_edit_timings'));
135 
136  $timings = new ilRadioGroupInputGUI($this->lng->txt('timings'),'timing_type');
137 
138  // opt deactivated
139  $dea = new ilRadioOption($this->lng->txt('crs_timings_disabled'),ilObjectActivation::TIMINGS_DEACTIVATED);
140  $dea->setInfo($this->lng->txt('crs_timings_disabled_info'));
141  $timings->addOption($dea);
142 
143  // Visiblity
144  $vis = new ilRadioOption($this->lng->txt('crs_timings_availability_enabled'),ilObjectActivation::TIMINGS_ACTIVATION);
145  #$vis->setInfo($this->lng->txt('crs_timings_visibility'));
146 
147  $start = new ilDateTimeInputGUI($this->lng->txt('crs_timings_start'),'timing_start');
148  $start->setShowTime(true);
149  #$start->setMinuteStepSize(5);
150  $vis->addSubItem($start);
151 
152  $end = new ilDateTimeInputGUI($this->lng->txt('crs_timings_end'),'timing_end');
153  $end->setShowTime(true);
154  #$end->setMinuteStepSize(5);
155  $vis->addSubItem($end);
156 
157  $isv = new ilCheckboxInputGUI($this->lng->txt('crs_timings_visibility_short'),'visible');
158  $isv->setInfo($this->lng->txt('crs_timings_visibility'));
159  $isv->setValue(1);
160  $vis->addSubItem($isv);
161 
162  $timings->addOption($vis);
163 
164  // Timings
165  $tim = new ilRadioOption($this->lng->txt('crs_timings_presetting'),ilObjectActivation::TIMINGS_PRESETTING);
166  $tim->setInfo($this->lng->txt('crs_item_presetting_info'));
167 
168  $start = new ilDateTimeInputGUI($this->lng->txt('crs_timings_sug_begin'),'sug_start');
169  $tim->addSubItem($start);
170 
171  $end = new ilDateTimeInputGUI($this->lng->txt('crs_timings_sug_end'),'sug_end');
172  $tim->addSubItem($end);
173 
174  if ($tree->checkForParentType($this->parent_ref_id,'crs'))
175  {
176  $cha = new ilCheckboxInputGUI($this->lng->txt('crs_timings_changeable'),'changeable');
177  $tim->addSubItem($cha);
178 
179  $start = new ilDateTimeInputGUI($this->lng->txt('crs_timings_early_begin'),'early_start');
180  $tim->addSubItem($start);
181 
182  $late = new ilDateTimeInputGUI($this->lng->txt('crs_timings_short_limit_start_end'),'late_end');
183  $tim->addSubItem($late);
184  }
185 
186 
187  $timings->addOption($tim);
188 
189  $this->form->addItem($timings);
190 
191  $this->form->addCommandButton('update',$this->lng->txt('save'));
192  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
193  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
setInfo($a_info)
Set Info.
This class represents a date/time property in a property form.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
addSubItem($a_item)
Add Subitem.
static _lookupObjId($a_id)
setShowTime($a_showtime)
Set Show Time Information.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjectActivationGUI::update ( )

update

public

Returns

Definition at line 260 of file class.ilObjectActivationGUI.php.

References $ilErr, $ilUser, $tpl, getItemId(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, initFormEdit(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

261  {
262  global $ilErr,$ilAccess,$tpl,$ilUser;
263 
264  // #19997 - see ilObjectListGUI::insertTimingsCommand()
265  if(!$ilAccess->checkAccess('write','',$this->parent_ref_id) &&
266  !$ilAccess->checkAccess('write','',$this->getItemId()))
267  {
268  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
269  }
270 
271  $this->initFormEdit();
272  if($this->form->checkInput())
273  {
274  include_once "Services/Object/classes/class.ilObjectActivation.php";
275  $activation = new ilObjectActivation();
276 
277  $activation->setTimingType($this->form->getInput('timing_type'));
278 
279  $date = $this->form->getInput('timing_start');
280  $date = new ilDateTime($date['date'].' '.$date['time'],IL_CAL_DATETIME,$ilUser->getTimeZone());
281  $activation->setTimingStart($date->get(IL_CAL_UNIX));
282 
283  $date = $this->form->getInput('timing_end');
284  $date = new ilDateTime($date['date'].' '.$date['time'],IL_CAL_DATETIME,$ilUser->getTimeZone());
285  $activation->setTimingEnd($date->get(IL_CAL_UNIX));
286 
287  $date = $this->form->getInput('sug_start');
288  $date = new ilDate($date['date'],IL_CAL_DATE);
289  $activation->setSuggestionStart($date->get(IL_CAL_UNIX));
290 
291  $date = $this->form->getInput('sug_end');
292  $date = new ilDate($date['date'],IL_CAL_DATE);
293  $activation->setSuggestionEnd($date->get(IL_CAL_UNIX));
294 
295  $date = $this->form->getInput('early_start');
296  $date = new ilDate($date['date'],IL_CAL_DATE);
297  $activation->setEarliestStart($date->get(IL_CAL_UNIX));
298 
299  $date = $this->form->getInput('late_end');
300  $date = new ilDate($date['date'],IL_CAL_DATE);
301  $activation->setLatestEnd($date->get(IL_CAL_UNIX));
302 
303  $activation->toggleVisible((bool) $this->form->getInput('visible'));
304  $activation->toggleChangeable((bool) $this->form->getInput('changeable'));
305 
306  if(!$activation->validateActivation())
307  {
308  ilUtil::sendFailure($ilErr->getMessage());
309  $this->form->setValuesByPost();
310  $tpl->setContent($this->form->getHTML());
311  return false;
312  }
313  else
314  {
315  $activation->update($this->getItemId());
316  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
317  $this->ctrl->redirect($this, "edit");
318  }
319  }
320  else
321  {
322  $this->form->setValuesByPost();
323  $tpl->setContent($this->form->getHTML());
324  }
325  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_DATETIME
const IL_CAL_UNIX
Class for single dates.
Date and time handling
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
Class ilObjectActivation.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilObjectActivationGUI::$ctrl
protected

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

◆ $item_id

ilObjectActivationGUI::$item_id
protected

Definition at line 15 of file class.ilObjectActivationGUI.php.

Referenced by getItemId().

◆ $lng

ilObjectActivationGUI::$lng
protected

Definition at line 18 of file class.ilObjectActivationGUI.php.

Referenced by __construct().

◆ $parent_ref_id

ilObjectActivationGUI::$parent_ref_id
protected

Definition at line 14 of file class.ilObjectActivationGUI.php.

◆ $tpl

ilObjectActivationGUI::$tpl
protected

Definition at line 16 of file class.ilObjectActivationGUI.php.

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


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