Public Member Functions | Data Fields

ilCourseItemAdministrationGUI Class Reference

Public Member Functions

 ilObjCourseItemAdministrationGUI (&$container_obj, $a_item_id)
 Constructor public.
 ilCourseItemAdministrationGUI (&$container_obj, $a_item_id)
 Constructor public.
executeCommand ()
 getItemId ()
 cancel ()
 edit ()
 update ()
 moveUp ()
 moveDown ()
 __checkItemId ()
 __initItem ()
 __toUnix ($date, $time=array())
 __prepareDateSelect ($a_unix_time)
 __prepareTimeSelect ($a_unix_time)
 __setTabs ()

Data Fields

 $container_obj
 $tpl
 $ctrl
 $lng

Detailed Description

Definition at line 34 of file class.ilCourseAvailabilityGUI.php.


Member Function Documentation

ilCourseItemAdministrationGUI::__checkItemId (  ) 

Definition at line 312 of file class.ilCourseItemAdministrationGUI.php.

References $tree, and getItemId().

Referenced by executeCommand().

        {
                global $tree;

                if(!$this->getItemId())
                {
                        return false;
                }
                // Item has to be within course
                if(!$tree->checkForParentType($this->getItemId(),'crs'))
                {
                        return false;
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItemAdministrationGUI::__initItem (  ) 

Definition at line 328 of file class.ilCourseItemAdministrationGUI.php.

References $tree, and ilObjectFactory::getInstanceByRefId().

Referenced by ilCourseItemAdministrationGUI().

        {
                global $ilObjDataCache,$tree;

                include_once "./course/classes/class.ilCourseItems.php";
                
                if(!is_object($this->items_obj))
                {
                        if($ilObjDataCache->lookupType($this->container_obj->getId()) == 'crs')
                        {
                                $this->items_obj =& new ilCourseItems($this->container_obj,$this->container_obj->getRefId());
                        }
                        else
                        {
                                // lookup crs_obj
                                $crs_ref_id = $tree->checkForParentType($this->container_obj->getRefId(),'crs');
                                $crs_obj = ilObjectFactory::getInstanceByRefId($crs_ref_id);

                                $this->items_obj =& new ilCourseItems($crs_obj,$this->container_obj->getRefId());
                        }
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItemAdministrationGUI::__prepareDateSelect ( a_unix_time  ) 

Definition at line 357 of file class.ilCourseItemAdministrationGUI.php.

Referenced by edit().

        {
                return array('y' => date('Y',$a_unix_time),
                                         'm' => date('m',$a_unix_time),
                                         'd' => date('d',$a_unix_time));
        }

Here is the caller graph for this function:

ilCourseItemAdministrationGUI::__prepareTimeSelect ( a_unix_time  ) 

Definition at line 364 of file class.ilCourseItemAdministrationGUI.php.

Referenced by edit().

        {
                return array('h' => date('G',$a_unix_time),
                                         'm' => date('i',$a_unix_time),
                                         's' => date('s',$a_unix_time));
        }

Here is the caller graph for this function:

ilCourseItemAdministrationGUI::__setTabs (  ) 

Definition at line 371 of file class.ilCourseItemAdministrationGUI.php.

References $_GET, and $rbacsystem.

Referenced by executeCommand().

        {
                global $rbacsystem,$ilUser;
                
                $this->tabs_gui->clearTargets();

                $this->tabs_gui->setBackTarget($this->lng->txt('back_to_'.$this->container_obj->getType().'_content'),
                                                                           'repository.php?ref_id='.$this->container_obj->getRefId());
                $this->tabs_gui->addTarget("timings",
                                                                   $this->ctrl->getLinkTarget($this,'edit'),
                                                                   "edit", get_class($this));
                $this->ctrl->setParameterByClass('ilconditionhandlerinterface','item_id',(int) $_GET['item_id']);
                $this->tabs_gui->addTarget("preconditions",
                                                                   $this->ctrl->getLinkTargetByClass('ilConditionHandlerInterface','listConditions'),
                                                                   "", "ilConditionHandlerInterface");
                return true;
        }

Here is the caller graph for this function:

ilCourseItemAdministrationGUI::__toUnix ( date,
time = array() 
)

Definition at line 352 of file class.ilCourseItemAdministrationGUI.php.

Referenced by edit(), and update().

        {
                return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
        }

Here is the caller graph for this function:

ilCourseItemAdministrationGUI::cancel (  ) 

Definition at line 112 of file class.ilCourseItemAdministrationGUI.php.

        {
                $this->ctrl->returnToParent($this);
        }

ilCourseItemAdministrationGUI::edit (  ) 

Definition at line 117 of file class.ilCourseItemAdministrationGUI.php.

References $_POST, $ilErr, $title, __prepareDateSelect(), __prepareTimeSelect(), __toUnix(), ilUtil::formCheckbox(), ilUtil::formRadioButton(), ilUtil::getImagePath(), getItemId(), ilUtil::makeDateSelect(), and ilUtil::makeTimeSelect().

Referenced by update().

        {
                global $ilErr,$ilAccess,$ilObjDataCache;

                if(!$ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
                {
                        $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
                }

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_edit_item.html","course");
                $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                $item_data = $this->items_obj->getItem($this->getItemId());
                $title = $ilObjDataCache->lookupTitle($item_data['obj_id']);

                if(isset($_POST['cmd']))
                {
                        $timing_type = $_POST['timing_type'];
                        $visible = $_POST['visible'];
                        $changeable = $_POST['changeable'];
                        $timing_start = $this->__toUnix($_POST['timing_start'],$_POST['timing_start_time']);
                        $timing_end = $this->__toUnix($_POST['timing_end'],$_POST['timing_end_time']);
                        $suggestion_start = $this->__toUnix($_POST['sug_start']);
                        $suggestion_end = $this->__toUnix($_POST['sug_end']);
                        $earliest_start = $this->__toUnix($_POST['early_start']);
                        $latest_end = $this->__toUnix($_POST['late_end']);
                }
                else
                {
                        $timing_type = $item_data['timing_type'];
                        $visible = $item_data['visible'];
                        $changeable = $item_data['changeable'];
                        $timing_start = $item_data['timing_start'];
                        $timing_end = $item_data['timing_end'];
                        $suggestion_start = $item_data['suggestion_start'];
                        $suggestion_end = $item_data['suggestion_end'];
                        $earliest_start = $item_data['earliest_start'];
                        $latest_end = $item_data['latest_end'];
                }

                // SET TEXT VARIABLES
                $this->tpl->setVariable("ALT_IMG",$this->lng->txt("obj_".$ilObjDataCache->lookupType($item_data['obj_id'])));
                $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath("icon_".$ilObjDataCache->lookupType($item_data['obj_id']).".gif"));
                $this->tpl->setVariable("TITLE",$ilObjDataCache->lookupTitle($item_data['obj_id']));
                $this->tpl->setVariable("EDIT_TIMINGS",$this->lng->txt('crs_edit_timings'));
                $this->tpl->setVariable("TXT_TIMINGS",$this->lng->txt('crs_timings_disabled'));
                $this->tpl->setVariable("INFO_DEACTIVATED",$this->lng->txt('crs_timings_disabled_info'));
                $this->tpl->setVariable("TXT_BEGIN",$this->lng->txt('crs_timings_start'));
                $this->tpl->setVariable("TXT_END",$this->lng->txt('crs_timings_END'));
                $this->tpl->setVariable("TXT_ACTIVATION_ENABLED",$this->lng->txt('crs_timings_availability_enabled'));
                $this->tpl->setVariable("TXT_PRESETTING",$this->lng->txt('crs_timings_presetting_tbl'));
                $this->tpl->setVariable("TXT_SUG_BEGIN",$this->lng->txt('crs_timings_sug_begin'));
                $this->tpl->setVariable("TXT_SUG_END",$this->lng->txt('crs_suggestion_end'));
                $this->tpl->setVariable("TXT_EARLY_BEGIN",$this->lng->txt('crs_timings_early_begin'));
                $this->tpl->setVariable("TXT_LATE_END",$this->lng->txt('crs_timings_late_end'));
                $this->tpl->setVariable("TXT_TIME",$this->lng->txt('time'));



                // Disabled
                $this->tpl->setVariable("TXT_AVAILABILITY",$this->lng->txt('crs_timings_availability_tbl'));
                $this->tpl->setVariable("TXT_TIMINGS_DEACTIVATED",$this->lng->txt('crs_timings_deactivated'));
                $this->tpl->setVariable("RADIO_DEACTIVATE",ilUtil::formRadioButton($timing_type == IL_CRS_TIMINGS_DEACTIVATED,
                                                                                                                                                   'timing_type',IL_CRS_TIMINGS_DEACTIVATED));

                // Activation
                $this->tpl->setVariable("RADIO_ACTIVATION",ilUtil::formRadioButton($timing_type == IL_CRS_TIMINGS_ACTIVATION,
                                                                                                                                                   'timing_type',IL_CRS_TIMINGS_ACTIVATION));
                $this->tpl->setVariable("TXT_TIMINGS_ACTIVATION",$this->lng->txt('crs_timings_availability'));
                $this->tpl->setVariable("INFO_AVAILABILITY",$this->lng->txt('crs_item_availability_info'));

                $this->tpl->setVariable("CHECK_VISIBILITY",ilUtil::formCheckbox($visible,
                                                                                                                                                'visible',1));
                $this->tpl->setVariable("TXT_VISIBILITY",$this->lng->txt('crs_timings_visibility'));

                // Timings
                $this->tpl->setVariable("RADIO_TIMINGS",ilUtil::formRadioButton($timing_type == IL_CRS_TIMINGS_PRESETTING,
                                                                                                                                                'timing_type',IL_CRS_TIMINGS_PRESETTING));
                $this->tpl->setVariable("TXT_TIMINGS_PRESETTING",$this->lng->txt('crs_timings_presetting'));
                $this->tpl->setVariable("INFO_PRESETTING",$this->lng->txt('crs_item_presetting_info'));

                $this->tpl->setVariable("CHECK_CHANGE",ilUtil::formCheckbox($changeable,'changeable',1));
                $this->tpl->setVariable("TXT_CHANGE",$this->lng->txt('crs_timings_changeable'));

                // Start
                $this->tpl->setVariable("TXT_START",$this->lng->txt('crs_timings_start'));

                $date = $this->__prepareDateSelect($timing_start);
                $this->tpl->setVariable("START_DATE_SELECT",
                                                                ilUtil::makeDateSelect('timing_start',$date['y'],$date['m'],$date['d'],date('Y',time())));

                $date = $this->__prepareTimeSelect($timing_start);
                $this->tpl->setVariable("START_TIME_SELECT",
                                                                ilUtil::makeTimeSelect('timing_start_time',true,$date['h'],$date['m'],0,false));

                // End
                $date = $this->__prepareDateSelect($timing_end);
                $this->tpl->setVariable("END_DATE_SELECT",
                                                                ilUtil::makeDateSelect('timing_end',$date['y'],$date['m'],$date['d'],date('Y',time())));

                $date = $this->__prepareTimeSelect($timing_end);
                $this->tpl->setVariable("END_TIME_SELECT",
                                                                ilUtil::makeTimeSelect('timing_end_time',true,$date['h'],$date['m'],0,false));

                // End
                $this->tpl->setVariable("TXT_END",$this->lng->txt('crs_timings_end'));

                // Suggestion Start
                $date = $this->__prepareDateSelect($suggestion_start);
                $this->tpl->setVariable("SUG_START_SELECT",
                                                                ilUtil::makeDateSelect('sug_start',$date['y'],$date['m'],$date['d'],date('Y',time())));
                
                $date = $this->__prepareDateSelect($suggestion_end);
                $this->tpl->setVariable("SUG_END_SELECT",
                                                                ilUtil::makeDateSelect('sug_end',$date['y'],$date['m'],$date['d'],date('Y',time())));

                // Earliest Latest
                $date = $this->__prepareDateSelect($earliest_start);
                $this->tpl->setVariable("EARLY_SELECT",
                                                                ilUtil::makeDateSelect('early_start',$date['y'],$date['m'],$date['d'],date('Y',time())));

                $date = $this->__prepareDateSelect($latest_end);
                $this->tpl->setVariable("LATE_SELECT",
                                                                ilUtil::makeDateSelect('late_end',$date['y'],$date['m'],$date['d'],date('Y',time())));

                $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt("cancel"));
                $this->tpl->setVariable("TXT_SAVE",$this->lng->txt("save"));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilCourseItemAdministrationGUI::executeCommand (  ) 

Definition at line 67 of file class.ilCourseItemAdministrationGUI.php.

References $_GET, $cmd, __checkItemId(), __setTabs(), and sendInfo().

        {
                global $ilTabs;

                $this->__setTabs();

                $cmd = $this->ctrl->getCmd();

                // Check if item id is given and valid
                if(!$this->__checkItemId())
                {
                        sendInfo($this->lng->txt("crs_no_item_id_given"),true);
                        $this->ctrl->returnToParent($this);
                }

                switch($this->ctrl->getNextClass($this))
                {

                        case 'ilconditionhandlerinterface':
                                
                                // preconditions for single course items
                                include_once './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;
                }
        }

Here is the call graph for this function:

ilCourseItemAdministrationGUI::getItemId (  ) 

Definition at line 107 of file class.ilCourseItemAdministrationGUI.php.

Referenced by __checkItemId(), edit(), moveDown(), moveUp(), and update().

        {
                return $this->item_id;
        }

Here is the caller graph for this function:

ilCourseItemAdministrationGUI::ilCourseItemAdministrationGUI ( &$  container_obj,
a_item_id 
)

Constructor public.

Definition at line 48 of file class.ilCourseItemAdministrationGUI.php.

References $container_obj, $ilCtrl, $ilErr, $lng, $tpl, and __initItem().

        {
                global $tpl,$ilCtrl,$lng,$ilObjDataCache,$ilErr,$ilTabs;

                $this->tpl =& $tpl;
                $this->ctrl =& $ilCtrl;
                $this->lng =& $lng;
                $this->lng->loadLanguageModule('crs');
                $this->err =& $ilErr;
                $this->tabs_gui =& $ilTabs;

                $this->container_obj =& $container_obj;

                $this->item_id = $a_item_id;
                $this->ctrl->saveParameter($this,'item_id');

                $this->__initItem();
        }

Here is the call graph for this function:

ilCourseItemAdministrationGUI::ilObjCourseItemAdministrationGUI ( &$  container_obj,
a_item_id 
)

Constructor public.

Definition at line 45 of file class.ilCourseAvailabilityGUI.php.

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

        {
                global $tpl,$ilCtrl,$lng,$ilObjDataCache;

                $this->tpl =& $tpl;
                $this->ctrl =& $ilCtrl;
                $this->lng =& $lng;

                $this->container_obj =& $container_obj;

                $this->item_id = $a_item_id;
                $this->ctrl->saveParameter($this,'item_id');
        }

ilCourseItemAdministrationGUI::moveDown (  ) 

Definition at line 295 of file class.ilCourseItemAdministrationGUI.php.

References $ilErr, getItemId(), and sendInfo().

        {
                global $ilErr,$ilAccess,$ilObjDataCache;

                if(!$ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
                {
                        $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
                }

                $this->items_obj->moveDown((int) $this->getItemId());
                sendInfo($this->lng->txt("crs_moved_item"),true);

                $this->ctrl->returnToParent($this);
                return true;
        }

Here is the call graph for this function:

ilCourseItemAdministrationGUI::moveUp (  ) 

Definition at line 279 of file class.ilCourseItemAdministrationGUI.php.

References $ilErr, getItemId(), and sendInfo().

        {
                global $ilErr,$ilAccess,$ilObjDataCache;

                if(!$ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
                {
                        $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
                }

                $this->items_obj->moveUp((int) $this->getItemId());
                sendInfo($this->lng->txt("crs_moved_item"),true);

                $this->ctrl->returnToParent($this);
                return true;
        }

Here is the call graph for this function:

ilCourseItemAdministrationGUI::update (  ) 

Definition at line 245 of file class.ilCourseItemAdministrationGUI.php.

References $_POST, $ilErr, __toUnix(), edit(), getItemId(), and sendInfo().

        {
                global $ilErr,$ilAccess,$ilObjDataCache;

                if(!$ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
                {
                        $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
                }

                $this->items_obj->setTimingType($_POST['timing_type']);
                $this->items_obj->setTimingStart($this->__toUnix($_POST['timing_start'],$_POST['timing_start_time']));
                $this->items_obj->setTimingEnd($this->__toUnix($_POST['timing_end'],$_POST['timing_end_time']));
                $this->items_obj->setSuggestionStart($this->__toUnix($_POST["sug_start"]));
                $this->items_obj->setSuggestionEnd($this->__toUnix($_POST["sug_end"],array('h' => 23,'m' => 55)));
                $this->items_obj->setEarliestStart($this->__toUnix($_POST['early_start']));
                $this->items_obj->setLatestEnd($this->__toUnix($_POST['late_end'],array('h' => 23,'m' => 55)));
                $this->items_obj->toggleVisible($_POST['visible']);
                $this->items_obj->toggleChangeable($_POST['changeable']);

                if(!$this->items_obj->validateActivation())
                {
                        sendInfo($ilErr->getMessage());
                        $this->edit();

                        return true;
                }
                $this->items_obj->update($this->getItemId());
                sendInfo($this->lng->txt('settings_saved'));
                $this->edit();
                #$this->ctrl->returnToParent($this);

                return true;
        }

Here is the call graph for this function:


Field Documentation

ilCourseItemAdministrationGUI::$container_obj
ilCourseItemAdministrationGUI::$ctrl

Definition at line 38 of file class.ilCourseAvailabilityGUI.php.

ilCourseItemAdministrationGUI::$lng
ilCourseItemAdministrationGUI::$tpl

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