ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilConditionHandlerGUI Class Reference

class ilConditionHandlerGUI More...

+ Collaboration diagram for ilConditionHandlerGUI:

Public Member Functions

 __construct ($gui_obj, $a_ref_id=null)
 Constructor <type> $lng <type> $tpl <type> $tree <type> $ilCtrl.
 setBackButtons ($a_btn_arr)
 getBackButtons ()
 executeCommand ()
 setAutomaticValidation ($a_status)
 getAutomaticValidation ()
 setTargetId ($a_target_id)
 set target id
 getTargetId ()
 get target id
 setTargetRefId ($a_target_ref_id)
 set target ref id
 getTargetRefId ()
 get target ref id
 setTargetType ($a_target_type)
 set target type
 getTargetType ()
 get target type
 setTargetTitle ($a_target_title)
 set target title
 isTargetReferenced ()
 Check if target has refernce id.
 getTargetTitle ()
 get target title
 chi_init (&$chi_target_obj, $a_ref_id=null)
 edit ()
 updateCondition ()
 askDelete ()
 delete ()
 selector ()
 add ()
 assign ()
 assign new trigger condition to target
 chi_update ()
 __getConditionsOfTarget ()

Static Public Member Functions

static translateOperator ($a_obj_id, $a_operator)
 Translate operator.

Data Fields

 $ctrl = null
 $lng
 $tpl
 $tree
 $ch_obj
 $target_obj
 $client_obj
 $target_id
 $target_type
 $target_title
 $target_ref_id
 $automatic_validation = true

Protected Member Functions

 getConditionHandler ()
 Get condition handler.
 listConditions ()
 list conditions ilToolbar
 saveObligatorySettings ()
 Save obligatory settings.
 saveObligatoryList ()
 Save obligatory settings.
 showObligatoryForm ($opt=array())
 Show obligatory form.

Private Member Functions

 initFormCondition ($a_source_id, $a_condition_id=0, $a_mode= 'add')
 Init form for condition table.

Detailed Description

class ilConditionHandlerGUI

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilConditionHandlerGUI.php 56797 2015-01-06 15:57:15Z akill

This class is aggregated in folders, groups which have a parent course object Since it is something like an interface, all varirables, methods have there own name space (names start with cci) to avoid collisions

ilConditionHandlerGUI:

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

Constructor & Destructor Documentation

ilConditionHandlerGUI::__construct (   $gui_obj,
  $a_ref_id = null 
)

Constructor <type> $lng <type> $tpl <type> $tree <type> $ilCtrl.

Parameters
<type>$gui_obj
<type>$a_ref_id

Definition at line 42 of file class.ilConditionHandlerGUI.php.

References $ilCtrl, $lng, $tpl, $tree, ilObjectFactory\getInstanceByRefId(), setTargetId(), setTargetRefId(), setTargetTitle(), and setTargetType().

{
include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
$this->ch_obj =& new ilConditionHandler();
$this->ctrl =& $ilCtrl;
$this->gui_obj =& $gui_obj;
$this->lng =& $lng;
$this->lng->loadLanguageModule('rbac');
$this->tpl =& $tpl;
$this->tree =& $tree;
if($a_ref_id)
{
$this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
}
else
{
$this->target_obj =& $this->gui_obj->object;
}
// this only works for ilObject derived objects (other objects
// should call set() methods manually
if (is_object($this->target_obj))
{
$this->setTargetId($this->target_obj->getId());
$this->setTargetRefId($this->target_obj->getRefId());
$this->setTargetType($this->target_obj->getType());
$this->setTargetTitle($this->target_obj->getTitle());
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilConditionHandlerGUI::__getConditionsOfTarget ( )

Definition at line 738 of file class.ilConditionHandlerGUI.php.

References ilConditionHandler\_getConditionsOfTarget(), getTargetId(), getTargetRefId(), and getTargetType().

Referenced by chi_update().

{
include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
foreach(ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(),$this->getTargetId(), $this->getTargetType()) as $condition)
{
if($condition['operator'] == 'not_member')
{
continue;
}
else
{
$cond[] = $condition;
}
}
return $cond ? $cond : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilConditionHandlerGUI::add ( )

Definition at line 622 of file class.ilConditionHandlerGUI.php.

References $_GET, initFormCondition(), selector(), and ilUtil\sendFailure().

Referenced by assign().

{
global $ilObjDataCache;
if(!$_GET['source_id'])
{
ilUtil::sendFailure("Missing id: condition_id");
$this->selector();
return false;
}
$this->initFormCondition((int) $_GET['source_id'],0,'add');
$this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_add.html',
"Services/AccessControl");
$this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilConditionHandlerGUI::askDelete ( )

Definition at line 547 of file class.ilConditionHandlerGUI.php.

References $_POST, $tpl, ilConditionHandler\_getCondition(), ilObject\_lookupTitle(), ilUtil\getImagePath(), listConditions(), and ilUtil\sendFailure().

{
global $tpl;
if(!count($_POST['conditions']))
{
ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
$this->listConditions();
return true;
}
// display confirmation message
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($this->ctrl->getFormAction($this, "listConditions"));
$cgui->setHeaderText($this->lng->txt("rbac_condition_delete_sure"));
$cgui->setCancel($this->lng->txt("cancel"), "listConditions");
$cgui->setConfirm($this->lng->txt("delete"), "delete");
// list conditions that should be deleted
foreach($_POST['conditions'] as $condition_id)
{
$condition = ilConditionHandler::_getCondition($condition_id);
$title = ilObject::_lookupTitle($condition['trigger_obj_id']).
" (".$this->lng->txt("condition").": ".
$this->lng->txt('condition_'.$condition['operator']).")";
$icon = ilUtil::getImagePath('icon_'.$condition['trigger_type'].'.svg');
$alt = $this->lng->txt('obj_'.$condition['trigger_type']);
$cgui->addItem("conditions[]", $condition_id, $title, $icon, $alt);
}
$tpl->setContent($cgui->getHTML());
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::assign ( )

assign new trigger condition to target

Definition at line 643 of file class.ilConditionHandlerGUI.php.

References $_GET, $_POST, add(), getAutomaticValidation(), ilObjectLP\getInstance(), ilObjectFactory\getInstanceByRefId(), getTargetId(), getTargetRefId(), getTargetType(), ilConditionHandler\lookupHiddenStatusByTarget(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilConditionHandler\UNIQUE_CONDITIONS.

{
if(!isset($_GET['source_id']))
{
echo "class.ilConditionHandlerGUI: no source_id given";
return false;
}
if(!$_POST['operator'])
{
ilUtil::sendFailure($this->lng->txt('err_check_input'));
$this->add();
return false;
}
$this->ch_obj->setTargetRefId($this->getTargetRefId());
$this->ch_obj->setTargetObjId($this->getTargetId());
$this->ch_obj->setTargetType($this->getTargetType());
switch($this->getTargetType())
{
case 'st':
$this->ch_obj->setReferenceHandlingType($_POST['ref_handling']);
break;
default:
$this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
break;
}
// this has to be changed, if non referenced trigger are implemted
if(!$trigger_obj =& ilObjectFactory::getInstanceByRefId((int) $_GET['source_id'],false))
{
echo 'ilConditionHandler: Trigger object does not exist';
}
$this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
$this->ch_obj->setTriggerObjId($trigger_obj->getId());
$this->ch_obj->setTriggerType($trigger_obj->getType());
$this->ch_obj->setOperator($_POST['operator']);
$this->ch_obj->setObligatory((int) $_POST['obligatory']);
$this->ch_obj->setHiddenStatus(ilConditionHandler::lookupHiddenStatusByTarget($this->getTargetRefId()));
$this->ch_obj->setValue('');
// Save assigned sco's
if($this->ch_obj->getTriggerType() == 'sahs')
{
include_once 'Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($this->ch_obj->getTriggerObjId());
$collection = $olp->getCollectionInstance();
if($collection)
{
$collection->delete();
}
if(is_array($_POST['item_ids'])) // #12901
{
$collection->activateEntries($_POST['item_ids']);
}
}
$this->ch_obj->enableAutomaticValidation($this->getAutomaticValidation());
if(!$this->ch_obj->storeCondition())
{
ilUtil::sendFailure($this->ch_obj->getErrorMessage(),true);
}
else
{
ilUtil::sendSuccess($this->lng->txt('added_new_condition'),true);
}
$this->ctrl->redirect($this,'listConditions');
return true;
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::chi_init ( $chi_target_obj,
  $a_ref_id = null 
)

Definition at line 222 of file class.ilConditionHandlerGUI.php.

References ilObjectFactory\getInstanceByRefId().

{
echo 'deprecated';
include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
$this->ch_obj =& new ilConditionHandler();
if($a_ref_id)
{
$this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
}
else
{
$this->target_obj =& $this->object;
}
return true;
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::chi_update ( )

Definition at line 717 of file class.ilConditionHandlerGUI.php.

References $_POST, __getConditionsOfTarget(), and ilUtil\sendSuccess().

{
#if(in_array('',$_POST['operator']))
#{
# ilUtil::sendInfo($this->lng->txt('select_one_operator'));
# return false;
#}
foreach($this->__getConditionsOfTarget() as $condition)
{
$this->ch_obj->setOperator($_POST['operator'][$condition["id"]]);
$this->ch_obj->setValue($_POST['value'][$condition["id"]]);
$this->ch_obj->updateCondition($condition['id']);
}
ilUtil::sendSuccess($this->lng->txt('conditions_updated'));
$this->ctrl->returnToParent($this);
return true;
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::delete ( )

Definition at line 583 of file class.ilConditionHandlerGUI.php.

References $_POST, listConditions(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if(!count($_POST['conditions']))
{
ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
$this->listConditions();
return true;
}
foreach($_POST['conditions'] as $condition_id)
{
$this->ch_obj->deleteCondition($condition_id);
}
ilUtil::sendSuccess($this->lng->txt('condition_deleted'),true);
$this->ctrl->redirect($this,'listConditions');
return true;
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::edit ( )

Definition at line 471 of file class.ilConditionHandlerGUI.php.

References $_GET, ilConditionHandler\_getCondition(), initFormCondition(), listConditions(), and ilUtil\sendFailure().

{
global $ilObjDataCache;
if(!$_GET['condition_id'])
{
ilUtil::sendFailure("Missing id: condition_id");
$this->listConditions();
return false;
}
$condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
$this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_edit_condition.html',
"Services/AccessControl");
$this->ctrl->setParameter($this,'condition_id',(int) $_GET['condition_id']);
$this->initFormCondition($condition['trigger_ref_id'],(int) $_GET['condition_id'],'edit');
$this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::executeCommand ( )

Definition at line 115 of file class.ilConditionHandlerGUI.php.

References $cmd, $ilErr, and $lng.

{
global $ilErr, $ilAccess, $lng;
if(!$ilAccess->checkAccess('write','',$this->getTargetRefId()))
{
$ilErr->raiseError($lng->txt('permission_denied'),$ilErr->WARNING);
}
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch ($next_class)
{
default:
if (empty($cmd))
{
$cmd = "view";
}
$this->$cmd();
break;
}
}
ilConditionHandlerGUI::getAutomaticValidation ( )

Definition at line 143 of file class.ilConditionHandlerGUI.php.

References $automatic_validation.

Referenced by assign().

+ Here is the caller graph for this function:

ilConditionHandlerGUI::getBackButtons ( )

Definition at line 110 of file class.ilConditionHandlerGUI.php.

References $_SESSION.

{
return $_SESSION['precon_btn'] ? $_SESSION['precon_btn'] : array();
}
ilConditionHandlerGUI::getConditionHandler ( )
protected

Get condition handler.

Returns
ilConditionHandler

Definition at line 101 of file class.ilConditionHandlerGUI.php.

References $ch_obj.

Referenced by selector().

{
return $this->ch_obj;
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::getTargetId ( )

get target id

Definition at line 160 of file class.ilConditionHandlerGUI.php.

References $target_id.

Referenced by __getConditionsOfTarget(), assign(), listConditions(), saveObligatoryList(), saveObligatorySettings(), and showObligatoryForm().

{
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::getTargetRefId ( )

get target ref id

Definition at line 176 of file class.ilConditionHandlerGUI.php.

References $target_ref_id.

Referenced by __getConditionsOfTarget(), assign(), isTargetReferenced(), listConditions(), saveObligatoryList(), saveObligatorySettings(), selector(), showObligatoryForm(), and updateCondition().

{
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::getTargetTitle ( )

get target title

Definition at line 217 of file class.ilConditionHandlerGUI.php.

References $target_title.

Referenced by initFormCondition().

{
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::getTargetType ( )

get target type

Definition at line 192 of file class.ilConditionHandlerGUI.php.

References $target_type.

Referenced by __getConditionsOfTarget(), assign(), initFormCondition(), listConditions(), saveObligatoryList(), saveObligatorySettings(), showObligatoryForm(), and updateCondition().

{
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::initFormCondition (   $a_source_id,
  $a_condition_id = 0,
  $a_mode = 'add' 
)
private

Init form for condition table.

private

Parameters

Definition at line 763 of file class.ilConditionHandlerGUI.php.

References $ch_obj, $tpl, ilConditionHandler\_getCondition(), ilConditionHandler\_isReferenceHandlingOptional(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilUtil\getImagePath(), ilObjectLP\getInstance(), getTargetTitle(), getTargetType(), ilFormPropertyGUI\setRequired(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), ilConditionHandler\SHARED_CONDITIONS, and ilConditionHandler\UNIQUE_CONDITIONS.

Referenced by add(), and edit().

{
$trigger_obj_id = ilObject::_lookupObjId($a_source_id);
$trigger_type = ilObject::_lookupType($trigger_obj_id);
$condition = ilConditionHandler::_getCondition($a_condition_id);
if(is_object($this->form))
{
return true;
}
include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
$this->form = new ilPropertyFormGUI();
$this->ctrl->setParameter($this,'source_id',$a_source_id);
$this->form->setFormAction($this->ctrl->getFormAction($this));
$info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source"));
$this->form->addItem($info_source);
$info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target"));
$info_target->setValue($this->getTargetTitle());
$this->form->addItem($info_target);
/* moved to list
$obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory');
$obl->setInfo($this->lng->txt('precondition_obligatory_info'));
$obl->setValue(1);
if($a_condition_id)
{
$obl->setChecked($condition['obligatory']);
}
else
{
$obl->setChecked(true);
}
$this->form->addItem($obl);
*/
$obl = new ilHiddenInputGUI('obligatory');
if($a_condition_id)
{
$obl->setValue($condition['obligatory']);
}
else
{
$obl->setValue(1);
}
$this->form->addItem($obl);
$sel = new ilSelectInputGUI($this->lng->txt('condition'),'operator');
include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
if($a_mode == 'add')
{
$operators[0] = $this->lng->txt('select_one');
}
foreach($ch_obj->getOperatorsByTargetType($trigger_type) as $operator)
{
$operators[$operator] = $this->lng->txt('condition_'.$operator);
}
$sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0);
$sel->setOptions($operators);
$sel->setRequired(true);
$this->form->addItem($sel);
{
$rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'),'ref_handling');
$rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS);
$opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'),ilConditionHandler::SHARED_CONDITIONS);
$rad_opt->addOption($opt2);
$opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'),ilConditionHandler::UNIQUE_CONDITIONS);
$rad_opt->addOption($opt1);
$this->form->addItem($rad_opt);
}
// Additional settings for SCO's
if($trigger_type == 'sahs')
{
$this->lng->loadLanguageModule('trac');
$cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'),'item_ids[]');
$cus->setRequired(true);
$tpl = new ilTemplate('tpl.condition_handler_sco_row.html',true,true,
"Services/AccessControl");
$counter = 0;
include_once 'Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($trigger_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
foreach($collection->getPossibleItems() as $item_id => $sahs_item)
{
$tpl->setCurrentBlock("sco_row");
$tpl->setVariable('SCO_ID',$item_id);
$tpl->setVariable('SCO_TITLE',$sahs_item['title']);
$tpl->setVariable('CHECKED',$collection->isAssignedEntry($item_id) ? 'checked="checked"' : '');
$tpl->parseCurrentBlock();
$counter++;
}
}
$tpl->setVariable('INFO_SEL',$this->lng->txt('trac_lp_determination_info_sco'));
$cus->setHTML($tpl->get());
$this->form->addItem($cus);
}
switch($a_mode)
{
case 'edit':
$this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.svg'));
$this->form->setTitle($this->lng->txt('rbac_edit_condition'));
$this->form->addCommandButton('updateCondition',$this->lng->txt('save'));
$this->form->addCommandButton('listConditions',$this->lng->txt('cancel'));
break;
case 'add':
$this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.svg'));
$this->form->setTitle($this->lng->txt('add_condition'));
$this->form->addCommandButton('assign',$this->lng->txt('save'));
$this->form->addCommandButton('selector',$this->lng->txt('back'));
break;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilConditionHandlerGUI::isTargetReferenced ( )

Check if target has refernce id.

Returns
bool

Definition at line 209 of file class.ilConditionHandlerGUI.php.

References getTargetRefId().

{
return $this->getTargetRefId() ? true : false;
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::listConditions ( )
protected

list conditions ilToolbar

Definition at line 246 of file class.ilConditionHandlerGUI.php.

References $_REQUEST, ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\getOptionalConditionsOfTarget(), getTargetId(), getTargetRefId(), getTargetType(), and showObligatoryForm().

Referenced by askDelete(), delete(), edit(), and updateCondition().

{
global $ilToolbar;
$ilToolbar->addButton($this->lng->txt('add_condition'),$this->ctrl->getLinkTarget($this,'selector'));
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.list_conditions.html','Services/AccessControl');
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()
);
if(count($optional_conditions))
{
if(!$_REQUEST["list_mode"])
{
$_REQUEST["list_mode"] = "subset";
}
}
else if(!$_REQUEST["list_mode"])
{
$_REQUEST["list_mode"] = "all";
}
// Show form only if conditions are availabe
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()))
)
{
$form = $this->showObligatoryForm($optional_conditions);
$this->tpl->setVariable('TABLE_SETTINGS',$form->getHTML());
}
include_once './Services/AccessControl/classes/class.ilConditionHandlerTableGUI.php';
$table = new ilConditionHandlerTableGUI($this,'listConditions', ($_REQUEST["list_mode"] != "all"));
$table->setConditions(
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()
)
);
$this->tpl->setVariable('TABLE_CONDITIONS',$table->getHTML());
$this->tpl->setContent($table->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilConditionHandlerGUI::saveObligatoryList ( )
protected

Save obligatory settings.

Definition at line 363 of file class.ilConditionHandlerGUI.php.

References $_POST, ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\calculateRequiredTriggers(), getTargetId(), getTargetRefId(), getTargetType(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilConditionHandler\updateObligatory().

{
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()
);
if($_POST["obl"] && sizeof($_POST["obl"]) > sizeof($all_conditions)-2)
{
ilUtil::sendFailure($this->lng->txt("rbac_precondition_minimum_optional"), true);
$this->ctrl->redirect($this,'listConditions');
}
foreach($all_conditions as $item)
{
$status = false;
if($_POST["obl"] && in_array($item["condition_id"], $_POST["obl"]))
{
$status = true;
}
ilConditionHandler::updateObligatory($item["condition_id"], $status);
}
// re-calculate
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType(),
true
);
ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'listConditions');
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::saveObligatorySettings ( )
protected

Save obligatory settings.

Definition at line 299 of file class.ilConditionHandlerGUI.php.

References ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\getOptionalConditionsOfTarget(), getTargetId(), getTargetRefId(), getTargetType(), ilConditionHandler\saveNumberOfRequiredTriggers(), ilUtil\sendFailure(), ilUtil\sendSuccess(), showObligatoryForm(), and ilConditionHandler\updateObligatory().

{
$form = $this->showObligatoryForm();
if($form->checkInput())
{
$old_mode = $form->getInput("old_list_mode");
switch($form->getInput("list_mode"))
{
case "all":
if($old_mode != "all")
{
include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()
);
// Set all optional conditions to obligatory
foreach((array) $optional_conditions as $item)
{
ilConditionHandler::updateObligatory($item["condition_id"], true);
}
}
break;
case "subset":
$num_req = $form->getInput('required');
if($old_mode != "subset")
{
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()
);
foreach($all_conditions as $item)
{
ilConditionHandler::updateObligatory($item["condition_id"], false);
}
$num_req = 1;
}
$this->getTargetRefId(),
$this->getTargetId(),
$num_req
);
break;
}
$cond = new ilConditionHandler();
$cond->setTargetRefId($this->getTargetRefId());
$cond->updateHiddenStatus((int) $form->getInput('hidden'));
ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
$this->ctrl->redirect($this,'listConditions');
}
$form->setValuesByPost();
ilUtil::sendFailure($this->lng->txt('err_check_input'));
$this->tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilConditionHandlerGUI::selector ( )

Definition at line 602 of file class.ilConditionHandlerGUI.php.

References getConditionHandler(), getTargetRefId(), and ilUtil\sendInfo().

Referenced by add().

{
include_once ("./Services/AccessControl/classes/class.ilConditionSelector.php");
ilUtil::sendInfo($this->lng->txt("condition_select_object"));
$exp = new ilConditionSelector($this, "selector");
$exp->setTypeWhiteList(array_merge($this->getConditionHandler()->getTriggerTypes(),
array("root", "cat", "grp", "fold", "crs")
));
//setRefId have to be after setTypeWhiteList!
$exp->setRefId($this->getTargetRefId());
$exp->setClickableTypes($this->getConditionHandler()->getTriggerTypes());
if (!$exp->handleCommand())
{
$this->tpl->setContent($exp->getHTML());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilConditionHandlerGUI::setAutomaticValidation (   $a_status)

Definition at line 139 of file class.ilConditionHandlerGUI.php.

{
$this->automatic_validation = $a_status;
}
ilConditionHandlerGUI::setBackButtons (   $a_btn_arr)

Definition at line 106 of file class.ilConditionHandlerGUI.php.

References $_SESSION.

{
$_SESSION['precon_btn'] = $a_btn_arr;
}
ilConditionHandlerGUI::setTargetId (   $a_target_id)

set target id

Definition at line 152 of file class.ilConditionHandlerGUI.php.

Referenced by __construct().

{
$this->target_id = $a_target_id;
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::setTargetRefId (   $a_target_ref_id)

set target ref id

Definition at line 168 of file class.ilConditionHandlerGUI.php.

Referenced by __construct().

{
$this->target_ref_id = $a_target_ref_id;
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::setTargetTitle (   $a_target_title)

set target title

Definition at line 200 of file class.ilConditionHandlerGUI.php.

Referenced by __construct().

{
$this->target_title = $a_target_title;
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::setTargetType (   $a_target_type)

set target type

Definition at line 184 of file class.ilConditionHandlerGUI.php.

Referenced by __construct().

{
$this->target_type = $a_target_type;
}

+ Here is the caller graph for this function:

ilConditionHandlerGUI::showObligatoryForm (   $opt = array())
protected

Show obligatory form.

Returns
ilPropertyFormGUI

Definition at line 403 of file class.ilConditionHandlerGUI.php.

References $_REQUEST, ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\calculateRequiredTriggers(), ilConditionHandler\getOptionalConditionsOfTarget(), getTargetId(), getTargetRefId(), getTargetType(), ilConditionHandler\lookupHiddenStatusByTarget(), ilCheckboxInputGUI\setChecked(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), and ilRadioGroupInputGUI\setValue().

Referenced by listConditions(), and saveObligatorySettings().

{
if(!$opt)
{
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()
);
}
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this),'listConditions');
$form->setTitle($this->lng->txt('precondition_obligatory_settings'));
$form->addCommandButton('saveObligatorySettings', $this->lng->txt('save'));
$hide = new ilCheckboxInputGUI($this->lng->txt('rbac_precondition_hide'),'hidden');
$hide->setValue(1);
$hide->setInfo($this->lng->txt('rbac_precondition_hide_info'));
$form->addItem($hide);
$mode = new ilRadioGroupInputGUI($this->lng->txt("rbac_precondition_mode"), "list_mode");
$form->addItem($mode);
$mode->setValue($_REQUEST["list_mode"]);
$mall = new ilRadioOption($this->lng->txt("rbac_precondition_mode_all"), "all");
$mall->setInfo($this->lng->txt("rbac_precondition_mode_all_info"));
$mode->addOption($mall);
$msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset");
$msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info"));
$mode->addOption($msubset);
$obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required');
$obl->setInfo($this->lng->txt('precondition_num_optional_info'));
if(count($opt))
{
$this->getTargetRefId(),
$this->getTargetId(),
$this->getTargetType()
);
$min = count($all) - count($opt) + 1;
$max = count($all) - 1;
}
else
{
$obligatory = $min = $max = 1;
}
$obl->setValue($obligatory);
$obl->setRequired(true);
$obl->setSize(1);
$obl->setMinValue($min);
$obl->setMaxValue($max);
$msubset->addSubItem($obl);
$old_mode = new ilHiddenInputGUI("old_list_mode");
$old_mode->setValue($_REQUEST["list_mode"]);
$form->addItem($old_mode);
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilConditionHandlerGUI::translateOperator (   $a_obj_id,
  $a_operator 
)
static

Translate operator.

Parameters
type$a_operator

Definition at line 81 of file class.ilConditionHandlerGUI.php.

References $GLOBALS, ilLPObjSettings\_mode2Text(), and ilConditionHandler\OPERATOR_LP.

Referenced by ilObjectListGUI\parseConditions().

{
switch($a_operator)
{
$GLOBALS['lng']->loadLanguageModule('trac');
include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
$obj_settings = new ilLPObjSettings($a_obj_id);
return ilLPObjSettings::_mode2Text($obj_settings->getMode());
default:
$GLOBALS['lng']->loadLanguageModule('rbac');
return $GLOBALS['lng']->txt('condition_'.$a_operator);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilConditionHandlerGUI::updateCondition ( )

Definition at line 491 of file class.ilConditionHandlerGUI.php.

References $_GET, $_POST, ilConditionHandler\_getCondition(), ilLPStatusWrapper\_refreshStatus(), ilObjectLP\getInstance(), getTargetRefId(), getTargetType(), listConditions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilConditionHandler\UNIQUE_CONDITIONS.

{
global $ilObjDataCache;
if(!$_GET['condition_id'])
{
ilUtil::sendFailure("Missing id: condition_id");
$this->listConditions();
return false;
}
// Update condition
include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
$condition_handler = new ilConditionHandler();
$condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
$condition_handler->setOperator($_POST['operator']);
$condition_handler->setObligatory((int) $_POST['obligatory']);
$condition_handler->setTargetRefId($this->getTargetRefId());
$condition_handler->setValue('');
switch($this->getTargetType())
{
case 'st':
$condition_handler->setReferenceHandlingType($_POST['ref_handling']);
break;
default:
$condition_handler->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
break;
}
$condition_handler->updateCondition($condition['id']);
// Update relevant sco's
if($condition['trigger_type'] == 'sahs')
{
include_once 'Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($condition['trigger_obj_id']);
$collection = $olp->getCollectionInstance();
if($collection)
{
$collection->delete();
}
if(is_array($_POST['item_ids'])) // #12901
{
$collection->activateEntries($_POST['item_ids']);
}
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']);
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->ctrl->redirect($this,'listConditions');
}

+ Here is the call graph for this function:

Field Documentation

ilConditionHandlerGUI::$automatic_validation = true

Definition at line 31 of file class.ilConditionHandlerGUI.php.

Referenced by getAutomaticValidation().

ilConditionHandlerGUI::$ch_obj

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

Referenced by getConditionHandler(), and initFormCondition().

ilConditionHandlerGUI::$client_obj

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

ilConditionHandlerGUI::$ctrl = null

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

ilConditionHandlerGUI::$lng

Definition at line 19 of file class.ilConditionHandlerGUI.php.

Referenced by __construct(), and executeCommand().

ilConditionHandlerGUI::$target_id

Definition at line 26 of file class.ilConditionHandlerGUI.php.

Referenced by getTargetId().

ilConditionHandlerGUI::$target_obj

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

ilConditionHandlerGUI::$target_ref_id

Definition at line 29 of file class.ilConditionHandlerGUI.php.

Referenced by getTargetRefId().

ilConditionHandlerGUI::$target_title

Definition at line 28 of file class.ilConditionHandlerGUI.php.

Referenced by getTargetTitle().

ilConditionHandlerGUI::$target_type

Definition at line 27 of file class.ilConditionHandlerGUI.php.

Referenced by getTargetType().

ilConditionHandlerGUI::$tpl

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

Referenced by __construct(), askDelete(), and initFormCondition().

ilConditionHandlerGUI::$tree

Definition at line 21 of file class.ilConditionHandlerGUI.php.

Referenced by __construct().


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