ILIAS  release_4-4 Revision
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: ilConditionHandlerInterface

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 317 of file class.ilObjectActivationGUI.php.

References $_GET, and $ilCtrl.

Referenced by executeCommand().

318  {
319  global $ilCtrl, $ilHelp;
320 
321  $this->tabs_gui->clearTargets();
322 
323  $ilHelp->setScreenIdComponent("obj");
324 
325  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_ref_id);
326  $back_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
327  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
328  $this->tabs_gui->setBackTarget($this->lng->txt('btn_back'), $back_link);
329 
330  $this->tabs_gui->addTarget("timings",
331  $this->ctrl->getLinkTarget($this,'edit'),
332  "edit", get_class($this));
333 
334  $this->ctrl->setParameterByClass('ilconditionhandlerinterface','item_id',$this->item_id);
335  $this->tabs_gui->addTarget("preconditions",
336  $this->ctrl->getLinkTargetByClass('ilConditionHandlerInterface','listConditions'),
337  "", "ilConditionHandlerInterface");
338  return true;
339  }
$_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 'ilconditionhandlerinterface':
61  // preconditions for single course items
62  include_once './Services/AccessControl/classes/class.ilConditionHandlerInterface.php';
63  $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
64  $new_gui =& new ilConditionHandlerInterface($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  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
class ilConditionHandlerInterface
+ 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  $start = new ilDateTime($item_data['timing_start'],IL_CAL_UNIX);
221  $data['timing_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
222  $data['timing_start']['time'] = $start->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
223 
224  $end = new ilDateTime($item_data['timing_end'],IL_CAL_UNIX);
225  $data['timing_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
226  $data['timing_end']['time'] = $end->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
227 
228  $start = new ilDate(date('Y-m-d',$item_data['suggestion_start']),IL_CAL_DATE);
229  $data['sug_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
230 
231  $end = new ilDate(date('Y-m-d',$item_data['suggestion_end']),IL_CAL_DATE);
232  $data['sug_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
233 
234  $start = new ilDate(date('Y-m-d',$item_data['earliest_start']),IL_CAL_DATE);
235  $data['early_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
236 
237  $end = new ilDate(date('Y-m-d',$item_data['latest_end']),IL_CAL_DATE);
238  $data['late_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
239  }
240 
241  $this->form->setValuesByArray($data);
242  }
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
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
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 250 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().

251  {
252  global $ilErr,$ilAccess,$tpl,$ilUser;
253 
254  // #19997 - see ilObjectListGUI::insertTimingsCommand()
255  if(!$ilAccess->checkAccess('write','',$this->parent_ref_id) &&
256  !$ilAccess->checkAccess('write','',$this->getItemId()))
257  {
258  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
259  }
260 
261  $this->initFormEdit();
262  if($this->form->checkInput())
263  {
264  include_once "Services/Object/classes/class.ilObjectActivation.php";
265  $activation = new ilObjectActivation();
266 
267  $activation->setTimingType($this->form->getInput('timing_type'));
268 
269  $date = $this->form->getInput('timing_start');
270  $date = new ilDateTime($date['date'].' '.$date['time'],IL_CAL_DATETIME,$ilUser->getTimeZone());
271  $activation->setTimingStart($date->get(IL_CAL_UNIX));
272 
273  $date = $this->form->getInput('timing_end');
274  $date = new ilDateTime($date['date'].' '.$date['time'],IL_CAL_DATETIME,$ilUser->getTimeZone());
275  $activation->setTimingEnd($date->get(IL_CAL_UNIX));
276 
277  $date = $this->form->getInput('sug_start');
278  $date = new ilDate($date['date'],IL_CAL_DATE);
279  $activation->setSuggestionStart($date->get(IL_CAL_UNIX));
280 
281  $date = $this->form->getInput('sug_end');
282  $date = new ilDate($date['date'],IL_CAL_DATE);
283  $activation->setSuggestionEnd($date->get(IL_CAL_UNIX));
284 
285  $date = $this->form->getInput('early_start');
286  $date = new ilDate($date['date'],IL_CAL_DATE);
287  $activation->setEarliestStart($date->get(IL_CAL_UNIX));
288 
289  $date = $this->form->getInput('late_end');
290  $date = new ilDate($date['date'],IL_CAL_DATE);
291  $activation->setLatestEnd($date->get(IL_CAL_UNIX));
292 
293  $activation->toggleVisible((bool) $this->form->getInput('visible'));
294  $activation->toggleChangeable((bool) $this->form->getInput('changeable'));
295 
296  if(!$activation->validateActivation())
297  {
298  ilUtil::sendFailure($ilErr->getMessage());
299  $this->form->setValuesByPost();
300  $tpl->setContent($this->form->getHTML());
301  return false;
302  }
303  else
304  {
305  $activation->update($this->getItemId());
306  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
307  $this->ctrl->redirect($this, "edit");
308  }
309  }
310  else
311  {
312  $this->form->setValuesByPost();
313  $tpl->setContent($this->form->getHTML());
314  }
315  }
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: