Public Member Functions | Data Fields

ilLMObjectGUI Class Reference
[Modules/IliasLearningModule]

Class ilLMObject. More...

Inheritance diagram for ilLMObjectGUI:

Public Member Functions

 ilLMObjectGUI (&$a_content_obj)
 constructor
 setActions ($a_actions="")
 build action array
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 create ()
 structure / page object creation form
 putInTree ()
 put this object into content object tree
 delete ()
 confirm deletion screen (delete page or structure objects)
 cancelDelete ()
 cancel deletion of page/structure objects
 confirmedDelete ()
 page and structure object deletion
 showPossibleSubObjects ($a_type)
 display subobject selection
 add_cell ($val, $link="")
 output a cell in object list
 showActions ()
 show possible action (form buttons)
 checkTree ()
 check the content object tree
 activatePage ($a_active)
 activates page or chapter (currently only for pages implemented)

Data Fields

 $ilias
 $tpl
 $lng
 $obj
 $objDefinition
 $ctrl
 $content_object
 $actions

Detailed Description

Class ilLMObject.

Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD)

Author:
Alex Killing <alex.killing@gmx.de>
Version:
Id:
class.ilLMObjectGUI.php 11711 2006-07-30 14:11:38Z akill

Definition at line 35 of file class.ilLMObjectGUI.php.


Member Function Documentation

ilLMObjectGUI::activatePage ( a_active  ) 

activates page or chapter (currently only for pages implemented)

Parameters:
boolean $a_active true/false for active or not

Definition at line 343 of file class.ilLMObjectGUI.php.

        {
                $this->obj->setActive($a_active);
                $this->obj->update();
        }

ilLMObjectGUI::add_cell ( val,
link = "" 
)

output a cell in object list

Reimplemented in ilStructureObjectGUI.

Definition at line 284 of file class.ilLMObjectGUI.php.

        {
                if(!empty($link))
                {
                        $this->tpl->setCurrentBlock("begin_link");
                        $this->tpl->setVariable("LINK_TARGET", $link);
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->touchBlock("end_link");
                }

                $this->tpl->setCurrentBlock("text");
                $this->tpl->setVariable("TEXT_CONTENT", $val);
                $this->tpl->parseCurrentBlock();
                $this->tpl->setCurrentBlock("table_cell");
                $this->tpl->parseCurrentBlock();
        }

ilLMObjectGUI::cancelDelete (  ) 

cancel deletion of page/structure objects

Definition at line 232 of file class.ilLMObjectGUI.php.

References $_GET.

        {
                session_unregister("saved_post");
                $this->ctrl->redirect($this, $_GET["backcmd"]);
        }

ilLMObjectGUI::checkTree (  ) 

check the content object tree

Definition at line 333 of file class.ilLMObjectGUI.php.

Referenced by ilStructureObjectGUI::cutPage(), ilStructureObjectGUI::pastePage(), ilStructureObjectGUI::save(), and ilLMPageObjectGUI::save().

        {
                $this->content_object->checkTree();
        }

Here is the caller graph for this function:

ilLMObjectGUI::confirmedDelete (  ) 

page and structure object deletion

Definition at line 242 of file class.ilLMObjectGUI.php.

References $_GET.

        {
                $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
                        true, false);
                $cont_obj_gui->confirmedDelete($this->obj->getId());
                $this->ctrl->redirect($this, $_GET["backcmd"]);
        }

ilLMObjectGUI::create (  ) 

structure / page object creation form

Reimplemented in ilStructureObjectGUI.

Definition at line 140 of file class.ilLMObjectGUI.php.

References $_GET, $_POST, $_SESSION, $data, $key, $rbacsystem, getTargetFrame(), and getTemplateFile().

        {
                global $rbacsystem;

                $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];

                // fill in saved values in case of error
                $data = array();
                $data["fields"] = array();
                $data["fields"]["title"] = $_SESSION["error_post_vars"]["Fobject"]["title"];
                $data["fields"]["desc"] = $_SESSION["error_post_vars"]["Fobject"]["desc"];

                $this->getTemplateFile("edit",$new_type);

                foreach ($data["fields"] as $key => $val)
                {
                        $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
                        $this->tpl->setVariable(strtoupper($key), $val);

                        if ($this->prepare_output)
                        {
                                $this->tpl->parseCurrentBlock();
                        }
                }
                $this->ctrl->setParameter($this, "new_type", $new_type);
//echo "<br>lmobjectgui_formaction";
//echo ":".$this->ctrl->getFormAction($this, "", true).":";
                $this->tpl->setVariable("FORMACTION",
                        $this->ctrl->getFormAction($this, "", true));
                $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
                $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
                $this->tpl->setVariable("CMD_SUBMIT", "save");
                $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
                $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));

        }

Here is the call graph for this function:

ilLMObjectGUI::delete (  ) 

confirm deletion screen (delete page or structure objects)

Definition at line 219 of file class.ilLMObjectGUI.php.

        {
                $this->setTabs();

                $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
                        true, false);
                $cont_obj_gui->delete($this->obj->getId());
        }

ilLMObjectGUI::getTargetFrame ( a_cmd,
a_target_frame = "" 
)

get target frame for command (command is method name without "Object", e.g.

"perm")

Parameters:
string $a_cmd command
string $a_target_frame default target frame (is returned, if no special target frame was set) public

Definition at line 95 of file class.ilLMObjectGUI.php.

Referenced by create().

        {
                if ($this->target_frame[$a_cmd] != "")
                {
                        return $this->target_frame[$a_cmd];
                }
                elseif (!empty($a_target_frame))
                {
                        return "target=\"".$a_target_frame."\"";
                }
                else
                {
                        return;
                }
        }

