ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjectActivationGUI Class Reference

Class ilObjectActivationGUI. More...

+ Collaboration diagram for ilObjectActivationGUI:

Public Member Functions

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

Protected Member Functions

 initFormEdit ()
 init form edit
 getValues ()
 get values

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

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.

{
global $tpl,$ilCtrl,$lng,$ilErr,$ilTabs;
$this->tpl =& $tpl;
$this->ctrl =& $ilCtrl;
$this->lng =& $lng;
$this->lng->loadLanguageModule('crs');
$this->err =& $ilErr;
$this->tabs_gui =& $ilTabs;
$this->parent_ref_id = $a_ref_id;
$this->item_id = $a_item_id;
$this->ctrl->saveParameter($this,'item_id');
}

Member Function Documentation

ilObjectActivationGUI::__setTabs ( )

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

References $_GET, and $ilCtrl.

Referenced by executeCommand().

{
global $ilCtrl, $ilHelp;
$this->tabs_gui->clearTargets();
$ilHelp->setScreenIdComponent("obj");
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_ref_id);
$back_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
$this->tabs_gui->setBackTarget($this->lng->txt('btn_back'), $back_link);
$this->tabs_gui->addTarget("timings",
$this->ctrl->getLinkTarget($this,'edit'),
"edit", get_class($this));
$this->ctrl->setParameterByClass('ilconditionhandlerinterface','item_id',$this->item_id);
$this->tabs_gui->addTarget("preconditions",
$this->ctrl->getLinkTargetByClass('ilConditionHandlerInterface','listConditions'),
"", "ilConditionHandlerInterface");
return true;
}

+ Here is the caller graph for this function:

ilObjectActivationGUI::cancel ( )

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

{
$this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', $this->parent_ref_id);
$this->ctrl->redirectByClass('ilrepositorygui');
}
ilObjectActivationGUI::edit ( )

edit timings

public

Returns

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

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

