54 $this->gui_obj = $gui_obj;
56 $this->lng->loadLanguageModule(
'rbac');
57 $this->lng->loadLanguageModule(
'cond');
64 $this->target_obj = &$this->gui_obj->object;
69 if (is_object($this->target_obj)) {
83 switch ($a_operator) {
85 $GLOBALS[
'DIC'][
'lng']->loadLanguageModule(
'trac');
86 include_once
'./Services/Tracking/classes/class.ilLPObjSettings.php';
91 $GLOBALS[
'DIC'][
'lng']->loadLanguageModule(
'rbac');
92 return $GLOBALS[
'DIC'][
'lng']->txt(
'condition_' . $a_operator);
119 $ilAccess = $DIC[
'ilAccess'];
122 if (!$ilAccess->checkAccess(
'write',
'', $this->getTargetRefId())) {
126 $next_class = $this->ctrl->getNextClass($this);
127 $cmd = $this->ctrl->getCmd();
129 switch ($next_class) {
141 $this->automatic_validation = $a_status;
154 $this->target_id = $a_target_id;
170 $this->target_ref_id = $a_target_ref_id;
186 $this->target_type = $a_target_type;
202 $this->target_title = $a_target_title;
230 $util = $DIC->conditions()->util();
233 if ($this->
getTargetRefId() > 0 && $util->isUnderParentControl($this->getTargetRefId())) {
238 $ilToolbar = $DIC[
'ilToolbar'];
240 $ilToolbar->addButton($this->lng->txt(
'add_condition'), $this->ctrl->getLinkTarget($this,
'selector'));
242 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.list_conditions.html',
'Services/AccessControl');
249 if (count($optional_conditions)) {
250 if (!$_REQUEST[
"list_mode"]) {
251 $_REQUEST[
"list_mode"] =
"subset";
253 } elseif (!$_REQUEST[
"list_mode"]) {
254 $_REQUEST[
"list_mode"] =
"all";
266 $this->tpl->setVariable(
'TABLE_SETTINGS',
$form->getHTML());
280 $this->tpl->setVariable(
'TABLE_CONDITIONS',
$h);
290 if (
$form->checkInput()) {
291 $old_mode =
$form->getInput(
"old_list_mode");
292 switch (
$form->getInput(
"list_mode")) {
294 if ($old_mode !=
"all") {
301 foreach ((array) $optional_conditions as $item) {
308 $num_req =
$form->getInput(
'required');
309 if ($old_mode !=
"subset") {
315 foreach ($all_conditions as $item) {
329 $cond->updateHiddenStatus((
int)
$form->getInput(
'hidden'));
331 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
332 $this->ctrl->redirect($this,
'listConditions');
335 $form->setValuesByPost();
337 $this->tpl->setContent(
$form->getHTML());
351 if (
$_POST[
"obl"] &&
sizeof(
$_POST[
"obl"]) >
sizeof($all_conditions) - 2) {
353 $this->ctrl->redirect($this,
'listConditions');
356 foreach ($all_conditions as $item) {
358 if (
$_POST[
"obl"] && in_array($item[
"condition_id"],
$_POST[
"obl"])) {
372 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
373 $this->ctrl->redirect($this,
'listConditions');
397 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
399 $form->setFormAction($this->ctrl->getFormAction($this),
'listConditions');
400 $form->setTitle($this->lng->txt(
'precondition_obligatory_settings'));
401 $form->addCommandButton(
'saveObligatorySettings', $this->lng->txt(
'save'));
406 $hide->setInfo($this->lng->txt(
'rbac_precondition_hide_info'));
407 $form->addItem($hide);
410 $form->addItem($mode);
411 $mode->setValue($_REQUEST[
"list_mode"]);
413 $mall =
new ilRadioOption($this->lng->txt(
"rbac_precondition_mode_all"),
"all");
414 $mall->
setInfo($this->lng->txt(
"rbac_precondition_mode_all_info"));
415 $mode->addOption($mall);
418 if (count($all) > 1) {
420 $max = count($all) - 1;
422 $msubset =
new ilRadioOption($this->lng->txt(
"rbac_precondition_mode_subset"),
"subset");
423 $msubset->
setInfo($this->lng->txt(
"rbac_precondition_mode_subset_info"));
424 $mode->addOption($msubset);
426 $obl =
new ilNumberInputGUI($this->lng->txt(
'precondition_num_obligatory'),
'required');
427 $obl->
setInfo($this->lng->txt(
'precondition_num_optional_info'));
430 $obl->setValue($num_required > 0 ? $num_required : null);
431 $obl->setRequired(
true);
433 $obl->setMinValue($min);
434 $obl->setMaxValue($max);
435 $msubset->addSubItem($obl);
439 $old_mode->setValue($_REQUEST[
"list_mode"]);
440 $form->addItem($old_mode);
450 $ilObjDataCache = $DIC[
'ilObjDataCache'];
452 if (!
$_GET[
'condition_id']) {
459 $this->tpl->addBlockfile(
462 'tpl.condition_handler_edit_condition.html',
463 "Services/AccessControl" 465 $this->ctrl->setParameter($this,
'condition_id', (
int) $_GET[
'condition_id']);
467 $this->
initFormCondition($condition[
'trigger_ref_id'], (
int) $_GET[
'condition_id'],
'edit');
468 $this->tpl->setVariable(
'CONDITION_TABLE', $this->form->getHTML());
475 $ilObjDataCache = $DIC[
'ilObjDataCache'];
477 if (!
$_GET[
'condition_id']) {
487 $condition_handler->setOperator(
$_POST[
'operator']);
488 $condition_handler->setObligatory((
int)
$_POST[
'obligatory']);
490 $condition_handler->setValue(
'');
493 $condition_handler->setReferenceHandlingType($_POST[
'ref_handling']);
500 $condition_handler->updateCondition($condition[
'id']);
503 if ($condition[
'trigger_type'] ==
'sahs') {
504 include_once
'Services/Object/classes/class.ilObjectLP.php';
506 $collection = $olp->getCollectionInstance();
508 $collection->delete();
511 if (is_array($_POST[
'item_ids'])) {
512 $collection->activateEntries($_POST[
'item_ids']);
515 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
519 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
520 $this->ctrl->redirect($this,
'listConditions');
529 if (!count(
$_POST[
'conditions'])) {
536 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
538 $cgui->setFormAction($this->ctrl->getFormAction($this,
"listConditions"));
539 $cgui->setHeaderText($this->lng->txt(
"rbac_condition_delete_sure"));
540 $cgui->setCancel($this->lng->txt(
"cancel"),
"listConditions");
541 $cgui->setConfirm($this->lng->txt(
"delete"),
"delete");
544 foreach (
$_POST[
'conditions'] as $condition_id) {
548 " (" . $this->lng->txt(
"condition") .
": " .
549 $this->lng->txt(
'condition_' . $condition[
'operator']) .
")";
551 $alt = $this->lng->txt(
'obj_' . $condition[
'trigger_type']);
553 $cgui->addItem(
"conditions[]", $condition_id,
$title, $icon, $alt);
556 $tpl->setContent($cgui->getHTML());
559 public function delete()
561 if (!count(
$_POST[
'conditions'])) {
567 foreach (
$_POST[
'conditions'] as $condition_id) {
568 $this->ch_obj->deleteCondition($condition_id);
570 ilUtil::sendSuccess($this->lng->txt(
'condition_deleted'),
true);
571 $this->ctrl->redirect($this,
'listConditions');
581 $exp->setTypeWhiteList(array_merge(
583 array(
"root",
"cat",
"grp",
"fold",
"crs",
"prg")
589 if (!$exp->handleCommand()) {
590 $this->tpl->setContent($exp->getHTML());
598 $ilObjDataCache = $DIC[
'ilObjDataCache'];
600 if (!
$_GET[
'source_id']) {
607 $this->tpl->addBlockfile(
610 'tpl.condition_handler_add.html',
611 "Services/AccessControl" 613 $this->tpl->setVariable(
'CONDITION_TABLE', $this->form->getHTML());
622 if (!isset(
$_GET[
'source_id'])) {
623 echo "class.ilConditionHandlerGUI: no source_id given";
627 if (!
$_POST[
'operator']) {
634 $this->ch_obj->setTargetObjId($this->
getTargetId());
639 $this->ch_obj->setReferenceHandlingType(
$_POST[
'ref_handling']);
648 echo 'ilConditionHandler: Trigger object does not exist';
650 $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
651 $this->ch_obj->setTriggerObjId($trigger_obj->getId());
652 $this->ch_obj->setTriggerType($trigger_obj->getType());
653 $this->ch_obj->setOperator(
$_POST[
'operator']);
654 $this->ch_obj->setObligatory((
int)
$_POST[
'obligatory']);
656 $this->ch_obj->setValue(
'');
659 if ($this->ch_obj->getTriggerType() ==
'sahs') {
660 include_once
'Services/Object/classes/class.ilObjectLP.php';
662 $collection = $olp->getCollectionInstance();
664 $collection->delete();
667 if (is_array($_POST[
'item_ids'])) {
668 $collection->activateEntries($_POST[
'item_ids']);
673 if (!$this->ch_obj->storeCondition()) {
676 ilUtil::sendSuccess($this->lng->txt(
'added_new_condition'),
true);
679 $this->ctrl->redirect($this,
'listConditions');
686 #if(in_array('',$_POST['operator'])) 688 # ilUtil::sendInfo($this->lng->txt('select_one_operator')); 693 $this->ch_obj->setOperator(
$_POST[
'operator'][$condition[
"id"]]);
694 $this->ch_obj->setValue(
$_POST[
'value'][$condition[
"id"]]);
695 $this->ch_obj->updateCondition($condition[
'id']);
697 ilUtil::sendSuccess($this->lng->txt(
'conditions_updated'));
699 $this->ctrl->returnToParent($this);
706 if ($condition[
'operator'] ==
'not_member') {
709 $cond[] = $condition;
712 return $cond ? $cond : array();
729 if (is_object($this->form)) {
732 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
734 $this->ctrl->setParameter($this,
'source_id', $a_source_id);
735 $this->form->setFormAction($this->ctrl->getFormAction($this));
739 $this->form->addItem($info_source);
743 $this->form->addItem($info_target);
760 if ($a_condition_id) {
761 $obl->setValue($condition[
'obligatory']);
765 $this->form->addItem($obl);
769 if ($a_mode ==
'add') {
770 $operators[0] = $this->lng->txt(
'select_one');
772 foreach ($ch_obj->getOperatorsByTriggerType($trigger_type) as $operator) {
773 $operators[$operator] = $this->lng->txt(
'condition_' . $operator);
775 $sel->setValue(isset($condition[
'operator']) ? $condition[
'operator'] : 0);
776 $sel->setOptions($operators);
777 $sel->setRequired(
true);
778 $this->form->addItem($sel);
785 $rad_opt->addOption($opt2);
788 $rad_opt->addOption($opt1);
790 $this->form->addItem($rad_opt);
794 if ($trigger_type ==
'sahs') {
795 $this->lng->loadLanguageModule(
'trac');
797 $cus =
new ilCustomInputGUI($this->lng->txt(
'trac_sahs_relevant_items'),
'item_ids[]');
801 'tpl.condition_handler_sco_row.html',
804 "Services/AccessControl" 808 include_once
'Services/Object/classes/class.ilObjectLP.php';
810 $collection = $olp->getCollectionInstance();
812 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
813 $tpl->setCurrentBlock(
"sco_row");
814 $tpl->setVariable(
'SCO_ID', $item_id);
815 $tpl->setVariable(
'SCO_TITLE', $sahs_item[
'title']);
816 $tpl->setVariable(
'CHECKED', $collection->isAssignedEntry($item_id) ?
'checked="checked"' :
'');
817 $tpl->parseCurrentBlock();
821 $tpl->setVariable(
'INFO_SEL', $this->lng->txt(
'trac_lp_determination_info_sco'));
822 $cus->setHTML(
$tpl->get());
823 $this->form->addItem($cus);
828 $this->form->setTitle($this->lng->txt(
'rbac_edit_condition'));
829 $this->form->addCommandButton(
'updateCondition', $this->lng->txt(
'save'));
830 $this->form->addCommandButton(
'listConditions', $this->lng->txt(
'cancel'));
836 $this->form->setTitle($this->lng->txt(
'add_condition'));
837 $this->form->addCommandButton(
'assign', $this->lng->txt(
'save'));
838 $this->form->addCommandButton(
'selector', $this->lng->txt(
'back'));
listConditions()
list conditions ilToolbar
getTargetType()
get target type
This class represents an option in a radio group.
class ilConditionHandlerGUI
static saveNumberOfRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_num)
Save number of obigatory triggers.
setValue($a_value)
Set Value.
setBackButtons($a_btn_arr)
static translateOperator($a_obj_id, $a_operator)
Translate operator.
initFormCondition($a_source_id, $a_condition_id=0, $a_mode='add')
Init form for condition table.
setTargetId($a_target_id)
set target id
__getConditionsOfTarget()
static calculatePersistedRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
static _lookupTitle($a_id)
lookup object title
static lookupPersistedHiddenStatusByTarget($a_target_ref_id)
Lookup persistedhidden status.
assign()
assign new trigger condition to target
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static lookupObligatoryConditionsOfTarget($a_target_ref_id, $a_target_obj_id)
Lookup obligatory conditions of target.
setInfo($a_info)
Set Info.
getTargetRefId()
get target ref id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct($gui_obj, $a_ref_id=null)
Constructor <type> $lng <type> $tpl <type> $tree <type> $ilCtrl.
setTargetRefId($a_target_ref_id)
set target ref id
if(isset($_POST['submit'])) $form
static getPersistedOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getConditionHandler()
Get condition handler.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
Table presentation of conditions.
setTargetTitle($a_target_title)
set target title
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
INTERNAL CLASS: Please do not use in consumer code.
setAutomaticValidation($a_status)
saveObligatorySettings()
Save obligatory settings.
static _isReferenceHandlingOptional($a_type)
is reference handling optional
saveObligatoryList()
Save obligatory settings.
This class represents a non editable value in a property form.
static updateObligatory($a_id, $a_status)
Toggle condition obligatory status.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getPersistedConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all persisted conditions of target object
static _getCondition($a_id)
getTargetId()
get target id
getTargetTitle()
get target title
setTargetType($a_target_type)
set target type
if(empty($password)) $table
isTargetReferenced()
Check if target has refernce id.
static getInstance($a_obj_id)
showObligatoryForm($opt=array())
Show obligatory form.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
Confirmation screen class.
static _mode2Text($a_mode)