ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilConditionHandlerGUI Class Reference

class ilConditionHandlerGUI More...

+ Collaboration diagram for ilConditionHandlerGUI:

Public Member Functions

 __construct (?int $a_ref_id=null)
 
 setBackButtons (array $a_btn_arr)
 
 getBackButtons ()
 
 executeCommand ()
 
 setAutomaticValidation (bool $a_status)
 
 getAutomaticValidation ()
 
 setTargetId (int $a_target_id)
 
 getTargetId ()
 
 setTargetRefId (int $a_target_ref_id)
 
 getTargetRefId ()
 
 setTargetType (string $a_target_type)
 
 getTargetType ()
 
 setTargetTitle (string $a_target_title)
 
 isTargetReferenced ()
 Check if target has refernce id. More...
 
 getTargetTitle ()
 
 edit (?ilPropertyFormGUI $form=null)
 
 updateCondition ()
 
 selector ()
 
 add (?ilPropertyFormGUI $form=null)
 
 assign ()
 assign new trigger condition to target More...
 
 getConditionsOfTarget ()
 

Static Public Member Functions

static translateOperator (int $a_obj_id, string $a_operator, string $value='')
 

Protected Member Functions

 initConditionIdFromQuery ()
 
 initConditionsIdsFromPost ()
 
 initItemIdsFromPost ()
 
 initObligatoryItemsFromPost ()
 
 initListModeFromPost ()
 
 initSourceIdFromQuery ()
 
 getConditionHandler ()
 
 showObligatoryForm (string $list_mode=self::LIST_MODE_ALL)
 
 adjustConditionsAfterDeletion ()
 
 listConditions (bool $load_form_with_request=false)
 
 handleConditionTriggerTableActions ()
 
 saveCompulsoryStatus ()
 
 confirmDeleteConditionTrigger ()
 
 deleteConditionTrigger ()
 
 initCompulsoryForm (bool $with_request=false)
 
 saveCompulsoryForm ()
 
 addConditionTrigger (bool $with_request=false)
 
 editConditionTrigger (bool $with_request=false)
 
 initRangeConditionInputItem (int $trigger_ref_id, int $trigger_obj_id, array $condition)
 
 extractValueOptionsFromInput (array $data)
 
 extractValueOptionsFromCondition (array $condition)
 
 updateConditionTrigger ()
 
 saveConditionTrigger ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
ilConditionUtil $conditionUtil
 
ilObjectDefinition $objectDefinition
 
ilConditionHandler $ch_obj
 
ilObject $target_obj = null
 
int $target_id = 0
 
string $target_type = ''
 
string $target_title = ''
 
int $target_ref_id = 0
 
bool $automatic_validation = true
 

Private Member Functions

 initFormCondition (int $a_source_id, int $a_condition_id=0, string $a_mode='add')
 
 initConditionTriggerForm (bool $with_request, int $trigger_id, int $condition_id, string $mode='add')
 

Private Attributes

const LIST_MODE_UNDEFINED = 'undefined'
 
const LIST_MODE_ALL = 'all'
 
const LIST_MODE_SUBSET = 'subset'
 
GlobalHttpState $http
 
Factory $refinery
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 

Detailed Description

class ilConditionHandlerGUI

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$ 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 40 of file class.ilConditionHandlerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilConditionHandlerGUI::__construct ( ?int  $a_ref_id = null)

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

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObject\getId(), ilObjectFactory\getInstanceByRefId(), ilObject\getRefId(), ilObject\getTitle(), ilObject\getType(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), null, ILIAS\Repository\objectDefinition(), ILIAS\Repository\refinery(), setTargetId(), setTargetRefId(), setTargetTitle(), setTargetType(), and ILIAS\Repository\toolbar().

69  {
70  global $DIC;
71 
72  $this->ch_obj = new ilConditionHandler();
73  $this->ctrl = $DIC->ctrl();
74  $this->lng = $DIC->language();
75  $this->lng->loadLanguageModule('rbac');
76  $this->lng->loadLanguageModule('cond');
77  $this->tpl = $DIC->ui()->mainTemplate();
78  $this->tree = $DIC->repositoryTree();
79  $this->access = $DIC->access();
80  $this->toolbar = $DIC->toolbar();
81  $this->conditionUtil = $DIC->conditions()->util();
82  $this->objectDefinition = $DIC['objDefinition'];
83  $this->http = $DIC->http();
84  $this->refinery = $DIC->refinery();
85  $this->ui_factory = $DIC->ui()->factory();
86  $this->ui_renderer = $DIC->ui()->renderer();
87 
88  if ($a_ref_id) {
90  if ($target_obj !== null) {
91  $this->setTargetId($target_obj->getId());
95  }
96  }
97  }
setTargetRefId(int $a_target_ref_id)
setTargetTitle(string $a_target_title)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
global $DIC
Definition: shib_login.php:22
setTargetType(string $a_target_type)
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilConditionHandlerGUI::add ( ?ilPropertyFormGUI  $form = null)

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

References initFormCondition(), initSourceIdFromQuery(), and selector().

Referenced by assign().

499  : void
500  {
501  $source_id = $this->initSourceIdFromQuery();
502  if (!$source_id) {
503  $this->tpl->setOnScreenMessage('failure', "Missing id: condition_id");
504  $this->selector();
505  return;
506  }
507  if (!$form instanceof ilPropertyFormGUI) {
508  $form = $this->initFormCondition($source_id, 0, 'add');
509  }
510  $this->tpl->setContent($form->getHTML());
511  }
initFormCondition(int $a_source_id, int $a_condition_id=0, string $a_mode='add')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addConditionTrigger()

ilConditionHandlerGUI::addConditionTrigger ( bool  $with_request = false)
protected

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

References ILIAS\Repository\ctrl(), initConditionTriggerForm(), initSourceIdFromQuery(), and selector().

Referenced by saveConditionTrigger().

1027  : void
1028  {
1029  $source_id = $this->initSourceIdFromQuery();
1030  if (!$source_id) {
1031  $this->tpl->setOnScreenMessage('failure', "Missing id: condition_id");
1032  $this->selector();
1033  return;
1034  }
1035  $this->ctrl->setParameter($this, 'source_id', $source_id);
1036  $form = $this->initConditionTriggerForm($with_request, $source_id, 0);
1037  $this->tpl->setContent($this->ui_renderer->render([$form]));
1038  }
initConditionTriggerForm(bool $with_request, int $trigger_id, int $condition_id, string $mode='add')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustConditionsAfterDeletion()

ilConditionHandlerGUI::adjustConditionsAfterDeletion ( )
protected

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

References ilConditionHandler\_getPersistedConditionsOfTarget(), ilConditionHandler\getPersistedOptionalConditionsOfTarget(), getTargetId(), getTargetRefId(), ilConditionHandler\lookupObligatoryConditionsOfTarget(), ilConditionHandler\saveNumberOfRequiredTriggers(), and ilConditionHandler\updateObligatory().

Referenced by deleteConditionTrigger().

439  : void
440  {
442  $this->getTargetRefId(),
443  $this->getTargetId()
444  );
446  $this->getTargetRefId(),
447  $this->getTargetId()
448  );
449  if (
450  count($conditions) === 1 &&
451  count($optional_conditions) > 0
452  ) {
453  // set to obligatory
454  foreach ($conditions as $condition) {
455  ilConditionHandler::updateObligatory($condition['id'], true);
456  }
457  }
459  $this->getTargetRefId(),
460  $this->getTargetId()
461  );
462  if (
463  $num_obligatory == count($conditions)
464  ) {
465  // set all obligatory
466  foreach ($conditions as $condition) {
467  ilConditionHandler::updateObligatory($condition['id'], true);
468  }
469  } elseif (
470  $num_obligatory > count($conditions)
471  ) {
472  // reduce required triggers to maximum
474  $this->getTargetRefId(),
475  $this->getTargetId(),
476  count($conditions) - 1
477  );
478  }
479  }
static lookupObligatoryConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id)
static updateObligatory(int $a_id, bool $a_status)
Toggle condition obligatory status.
static saveNumberOfRequiredTriggers(int $a_target_ref_id, int $a_target_obj_id, int $a_num)
static getPersistedOptionalConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_obj_type='')
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assign()

ilConditionHandlerGUI::assign ( )

assign new trigger condition to target

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

References add(), ILIAS\Repository\ctrl(), getAutomaticValidation(), ilObjectLP\getInstance(), ilObjectFactory\getInstanceByRefId(), getTargetId(), getTargetRefId(), getTargetType(), initFormCondition(), initItemIdsFromPost(), initSourceIdFromQuery(), ILIAS\Repository\lng(), ilConditionHandler\lookupPersistedHiddenStatusByTarget(), null, selector(), and ilConditionHandler\UNIQUE_CONDITIONS.

516  : void
517  {
518  $source_id = $this->initSourceIdFromQuery();
519  if (!$source_id) {
520  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_condition_selected'));
521  $this->selector();
522  return;
523  }
524 
525  $form = $this->initFormCondition($source_id, 0, 'add');
526  if (!$form->checkInput()) {
527  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
528  $this->add($form);
529  return;
530  }
531  $this->ch_obj->setTargetRefId($this->getTargetRefId());
532  $this->ch_obj->setTargetObjId($this->getTargetId());
533  $this->ch_obj->setTargetType($this->getTargetType());
534 
535  switch ($this->getTargetType()) {
536  case 'st':
537  $this->ch_obj->setReferenceHandlingType((int) $form->getInput('ref_handling'));
538  break;
539 
540  default:
541  $this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
542  break;
543  }
544  // this has to be changed, if non referenced trigger are implemted
545  $trigger_obj = ilObjectFactory::getInstanceByRefId($source_id);
546  if ($trigger_obj !== null) {
547  $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
548  $this->ch_obj->setTriggerObjId($trigger_obj->getId());
549  $this->ch_obj->setTriggerType($trigger_obj->getType());
550  }
551  $this->ch_obj->setOperator($form->getInput('operator'));
552  $this->ch_obj->setObligatory((bool) $form->getInput('obligatory'));
553  $this->ch_obj->setHiddenStatus(ilConditionHandler::lookupPersistedHiddenStatusByTarget($this->getTargetRefId()));
554  $this->ch_obj->setValue('');
555 
556  // Save assigned sco's
557  if ($this->ch_obj->getTriggerType() === 'sahs') {
558  $olp = ilObjectLP::getInstance($this->ch_obj->getTriggerObjId());
559  $collection = $olp->getCollectionInstance();
560  if ($collection) {
561  $collection->delete();
562  }
563 
564  $items_ids = $this->initItemIdsFromPost();
565  if (count($items_ids)) { // #12901
566  $collection->activateEntries($items_ids->toArray());
567  }
568  }
569  $this->ch_obj->enableAutomaticValidation($this->getAutomaticValidation());
570  if (!$this->ch_obj->storeCondition()) {
571  $this->tpl->setOnScreenMessage('failure', $this->ch_obj->getErrorMessage(), true);
572  } else {
573  $this->tpl->setOnScreenMessage('success', $this->lng->txt('added_new_condition'), true);
574  }
575  $this->ctrl->redirect($this, 'listConditions');
576  }
static lookupPersistedHiddenStatusByTarget(int $a_target_ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
add(?ilPropertyFormGUI $form=null)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
initFormCondition(int $a_source_id, int $a_condition_id=0, string $a_mode='add')
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ confirmDeleteConditionTrigger()

ilConditionHandlerGUI::confirmDeleteConditionTrigger ( )
protected

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

References ilConditionHandler\_getCondition(), ilConditionHandler\_getPersistedConditionsOfTarget(), ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), getTargetId(), getTargetRefId(), getTargetType(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by handleConditionTriggerTableActions().

796  : void
797  {
798  $condition_trigger_ids = $this->http->wrapper()->query()->retrieve(
799  ConditionTriggerTableGUI::ID_TOKEN_NS,
800  $this->refinery->byTrying(
801  [
802  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
803  // Actions for entire table sends a fixed token in an array, instead of all row ids
804  $this->refinery->custom()->transformation(function ($var) {
805  if (
806  is_array($var) &&
807  count($var) === 1 &&
808  (string) $var[0] === 'ALL_OBJECTS'
809  ) {
810  return $var;
811  }
812  throw new UnexpectedValueException('Unexpected string in row_id array.');
813  }),
814  $this->refinery->always([])
815  ]
816  )
817  );
818 
819  if ($condition_trigger_ids === ['ALL_OBJECTS']) {
820  $condition_trigger_ids = [];
822  $this->getTargetRefId(),
823  $this->getTargetId(),
824  $this->getTargetType()
825  ) as $condition) {
826  $condition_trigger_ids[] = $condition['id'];
827  }
828  }
829 
830  $items = [];
831  foreach ($condition_trigger_ids as $condition_trigger_id) {
832  $condition = ilConditionHandler::_getCondition($condition_trigger_id);
833  $items[] = $this->ui_factory->modal()->interruptiveItem()->standard(
834  (string) $condition_trigger_id,
835  ilObject::_lookupTitle($condition['trigger_obj_id']) .
836  ' (' . $this->lng->txt('condition') . ':' .
837  $this->lng->txt('condition_' . $condition['operator']) . ')'
838  );
839  }
840 
841  $output = $this->ui_renderer->renderAsync(
842  [
843  $this->ui_factory->modal()->interruptive(
844  $this->lng->txt('confirm'),
845  $this->lng->txt('rbac_condition_delete_sure'),
846  $this->ctrl->getFormAction($this, 'deleteConditionTrigger')
847  )->withAffectedItems($items)
848  ]
849  );
850 
851  $this->http->saveResponse($this->http->response()->withBody(
852  Streams::ofString($output)
853  ));
854  $this->http->sendResponse();
855  $this->http->close();
856  }
static _getCondition(int $a_id)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteConditionTrigger()

ilConditionHandlerGUI::deleteConditionTrigger ( )
protected

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

References adjustConditionsAfterDeletion(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), listConditions(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

858  : void
859  {
860  $condition_trigger_ids = $this->http->wrapper()->post()->retrieve(
861  'interruptive_items',
862  $this->refinery->byTrying(
863  [
864  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
865  $this->refinery->always([])
866  ]
867  )
868  );
869  if (!count($condition_trigger_ids)) {
870  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_condition_selected'));
871  $this->listConditions();
872  return;
873  }
874 
875  foreach ($condition_trigger_ids as $condition_id) {
876  $this->ch_obj->deleteCondition($condition_id);
877  }
879  $this->tpl->setOnScreenMessage('success', $this->lng->txt('condition_deleted'), true);
880  $this->ctrl->redirect($this, 'listConditions');
881  }
static http()
Fetches the global http state from ILIAS.
listConditions(bool $load_form_with_request=false)
+ Here is the call graph for this function:

◆ edit()

ilConditionHandlerGUI::edit ( ?ilPropertyFormGUI  $form = null)

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

References ilConditionHandler\_getCondition(), ILIAS\Repository\ctrl(), initConditionIdFromQuery(), initFormCondition(), and listConditions().

Referenced by updateCondition().

366  : void
367  {
368  $condition_id = $this->initConditionIdFromQuery();
369  if (!$condition_id) {
370  $this->tpl->setOnScreenMessage('failure', "Missing id: condition_id");
371  $this->listConditions();
372  return;
373  }
374  $this->ctrl->setParameter($this, 'condition_id', $condition_id);
375  $condition = ilConditionHandler::_getCondition($condition_id);
376 
377  if (!$form instanceof ilPropertyFormGUI) {
378  $form = $this->initFormCondition($condition['trigger_ref_id'], $condition_id, 'edit');
379  }
380  $this->tpl->setContent($form->getHTML());
381  }
static _getCondition(int $a_id)
initFormCondition(int $a_source_id, int $a_condition_id=0, string $a_mode='add')
listConditions(bool $load_form_with_request=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editConditionTrigger()

ilConditionHandlerGUI::editConditionTrigger ( bool  $with_request = false)
protected

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

References ilConditionHandler\_getCondition(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initConditionIdFromQuery(), initConditionTriggerForm(), listConditions(), and ILIAS\Repository\refinery().

Referenced by handleConditionTriggerTableActions(), and updateConditionTrigger().

1040  : void
1041  {
1042  if ($this->http->wrapper()->query()->has(ConditionTriggerTableGUI::ID_TOKEN_NS)) {
1043  $condition_id = $this->http->wrapper()->query()->retrieve(
1044  ConditionTriggerTableGUI::ID_TOKEN_NS,
1045  $this->refinery->byTrying(
1046  [
1047  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
1048  $this->refinery->always([])
1049  ]
1050  )
1051  );
1052  $condition_id = end($condition_id);
1053  } else {
1054  $condition_id = $this->initConditionIdFromQuery();
1055  }
1056  if (!$condition_id) {
1057  $this->tpl->setOnScreenMessage('failure', "Missing id: condition_id");
1058  $this->listConditions();
1059  return;
1060  }
1061  $condition = ilConditionHandler::_getCondition($condition_id);
1062  $this->ctrl->setParameter($this, 'condition_id', $condition_id);
1063  $form = $this->initConditionTriggerForm(
1064  $with_request,
1065  $condition['trigger_ref_id'],
1066  $condition_id,
1067  'edit'
1068  );
1069  $this->tpl->setContent($this->ui_renderer->render([$form]));
1070  }
static _getCondition(int $a_id)
static http()
Fetches the global http state from ILIAS.
initConditionTriggerForm(bool $with_request, int $trigger_id, int $condition_id, string $mode='add')
listConditions(bool $load_form_with_request=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilConditionHandlerGUI::executeCommand ( )

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

References $DIC, $ilErr, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

226  : void
227  {
228  global $DIC;
229 
230  $ilErr = $DIC['ilErr'];
231 
232  if (!$this->access->checkAccess('write', '', $this->getTargetRefId())) {
233  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
234  }
235 
236  $next_class = $this->ctrl->getNextClass($this);
237  $cmd = $this->ctrl->getCmd();
238  switch ($next_class) {
239  default:
240  if (empty($cmd)) {
241  $cmd = "view";
242  }
243  $this->$cmd();
244  break;
245  }
246  }
$ilErr
Definition: raiseError.php:33
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ extractValueOptionsFromCondition()

ilConditionHandlerGUI::extractValueOptionsFromCondition ( array  $condition)
protected

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

Referenced by initRangeConditionInputItem().

1204  : array
1205  {
1206  if (($condition['value'] ?? '') === '') {
1207  return [0,0,0];
1208  }
1209  $value_arr = unserialize($condition['value']);
1210  if ($value_arr === false) {
1211  return [0,0,0];
1212  }
1213  return [
1214  $value_arr['objective'] ?? 0,
1215  $value_arr['min_percentage'] ?? 0,
1216  $value_arr['max_percentage'] ?? 0
1217  ];
1218  }
+ Here is the caller graph for this function:

◆ extractValueOptionsFromInput()

ilConditionHandlerGUI::extractValueOptionsFromInput ( array  $data)
protected

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

References null, and ilConditionHandler\OPERATOR_RESULT_RANGE_PERCENTAGE.

Referenced by saveConditionTrigger(), and updateConditionTrigger().

1189  : string
1190  {
1191  if ($data['condition_configuration']['operator'][0] !== ilConditionHandler::OPERATOR_RESULT_RANGE_PERCENTAGE) {
1192  return '';
1193  }
1194  return serialize(
1195  [
1196  'objective' => $data['condition_configuration']['operator'][1]['result_range_percentage']['objective'] ?? null,
1197  'min_percentage' => $data['condition_configuration']['operator'][1]['result_range_percentage']['min'],
1198  'max_percentage' => $data['condition_configuration']['operator'][1]['result_range_percentage']['max']
1199 
1200  ]
1201  );
1202  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getAutomaticValidation()

ilConditionHandlerGUI::getAutomaticValidation ( )

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

References $automatic_validation.

Referenced by assign(), and saveConditionTrigger().

253  : bool
254  {
256  }
+ Here is the caller graph for this function:

◆ getBackButtons()

ilConditionHandlerGUI::getBackButtons ( )

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

References ilSession\get(), and ilSession\has().

218  : array
219  {
220  if (ilSession::has('precon_btn')) {
221  return ilSession::get('precon_btn');
222  }
223  return [];
224  }
static get(string $a_var)
static has($a_var)
+ Here is the call graph for this function:

◆ getConditionHandler()

ilConditionHandlerGUI::getConditionHandler ( )
protected

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

References $ch_obj.

Referenced by selector().

209  {
210  return $this->ch_obj;
211  }
+ Here is the caller graph for this function:

◆ getConditionsOfTarget()

ilConditionHandlerGUI::getConditionsOfTarget ( )

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

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

578  : array
579  {
580  $cond = [];
582  $this->getTargetRefId(),
583  $this->getTargetId(),
584  $this->getTargetType()
585  ) as $condition) {
586  if ($condition['operator'] === 'not_member') {
587  continue;
588  }
589 
590  $cond[] = $condition;
591  }
592  return $cond;
593  }
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object
+ Here is the call graph for this function:

◆ getTargetId()

ilConditionHandlerGUI::getTargetId ( )

◆ getTargetRefId()

◆ getTargetTitle()

ilConditionHandlerGUI::getTargetTitle ( )

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

References $target_title.

Referenced by initFormCondition().

301  : string
302  {
303  return $this->target_title;
304  }
+ Here is the caller graph for this function:

◆ getTargetType()

ilConditionHandlerGUI::getTargetType ( )

◆ handleConditionTriggerTableActions()

ilConditionHandlerGUI::handleConditionTriggerTableActions ( )
protected

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

References confirmDeleteConditionTrigger(), ILIAS\Repository\ctrl(), editConditionTrigger(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and saveCompulsoryStatus().

734  : void
735  {
736  $action = $this->http->wrapper()->query()->retrieve(
737  ConditionTriggerTableGUI::ACTION_TOKEN_NS,
738  $this->refinery->byTrying(
739  [
740  $this->refinery->kindlyTo()->string(),
741  $this->refinery->always('')
742  ]
743  )
744  );
745  match ($action) {
746  'editConditionTrigger' => $this->editConditionTrigger(),
747  'saveCompulsory' => $this->saveCompulsoryStatus(),
748  'confirmDeleteConditionTrigger' => $this->confirmDeleteConditionTrigger(),
749  default => $this->ctrl->redirect($this, 'listConditions')
750  };
751  }
editConditionTrigger(bool $with_request=false)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ initCompulsoryForm()

ilConditionHandlerGUI::initCompulsoryForm ( bool  $with_request = false)
protected

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

References ilConditionHandler\_getPersistedConditionsOfTarget(), ILIAS\Repository\ctrl(), ilConditionHandler\getPersistedOptionalConditionsOfTarget(), getTargetId(), getTargetRefId(), getTargetType(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilConditionHandler\lookupObligatoryConditionsOfTarget(), ilConditionHandler\lookupPersistedHiddenStatusByTarget(), null, ILIAS\Repository\objectDefinition(), ILIAS\Repository\refinery(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by listConditions(), and saveCompulsoryForm().

883  : ?StandardForm
884  {
885  if (!$this->objectDefinition->isRBACObject($this->getTargetType())) {
886  return null;
887  }
888 
891  $this->getTargetRefId(),
892  $this->getTargetId(),
893  $this->getTargetType()
894  );
895 
896  $old_status = $this->ui_factory->input()->field()->hidden()->withValue(
897  (string) (count($optional_conditions) ? self::LIST_MODE_SUBSET : self::LIST_MODE_ALL)
898  );
899 
900  $hidden = $this->ui_factory->input()->field()->checkbox(
901  $this->lng->txt('rbac_precondition_hide'),
902  $this->lng->txt('rbac_precondition_hide_info')
904 
905  $condition_mode_all = $this->ui_factory->input()->field()->group(
906  [],
907  $this->lng->txt('rbac_precondition_mode_all'),
908  $this->lng->txt('rbac_precondition_mode_all_info')
909  );
910  $list_mode_items[self::LIST_MODE_ALL] = $condition_mode_all;
911 
912  $subset_limit = [];
913  if (count($all_conditions) > 1) {
914 
916  $this->getTargetRefId(),
917  $this->getTargetId()
918  );
919  $subset_limit['num_compulsory'] =
920  $this->ui_factory->input()
921  ->field()
922  ->numeric(
923  $this->lng->txt('precondition_num_obligatory'),
924  $this->lng->txt('precondition_num_optional_info')
925  )
926  ->withValue($num_required > 0 ? $num_required : null)
927  ->withAdditionalTransformation(
928  $this->refinery->logical()->parallel(
929  [
930  $this->refinery->int()->isGreaterThan(0),
931  $this->refinery->int()->isLessThan(count($all_conditions))
932  ]
933  )
934  );
935  }
936  if (count($all_conditions) > 1) {
937  $condition_mode_subset = $this->ui_factory->input()->field()->group(
938  $subset_limit,
939  $this->lng->txt('rbac_precondition_mode_subset'),
940  $this->lng->txt('rbac_precondition_mode_subset_info')
941  );
942  $list_mode_items[self::LIST_MODE_SUBSET] = $condition_mode_subset;
943  }
944 
945  $list_mode = $this->ui_factory->input()->field()->switchableGroup(
946  $list_mode_items,
947  $this->lng->txt('rbac_precondition_mode')
948  )->withValue(
950  $this->getTargetRefId(),
951  $this->getTargetId(),
952  $this->getTargetType()
953  )) ? self::LIST_MODE_SUBSET : self::LIST_MODE_ALL
954  );
955 
956  $main_section = $this->ui_factory->input()->field()->section(
957  [
958  'old_status' => $old_status,
959  'hidden_status' => $hidden,
960  'list_mode' => $list_mode
961  ],
962  $this->lng->txt('precondition_obligatory_settings')
963  );
964  $form = $this->ui_factory->input()->container()->form()->standard(
965  $this->ctrl->getFormAction($this, 'saveCompulsoryForm'),
966  [
967  'compulsory_configuration' => $main_section
968  ]
969  );
970  if ($with_request) {
971  $form = $form->withRequest($this->http->request());
972  }
973  return $form;
974  }
static lookupObligatoryConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id)
static lookupPersistedHiddenStatusByTarget(int $a_target_ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
static getPersistedOptionalConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_obj_type='')
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initConditionIdFromQuery()

ilConditionHandlerGUI::initConditionIdFromQuery ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by edit(), editConditionTrigger(), updateCondition(), and updateConditionTrigger().

100  : int
101  {
102  if ($this->http->wrapper()->query()->has('condition_id')) {
103  return $this->http->wrapper()->query()->retrieve(
104  'condition_id',
105  $this->refinery->kindlyTo()->int()
106  );
107  }
108  return 0;
109  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initConditionsIdsFromPost()

ilConditionHandlerGUI::initConditionsIdsFromPost ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

111  : SplFixedArray
112  {
113  if ($this->http->wrapper()->post()->has('conditions')) {
114  return SplFixedArray::fromArray(
115  $this->http->wrapper()->post()->retrieve(
116  'conditions',
117  $this->refinery->kindlyTo()->listOf(
118  $this->refinery->kindlyTo()->int()
119  )
120  )
121  );
122  }
123  return new SplFixedArray(0);
124  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ initConditionTriggerForm()

ilConditionHandlerGUI::initConditionTriggerForm ( bool  $with_request,
int  $trigger_id,
int  $condition_id,
string  $mode = 'add' 
)
private

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

References ilConditionHandler\_getCondition(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initRangeConditionInputItem(), ILIAS\Repository\lng(), and ilConditionHandler\OPERATOR_RESULT_RANGE_PERCENTAGE.

Referenced by addConditionTrigger(), editConditionTrigger(), saveConditionTrigger(), and updateConditionTrigger().

1072  : StandardForm
1073  {
1074  $trigger_type = ilObject::_lookupType($trigger_id, true);
1075  $trigger_obj_id = ilObject::_lookupObjId($trigger_id);
1076  $condition_handler = new ilConditionHandler();
1077  $condition = ilConditionHandler::_getCondition($condition_id);
1078 
1079  if ($mode == 'edit') {
1080  $main_section_items['obligatory'] = $this->ui_factory->input()->field()->hidden()
1081  ->withValue($condition['obligatory']);
1082  }
1083 
1084  $group_items = [];
1085  foreach ($condition_handler->getOperatorsByTriggerType($trigger_type) as $operator) {
1086  switch ($operator) {
1088  $group_items[$operator] = $this->ui_factory->input()->field()->group(
1089  [
1090  'result_range_percentage' => $this->initRangeConditionInputItem(
1091  $trigger_id,
1092  $trigger_obj_id,
1093  $condition
1094  )
1095  ],
1096  $this->lng->txt('condition_' . $operator)
1097  );
1098  break;
1099  default:
1100  $group_items[$operator] = $this->ui_factory->input()->field()->group(
1101  [],
1102  $this->lng->txt('condition_' . $operator)
1103  );
1104 
1105  }
1106  }
1107  $main_section_items['operator'] = $this->ui_factory->input()->field()->switchableGroup(
1108  $group_items,
1109  $this->lng->txt('condition')
1110  )->withRequired(true);
1111  if ($mode == 'edit') {
1112  $main_section_items['operator'] = $main_section_items['operator']->withValue((string) ($condition['operator']));
1113  }
1114 
1115  // main section
1116  $main_section = $this->ui_factory->input()->field()->section(
1117  $main_section_items,
1118  $this->lng->txt('add_condition') . ' (' . ilObject::_lookupTitle($trigger_obj_id) . ')'
1119  );
1120  // form
1121  $form = $this->ui_factory->input()->container()->form()->standard(
1122  $this->ctrl->getLinkTarget($this, $mode === 'add' ? 'saveConditionTrigger' : 'updateConditionTrigger'),
1123  [
1124  'condition_configuration' => $main_section
1125  ]
1126  );
1127  if ($with_request) {
1128  $form = $form->withRequest($this->http->request());
1129  }
1130  return $form;
1131  }
static _getCondition(int $a_id)
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
initRangeConditionInputItem(int $trigger_ref_id, int $trigger_obj_id, array $condition)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormCondition()

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

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

References ilConditionHandler\_getCondition(), ilConditionHandler\_isReferenceHandlingOptional(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ilObjectLP\getInstance(), getTargetTitle(), getTargetType(), ILIAS\Repository\lng(), ilFormPropertyGUI\setInfo(), ilRadioGroupInputGUI\setValue(), ilConditionHandler\SHARED_CONDITIONS, and ilConditionHandler\UNIQUE_CONDITIONS.

Referenced by add(), assign(), edit(), and updateCondition().

600  $trigger_obj_id = ilObject::_lookupObjId($a_source_id);
601  $trigger_type = ilObject::_lookupType($trigger_obj_id);
602 
603  $condition = ilConditionHandler::_getCondition($a_condition_id);
604  $form = new ilPropertyFormGUI();
605  $this->ctrl->setParameter($this, 'source_id', $a_source_id);
606  $form->setFormAction($this->ctrl->getFormAction($this));
607 
608  $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source"));
609  $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id)));
610  $form->addItem($info_source);
611 
612  $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target"));
613  $info_target->setValue($this->getTargetTitle());
614  $form->addItem($info_target);
615 
616  $obl = new ilHiddenInputGUI('obligatory');
617  if ($a_condition_id) {
618  $obl->setValue((string) (bool) $condition['obligatory']);
619  } else {
620  $obl->setValue("1");
621  }
622  $form->addItem($obl);
623 
624  $sel = new ilSelectInputGUI($this->lng->txt('condition'), 'operator');
625  $ch_obj = new ilConditionHandler();
626  $operators = [];
627  if ($a_mode === 'add') {
628  $operators[''] = $this->lng->txt('select_one');
629  }
630  foreach ($ch_obj->getOperatorsByTriggerType($trigger_type) as $operator) {
631  $operators[$operator] = $this->lng->txt('condition_' . $operator);
632  }
633  $sel->setValue($condition['operator'] ?? '');
634  $sel->setOptions($operators);
635  $sel->setRequired(true);
636  $form->addItem($sel);
637 
639  $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'), 'ref_handling');
640  $rad_opt->setValue((string) ($condition['ref_handling'] ?? ilConditionHandler::SHARED_CONDITIONS));
641 
642  $opt2 = new ilRadioOption(
643  $this->lng->txt('cond_ref_shared'),
644  (string) ilConditionHandler::SHARED_CONDITIONS
645  );
646  $rad_opt->addOption($opt2);
647 
648  $opt1 = new ilRadioOption(
649  $this->lng->txt('cond_ref_unique'),
651  );
652  $rad_opt->addOption($opt1);
653 
654  $form->addItem($rad_opt);
655  }
656 
657  // Additional settings for SCO's
658  if ($trigger_type === 'sahs') {
659  $this->lng->loadLanguageModule('trac');
660 
661  $cus = new ilCheckboxGroupInputGUI($this->lng->txt('trac_sahs_relevant_items'), 'item_ids');
662  $cus->setInfo($this->lng->txt('trac_lp_determination_info_sco'));
663  $cus->setRequired(true);
664 
665  $olp = ilObjectLP::getInstance($trigger_obj_id);
666  $collection = $olp->getCollectionInstance();
667  $checked = [];
668  if ($collection) {
669  foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
670  $sco = new ilCheckboxOption($sahs_item['title'], (string) $item_id);
671  if ($collection->isAssignedEntry($item_id)) {
672  $checked[] = $item_id;
673  }
674  $cus->addOption($sco);
675  }
676  }
677  $cus->setValue($checked);
678  $form->addItem($cus);
679  }
680  switch ($a_mode) {
681  case 'edit':
682  $form->setTitleIcon(ilUtil::getImagePath('standard/icon_' . $this->getTargetType() . '.svg'));
683  $form->setTitle($this->lng->txt('rbac_edit_condition'));
684  $form->addCommandButton('updateCondition', $this->lng->txt('save'));
685  $form->addCommandButton('listConditions', $this->lng->txt('cancel'));
686  break;
687 
688  case 'add':
689  $form->setTitleIcon(ilUtil::getImagePath('standard/icon_' . $this->getTargetType() . '.svg'));
690  $form->setTitle($this->lng->txt('add_condition'));
691  $form->addCommandButton('assign', $this->lng->txt('save'));
692  $form->addCommandButton('selector', $this->lng->txt('back'));
693  break;
694  }
695  return $form;
696  }
This class represents an option in a radio group.
static _getCondition(int $a_id)
This class represents an option in a checkbox group.
This class represents a selection list property in a property form.
static _isReferenceHandlingOptional(string $a_type)
static _lookupObjId(int $ref_id)
This class represents a hidden form property in a property form.
This class represents a property in a property form.
static _lookupTitle(int $obj_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This class represents a property in a property form.
static _lookupType(int $id, bool $reference=false)
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initItemIdsFromPost()

ilConditionHandlerGUI::initItemIdsFromPost ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by assign(), and updateCondition().

126  : SplFixedArray
127  {
128  if ($this->http->wrapper()->post()->has('item_ids')) {
129  return SplFixedArray::fromArray(
130  $this->http->wrapper()->post()->retrieve(
131  'item_ids',
132  $this->refinery->kindlyTo()->listOf(
133  $this->refinery->kindlyTo()->int()
134  )
135  )
136  );
137  }
138  return new SplFixedArray(0);
139  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initListModeFromPost()

ilConditionHandlerGUI::initListModeFromPost ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

156  : string
157  {
158  return $this->http->wrapper()->post()->retrieve(
159  'list_mode',
160  $this->refinery->byTrying([
161  $this->refinery->kindlyTo()->string(),
162  $this->refinery->always(self::LIST_MODE_UNDEFINED)
163  ])
164  );
165  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ initObligatoryItemsFromPost()

ilConditionHandlerGUI::initObligatoryItemsFromPost ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

141  : SplFixedArray
142  {
143  if ($this->http->wrapper()->post()->has('obl')) {
144  return SplFixedArray::fromArray(
145  $this->http->wrapper()->post()->retrieve(
146  'obl',
147  $this->refinery->kindlyTo()->listOf(
148  $this->refinery->kindlyTo()->int()
149  )
150  )
151  );
152  }
153  return new SplFixedArray(0);
154  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ initRangeConditionInputItem()

ilConditionHandlerGUI::initRangeConditionInputItem ( int  $trigger_ref_id,
int  $trigger_obj_id,
array  $condition 
)
protected

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

References ilCourseObjective\_getObjectiveIds(), ilObject\_lookupType(), extractValueOptionsFromCondition(), ilObjectFactory\getInstanceByRefId(), ilCourseConstants\IL_CRS_VIEW_OBJECTIVE, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation().

Referenced by initConditionTriggerForm().

1133  : Section
1134  {
1135  list($stored_objective_id, $stored_min, $stored_max) = $this->extractValueOptionsFromCondition($condition);
1136  if (ilObject::_lookupType($trigger_obj_id) === 'crs') {
1137  $course = ilObjectFactory::getInstanceByRefId($trigger_ref_id);
1138  if (($course instanceof ilObjCourse) && $course->getViewMode() == ilCourseConstants::IL_CRS_VIEW_OBJECTIVE) {
1139  $select_options = [];
1140  foreach (ilCourseObjective::_getObjectiveIds($trigger_obj_id) as $objective_id) {
1141  $objective = new ilCourseObjective($course, $objective_id);
1142  $select_options[$objective_id] = $objective->getTitle();
1143  }
1144  $this->lng->loadLanguageModule('crs');
1145  $sections['objective'] = $this->ui_factory->input()->field()->select(
1146  $this->lng->txt('crs_objectives'),
1147  $select_options,
1148  )->withRequired(true);
1149  if ($stored_objective_id > 0) {
1150  $sections['objective'] = $sections['objective']->withValue($stored_objective_id);
1151  }
1152  }
1153  }
1154  $sections['min'] = $this->ui_factory->input()->field()->numeric(
1155  $this->lng->txt('precondition_operator_range_min'),
1157  $this->refinery->logical()->parallel(
1158  [
1159  $this->refinery->int()->isGreaterThanOrEqual(0),
1160  $this->refinery->int()->isLessThanOrEqual(100)
1161  ]
1162  )
1163  )->withRequired(true)
1164  ->withValue($stored_min);
1165  $sections['max'] = $this->ui_factory->input()->field()->numeric(
1166  $this->lng->txt('precondition_operator_range_max'),
1168  $this->refinery->logical()->parallel(
1169  [
1170  $this->refinery->int()->isGreaterThan(0),
1171  $this->refinery->int()->isLessThanOrEqual(100)
1172  ]
1173  )
1174  )->withRequired(true)
1175  ->withValue($stored_max);
1176  return $this->ui_factory->input()->field()->section(
1177  $sections,
1178  ''
1179  )->withAdditionalTransformation(
1180  $this->refinery->custom()->constraint(
1181  function ($min_max) {
1182  return $min_max['min'] < $min_max['max'];
1183  },
1184  $this->lng->txt('precondition_operator_range_err_min_max')
1185  )
1186  );
1187  }
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
class ilcourseobjective
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupType(int $id, bool $reference=false)
extractValueOptionsFromCondition(array $condition)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSourceIdFromQuery()

ilConditionHandlerGUI::initSourceIdFromQuery ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by add(), addConditionTrigger(), assign(), and saveConditionTrigger().

167  : int
168  {
169  if ($this->http->wrapper()->query()->has('source_id')) {
170  return $this->http->wrapper()->query()->retrieve(
171  'source_id',
172  $this->refinery->kindlyTo()->int()
173  );
174  }
175  return 0;
176  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTargetReferenced()

ilConditionHandlerGUI::isTargetReferenced ( )

Check if target has refernce id.

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

References getTargetRefId().

296  : bool
297  {
298  return (bool) $this->getTargetRefId();
299  }
+ Here is the call graph for this function:

◆ listConditions()

ilConditionHandlerGUI::listConditions ( bool  $load_form_with_request = false)
protected

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

References ILIAS\Repository\ctrl(), ilConditionHandler\getPersistedOptionalConditionsOfTarget(), getTargetId(), getTargetRefId(), getTargetType(), initCompulsoryForm(), and ILIAS\Repository\lng().

Referenced by deleteConditionTrigger(), edit(), editConditionTrigger(), saveCompulsoryForm(), updateCondition(), and updateConditionTrigger().

698  : void
699  {
701  $this->getTargetRefId(),
702  $this->getTargetId(),
703  $this->getTargetType()
704  );
705  $allow_optional_preconditions = (bool) count($optional_conditions);
706  $table = new ConditionTriggerTableGUI(
707  new ConditionTriggerProvider(
708  $this->getTargetRefId(),
709  $this->getTargetId(),
710  $this->getTargetType()
711  ),
712  $allow_optional_preconditions
713  );
714 
715  // add condition button
716  $add_condition_trigger_button = $this->ui_factory->button()->standard(
717  $this->lng->txt('add_condition'),
718  $this->ctrl->getLinkTarget($this, 'selector')
719  );
720  $add_condition_trigger_button = $this->ui_renderer->render($add_condition_trigger_button);
721 
722  $form = $this->initCompulsoryForm($load_form_with_request);
723  $form_content = '';
724  if ($form instanceof StandardForm) {
725  $form_content = $this->ui_renderer->render([$form]);
726  }
727  $this->tpl->setContent(
728  $add_condition_trigger_button .
729  $form_content .
730  $table->render()
731  );
732  }
initCompulsoryForm(bool $with_request=false)
static getPersistedOptionalConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_obj_type='')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCompulsoryForm()

ilConditionHandlerGUI::saveCompulsoryForm ( )
protected

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

References $data, ilConditionHandler\_getPersistedConditionsOfTarget(), ILIAS\Repository\ctrl(), ilConditionHandler\getPersistedOptionalConditionsOfTarget(), getTargetId(), getTargetRefId(), getTargetType(), initCompulsoryForm(), listConditions(), ILIAS\Repository\lng(), ilConditionHandler\saveNumberOfRequiredTriggers(), and ilConditionHandler\updateObligatory().

976  : void
977  {
978  $form = $this->initCompulsoryForm(true);
979  $data = $form->getData();
980  if (!$data) {
981  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
982  $this->listConditions(true);
983  return;
984  }
985  $cond = new ilConditionHandler();
986  $cond->setTargetRefId($this->getTargetRefId());
987  $cond->updateHiddenStatus($data['compulsory_configuration']['hidden_status']);
988 
989  $old_status = $data['compulsory_configuration']['old_status'];
990  switch ($data['compulsory_configuration']['list_mode'][0]) {
991  case self::LIST_MODE_ALL:
992  if ($old_status != self::LIST_MODE_ALL) {
994  $this->getTargetRefId(),
995  $this->getTargetId(),
996  $this->getTargetType()
997  );
998  // Set all optional conditions to obligatory
999  foreach ($optional_conditions as $item) {
1000  ilConditionHandler::updateObligatory($item["condition_id"], true);
1001  }
1002  }
1003  break;
1004  case self::LIST_MODE_SUBSET:
1005  $num_required = $data['compulsory_configuration']['list_mode'][1]['num_compulsory'];
1006  if ($old_status != self::LIST_MODE_SUBSET) {
1008  $this->getTargetRefId(),
1009  $this->getTargetId(),
1010  $this->getTargetType()
1011  );
1012  foreach ($all_conditions as $item) {
1013  ilConditionHandler::updateObligatory($item["condition_id"], false);
1014  }
1015  }
1017  $this->getTargetRefId(),
1018  $this->getTargetId(),
1019  (int) $num_required
1020  );
1021  break;
1022  }
1023  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1024  $this->ctrl->redirect($this, 'listConditions');
1025  }
static updateObligatory(int $a_id, bool $a_status)
Toggle condition obligatory status.
static saveNumberOfRequiredTriggers(int $a_target_ref_id, int $a_target_obj_id, int $a_num)
initCompulsoryForm(bool $with_request=false)
static getPersistedOptionalConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_obj_type='')
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object
listConditions(bool $load_form_with_request=false)
+ Here is the call graph for this function:

◆ saveCompulsoryStatus()

ilConditionHandlerGUI::saveCompulsoryStatus ( )
protected

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

References ilConditionHandler\_getPersistedConditionsOfTarget(), ilConditionHandler\calculatePersistedRequiredTriggers(), ILIAS\Repository\ctrl(), getTargetId(), getTargetRefId(), getTargetType(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilConditionHandler\updateObligatory().

Referenced by handleConditionTriggerTableActions().

753  : void
754  {
756  $this->getTargetRefId(),
757  $this->getTargetId(),
758  $this->getTargetType()
759  );
760 
761  $compulsory_ids = $this->http->wrapper()->query()->retrieve(
762  ConditionTriggerTableGUI::ID_TOKEN_NS,
763  $this->refinery->byTrying(
764  [
765  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
766  $this->refinery->always([])
767  ]
768  )
769  );
770 
771  if (count($compulsory_ids) > (count($all_conditions) - 2)) {
772  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("rbac_precondition_minimum_optional"), true);
773  $this->ctrl->redirect($this, 'listConditions');
774  }
775 
776  foreach ($all_conditions as $item) {
777  $status = false;
778  if (in_array($item['condition_id'], $compulsory_ids)) {
779  $status = true;
780  }
781  ilConditionHandler::updateObligatory($item['condition_id'], $status);
782  }
783 
784  // re-calculate
786  $this->getTargetRefId(),
787  $this->getTargetId(),
788  $this->getTargetType(),
789  true
790  );
791 
792  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
793  $this->ctrl->redirect($this, 'listConditions');
794  }
static updateObligatory(int $a_id, bool $a_status)
Toggle condition obligatory status.
static calculatePersistedRequiredTriggers(int $a_target_ref_id, int $a_target_obj_id, string $a_target_obj_type='', bool $a_force_update=false)
static http()
Fetches the global http state from ILIAS.
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveConditionTrigger()

ilConditionHandlerGUI::saveConditionTrigger ( )
protected
    switch ($this->getTargetType()) {
        case 'st':
            $this->ch_obj->setReferenceHandlingType((int) $form->getInput('ref_handling'));
            break;

        default:
            $this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
            break;
    }

this has to be changed, if non referenced trigger are implemted $this->ch_obj->setOperator($form->getInput('operator')); $this->ch_obj->setObligatory((bool) $form->getInput('obligatory')); $this->ch_obj->setHiddenStatus(ilConditionHandler::lookupPersistedHiddenStatusByTarget($this->getTargetRefId())); $this->ch_obj->setValue('');

Save assigned sco's if ($this->ch_obj->getTriggerType() === 'sahs') { $olp = ilObjectLP::getInstance($this->ch_obj->getTriggerObjId()); $collection = $olp->getCollectionInstance(); if ($collection) { $collection->delete(); }

$items_ids = $this->initItemIdsFromPost(); if (count($items_ids)) { // #12901 $collection->activateEntries($items_ids->toArray()); } }

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

References $data, addConditionTrigger(), ILIAS\Repository\ctrl(), extractValueOptionsFromInput(), getAutomaticValidation(), ilObjectFactory\getInstanceByRefId(), getTargetId(), getTargetRefId(), getTargetType(), initConditionTriggerForm(), initSourceIdFromQuery(), ILIAS\Repository\lng(), and ilConditionHandler\lookupPersistedHiddenStatusByTarget().

1279  : void
1280  {
1281  $source_id = $this->initSourceIdFromQuery();
1282  if (!$source_id) {
1283  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_condition_selected'), true);
1284  $this->ctrl->redirect($this, 'listConditions');
1285  return;
1286  }
1287 
1288  $form = $this->initConditionTriggerForm(true, $source_id, 0);
1289  $data = $form->getData();
1290  if (!$data) {
1291  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
1292  $this->addConditionTrigger(true);
1293  return;
1294  }
1295 
1296  $condition = new ilConditionHandler();
1297  $condition->setTargetRefId($this->getTargetRefId());
1298  $condition->setTargetObjId($this->getTargetId());
1299  $condition->setTargetType($this->getTargetType());
1300  $trigger = ilObjectFactory::getInstanceByRefId($source_id, false);
1301  if ($trigger instanceof ilObject) {
1302  $condition->setTriggerRefId($trigger->getRefId());
1303  $condition->setTriggerObjId($trigger->getId());
1304  $condition->setTriggerType($trigger->getType());
1305  }
1306  $condition->setOperator($data['condition_configuration']['operator'][0]);
1307  $condition->setObligatory((bool) ($data['condition_configuration']['obligatory'] ?? true));
1308  $condition->setHiddenStatus(ilConditionHandler::lookupPersistedHiddenStatusByTarget($this->getTargetRefId()));
1309  $condition->setValue($this->extractValueOptionsFromInput($data));
1310  $condition->enableAutomaticValidation($this->getAutomaticValidation());
1311  if (!$condition->storeCondition()) {
1312  $this->tpl->setOnScreenMessage('failure', $condition->getErrorMessage(), true);
1313  } else {
1314  $this->tpl->setOnScreenMessage('success', $this->lng->txt('added_new_condition'), true);
1315  }
1316  $this->ctrl->redirect($this, 'listConditions');
1317 
1350  }
static lookupPersistedHiddenStatusByTarget(int $a_target_ref_id)
addConditionTrigger(bool $with_request=false)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
initConditionTriggerForm(bool $with_request, int $trigger_id, int $condition_id, string $mode='add')
+ Here is the call graph for this function:

◆ selector()

ilConditionHandlerGUI::selector ( )

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

References getConditionHandler(), getTargetRefId(), and ILIAS\Repository\lng().

Referenced by add(), addConditionTrigger(), and assign().

481  : void
482  {
483  $this->tpl->setOnScreenMessage('info', $this->lng->txt("condition_select_object"));
484 
485  $exp = new ilConditionSelector($this, "selector");
486  $exp->setTypeWhiteList(array_merge(
487  $this->getConditionHandler()->getTriggerTypes(),
488  array("root", "cat", "grp", "fold", "crs", "prg")
489  ));
490  //setRefId have to be after setTypeWhiteList!
491  $exp->setRefId($this->getTargetRefId());
492  $exp->setClickableTypes($this->getConditionHandler()->getTriggerTypes());
493 
494  if (!$exp->handleCommand()) {
495  $this->tpl->setContent($exp->getHTML());
496  }
497  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAutomaticValidation()

ilConditionHandlerGUI::setAutomaticValidation ( bool  $a_status)

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

248  : void
249  {
250  $this->automatic_validation = $a_status;
251  }

◆ setBackButtons()

ilConditionHandlerGUI::setBackButtons ( array  $a_btn_arr)

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

References ilSession\set().

213  : void
214  {
215  ilSession::set('precon_btn', $a_btn_arr);
216  }
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ setTargetId()

ilConditionHandlerGUI::setTargetId ( int  $a_target_id)

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

Referenced by __construct().

258  : void
259  {
260  $this->target_id = $a_target_id;
261  }
+ Here is the caller graph for this function:

◆ setTargetRefId()

ilConditionHandlerGUI::setTargetRefId ( int  $a_target_ref_id)

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

Referenced by __construct().

268  : void
269  {
270  $this->target_ref_id = $a_target_ref_id;
271  }
+ Here is the caller graph for this function:

◆ setTargetTitle()

ilConditionHandlerGUI::setTargetTitle ( string  $a_target_title)

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

Referenced by __construct().

288  : void
289  {
290  $this->target_title = $a_target_title;
291  }
+ Here is the caller graph for this function:

◆ setTargetType()

ilConditionHandlerGUI::setTargetType ( string  $a_target_type)

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

Referenced by __construct().

278  : void
279  {
280  $this->target_type = $a_target_type;
281  }
+ Here is the caller graph for this function:

◆ showObligatoryForm()

ilConditionHandlerGUI::showObligatoryForm ( string  $list_mode = self::LIST_MODE_ALL)
protected

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

References ilConditionHandler\_getPersistedConditionsOfTarget(), ILIAS\Repository\ctrl(), getTargetId(), getTargetRefId(), ILIAS\Repository\lng(), ilConditionHandler\lookupObligatoryConditionsOfTarget(), ilConditionHandler\lookupPersistedHiddenStatusByTarget(), null, ILIAS\Repository\objectDefinition(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), and ilRadioGroupInputGUI\setValue().

311  : ?ilPropertyFormGUI {
312  if (!$this->objectDefinition->isRBACObject($this->getTargetType())) {
313  return null;
314  }
315 
317  $form = new ilPropertyFormGUI();
318  $form->setFormAction($this->ctrl->getFormAction($this, 'listConditions'));
319  $form->setTitle($this->lng->txt('precondition_obligatory_settings'));
320  $form->addCommandButton('saveObligatorySettings', $this->lng->txt('save'));
321 
322  $hide = new ilCheckboxInputGUI($this->lng->txt('rbac_precondition_hide'), 'hidden');
324  $hide->setValue("1");
325  $hide->setInfo($this->lng->txt('rbac_precondition_hide_info'));
326  $form->addItem($hide);
327 
328  $mode = new ilRadioGroupInputGUI($this->lng->txt("rbac_precondition_mode"), "list_mode");
329  $form->addItem($mode);
330  $mode->setValue($list_mode);
331 
332  $mall = new ilRadioOption($this->lng->txt("rbac_precondition_mode_all"), "all");
333  $mall->setInfo($this->lng->txt("rbac_precondition_mode_all_info"));
334  $mode->addOption($mall);
335 
336  if (count($all) > 1) {
337  $min = 1;
338  $max = count($all) - 1;
339 
340  $msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset");
341  $msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info"));
342  $mode->addOption($msubset);
343 
344  $obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required');
345  $obl->setInfo($this->lng->txt('precondition_num_optional_info'));
346 
348  $this->getTargetRefId(),
349  $this->getTargetId()
350  );
351  $obl->setValue($num_required > 0 ? (string) $num_required : null);
352  $obl->setRequired(true);
353  $obl->setSize(1);
354  $obl->setMinValue($min);
355  $obl->setMaxValue($max);
356  $msubset->addSubItem($obl);
357  }
358 
359  $old_mode = new ilHiddenInputGUI("old_list_mode");
360  $old_mode->setValue($list_mode);
361  $form->addItem($old_mode);
362 
363  return $form;
364  }
This class represents an option in a radio group.
setInfo(string $a_info)
static lookupObligatoryConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id)
static lookupPersistedHiddenStatusByTarget(int $a_target_ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This class represents a hidden form property in a property form.
This class represents a property in a property form.
This class represents a number property in a property form.
static _getPersistedConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_target_type="")
get all persisted conditions of target object
+ Here is the call graph for this function:

◆ translateOperator()

static ilConditionHandlerGUI::translateOperator ( int  $a_obj_id,
string  $a_operator,
string  $value = '' 
)
static

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

References $DIC, ilObject\_lookupType(), ilLPObjSettings\_mode2Text(), ilLanguage\loadLanguageModule(), ilCourseObjective\lookupObjectiveTitle(), ilConditionHandler\OPERATOR_LP, ilConditionHandler\OPERATOR_RESULT_RANGE_PERCENTAGE, and ilLanguage\txt().

Referenced by ilInfoScreenGUI\addPreconditionSection(), ilObjectListGUI\parseConditions(), and ILIAS\Conditions\Configuration\ConditionTriggerProvider\read().

178  : string
179  {
180  global $DIC;
181 
182  $lng = $DIC->language();
183  switch ($a_operator) {
185  $lng->loadLanguageModule('trac');
186 
187  $obj_settings = new ilLPObjSettings($a_obj_id);
188  return ilLPObjSettings::_mode2Text($obj_settings->getMode());
189 
191  $postfix = '';
192  $value_arr = unserialize($value);
193  if ($value_arr !== false) {
194  $postfix = ', ';
195  if (ilObject::_lookupType($a_obj_id) === 'crs') {
196  $postfix .= ilCourseObjective::lookupObjectiveTitle((int) $value_arr['objective']) . ' ';
197  }
198  $postfix .= $value_arr['min_percentage'] . ' - ' . $value_arr['max_percentage'] . '%';
199  }
200  return $lng->txt('condition_' . $a_operator) . $postfix;
201 
202  default:
203  $lng->loadLanguageModule('rbac');
204  return $lng->txt('condition_' . $a_operator);
205  }
206  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: shib_login.php:22
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
static _lookupType(int $id, bool $reference=false)
static _mode2Text(int $a_mode)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCondition()

ilConditionHandlerGUI::updateCondition ( )

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

References ilConditionHandler\_getCondition(), ilLPStatusWrapper\_refreshStatus(), ILIAS\Repository\ctrl(), edit(), ilObjectLP\getInstance(), getTargetRefId(), getTargetType(), initConditionIdFromQuery(), initFormCondition(), initItemIdsFromPost(), listConditions(), ILIAS\Repository\lng(), and ilConditionHandler\UNIQUE_CONDITIONS.

383  : void
384  {
385  $condition_id = $this->initConditionIdFromQuery();
386  if (!$condition_id) {
387  $this->tpl->setOnScreenMessage('failure', "Missing id: condition_id");
388  $this->listConditions();
389  return;
390  }
391  // Update condition
392  $condition_handler = new ilConditionHandler();
393  $condition = ilConditionHandler::_getCondition($condition_id);
394 
395  $form = $this->initFormCondition(
396  $condition['trigger_ref_id'],
397  $condition_id,
398  'edit'
399  );
400 
401  if (!$form->checkInput()) {
402  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
403  $this->edit($form);
404  return;
405  }
406 
407  $condition_handler->setOperator((string) $form->getInput('operator'));
408  $condition_handler->setObligatory((bool) $form->getInput('obligatory'));
409  $condition_handler->setTargetRefId($this->getTargetRefId());
410  $condition_handler->setValue('');
411  switch ($this->getTargetType()) {
412  case 'st':
413  $condition_handler->setReferenceHandlingType((int) $form->getInput('ref_handling'));
414  break;
415 
416  default:
417  $condition_handler->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
418  break;
419  }
420  $condition_handler->updateCondition($condition['id']);
421 
422  // Update relevant sco's
423  if ($condition['trigger_type'] === 'sahs') {
424  $olp = ilObjectLP::getInstance($condition['trigger_obj_id']);
425  $collection = $olp->getCollectionInstance();
426  if ($collection) {
427  $collection->delete();
428  }
429  $item_ids = $this->initItemIdsFromPost();
430  if (count($item_ids)) { // #12901
431  $collection->activateEntries($item_ids->toArray());
432  }
433  ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']);
434  }
435  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
436  $this->ctrl->redirect($this, 'listConditions');
437  }
static _getCondition(int $a_id)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
edit(?ilPropertyFormGUI $form=null)
initFormCondition(int $a_source_id, int $a_condition_id=0, string $a_mode='add')
static getInstance(int $obj_id)
listConditions(bool $load_form_with_request=false)
+ Here is the call graph for this function:

◆ updateConditionTrigger()

ilConditionHandlerGUI::updateConditionTrigger ( )
protected
    switch ($this->getTargetType()) {
        case 'st':
            $condition_handler->setReferenceHandlingType((int) $form->getInput('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') { $olp = ilObjectLP::getInstance($condition['trigger_obj_id']); $collection = $olp->getCollectionInstance(); if ($collection) { $collection->delete(); } $item_ids = $this->initItemIdsFromPost(); if (count($item_ids)) { // #12901 $collection->activateEntries($item_ids->toArray()); } ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']); } $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true); $this->ctrl->redirect($this, 'listConditions');

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

References $data, ilConditionHandler\_getCondition(), ILIAS\Repository\ctrl(), editConditionTrigger(), extractValueOptionsFromInput(), getTargetRefId(), initConditionIdFromQuery(), initConditionTriggerForm(), listConditions(), and ILIAS\Repository\lng().

1220  : void
1221  {
1222  $condition_id = $this->initConditionIdFromQuery();
1223  if (!$condition_id) {
1224  $this->tpl->setOnScreenMessage('failure', "Missing id: condition_id");
1225  $this->listConditions();
1226  return;
1227  }
1228  $condition = ilConditionHandler::_getCondition($condition_id);
1229  $form = $this->initConditionTriggerForm(true, $condition['trigger_ref_id'], $condition_id, 'edit');
1230  $data = $form->getData();
1231  if (!$data) {
1232  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
1233  $this->editConditionTrigger(true);
1234  return;
1235  }
1236 
1237  // Update condition
1238  $condition_handler = new ilConditionHandler();
1239  $condition_handler->setOperator($data['condition_configuration']['operator'][0]);
1240  $condition_handler->setObligatory((bool) $data['condition_configuration']['obligatory']);
1241  $condition_handler->setTargetRefId($this->getTargetRefId());
1242  $condition_handler->setValue($this->extractValueOptionsFromInput($data));
1243  $condition_handler->updateCondition($condition_id);
1244  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1245  $this->ctrl->redirect($this, 'listConditions');
1246 
1277  }
static _getCondition(int $a_id)
editConditionTrigger(bool $with_request=false)
initConditionTriggerForm(bool $with_request, int $trigger_id, int $condition_id, string $mode='add')
listConditions(bool $load_form_with_request=false)
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilConditionHandlerGUI::$access
protected

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

◆ $automatic_validation

bool ilConditionHandlerGUI::$automatic_validation = true
protected

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

Referenced by getAutomaticValidation().

◆ $ch_obj

ilConditionHandler ilConditionHandlerGUI::$ch_obj
protected

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

Referenced by getConditionHandler().

◆ $conditionUtil

ilConditionUtil ilConditionHandlerGUI::$conditionUtil
protected

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

◆ $ctrl

ilCtrl ilConditionHandlerGUI::$ctrl
protected

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

◆ $http

GlobalHttpState ilConditionHandlerGUI::$http
private

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

◆ $lng

ilLanguage ilConditionHandlerGUI::$lng
protected

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

◆ $objectDefinition

ilObjectDefinition ilConditionHandlerGUI::$objectDefinition
protected

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

◆ $refinery

Factory ilConditionHandlerGUI::$refinery
private

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

◆ $target_id

int ilConditionHandlerGUI::$target_id = 0
protected

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

Referenced by getTargetId().

◆ $target_obj

ilObject ilConditionHandlerGUI::$target_obj = null
protected

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

◆ $target_ref_id

int ilConditionHandlerGUI::$target_ref_id = 0
protected

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

Referenced by getTargetRefId().

◆ $target_title

string ilConditionHandlerGUI::$target_title = ''
protected

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

Referenced by getTargetTitle().

◆ $target_type

string ilConditionHandlerGUI::$target_type = ''
protected

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

Referenced by getTargetType().

◆ $toolbar

ilToolbarGUI ilConditionHandlerGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilConditionHandlerGUI::$tpl
protected

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

◆ $tree

ilTree ilConditionHandlerGUI::$tree
protected

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

◆ $ui_factory

UIFactory ilConditionHandlerGUI::$ui_factory
private

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

◆ $ui_renderer

UIRenderer ilConditionHandlerGUI::$ui_renderer
private

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

◆ LIST_MODE_ALL

const ilConditionHandlerGUI::LIST_MODE_ALL = 'all'
private

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

◆ LIST_MODE_SUBSET

const ilConditionHandlerGUI::LIST_MODE_SUBSET = 'subset'
private

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

◆ LIST_MODE_UNDEFINED

const ilConditionHandlerGUI::LIST_MODE_UNDEFINED = 'undefined'
private

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


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