Public Member Functions | Data Fields

ilConditionHandlerInterface Class Reference

Public Member Functions

 ilConditionHandlerInterface (&$gui_obj, $a_ref_id=null)
 setTargetId ($a_target_id)
 set target id
 getTargetId ()
 get target id
 setTargetRefId ($a_target_ref_id)
 set target ref id
 getTargetRefId ()
 get target ref id
 setTargetType ($a_target_type)
 set target type
 getTargetType ()
 get target type
 setTargetTitle ($a_target_title)
 set target title
 getTargetTitle ()
 get target title
 chi_init (&$chi_target_obj, $a_ref_id=null)
chi_list ()
 get conditioni list
 chi_delete ()
 chi_selector ($a_tpl_block="content", $a_tpl_var="OBJECTS")
 chi_assign ($a_automatic_validation=true)
 assign new trigger condition to target
 chi_update ()

Data Fields

 $lng
 $tpl
 $tree
 $ch_obj
 $target_obj
 $client_obj
 $target_id
 $target_type
 $target_title
 $target_ref_id

Detailed Description

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


Member Function Documentation

ilConditionHandlerInterface::chi_assign ( a_automatic_validation = true  ) 

assign new trigger condition to target

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

References $_GET, $target_obj, ilObjectFactory::getInstanceByRefId(), getTargetId(), getTargetRefId(), getTargetType(), and sendInfo().

        {
                if(!isset($_GET['source_id']))
                {
                        echo "class.ilConditionHandlerInterface: no source_id given";

                        return false;
                }

                // automatic determination of obj id and type works only for
                // referenced objects
                if ($this->getTargetRefId() > 0)
                {
                        if(!$target_obj =& ilObjectFactory::getInstanceByRefId($this->getTargetRefId(),false))
                        {
                                echo 'ilConditionHandler: Target object does not exist';
                        }
                        $this->ch_obj->setTargetObjId($target_obj->getId());
                        $this->ch_obj->setTargetType($target_obj->getType());
                }
                $this->ch_obj->setTargetRefId($this->getTargetRefId());
                $this->ch_obj->setTargetObjId($this->getTargetId());
                $this->ch_obj->setTargetType($this->getTargetType());
                
                // this has to be changed, if non referenced trigger are implemted
                if(!$trigger_obj =& ilObjectFactory::getInstanceByRefId((int) $_GET['source_id'],false))
                {
                        echo 'ilConditionHandler: Trigger object does not exist';
                }
                $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
                $this->ch_obj->setTriggerObjId($trigger_obj->getId());
                $this->ch_obj->setTriggerType($trigger_obj->getType());
                $this->ch_obj->setOperator('');
                $this->ch_obj->setValue('');

                $this->ch_obj->enableAutomaticValidation($a_automatic_validation);
                if(!$this->ch_obj->storeCondition())
                {
                        sendInfo($this->ch_obj->getErrorMessage());
                }
                else
                {
                        sendInfo($this->lng->txt('added_new_condition'));
                }
                return true;
        }

Here is the call graph for this function:

ilConditionHandlerInterface::chi_delete (  ) 

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

References $_POST, and sendInfo().

        {
                if(!count($_POST['conditions']))
                {
                        sendInfo('no_condition_selected');

                        return true;
                }

                foreach($_POST['conditions'] as $condition_id)
                {
                        $this->ch_obj->deleteCondition($condition_id);
                }
                sendInfo($this->lng->txt('condition_deleted'));
                return true;
        }

Here is the call graph for this function:

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

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

References ilObjectFactory::getInstanceByRefId().

        {
                echo 'deprecated';
                
                include_once "./classes/class.ilConditionHandler.php";

                $this->ch_obj =& new ilConditionHandler();

                if($a_ref_id)
                {
                        $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
                }
                else
                {
                        $this->target_obj =& $this->object;
                }

                return true;
        }

Here is the call graph for this function:

& ilConditionHandlerInterface::chi_list (  ) 

get conditioni list

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

References $_GET, $counter, $rbacsystem, $tbl, $tpl, ilConditionHandler::_getConditionsOfTarget(), ilUtil::formCheckbox(), ilUtil::formSelect(), ilUtil::getImagePath(), ilObjectFactory::getInstanceByRefId(), getTargetId(), getTargetRefId(), getTargetTitle(), getTargetType(), and ilUtil::switchColor().

        {
                global $rbacsystem;

                $operators = array(''                   => $this->lng->txt('condition_select_one'),
                                                   'passed'             => $this->lng->txt('condition_passed'));

                $tpl =& new ilTemplate("tpl.table.html", true, true);


                $tpl->setCurrentBlock("tbl_form_header");
                $tpl->setVariable("FORMACTION",$this->gui_obj->ctrl->getFormAction($this->gui_obj));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("COLUMN_COUNTS",4);
                $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));

                if(count(ilConditionHandler::_getConditionsOfTarget($this->getTargetId(), $this->getTargetType())))
                {

                        $tpl->setCurrentBlock("tbl_action_btn");
                        $tpl->setVariable("BTN_NAME","chi_delete");
                        $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
                        $tpl->parseCurrentBlock();

                        $tpl->setCurrentBlock("plain_button");
                        $tpl->setVariable("PBTN_NAME","chi_update");
                        $tpl->setVariable("PBTN_VALUE",$this->lng->txt("condition_update"));
                        $tpl->parseCurrentBlock();
                }

                $tpl->setCurrentBlock("plain_button");
                $tpl->setVariable("PBTN_NAME","chi_selector");
                $tpl->setVariable("PBTN_VALUE",$this->lng->txt("add_condition"));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_row");

                $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.condition_handler_row.html");

                $counter = 0;
                foreach(ilConditionHandler::_getConditionsOfTarget($this->getTargetId(), $this->getTargetType()) as $condition)
                {
                        $tmp_obj =& ilObjectFactory::getInstanceByRefId($condition['trigger_ref_id']);

                        $tpl->setCurrentBlock("tbl_content");
                        $tpl->setVariable("CHECKBOX",ilUtil::formCheckbox(0,"conditions[]",$condition['id']));
                        $tpl->setVariable("OBJ_TITLE",$tmp_obj->getTitle());
                        $tpl->setVariable("OBJ_DESCRIPTION",$tmp_obj->getDescription());
                        $tpl->setVariable("ROWCOL", ilUtil::switchColor($counter++,"tblrow2","tblrow1"));

                        $tpl->setVariable("OBJ_CONDITION",ilUtil::formSelect($condition['operator'],
                                                                                                                                 "operator[".$condition['id']."]",
                                                                                                                                 $operators,
                                                                                                                                 false,
                                                                                                                                 true));

                        $tpl->setVariable("OBJ_VALUE_NAME","value[".$condition['id']."]");
                        $tpl->setVariable("OBJ_VALUE_VALUE",$condition['value']); 

                        $tpl->parseCurrentBlock();
                }


                // create table
                include_once './classes/class.ilTableGUI.php';

                $tbl =& new ilTableGUI();

                // title & header columns
                $tbl->setTitle($this->getTargetTitle()." ".$this->lng->txt("preconditions"),"icon_".$this->getTargetType().".gif",
                                           $this->lng->txt("preconditions"));

                $tbl->setHeaderNames(array("",$this->lng->txt("title"),$this->lng->txt("condition"),
                                                                   $this->lng->txt("value")));
                $tbl->setHeaderVars(array("","title","condition","value"), 
                                                        array("ref_id" => $this->getTargetRefId(),
                                                                  "cmdClass" => "ilobjcoursegui",
                                                                  "cmdNode" => $_GET["cmdNode"],
                                                                  "cmd" => "cci_edit"));
                $tbl->setColumnWidth(array("1%","40%","30%","30%"));

                $tbl->setLimit($_GET["limit"]);
                $tbl->setOffset($_GET["offset"]);
                $tbl->setMaxCount(10);

                // footer
                $tbl->disable("footer");
                $tbl->disable('sort');

                // render table
                $tbl->setTemplate($tpl);
                $tbl->render();

                return $tpl->get();
        }

Here is the call graph for this function:

ilConditionHandlerInterface::chi_selector ( a_tpl_block = "content",
a_tpl_var = "OBJECTS" 
)

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

References $_GET, $exp, getTargetRefId(), and sendInfo().

        {
                include_once ("classes/class.ilConditionSelector.php");

                $this->tpl->setCurrentBlock($a_tpl_block);
                $this->tpl->addBlockFile($a_tpl_var, "objects", "tpl.condition_selector.html");

                sendInfo($this->lng->txt("condition_select_object"));

                $exp = new ilConditionSelector($this->gui_obj->ctrl->getLinkTarget($this->gui_obj,'copySelector'));
                $exp->setExpand($_GET["condition_selector_expand"] ? $_GET["condition_selector_expand"] : $this->tree->readRootId());
                $exp->setExpandTarget($this->gui_obj->ctrl->getLinkTarget($this->gui_obj,'chi_selector'));
                $exp->setTargetGet("ref_id");
                $exp->setRefId($this->getTargetRefId());
                $exp->addFilter('crs');
                $exp->setSelectableTypes($this->ch_obj->getTriggerTypes());
                $exp->setControlClass($this->gui_obj);
                // build html-output
                $exp->setOutput(0);

                $this->tpl->setCurrentBlock("objects");
                $this->tpl->setVariable("EXPLORER",$exp->getOutput());
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

ilConditionHandlerInterface::chi_update (  ) 

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

References $_POST, ilConditionHandler::_getConditionsOfTarget(), getTargetId(), getTargetType(), and sendInfo().

        {
                #if(in_array('',$_POST['operator']))
                #{
                #       sendInfo($this->lng->txt('select_one_operator'));

                #       return false;
                #}
                foreach(ilConditionHandler::_getConditionsOfTarget($this->getTargetId(), $this->getTargetType()) as $condition)
                {
                        $this->ch_obj->setOperator($_POST['operator'][$condition["id"]]);
                        $this->ch_obj->setValue($_POST['value'][$condition["id"]]);
                        $this->ch_obj->updateCondition($condition['id']);

                }
                sendInfo($this->lng->txt('conditions_updated'));

                return true;
        }

Here is the call graph for this function:

ilConditionHandlerInterface::getTargetId (  ) 

get target id

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

Referenced by chi_assign(), chi_list(), and chi_update().

        {
                return $this->target_id;
        }

Here is the caller graph for this function:

ilConditionHandlerInterface::getTargetRefId (  ) 

get target ref id

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

Referenced by chi_assign(), chi_list(), and chi_selector().

        {
                return $this->target_ref_id;
        }

Here is the caller graph for this function:

ilConditionHandlerInterface::getTargetTitle (  ) 

get target title

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

Referenced by chi_list().

        {
                return $this->target_title;
        }

Here is the caller graph for this function:

ilConditionHandlerInterface::getTargetType (  ) 

get target type

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

Referenced by chi_assign(), chi_list(), and chi_update().

        {
                return $this->target_type;
        }

Here is the caller graph for this function:

ilConditionHandlerInterface::ilConditionHandlerInterface ( &$  gui_obj,
a_ref_id = null 
)

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

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

        {
                global $lng,$tpl,$tree;

                include_once "./classes/class.ilConditionHandler.php";

                $this->ch_obj =& new ilConditionHandler();

                $this->gui_obj =& $gui_obj;
                $this->lng =& $lng;
                $this->tpl =& $tpl;
                $this->tree =& $tree;
                
                if($a_ref_id)
                {
                        $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
                }
                else
                {
                        $this->target_obj =& $this->gui_obj->object;
                }

                // this only works for ilObject derived objects (other objects
                // should call set() methods manually   
                if (is_object($this->target_obj))
                {
                        $this->setTargetId($this->target_obj->getId());
                        $this->setTargetRefId($this->target_obj->getRefId());
                        $this->setTargetType($this->target_obj->getType());
                        $this->setTargetTitle($this->target_obj->getTitle());
                }
                
        }

Here is the call graph for this function:

ilConditionHandlerInterface::setTargetId ( a_target_id  ) 

set target id

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

Referenced by ilConditionHandlerInterface().

        {
                $this->target_id = $a_target_id;
        }

Here is the caller graph for this function:

ilConditionHandlerInterface::setTargetRefId ( a_target_ref_id  ) 

set target ref id

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

Referenced by ilConditionHandlerInterface().

        {
                $this->target_ref_id = $a_target_ref_id;
        }

Here is the caller graph for this function:

ilConditionHandlerInterface::setTargetTitle ( a_target_title  ) 

set target title

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

Referenced by ilConditionHandlerInterface().

        {
                $this->target_title = $a_target_title;
        }

Here is the caller graph for this function:

ilConditionHandlerInterface::setTargetType ( a_target_type  ) 

set target type

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

Referenced by ilConditionHandlerInterface().

        {
                $this->target_type = $a_target_type;
        }

Here is the caller graph for this function:


Field Documentation

ilConditionHandlerInterface::$ch_obj

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

ilConditionHandlerInterface::$client_obj

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

ilConditionHandlerInterface::$lng

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

Referenced by ilConditionHandlerInterface().

ilConditionHandlerInterface::$target_id

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

ilConditionHandlerInterface::$target_obj

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

Referenced by chi_assign().

ilConditionHandlerInterface::$target_ref_id

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

ilConditionHandlerInterface::$target_title

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

ilConditionHandlerInterface::$target_type

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

ilConditionHandlerInterface::$tpl

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

Referenced by chi_list(), and ilConditionHandlerInterface().

ilConditionHandlerInterface::$tree

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

Referenced by ilConditionHandlerInterface().


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