ILIAS  release_4-4 Revision
ilConditionHandlerInterface Class Reference

class ilConditionHandlerInterface More...

+ Collaboration diagram for ilConditionHandlerInterface:

Public Member Functions

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

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

 listConditions ()
 list conditions ilToolbar More...
 
 saveObligatorySettings ()
 Save obligatory settings. More...
 
 saveObligatoryList ()
 Save obligatory settings. More...
 
 showObligatoryForm ($opt=array())
 Show obligatory form. More...
 

Private Member Functions

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

Detailed Description

class ilConditionHandlerInterface

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

ilConditionHandlerInterface:

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

Member Function Documentation

◆ __getConditionsOfTarget()

ilConditionHandlerInterface::__getConditionsOfTarget ( )

Definition at line 708 of file class.ilConditionHandlerInterface.php.

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

Referenced by chi_update().

709  {
710  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
711 
712  foreach(ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(),$this->getTargetId(), $this->getTargetType()) as $condition)
713  {
714  if($condition['operator'] == 'not_member')
715  {
716  continue;
717  }
718  else
719  {
720  $cond[] = $condition;
721  }
722  }
723  return $cond ? $cond : array();
724  }
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __showButtons()

ilConditionHandlerInterface::__showButtons ( )

Definition at line 726 of file class.ilConditionHandlerInterface.php.

References getBackButtons().

727  {
728  if(!$this->getBackButtons())
729  {
730  return false;
731  }
732 
733  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
734  foreach($this->getBackButtons() as $name => $link)
735  {
736  $this->tpl->setCurrentBlock("btn_cell");
737  $this->tpl->setVariable("BTN_LINK",$link);
738  $this->tpl->setVariable("BTN_TXT",$this->lng->txt($name));
739  $this->tpl->parseCurrentBlock();
740  }
741  }
+ Here is the call graph for this function:

◆ add()

ilConditionHandlerInterface::add ( )

Definition at line 593 of file class.ilConditionHandlerInterface.php.

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

Referenced by assign().

594  {
595  global $ilObjDataCache;
596 
597  if(!$_GET['source_id'])
598  {
599  ilUtil::sendFailure("Missing id: condition_id");
600  $this->selector();
601  return false;
602  }
603 
604  $this->initFormCondition((int) $_GET['source_id'],0,'add');
605  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_add.html',
606  "Services/AccessControl");
607  $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
608  }
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initFormCondition($a_source_id, $a_condition_id=0, $a_mode='add')
Init form for condition table.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ askDelete()

ilConditionHandlerInterface::askDelete ( )

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

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

500  {
501  global $tpl;
502 
503  if(!count($_POST['conditions']))
504  {
505  ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
506  $this->listConditions();
507  return true;
508  }
509 
510  // display confirmation message
511  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
512  $cgui = new ilConfirmationGUI();
513  $cgui->setFormAction($this->ctrl->getFormAction($this, "listConditions"));
514  $cgui->setHeaderText($this->lng->txt("rbac_condition_delete_sure"));
515  $cgui->setCancel($this->lng->txt("cancel"), "listConditions");
516  $cgui->setConfirm($this->lng->txt("delete"), "delete");
517 
518  // list conditions that should be deleted
519  foreach($_POST['conditions'] as $condition_id)
520  {
521  $condition = ilConditionHandler::_getCondition($condition_id);
522 
523  $title = ilObject::_lookupTitle($condition['trigger_obj_id']).
524  " (".$this->lng->txt("condition").": ".
525  $this->lng->txt('condition_'.$condition['operator']).")";
526  $icon = ilUtil::getImagePath('icon_'.$condition['trigger_type'].'_s.png');
527  $alt = $this->lng->txt('obj_'.$condition['trigger_type']);
528 
529  $cgui->addItem("conditions[]", $condition_id, $title, $icon, $alt);
530  }
531 
532  $tpl->setContent($cgui->getHTML());
533  }
$_POST['username']
Definition: cron.php:12
static _lookupTitle($a_id)
lookup object title
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ assign()

ilConditionHandlerInterface::assign ( )

assign new trigger condition to target

Definition at line 614 of file class.ilConditionHandlerInterface.php.

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

615  {
616  if(!isset($_GET['source_id']))
617  {
618  echo "class.ilConditionHandlerInterface: no source_id given";
619 
620  return false;
621  }
622  if(!$_POST['operator'])
623  {
624  ilUtil::sendFailure($this->lng->txt('err_check_input'));
625  $this->add();
626  return false;
627  }
628 
629  $this->ch_obj->setTargetRefId($this->getTargetRefId());
630  $this->ch_obj->setTargetObjId($this->getTargetId());
631  $this->ch_obj->setTargetType($this->getTargetType());
632 
633  switch($this->getTargetType())
634  {
635  case 'st':
636  $this->ch_obj->setReferenceHandlingType($_POST['ref_handling']);
637  break;
638 
639  default:
640  $this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
641  break;
642  }
643  // this has to be changed, if non referenced trigger are implemted
644  if(!$trigger_obj =& ilObjectFactory::getInstanceByRefId((int) $_GET['source_id'],false))
645  {
646  echo 'ilConditionHandler: Trigger object does not exist';
647  }
648  $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
649  $this->ch_obj->setTriggerObjId($trigger_obj->getId());
650  $this->ch_obj->setTriggerType($trigger_obj->getType());
651  $this->ch_obj->setOperator($_POST['operator']);
652  $this->ch_obj->setObligatory((int) $_POST['obligatory']);
653  $this->ch_obj->setValue('');
654 
655  // Save assigned sco's
656  if($this->ch_obj->getTriggerType() == 'sahs')
657  {
658  include_once 'Services/Object/classes/class.ilObjectLP.php';
659  $olp = ilObjectLP::getInstance($this->ch_obj->getTriggerObjId());
660  $collection = $olp->getCollectionInstance();
661  if($collection)
662  {
663  $collection->delete();
664  }
665 
666  if(is_array($_POST['item_ids'])) // #12901
667  {
668  $collection->activateEntries($_POST['item_ids']);
669  }
670  }
671 
672  $this->ch_obj->enableAutomaticValidation($this->getAutomaticValidation());
673  if(!$this->ch_obj->storeCondition())
674  {
675  ilUtil::sendFailure($this->ch_obj->getErrorMessage(),true);
676  }
677  else
678  {
679  ilUtil::sendSuccess($this->lng->txt('added_new_condition'),true);
680  }
681 
682  $this->ctrl->redirect($this,'listConditions');
683 
684  return true;
685  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getInstance($a_obj_id)
+ Here is the call graph for this function:

◆ chi_init()

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

Definition at line 193 of file class.ilConditionHandlerInterface.php.

References ilObjectFactory\getInstanceByRefId().

194  {
195  echo 'deprecated';
196 
197  include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
198 
199  $this->ch_obj =& new ilConditionHandler();
200 
201  if($a_ref_id)
202  {
203  $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
204  }
205  else
206  {
207  $this->target_obj =& $this->object;
208  }
209 
210  return true;
211  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Handles conditions for accesses to different ILIAS objects.
+ Here is the call graph for this function:

◆ chi_update()

ilConditionHandlerInterface::chi_update ( )

Definition at line 687 of file class.ilConditionHandlerInterface.php.

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

688  {
689  #if(in_array('',$_POST['operator']))
690  #{
691  # ilUtil::sendInfo($this->lng->txt('select_one_operator'));
692 
693  # return false;
694  #}
695  foreach($this->__getConditionsOfTarget() as $condition)
696  {
697  $this->ch_obj->setOperator($_POST['operator'][$condition["id"]]);
698  $this->ch_obj->setValue($_POST['value'][$condition["id"]]);
699  $this->ch_obj->updateCondition($condition['id']);
700 
701  }
702  ilUtil::sendSuccess($this->lng->txt('conditions_updated'));
703 
704  $this->ctrl->returnToParent($this);
705 
706  return true;
707  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ delete()

ilConditionHandlerInterface::delete ( )

Definition at line 535 of file class.ilConditionHandlerInterface.php.

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

536  {
537  if(!count($_POST['conditions']))
538  {
539  ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
540  $this->listConditions();
541  return true;
542  }
543 
544  foreach($_POST['conditions'] as $condition_id)
545  {
546  $this->ch_obj->deleteCondition($condition_id);
547  }
548  ilUtil::sendSuccess($this->lng->txt('condition_deleted'),true);
549  $this->ctrl->redirect($this,'listConditions');
550 
551  return true;
552  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ edit()

ilConditionHandlerInterface::edit ( )

Definition at line 423 of file class.ilConditionHandlerInterface.php.

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

424  {
425  global $ilObjDataCache;
426 
427  if(!$_GET['condition_id'])
428  {
429  ilUtil::sendFailure("Missing id: condition_id");
430  $this->listConditions();
431  return false;
432  }
433  $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
434 
435  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_edit_condition.html',
436  "Services/AccessControl");
437  $this->ctrl->setParameter($this,'condition_id',(int) $_GET['condition_id']);
438 
439  $this->initFormCondition($condition['trigger_ref_id'],(int) $_GET['condition_id'],'edit');
440  $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
441  }
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initFormCondition($a_source_id, $a_condition_id=0, $a_mode='add')
Init form for condition table.
+ Here is the call graph for this function:

◆ executeCommand()

ilConditionHandlerInterface::executeCommand ( )

Definition at line 86 of file class.ilConditionHandlerInterface.php.

References $cmd, $ilErr, and $lng.

87  {
88  global $ilErr, $ilAccess, $lng;
89 
90  if(!$ilAccess->checkAccess('write','',$this->getTargetRefId()))
91  {
92  $ilErr->raiseError($lng->txt('permission_denied'),$ilErr->WARNING);
93  }
94 
95  $next_class = $this->ctrl->getNextClass($this);
96  $cmd = $this->ctrl->getCmd();
97 
98  switch ($next_class)
99  {
100  default:
101  if (empty($cmd))
102  {
103  $cmd = "view";
104  }
105  $this->$cmd();
106  break;
107  }
108  }
$cmd
Definition: sahs_server.php:35

◆ getAutomaticValidation()

ilConditionHandlerInterface::getAutomaticValidation ( )

Definition at line 114 of file class.ilConditionHandlerInterface.php.

References $automatic_validation.

Referenced by assign().

+ Here is the caller graph for this function:

◆ getBackButtons()

ilConditionHandlerInterface::getBackButtons ( )

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

References $_SESSION.

Referenced by __showButtons().

82  {
83  return $_SESSION['precon_btn'] ? $_SESSION['precon_btn'] : array();
84  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ getTargetId()

ilConditionHandlerInterface::getTargetId ( )

get target id

Definition at line 131 of file class.ilConditionHandlerInterface.php.

References $target_id.

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

+ Here is the caller graph for this function:

◆ getTargetRefId()

ilConditionHandlerInterface::getTargetRefId ( )

◆ getTargetTitle()

ilConditionHandlerInterface::getTargetTitle ( )

get target title

Definition at line 188 of file class.ilConditionHandlerInterface.php.

References $target_title.

Referenced by initFormCondition().

+ Here is the caller graph for this function:

◆ getTargetType()

ilConditionHandlerInterface::getTargetType ( )

◆ ilConditionHandlerInterface()

ilConditionHandlerInterface::ilConditionHandlerInterface (   $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.ilConditionHandlerInterface.php.

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

43  {
44  global $lng,$tpl,$tree,$ilCtrl;
45 
46  include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
47 
48  $this->ch_obj =& new ilConditionHandler();
49 
50  $this->ctrl =& $ilCtrl;
51  $this->gui_obj =& $gui_obj;
52  $this->lng =& $lng;
53  $this->lng->loadLanguageModule('rbac');
54  $this->tpl =& $tpl;
55  $this->tree =& $tree;
56 
57  if($a_ref_id)
58  {
59  $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
60  }
61  else
62  {
63  $this->target_obj =& $this->gui_obj->object;
64  }
65 
66  // this only works for ilObject derived objects (other objects
67  // should call set() methods manually
68  if (is_object($this->target_obj))
69  {
70  $this->setTargetId($this->target_obj->getId());
71  $this->setTargetRefId($this->target_obj->getRefId());
72  $this->setTargetType($this->target_obj->getType());
73  $this->setTargetTitle($this->target_obj->getTitle());
74  }
75  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
global $ilCtrl
Definition: ilias.php:18
Handles conditions for accesses to different ILIAS objects.
setTargetTitle($a_target_title)
set target title
setTargetRefId($a_target_ref_id)
set target ref id
setTargetType($a_target_type)
set target type
+ Here is the call graph for this function:

◆ initFormCondition()

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

Init form for condition table.

private

Parameters

Definition at line 750 of file class.ilConditionHandlerInterface.php.

References 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().

751  {
752  $trigger_obj_id = ilObject::_lookupObjId($a_source_id);
753  $trigger_type = ilObject::_lookupType($trigger_obj_id);
754 
755  $condition = ilConditionHandler::_getCondition($a_condition_id);
756 
757  if(is_object($this->form))
758  {
759  return true;
760  }
761  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
762  $this->form = new ilPropertyFormGUI();
763  $this->ctrl->setParameter($this,'source_id',$a_source_id);
764  $this->form->setFormAction($this->ctrl->getFormAction($this));
765 
766  $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source"));
767  $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id)));
768  $this->form->addItem($info_source);
769 
770  $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target"));
771  $info_target->setValue($this->getTargetTitle());
772  $this->form->addItem($info_target);
773 
774  /* moved to list
775  $obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory');
776  $obl->setInfo($this->lng->txt('precondition_obligatory_info'));
777  $obl->setValue(1);
778  if($a_condition_id)
779  {
780  $obl->setChecked($condition['obligatory']);
781  }
782  else
783  {
784  $obl->setChecked(true);
785  }
786  $this->form->addItem($obl);
787  */
788  $obl = new ilHiddenInputGUI('obligatory');
789  if($a_condition_id)
790  {
791  $obl->setValue($condition['obligatory']);
792  }
793  else
794  {
795  $obl->setValue(1);
796  }
797  $this->form->addItem($obl);
798 
799  $sel = new ilSelectInputGUI($this->lng->txt('condition'),'operator');
800  include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
801  $ch_obj = new ilConditionHandler();
802  if($a_mode == 'add')
803  {
804  $operators[0] = $this->lng->txt('select_one');
805  }
806  foreach($ch_obj->getOperatorsByTargetType($trigger_type) as $operator)
807  {
808  $operators[$operator] = $this->lng->txt('condition_'.$operator);
809  }
810  $sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0);
811  $sel->setOptions($operators);
812  $sel->setRequired(true);
813  $this->form->addItem($sel);
814 
816  {
817  $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'),'ref_handling');
818  $rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS);
819 
820  $opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'),ilConditionHandler::SHARED_CONDITIONS);
821  $rad_opt->addOption($opt2);
822 
823  $opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'),ilConditionHandler::UNIQUE_CONDITIONS);
824  $rad_opt->addOption($opt1);
825 
826  $this->form->addItem($rad_opt);
827  }
828 
829  // Additional settings for SCO's
830  if($trigger_type == 'sahs')
831  {
832  $this->lng->loadLanguageModule('trac');
833 
834  $cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'),'item_ids[]');
835  $cus->setRequired(true);
836 
837  $tpl = new ilTemplate('tpl.condition_handler_sco_row.html',true,true,
838  "Services/AccessControl");
839  $counter = 0;
840 
841  include_once 'Services/Object/classes/class.ilObjectLP.php';
842  $olp = ilObjectLP::getInstance($trigger_obj_id);
843  $collection = $olp->getCollectionInstance();
844  if($collection)
845  {
846  foreach($collection->getPossibleItems() as $item_id => $sahs_item)
847  {
848  $tpl->setCurrentBlock("sco_row");
849  $tpl->setVariable('SCO_ID',$item_id);
850  $tpl->setVariable('SCO_TITLE',$sahs_item['title']);
851  $tpl->setVariable('CHECKED',$collection->isAssignedEntry($item_id) ? 'checked="checked"' : '');
852  $tpl->parseCurrentBlock();
853  $counter++;
854  }
855  }
856  $tpl->setVariable('INFO_SEL',$this->lng->txt('trac_lp_determination_info_sco'));
857  $cus->setHTML($tpl->get());
858  $this->form->addItem($cus);
859  }
860  switch($a_mode)
861  {
862  case 'edit':
863  $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.png'));
864  $this->form->setTitle($this->lng->txt('rbac_edit_condition'));
865  $this->form->addCommandButton('updateCondition',$this->lng->txt('save'));
866  $this->form->addCommandButton('listConditions',$this->lng->txt('cancel'));
867  break;
868 
869 
870  case 'add':
871  $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.png'));
872  $this->form->setTitle($this->lng->txt('add_condition'));
873  $this->form->addCommandButton('assign',$this->lng->txt('save'));
874  $this->form->addCommandButton('selector',$this->lng->txt('back'));
875  break;
876  }
877  return true;
878  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
This class represents a property form user interface.
static _lookupTitle($a_id)
lookup object title
This class represents a hidden form property in a property form.
This class represents a property in a property form.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
static _lookupType($a_id, $a_reference=false)
lookup object type
Handles conditions for accesses to different ILIAS objects.
This class represents a custom property in a property form.
static _isReferenceHandlingOptional($a_type)
is reference handling optional
This class represents a non editable value in a property form.
static getInstance($a_obj_id)
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTargetReferenced()

ilConditionHandlerInterface::isTargetReferenced ( )

Check if target has refernce id.

Returns
bool

Definition at line 180 of file class.ilConditionHandlerInterface.php.

References getTargetRefId().

181  {
182  return $this->getTargetRefId() ? true : false;
183  }
+ Here is the call graph for this function:

◆ listConditions()

ilConditionHandlerInterface::listConditions ( )
protected

list conditions ilToolbar

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

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

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

218  {
219  global $ilToolbar;
220 
221  $ilToolbar->addButton($this->lng->txt('add_condition'),$this->ctrl->getLinkTarget($this,'selector'));
222 
223  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.list_conditions.html','Services/AccessControl');
224 
226  $this->getTargetRefId(),
227  $this->getTargetId(),
228  $this->getTargetType()
229  );
230  if(count($optional_conditions))
231  {
232  if(!$_REQUEST["list_mode"])
233  {
234  $_REQUEST["list_mode"] = "subset";
235  }
236  }
237  else if(!$_REQUEST["list_mode"])
238  {
239  $_REQUEST["list_mode"] = "all";
240  }
241  $form = $this->showObligatoryForm($optional_conditions);
242  $this->tpl->setVariable('TABLE_SETTINGS',$form->getHTML());
243 
244  include_once './Services/AccessControl/classes/class.ilConditionHandlerTableGUI.php';
245  $table = new ilConditionHandlerTableGUI($this,'listConditions', ($_REQUEST["list_mode"] != "all"));
246  $table->setConditions(
248  $this->getTargetRefId(),
249  $this->getTargetId(),
250  $this->getTargetType()
251  )
252  );
253 
254  $this->tpl->setVariable('TABLE_CONDITIONS',$table->getHTML());
255  $this->tpl->setContent($table->getHTML());
256  }
showObligatoryForm($opt=array())
Show obligatory form.
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
Table presentation of conditions.
static getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObligatoryList()

ilConditionHandlerInterface::saveObligatoryList ( )
protected

Save obligatory settings.

Definition at line 321 of file class.ilConditionHandlerInterface.php.

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

322  {
324  $this->getTargetRefId(),
325  $this->getTargetId(),
326  $this->getTargetType()
327  );
328 
329  if($_POST["obl"] && sizeof($_POST["obl"]) > sizeof($all_conditions)-2)
330  {
331  ilUtil::sendFailure($this->lng->txt("rbac_precondition_minimum_optional"), true);
332  $this->ctrl->redirect($this,'listConditions');
333  }
334 
335  foreach($all_conditions as $item)
336  {
337  $status = false;
338  if($_POST["obl"] && in_array($item["condition_id"], $_POST["obl"]))
339  {
340  $status = true;
341  }
342  ilConditionHandler::updateObligatory($item["condition_id"], $status);
343  }
344 
345  // re-calculate
347  $this->getTargetRefId(),
348  $this->getTargetId(),
349  $this->getTargetType(),
350  true
351  );
352 
353  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
354  $this->ctrl->redirect($this,'listConditions');
355  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
static calculateRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static updateObligatory($a_id, $a_status)
Toggle condition obligatory status.
+ Here is the call graph for this function:

◆ saveObligatorySettings()

ilConditionHandlerInterface::saveObligatorySettings ( )
protected

Save obligatory settings.

Definition at line 261 of file class.ilConditionHandlerInterface.php.

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

262  {
263  $form = $this->showObligatoryForm();
264  if($form->checkInput())
265  {
266  $old_mode = $form->getInput("old_list_mode");
267  switch($form->getInput("list_mode"))
268  {
269  case "all":
270  if($old_mode != "all")
271  {
272  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
274  $this->getTargetRefId(),
275  $this->getTargetId(),
276  $this->getTargetType()
277  );
278  // Set all optional conditions to obligatory
279  foreach((array) $optional_conditions as $item)
280  {
281  ilConditionHandler::updateObligatory($item["condition_id"], true);
282  }
283  }
284  break;
285 
286  case "subset":
287  $num_req = $form->getInput('required');
288  if($old_mode != "subset")
289  {
291  $this->getTargetRefId(),
292  $this->getTargetId(),
293  $this->getTargetType()
294  );
295  foreach($all_conditions as $item)
296  {
297  ilConditionHandler::updateObligatory($item["condition_id"], false);
298  }
299  $num_req = 1;
300  }
302  $this->getTargetRefId(),
303  $this->getTargetId(),
304  $num_req
305  );
306  break;
307  }
308 
309  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
310  $this->ctrl->redirect($this,'listConditions');
311  }
312 
313  $form->setValuesByPost();
314  ilUtil::sendFailure($this->lng->txt('err_check_input'));
315  $this->tpl->setContent($form->getHTML());
316  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static saveNumberOfRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_num)
Save number of obigatory triggers.
showObligatoryForm($opt=array())
Show obligatory form.
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
static getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static updateObligatory($a_id, $a_status)
Toggle condition obligatory status.
+ Here is the call graph for this function:

◆ selector()

ilConditionHandlerInterface::selector ( )

Definition at line 554 of file class.ilConditionHandlerInterface.php.

References $_GET, $path, $tree, getTargetRefId(), ilUtil\sendInfo(), and ilExplorer\setExpand().

Referenced by add().

555  {
556  global $tree;
557 
558  include_once ("./Services/AccessControl/classes/class.ilConditionSelector.php");
559 
560  $this->tpl->addBlockFile('ADM_CONTENT', "adm_content", "tpl.condition_selector.html",
561  "Services/AccessControl");
562 
563  ilUtil::sendInfo($this->lng->txt("condition_select_object"));
564 
565  $exp = new ilConditionSelector($this->ctrl->getLinkTarget($this,'copySelector'));
566  $exp->setExpand($_GET["condition_selector_expand"] ? $_GET["condition_selector_expand"] : $this->tree->readRootId());
567  $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'selector'));
568  $exp->setTargetGet("ref_id");
569  $exp->setRefId($this->getTargetRefId());
570 
571  if($this->getTargetRefId())
572  {
573  $path = $tree->getPathId($this->getTargetRefId());
574  array_pop($path);
575  $exp->setForceOpenPath($path);
576  }
577 
578  $exp->addFilter('crs');
579  $exp->addFilter('tst');
580  $exp->addFilter('sahs');
581  $exp->addFilter('svy');
582 
583  $exp->setSelectableTypes($this->ch_obj->getTriggerTypes());
584  $exp->setControlClass($this);
585  // build html-output
586  $exp->setOutput(0);
587 
588  $this->tpl->setCurrentBlock("adm_content");
589  $this->tpl->setVariable("EXPLORER",$exp->getOutput());
590  $this->tpl->parseCurrentBlock();
591  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$path
Definition: index.php:22
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAutomaticValidation()

ilConditionHandlerInterface::setAutomaticValidation (   $a_status)

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

111  {
112  $this->automatic_validation = $a_status;
113  }

◆ setBackButtons()

ilConditionHandlerInterface::setBackButtons (   $a_btn_arr)

Definition at line 77 of file class.ilConditionHandlerInterface.php.

References $_SESSION.

78  {
79  $_SESSION['precon_btn'] = $a_btn_arr;
80  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ setTargetId()

ilConditionHandlerInterface::setTargetId (   $a_target_id)

set target id

Definition at line 123 of file class.ilConditionHandlerInterface.php.

Referenced by ilConditionHandlerInterface().

124  {
125  $this->target_id = $a_target_id;
126  }
+ Here is the caller graph for this function:

◆ setTargetRefId()

ilConditionHandlerInterface::setTargetRefId (   $a_target_ref_id)

set target ref id

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

Referenced by ilConditionHandlerInterface().

140  {
141  $this->target_ref_id = $a_target_ref_id;
142  }
+ Here is the caller graph for this function:

◆ setTargetTitle()

ilConditionHandlerInterface::setTargetTitle (   $a_target_title)

set target title

Definition at line 171 of file class.ilConditionHandlerInterface.php.

Referenced by ilConditionHandlerInterface().

172  {
173  $this->target_title = $a_target_title;
174  }
+ Here is the caller graph for this function:

◆ setTargetType()

ilConditionHandlerInterface::setTargetType (   $a_target_type)

set target type

Definition at line 155 of file class.ilConditionHandlerInterface.php.

Referenced by ilConditionHandlerInterface().

156  {
157  $this->target_type = $a_target_type;
158  }
+ Here is the caller graph for this function:

◆ showObligatoryForm()

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

Show obligatory form.

Returns
ilPropertyFormGUI

Definition at line 361 of file class.ilConditionHandlerInterface.php.

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

Referenced by listConditions(), and saveObligatorySettings().

362  {
363  if(!$opt)
364  {
366  $this->getTargetRefId(),
367  $this->getTargetId(),
368  $this->getTargetType()
369  );
370  }
371 
373 
374  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
375  $form = new ilPropertyFormGUI();
376  $form->setFormAction($this->ctrl->getFormAction($this),'listConditions');
377  $form->setTitle($this->lng->txt('precondition_obligatory_settings'));
378  $form->addCommandButton('saveObligatorySettings', $this->lng->txt('save'));
379 
380  $mode = new ilRadioGroupInputGUI($this->lng->txt("rbac_precondition_mode"), "list_mode");
381  $form->addItem($mode);
382  $mode->setValue($_REQUEST["list_mode"]);
383 
384  $mall = new ilRadioOption($this->lng->txt("rbac_precondition_mode_all"), "all");
385  $mall->setInfo($this->lng->txt("rbac_precondition_mode_all_info"));
386  $mode->addOption($mall);
387 
388  $msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset");
389  $msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info"));
390  $mode->addOption($msubset);
391 
392  $obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required');
393  $obl->setInfo($this->lng->txt('precondition_num_optional_info'));
394  if(count($opt))
395  {
397  $this->getTargetRefId(),
398  $this->getTargetId(),
399  $this->getTargetType()
400  );
401  $min = count($all) - count($opt) + 1;
402  $max = count($all) - 1;
403  }
404  else
405  {
406  $obligatory = $min = $max = 1;
407  }
408  $obl->setValue($obligatory);
409  $obl->setRequired(true);
410  $obl->setSize(1);
411  $obl->setMinValue($min);
412  $obl->setMaxValue($max);
413  $msubset->addSubItem($obl);
414 
415  $old_mode = new ilHiddenInputGUI("old_list_mode");
416  $old_mode->setValue($_REQUEST["list_mode"]);
417  $form->addItem($old_mode);
418 
419  return $form;
420  }
This class represents an option in a radio group.
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
This class represents a property form user interface.
setInfo($a_info)
Set Info.
static calculateRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
setInfo($a_info)
Set Information Text.
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 getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCondition()

ilConditionHandlerInterface::updateCondition ( )

Definition at line 443 of file class.ilConditionHandlerInterface.php.

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

444  {
445  global $ilObjDataCache;
446 
447  if(!$_GET['condition_id'])
448  {
449  ilUtil::sendFailure("Missing id: condition_id");
450  $this->listConditions();
451  return false;
452  }
453 
454  // Update condition
455  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
456  $condition_handler = new ilConditionHandler();
457 
458  $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
459  $condition_handler->setOperator($_POST['operator']);
460  $condition_handler->setObligatory((int) $_POST['obligatory']);
461  $condition_handler->setTargetRefId($this->getTargetRefId());
462  $condition_handler->setValue('');
463  switch($this->getTargetType())
464  {
465  case 'st':
466  $condition_handler->setReferenceHandlingType($_POST['ref_handling']);
467  break;
468 
469  default:
470  $condition_handler->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
471  break;
472  }
473  $condition_handler->updateCondition($condition['id']);
474 
475  // Update relevant sco's
476  if($condition['trigger_type'] == 'sahs')
477  {
478  include_once 'Services/Object/classes/class.ilObjectLP.php';
479  $olp = ilObjectLP::getInstance($condition['trigger_obj_id']);
480  $collection = $olp->getCollectionInstance();
481  if($collection)
482  {
483  $collection->delete();
484  }
485 
486  if(is_array($_POST['item_ids'])) // #12901
487  {
488  $collection->activateEntries($_POST['item_ids']);
489  }
490 
491  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
492  ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']);
493  }
494 
495  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
496  $this->ctrl->redirect($this,'listConditions');
497  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Handles conditions for accesses to different ILIAS objects.
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static getInstance($a_obj_id)
+ Here is the call graph for this function:

Field Documentation

◆ $automatic_validation

ilConditionHandlerInterface::$automatic_validation = true

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

Referenced by getAutomaticValidation().

◆ $ch_obj

ilConditionHandlerInterface::$ch_obj

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

◆ $client_obj

ilConditionHandlerInterface::$client_obj

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

◆ $ctrl

ilConditionHandlerInterface::$ctrl = null

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

◆ $lng

ilConditionHandlerInterface::$lng

◆ $target_id

ilConditionHandlerInterface::$target_id

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

Referenced by getTargetId().

◆ $target_obj

ilConditionHandlerInterface::$target_obj

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

◆ $target_ref_id

ilConditionHandlerInterface::$target_ref_id

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

Referenced by getTargetRefId().

◆ $target_title

ilConditionHandlerInterface::$target_title

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

Referenced by getTargetTitle().

◆ $target_type

ilConditionHandlerInterface::$target_type

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

Referenced by getTargetType().

◆ $tpl

ilConditionHandlerInterface::$tpl

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

Referenced by askDelete(), and ilConditionHandlerInterface().

◆ $tree

ilConditionHandlerInterface::$tree

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

Referenced by ilConditionHandlerInterface(), and selector().


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