Here is the caller graph for this function:

ilLMObjectGUI::getTemplateFile ( a_cmd,
a_type = "" 
)

get a template blockfile format: tpl.

<objtype>_<command>.html

Parameters:
string command
string object type definition public

Definition at line 119 of file class.ilLMObjectGUI.php.

References $_GET.

Referenced by create().

        {
                if (!$a_type)
                {
                        $a_type = $_GET["type"];
                }

                $template = "tpl.".$a_type."_".$a_cmd.".html";

                if (!$this->tpl->fileExists($template))
                {
                        $template = "tpl.obj_".$a_cmd.".html";
                }

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", $template);
        }

Here is the caller graph for this function:

ilLMObjectGUI::ilLMObjectGUI ( &$  a_content_obj  ) 

constructor

Parameters:
object $a_content_obj content object

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

References $ilCtrl, $ilias, $lng, $objDefinition, and $tpl.

Referenced by ilLMPageObjectGUI::ilLMPageObjectGUI(), and ilStructureObjectGUI::ilStructureObjectGUI().

        {
                global $ilias, $tpl, $lng, $objDefinition, $ilCtrl;

                $this->ilias =& $ilias;
                $this->tpl =& $tpl;
                $this->lng =& $lng;
                $this->ctrl =& $ilCtrl;
                $this->objDefinition =& $objDefinition;
                $this->content_object =& $a_content_obj;
        }

Here is the caller graph for this function:

ilLMObjectGUI::putInTree (  ) 

put this object into content object tree

Reimplemented in ilStructureObjectGUI.

Definition at line 182 of file class.ilLMObjectGUI.php.

References $_GET, and $tree.

Referenced by ilLMPageObjectGUI::save().

        {
                $tree = new ilTree($this->content_object->getId());
                $tree->setTableNames('lm_tree', 'lm_data');
                $tree->setTreeTablePK("lm_id");

                $parent_id = (!empty($_GET["obj_id"]))
                        ? $_GET["obj_id"]
                        : $tree->getRootId();

                if (!empty($_GET["target"]))
                {
                        $target = $_GET["target"];
                }
                else
                {
                        // determine last child of current type
                        $childs =& $tree->getChildsByType($parent_id, $this->obj->getType());
                        if (count($childs) == 0)
                        {
                                $target = IL_FIRST_NODE;
                        }
                        else
                        {
                                $target = $childs[count($childs) - 1]["obj_id"];
                        }
                }
                if (!$tree->isInTree($this->obj->getId()))
                {
                        $tree->insertNode($this->obj->getId(), $parent_id, $target);
                }
        }

Here is the caller graph for this function:

ilLMObjectGUI::setActions ( a_actions = ""  ) 

build action array

Parameters:
array $a_actions action array (key = action key, value = action language string) private

Definition at line 72 of file class.ilLMObjectGUI.php.

References $lng.

Referenced by ilStructureObjectGUI::subchap(), and ilStructureObjectGUI::view().

        {
                if (is_array($a_actions))
                {
                        foreach ($a_actions as $name => $lng)
                        {
                                $this->actions[$name] = array("name" => $name, "lng" => $lng);
                        }
                }
                else
                {
                        $this->actions = "";
                }
        }

Here is the caller graph for this function:

ilLMObjectGUI::showActions (  ) 

show possible action (form buttons)

public

Definition at line 307 of file class.ilLMObjectGUI.php.

References ilUtil::getImagePath().

Referenced by ilStructureObjectGUI::subchap(), and ilStructureObjectGUI::view().

        {
                $notoperations = array();
                $operations = array();

                $operations = $this->actions;

                if (count($operations) > 0)
                {
                        foreach ($operations as $val)
                        {
                                $this->tpl->setCurrentBlock("operation_btn");
                                $this->tpl->setVariable("BTN_NAME", $val["name"]);
                                $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
                                $this->tpl->parseCurrentBlock();
                        }

                        $this->tpl->setCurrentBlock("operation");
                        $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
                        $this->tpl->parseCurrentBlock();
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLMObjectGUI::showPossibleSubObjects ( a_type  ) 

display subobject selection

Parameters:
string $a_type parent object type

Definition at line 256 of file class.ilLMObjectGUI.php.

References $d, $row, and formSelect().

        {
                $d = $this->objDefinition->getCreatableSubObjects($a_type);
                if (count($d) > 0)
                {
                        foreach ($d as $row)
                        {
                                $subobj[] = $row["name"];
                        }
                }

                if (is_array($subobj))
                {
                        //build form
                        $opts = ilUtil::formSelect(12,"new_type",$subobj);
                        //$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
                        $this->tpl->setCurrentBlock("add_object");
                        $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
                        //$this->tpl->setVariable("FORMACTION_OBJ_ADD", "adm_object.php?cmd=create&ref_id=".$_GET["ref_id"]);
                        $this->tpl->setVariable("BTN_NAME", "create");
                        $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
                        $this->tpl->parseCurrentBlock();
                }
        }

Here is the call graph for this function:


Field Documentation

ilLMObjectGUI::$actions

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

ilLMObjectGUI::$content_object

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

ilLMObjectGUI::$ctrl

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

ilLMObjectGUI::$ilias
ilLMObjectGUI::$lng
ilLMObjectGUI::$obj

Reimplemented in ilLMPageObjectGUI, and ilStructureObjectGUI.

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

ilLMObjectGUI::$objDefinition

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

Referenced by ilLMObjectGUI().

ilLMObjectGUI::$tpl

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