{
global $ilErr,$ilAccess,$tpl;
// #19997 - see ilObjectListGUI::insertTimingsCommand()
if(!$ilAccess->checkAccess('write','',$this->parent_ref_id) &&
!$ilAccess->checkAccess('write','',$this->getItemId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
$this->initFormEdit();
$this->getValues();
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

ilObjectActivationGUI::executeCommand ( )

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

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

{
global $tpl;
$this->__setTabs();
$cmd = $this->ctrl->getCmd();
// Check if item id is given and valid
if(!$this->item_id)
{
ilUtil::sendFailure($this->lng->txt("crs_no_item_id_given"),true);
$this->ctrl->returnToParent($this);
}
$tpl->getStandardTemplate();
switch($this->ctrl->getNextClass($this))
{
case 'ilconditionhandlerinterface':
// preconditions for single course items
include_once './Services/AccessControl/classes/class.ilConditionHandlerInterface.php';
$this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
$new_gui =& new ilConditionHandlerInterface($this,(int) $_GET['item_id']);
$this->ctrl->forwardCommand($new_gui);
$this->tabs_gui->setTabActive('preconditions');
break;
default:
$this->tabs_gui->setTabActive('timings');
if(!$cmd)
{
$cmd = 'edit';
}
$this->$cmd();
$this->tabs_gui->setTabActive('timings');
break;
}
$tpl->show();
}

+ Here is the call graph for this function:

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:

ilObjectActivationGUI::getValues ( )
protected

get values

protected

Returns

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

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

Referenced by edit().

{
global $ilUser;
include_once "Services/Object/classes/class.ilObjectActivation.php";
$item_data = ilObjectActivation::getItem($this->getItemId());
$data = array();
if(!$item_data)
{
$data['timing_type'] = ilObjectActivation::TIMINGS_DEACTIVATED;
}
else
{
$data['timing_type'] = $item_data['timing_type'];
$data['visible'] = $item_data['visible'];
$data['changeable'] = $item_data['changeable'];
$start = new ilDateTime($item_data['timing_start'],IL_CAL_UNIX);
$data['timing_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
$data['timing_start']['time'] = $start->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
$end = new ilDateTime($item_data['timing_end'],IL_CAL_UNIX);
$data['timing_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
$data['timing_end']['time'] = $end->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
$start = new ilDate(date('Y-m-d',$item_data['suggestion_start']),IL_CAL_DATE);
$data['sug_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
$end = new ilDate(date('Y-m-d',$item_data['suggestion_end']),IL_CAL_DATE);
$data['sug_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
$start = new ilDate(date('Y-m-d',$item_data['earliest_start']),IL_CAL_DATE);
$data['early_start']['date'] = $start->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
$end = new ilDate(date('Y-m-d',$item_data['latest_end']),IL_CAL_DATE);
$data['late_end']['date'] = $end->get(IL_CAL_FKT_DATE,'Y-m-d','UTC');
}
$this->form->setValuesByArray($data);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
global $tree;
include_once "Services/Object/classes/class.ilObjectActivation.php";
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
$this->form->setTitle($title.': '.$this->lng->txt('crs_edit_timings'));
$timings = new ilRadioGroupInputGUI($this->lng->txt('timings'),'timing_type');
// opt deactivated
$dea = new ilRadioOption($this->lng->txt('crs_timings_disabled'),ilObjectActivation::TIMINGS_DEACTIVATED);
$dea->setInfo($this->lng->txt('crs_timings_disabled_info'));
$timings->addOption($dea);
// Visiblity
$vis = new ilRadioOption($this->lng->txt('crs_timings_availability_enabled'),ilObjectActivation::TIMINGS_ACTIVATION);
#$vis->setInfo($this->lng->txt('crs_timings_visibility'));
$start = new ilDateTimeInputGUI($this->lng->txt('crs_timings_start'),'timing_start');
$start->setShowTime(true);
#$start->setMinuteStepSize(5);
$vis->addSubItem($start);
$end = new ilDateTimeInputGUI($this->lng->txt('crs_timings_end'),'timing_end');
$end->setShowTime(true);
#$end->setMinuteStepSize(5);
$vis->addSubItem($end);
$isv = new ilCheckboxInputGUI($this->lng->txt('crs_timings_visibility_short'),'visible');
$isv->setInfo($this->lng->txt('crs_timings_visibility'));
$isv->setValue(1);
$vis->addSubItem($isv);
$timings->addOption($vis);
// Timings
$tim = new ilRadioOption($this->lng->txt('crs_timings_presetting'),ilObjectActivation::TIMINGS_PRESETTING);
$tim->setInfo($this->lng->txt('crs_item_presetting_info'));
$start = new ilDateTimeInputGUI($this->lng->txt('crs_timings_sug_begin'),'sug_start');
$tim->addSubItem($start);
$end = new ilDateTimeInputGUI($this->lng->txt('crs_timings_sug_end'),'sug_end');
$tim->addSubItem($end);
if ($tree->checkForParentType($this->parent_ref_id,'crs'))
{
$cha = new ilCheckboxInputGUI($this->lng->txt('crs_timings_changeable'),'changeable');
$tim->addSubItem($cha);
$start = new ilDateTimeInputGUI($this->lng->txt('crs_timings_early_begin'),'early_start');
$tim->addSubItem($start);
$late = new ilDateTimeInputGUI($this->lng->txt('crs_timings_short_limit_start_end'),'late_end');
$tim->addSubItem($late);
}
$timings->addOption($tim);
$this->form->addItem($timings);
$this->form->addCommandButton('update',$this->lng->txt('save'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
global $ilErr,$ilAccess,$tpl,$ilUser;
// #19997 - see ilObjectListGUI::insertTimingsCommand()
if(!$ilAccess->checkAccess('write','',$this->parent_ref_id) &&
!$ilAccess->checkAccess('write','',$this->getItemId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
$this->initFormEdit();
if($this->form->checkInput())
{
include_once "Services/Object/classes/class.ilObjectActivation.php";
$activation = new ilObjectActivation();
$activation->setTimingType($this->form->getInput('timing_type'));
$date = $this->form->getInput('timing_start');
$date = new ilDateTime($date['date'].' '.$date['time'],IL_CAL_DATETIME,$ilUser->getTimeZone());
$activation->setTimingStart($date->get(IL_CAL_UNIX));
$date = $this->form->getInput('timing_end');
$date = new ilDateTime($date['date'].' '.$date['time'],IL_CAL_DATETIME,$ilUser->getTimeZone());
$activation->setTimingEnd($date->get(IL_CAL_UNIX));
$date = $this->form->getInput('sug_start');
$date = new ilDate($date['date'],IL_CAL_DATE);
$activation->setSuggestionStart($date->get(IL_CAL_UNIX));
$date = $this->form->getInput('sug_end');
$date = new ilDate($date['date'],IL_CAL_DATE);
$activation->setSuggestionEnd($date->get(IL_CAL_UNIX));
$date = $this->form->getInput('early_start');
$date = new ilDate($date['date'],IL_CAL_DATE);
$activation->setEarliestStart($date->get(IL_CAL_UNIX));
$date = $this->form->getInput('late_end');
$date = new ilDate($date['date'],IL_CAL_DATE);
$activation->setLatestEnd($date->get(IL_CAL_UNIX));
$activation->toggleVisible((bool) $this->form->getInput('visible'));
$activation->toggleChangeable((bool) $this->form->getInput('changeable'));
if(!$activation->validateActivation())
{
ilUtil::sendFailure($ilErr->getMessage());
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHTML());
return false;
}
else
{
$activation->update($this->getItemId());
ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
$this->ctrl->redirect($this, "edit");
}
}
else
{
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHTML());
}
}

+ Here is the call graph for this function:

Field Documentation

ilObjectActivationGUI::$ctrl
protected

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

ilObjectActivationGUI::$item_id
protected

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

Referenced by getItemId().

ilObjectActivationGUI::$lng
protected

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

Referenced by __construct().

ilObjectActivationGUI::$parent_ref_id
protected

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

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: