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

Class ilLPListOfSettingsGUI. More...

+ Inheritance diagram for ilLPListOfSettingsGUI:
+ Collaboration diagram for ilLPListOfSettingsGUI:

Public Member Functions

 __construct ($a_mode, $a_ref_id)
executeCommand ()
 execute command
- Public Member Functions inherited from ilLearningProgressBaseGUI
 ilLearningProgressBaseGUI ($a_mode, $a_ref_id=0, $a_usr_id=0)
 isAnonymized ()
 getMode ()
 getRefId ()
 getObjId ()
 getUserId ()
 activateStatistics ($a_act=true)
 __getDefaultCommand ()
 __setSubTabs ($a_active)
 __buildFooter ()
 __buildHeader ()
 __insertPath (&$a_tpl, $a_ref_id)
 insert path
 __showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
 _getImagePathForStatus ($a_status)
 Get image path for status.
 _getStatusText ($a_status)
 Get status alt text.
__initTableGUI ()
 __showObjectDetails (&$info, $item_id=0)
 show details about current object.
 __appendUserInfo (&$info, $a_user)
 __appendLPDetails (&$info, $item_id, $user_id)
 __readStatus ($a_obj_id, $user_id)
 __showButton ($a_link, $a_text, $a_target= '')
 __sort ($a_ids, $a_table, $a_field, $a_id_name)
 Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
 __getPercent ($max, $reached)
 __readItemStatusInfo ($a_items)
 __getLegendHTML ()
 __showEditUser ($a_user_id, $a_ref_id, $a_cancel, $a_sub_id=false)
 __updateUser ($user_id, $obj_id)

Protected Member Functions

 show ()
 Show settings tables.
 initFormSettings ()
 Init property form.
 saveSettings ()
 Save learning progress settings.
 getTableByMode ()
 Get tables by mode.
 assign ()
 Save material assignment.
 deassign ()
 save mterial assignment
 groupMaterials ()
 Group materials.
 releaseMaterials ()
 saveObligatoryMaterials ()
 Save obligatory state per grouped materials.
 updateTLT ()

Protected Attributes

 $obj_settings
 $obj_lp
- Protected Attributes inherited from ilLearningProgressBaseGUI
 $anonymized

Additional Inherited Members

- Static Public Member Functions inherited from ilLearningProgressBaseGUI
static _showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
static isObjectOffline ($a_obj_id, $a_type=null)
- Data Fields inherited from ilLearningProgressBaseGUI
 $tpl = null
 $ctrl = null
 $lng = null
 $ref_id = 0
 $mode = 0
 $statistics_activated = false
const LP_CONTEXT_PERSONAL_DESKTOP = 1
const LP_CONTEXT_ADMINISTRATION = 2
const LP_CONTEXT_REPOSITORY = 3
const LP_CONTEXT_USER_FOLDER = 4
const LP_CONTEXT_ORG_UNIT = 5
const LP_ACTIVE_SETTINGS = 1
const LP_ACTIVE_OBJECTS = 2
const LP_ACTIVE_PROGRESS = 3
const LP_ACTIVE_LM_STATISTICS = 4
const LP_ACTIVE_USERS = 5
const LP_ACTIVE_SUMMARY = 6
const LP_ACTIVE_OBJSTATACCESS = 7
const LP_ACTIVE_OBJSTATTYPES = 8
const LP_ACTIVE_OBJSTATDAILY = 9
const LP_ACTIVE_OBJSTATADMIN = 10
const LP_ACTIVE_MATRIX = 11

Detailed Description

Class ilLPListOfSettingsGUI.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilLPListOfSettingsGUI.php 56473 2014-12-16 16:13:56Z jluetzen

ilLPListOfSettingsGUI:

Definition at line 20 of file class.ilLPListOfSettingsGUI.php.

Constructor & Destructor Documentation

ilLPListOfSettingsGUI::__construct (   $a_mode,
  $a_ref_id 
)

Definition at line 25 of file class.ilLPListOfSettingsGUI.php.

References ilObjectLP\getInstance(), and ilLearningProgressBaseGUI\getObjId().

{
parent::__construct($a_mode,$a_ref_id);
$this->obj_settings = new ilLPObjSettings($this->getObjId());
include_once './Services/Object/classes/class.ilObjectLP.php';
$this->obj_lp = ilObjectLP::getInstance($this->getObjId());
}

+ Here is the call graph for this function:

Member Function Documentation

ilLPListOfSettingsGUI::assign ( )
protected

Save material assignment.

Returns
void

Definition at line 194 of file class.ilLPListOfSettingsGUI.php.

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if(!$_POST['item_ids'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->redirect($this,'show');
}
if(count($_POST['item_ids']))
{
$collection = $this->obj_lp->getCollectionInstance();
if($collection && $collection->hasSelectableItems())
{
$collection->activateEntries($_POST['item_ids']);
}
// #15045 - has to be done before LP refresh!
$this->obj_lp->resetCaches();
// refresh learning progress
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
}
ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
$this->ctrl->redirect($this,'show');
}

+ Here is the call graph for this function:

ilLPListOfSettingsGUI::deassign ( )
protected

save mterial assignment

Returns
void

Definition at line 224 of file class.ilLPListOfSettingsGUI.php.

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if(!$_POST['item_ids'])
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->redirect($this,'show');
return false;
}
if(count($_POST['item_ids']))
{
$collection = $this->obj_lp->getCollectionInstance();
if($collection && $collection->hasSelectableItems())
{
$collection->deactivateEntries($_POST['item_ids']);
}
// #15045 - has to be done before LP refresh!
$this->obj_lp->resetCaches();
// refresh learning progress
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
}
ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
$this->ctrl->redirect($this,'show');
}

+ Here is the call graph for this function:

& ilLPListOfSettingsGUI::executeCommand ( )

execute command

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

References $cmd, and ilLearningProgressBaseGUI\__getDefaultCommand().

{
switch($this->ctrl->getNextClass())
{
default:
$this->$cmd();
}
return true;
}

+ Here is the call graph for this function:

ilLPListOfSettingsGUI::getTableByMode ( )
protected

Get tables by mode.

Definition at line 178 of file class.ilLPListOfSettingsGUI.php.

References ilLearningProgressBaseGUI\getRefId(), and ilLPCollectionSettingsTableGUI\parse().

Referenced by saveSettings(), and show().

{
$collection = $this->obj_lp->getCollectionInstance();
if($collection && $collection->hasSelectableItems())
{
include_once "Services/Tracking/classes/repository_statistics/class.ilLPCollectionSettingsTableGUI.php";
$table = new ilLPCollectionSettingsTableGUI($this, 'show', $this->getRefId(), $this->obj_lp->getCurrentMode());
$table->parse($collection);
return $table->getHTML();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPListOfSettingsGUI::groupMaterials ( )
protected

Group materials.

Definition at line 254 of file class.ilLPListOfSettingsGUI.php.

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if(!count((array) $_POST['item_ids']))
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->redirect($this,'show');
}
$collection = $this->obj_lp->getCollectionInstance();
if($collection && $collection->hasSelectableItems())
{
// Assign new grouping id
$collection->createNewGrouping((array)$_POST['item_ids']);
// refresh learning progress
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
}
ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
$this->ctrl->redirect($this,'show');
}

+ Here is the call graph for this function:

ilLPListOfSettingsGUI::initFormSettings ( )
protected

Init property form.

Returns
ilPropertyFormGUI $form

Definition at line 72 of file class.ilLPListOfSettingsGUI.php.

References ilObjUserTracking\_getValidTimeSpan(), ilLPObjSettings\LP_MODE_VISITS, ilFormPropertyGUI\setRequired(), ilNumberInputGUI\setSize(), and ilRadioOption\setValue().

Referenced by saveSettings(), and show().

{
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setTitle($this->lng->txt('tracking_settings'));
$form->setFormAction($this->ctrl->getFormAction($this));
// Mode
$mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus');
$mod->setRequired(true);
$mod->setValue($this->obj_lp->getCurrentMode());
$form->addItem($mod);
foreach($this->obj_lp->getValidModes() as $mode_key)
{
$opt = new ilRadioOption(
$this->obj_lp->getModeText($mode_key),
$mode_key,
$this->obj_lp->getModeInfoText($mode_key)
);
$opt->setValue($mode_key);
$mod->addOption($opt);
// :TODO: Subitem for visits ?!
{
$vis = new ilNumberInputGUI($this->lng->txt('trac_visits'), 'visits');
$vis->setSize(3);
$vis->setMaxLength(4);
$vis->setInfo(sprintf($this->lng->txt('trac_visits_info'),
$vis->setRequired(true);
$vis->setValue($this->obj_settings->getVisits());
$opt->addSubItem($vis);
}
}
$form->addCommandButton('saveSettings', $this->lng->txt('save'));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPListOfSettingsGUI::releaseMaterials ( )
protected

Definition at line 280 of file class.ilLPListOfSettingsGUI.php.

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if(!count((array) $_POST['item_ids']))
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->redirect($this,'show');
}
$collection = $this->obj_lp->getCollectionInstance();
if($collection && $collection->hasSelectableItems())
{
$collection->releaseGrouping((array)$_POST['item_ids']);
// refresh learning progress
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
}
ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
$this->ctrl->redirect($this,'show');
}

+ Here is the call graph for this function:

ilLPListOfSettingsGUI::saveObligatoryMaterials ( )
protected

Save obligatory state per grouped materials.

Definition at line 305 of file class.ilLPListOfSettingsGUI.php.

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

{
if(!is_array((array) $_POST['grp']))
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$this->ctrl->redirect($this,'show');
}
try {
$collection = $this->obj_lp->getCollectionInstance();
if($collection && $collection->hasSelectableItems())
{
$collection->saveObligatoryMaterials((array)$_POST['grp']);
// refresh learning progress
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
$this->ctrl->redirect($this,'show');
}
catch(UnexpectedValueException $e) {
ilUtil::sendFailure($this->lng->txt('trac_grouped_material_obligatory_err'), true);
ilUtil::sendInfo($this->lng->txt('err_check_input'),true);
$this->ctrl->redirect($this,'show');
}
}

+ Here is the call graph for this function:

ilLPListOfSettingsGUI::saveSettings ( )
protected

Save learning progress settings.

Returns
void

Definition at line 118 of file class.ilLPListOfSettingsGUI.php.

References getTableByMode(), initFormSettings(), ilLPObjSettings\LP_MODE_VISITS, ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

{
$form = $this->initFormSettings();
if($form->checkInput())
{
// anything changed?
// mode
$new_mode = (int)$form->getInput('modus');
$old_mode = $this->obj_lp->getCurrentMode();
$mode_changed = ($old_mode != $new_mode);
// visits
$new_visits = null;
$visits_changed = null;
{
$new_visits = (int)$form->getInput('visits');
$old_visits = $this->obj_settings->getVisits();
$visits_changed = ($old_visits != $new_visits);
}
if($mode_changed)
{
// delete existing collection
$collection = $this->obj_lp->getCollectionInstance();
if($collection)
{
$collection->delete();
}
}
$refresh_lp = ($mode_changed || $visits_changed);
// has to be done before LP refresh!
$this->obj_lp->resetCaches();
$this->obj_settings->setMode($new_mode);
$this->obj_settings->setVisits($new_visits);
$this->obj_settings->update($refresh_lp);
if($mode_changed && $this->obj_lp->getCollectionInstance())
{
ilUtil::sendInfo($this->lng->txt('trac_edit_collection'), true);
}
ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
$this->ctrl->redirect($this, 'show');
}
$form->setValuesByPost();
ilUtil::sendFailure($this->lng->txt('err_check_input'));
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_obj_settings.html','Services/Tracking');
$this->tpl->setVariable('PROP_FORM',$form->getHTML());
$this->tpl->setVariable('COLLECTION_TABLE',$this->getTableByMode());
}

+ Here is the call graph for this function:

ilLPListOfSettingsGUI::show ( )
protected

Show settings tables.

Definition at line 53 of file class.ilLPListOfSettingsGUI.php.

References getTableByMode(), and initFormSettings().

{
global $ilHelp;
$ilHelp->setSubScreenId("trac_settings");
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_obj_settings.html','Services/Tracking');
$form = $this->initFormSettings();
$this->tpl->setVariable('PROP_FORM',$form->getHTML());
$this->tpl->setVariable('COLLECTION_TABLE',$this->getTableByMode());
}

+ Here is the call graph for this function:

ilLPListOfSettingsGUI::updateTLT ( )
protected

Definition at line 335 of file class.ilLPListOfSettingsGUI.php.

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), and ilUtil\sendSuccess().

{
include_once "Services/MetaData/classes/class.ilMD.php";
foreach($_POST['tlt'] as $item_id => $item)
{
$md_obj = new ilMD($this->getObjId(),$item_id,'st');
if(!is_object($md_section = $md_obj->getEducational()))
{
$md_section = $md_obj->addEducational();
$md_section->save();
}
$md_section->setPhysicalTypicalLearningTime((int)$item['mo'],
(int)$item['d'],(int)$item['h'],(int)$item['m'],0);
$md_section->update();
}
// refresh learning progress
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
$this->ctrl->redirect($this,'show');
}

+ Here is the call graph for this function:

Field Documentation

ilLPListOfSettingsGUI::$obj_lp
protected

Definition at line 23 of file class.ilLPListOfSettingsGUI.php.

ilLPListOfSettingsGUI::$obj_settings
protected

Definition at line 22 of file class.ilLPListOfSettingsGUI.php.


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