ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilHierarchyFormGUI Class Reference

This class represents a hierarchical form. More...

+ Inheritance diagram for ilHierarchyFormGUI:
+ Collaboration diagram for ilHierarchyFormGUI:

Public Member Functions

 __construct ()
 Constructor.
 setParentCommand ($a_parent_obj, $a_parent_cmd)
 Set parent gui object/cmd.
 getParentObject ()
 Get Parent object.
 getParentCommand ()
 Get parent command.
 setId ($a_id)
 Set Id.
 getId ()
 Get Id.
 setTree ($a_tree)
 Set Tree Object.
 getTree ()
 Get Tree Object.
 setCurrentTopNodeId ($a_currenttopnodeid)
 Set Current Top Node ID.
 getCurrentTopNodeId ()
 Get Current Top Node ID.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setIcon ($a_icon)
 Set Icon.
 getIcon ()
 Get Icon.
 setCheckboxName ($a_checkboxname)
 Set Checkbox Name.
 getCheckboxName ()
 Get Checkbox Name.
 setDragIcon ($a_dragicon)
 Set Drag Icon Path.
 getDragIcon ()
 Get Drag Icon Path.
 setMaxDepth ($a_maxdepth)
 Set Maximum Depth.
 getMaxDepth ()
 Get Maximum Depth.
 setExplorerUpdater ($a_exp_frame, $a_exp_id, $a_exp_target_script)
 Set Explorer Updater.
 setTriggeredUpdateCommand ($a_triggered_update_command)
 Set Explorer Updater.
 addHelpItem ($a_text, $a_image="")
 Get all help items.
 getHelpItems ()
 Get all help items.
 makeDragTarget ($a_id, $a_group, $a_first_child_drop_area=false, $a_as_subitem=false, $a_diss_text="")
 Makes a nodes (following droparea) a drag target.
 makeDragContent ($a_id, $a_group)
 Makes a node a drag content.
 addMultiCommand ($a_txt, $a_cmd)
 Add a multi command (for selection of items)
 addCommand ($a_txt, $a_cmd)
 Add a command.
 setHighlightedNodes ($a_val)
 Set highlighted nodes.
 getHighlightedNodes ()
 Get highlighted nodes.
 setFocusId ($a_val)
 Set focus if.
 getFocusId ()
 Get focus id.
 setExpandVariable ($a_val)
 Set expand variable.
 getExpandVariable ()
 Get expand variable.
 setExpanded ($a_val)
 Set expanded Array.
 getExpanded ()
 Get expanded array.
 updateExpanded ()
 Update expand information in session.
 getChilds ($a_node_id=false)
 Get all childs of current node.
 getContent ()
 Get Form Content.
 getLevelHTML ($a_par_node, $a_depth, &$a_childs)
 Get Form HTML.
 renderChild ($a_tpl, $a_child, $a_depth, $next_sibling=null)
 Render a single child (including grandchilds)
 getChildIcon ($a_item)
 Get icon path for an item.
 getChildIconAlt ($a_item)
 Get icon alt text for an item.
 getChildCommands ($a_item)
 Get item commands.
 getMenuItems ($a_node, $a_depth, $a_first_child=false, $a_next_sibling=null, $a_childs=null)
 Get menu items for drop area of node.
 nodeAllowsChilds ($a_node)
 Checks, whether current nodes allows childs at all.
 manageDragAndDrop ($a_node, $a_depth, $a_first_child=false, $a_next_sibling=null, $a_childs=null)
 Makes nodes drag and drop content and targets.
- Public Member Functions inherited from ilFormGUI
 ilFormGUI ()
 Constructor.
 setFormAction ($a_formaction)
 Set FormAction.
 getFormAction ()
 Get FormAction.
 setTarget ($a_target)
 Set Target.
 getTarget ()
 Get Target.
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false.
 getMultipart ()
 Get Enctype Multipart/Formdata true/false.
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open.
 getKeepOpen ()
 Get Keep Form Tag Open.
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag.
 getOpenTag ()
 Get Open Form Tag Enabled.
 setCloseTag ($a_val)
 Set close tag.
 getCloseTag ()
 Get close tag.
 getHTML ()
 Get HTML.

Static Public Member Functions

static getPostMulti ()
 Get multi number of _POST input.
static getPostNodeId ()
 Get node ID of _POST input.
static getPostFirstChild ()
 Should node be inserted as first child of target node (true) or as successor (false)

Additional Inherited Members

- Protected Attributes inherited from ilFormGUI
 $formaction
 $multipart = false
 $keepopen = false
 $opentag = true

Detailed Description

This class represents a hierarchical form.

These forms are used for quick editing, where each node is represented by it's title.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilHierarchyFormGUI.php.

Constructor & Destructor Documentation

ilHierarchyFormGUI::__construct ( )

Constructor.

Parameters

Reimplemented in ilSCORM2004OrganizationHFormGUI.

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

References $lng, $tpl, ilFormGUI\ilFormGUI(), ilYuiUtil\initDragDrop(), and setCheckboxName().

Referenced by ilChapterHierarchyFormGUI\__construct().

{
global $lng, $tpl;
$this->maxdepth = -1;
$this->multi_commands = array();
$this->commands = array();
$this->drag_target[] = array();
$this->drag_content[] = array();
$lng->loadLanguageModule("form");
$this->setCheckboxName("cbox");
$this->help_items = array();
include_once("./Services/YUI/classes/class.ilYuiUtil.php");
$tpl->addJavascript("./Services/Form/js/ServiceFormHierarchyForm.js");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Function Documentation

ilHierarchyFormGUI::addCommand (   $a_txt,
  $a_cmd 
)

Add a command.

Parameters
string$a_txtcommand text
string$a_cmdcommand

Definition at line 326 of file class.ilHierarchyFormGUI.php.

{
$this->commands[] = array("text" => $a_txt, "cmd" => $a_cmd);
}
ilHierarchyFormGUI::addHelpItem (   $a_text,
  $a_image = "" 
)

Get all help items.

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

{
$this->help_items[] = array("text" => $a_text,
"image" => $a_image);
}
ilHierarchyFormGUI::addMultiCommand (   $a_txt,
  $a_cmd 
)

Add a multi command (for selection of items)

Parameters
string$a_txtcommand text
string$a_cmdcommand

Definition at line 315 of file class.ilHierarchyFormGUI.php.

{
$this->multi_commands[] = array("text" => $a_txt, "cmd" => $a_cmd);
}
ilHierarchyFormGUI::getCheckboxName ( )

Get Checkbox Name.

Returns
string Checkbox Name

Definition at line 186 of file class.ilHierarchyFormGUI.php.

Referenced by renderChild().

{
return $this->checkboxname;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getChildCommands (   $a_item)

Get item commands.

Parameters
arrayitem array
Returns
array array of arrays("text", "link")

Reimplemented in ilChapterHierarchyFormGUI, and ilSCORM2004OrganizationHFormGUI.

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

Referenced by renderChild().

{
return false;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getChildIcon (   $a_item)

Get icon path for an item.

Parameters
arrayitem array
Returns
string icon path

Reimplemented in ilChapterHierarchyFormGUI.

Definition at line 1003 of file class.ilHierarchyFormGUI.php.

References ilUtil\getImagePath().

Referenced by renderChild().

{
return ilUtil::getImagePath("icon_".$a_item["type"].".gif");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getChildIconAlt (   $a_item)

Get icon alt text for an item.

Parameters
arrayitem array
Returns
string icon alt text

Reimplemented in ilChapterHierarchyFormGUI.

Definition at line 1014 of file class.ilHierarchyFormGUI.php.

References $lng.

Referenced by renderChild().

{
global $lng;
return $lng->txt($a_item["type"]);
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getChilds (   $a_node_id = false)

Get all childs of current node.

Standard implementation uses tree object.

Definition at line 458 of file class.ilHierarchyFormGUI.php.

References getCurrentTopNodeId(), and getTree().

Referenced by getLevelHTML().

{
if ($a_node_id == false)
{
$a_node_id = $this->getCurrentTopNodeId();
}
$tree_childs = $this->getTree()->getChilds($a_node_id);
$childs = array();
foreach($tree_childs as $tree_child)
{
$childs[] = array("node_id" => $tree_child["child"],
"title" => $tree_child["title"],
"type" => $tree_child["type"]);
}
return $childs;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getContent ( )

Get Form Content.

Reimplemented from ilFormGUI.

Definition at line 480 of file class.ilHierarchyFormGUI.php.

References $cmd, $lng, getCurrentTopNodeId(), getDragIcon(), getExpandVariable(), getHelpItems(), getIcon(), ilUtil\getImagePath(), getLevelHTML(), getTitle(), getTree(), and updateExpanded().

{
global $lng;
if ($this->getExpandVariable() != "")
{
$this->updateExpanded();
}
$ttpl = new ilTemplate("tpl.hierarchy_form.html", true, true, "Services/Form");
$top_node_data = $this->getTree()->getNodeData($this->getCurrentTopNodeId());
$top_node = array("node_id" => $top_node_data["child"],
"title" => $top_node_data["title"],
"type" => $top_node_data["type"]);
$childs = null;
$nodes_html = $this->getLevelHTML($top_node, 0, $childs);
// icon
if ($this->getIcon() != "")
{
$ttpl->setCurrentBlock("icon");
$ttpl->setVariable("SRC_ICON", $this->getIcon());
$ttpl->parseCurrentBlock();
}
// commands
$secs = array("1", "2");
foreach ($secs as $sec)
{
reset($this->commands);
reset($this->multi_commands);
if (count($this->multi_commands) > 0 || count($this->commands) > 0)
{
if (count($childs) > 0)
{
$single = false;
foreach($this->commands as $cmd)
{
$ttpl->setCurrentBlock("cmd".$sec);
$ttpl->setVariable("CMD", $cmd["cmd"]);
$ttpl->setVariable("CMD_TXT", $cmd["text"]);
$ttpl->parseCurrentBlock();
$single = true;
}
$multi = false;
foreach($this->multi_commands as $cmd)
{
$ttpl->setCurrentBlock("multi_cmd".$sec);
$ttpl->setVariable("MULTI_CMD", $cmd["cmd"]);
$ttpl->setVariable("MULTI_CMD_TXT", $cmd["text"]);
$ttpl->parseCurrentBlock();
$multi = true;
}
if ($multi)
{
$ttpl->setCurrentBlock("multi_cmds".$sec);
$ttpl->setVariable("MCMD_ALT", $lng->txt("commands"));
if ($sec == "1")
{
$ttpl->setVariable("MCMD_IMG", ilUtil::getImagePath("arrow_downright.gif"));
}
else
{
$ttpl->setVariable("MCMD_IMG", ilUtil::getImagePath("arrow_upright.gif"));
}
$ttpl->parseCurrentBlock();
}
}
if ($single || $multi)
{
$ttpl->setCurrentBlock("commands".$sec);
$ttpl->parseCurrentBlock();
}
$single = true;
}
}
// explorer updater
if ($this->exp_frame != "")
{
$ttpl->setCurrentBlock("updater");
$ttpl->setVariable("UPDATER_FRAME", $this->exp_frame);
$ttpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
$ttpl->setVariable("HREF_UPDATER", $this->exp_target_script);
$ttpl->parseCurrentBlock();
}
// drag and drop initialisation
foreach($this->drag_target as $drag_target)
{
$ttpl->setCurrentBlock("dragtarget");
$ttpl->setVariable("EL_ID", $drag_target["id"]);
$ttpl->setVariable("GROUP", $drag_target["group"]);
$ttpl->parseCurrentBlock();
}
foreach($this->drag_content as $drag_content)
{
$ttpl->setCurrentBlock("dragcontent");
$ttpl->setVariable("EL_ID", $drag_content["id"]);
$ttpl->setVariable("GROUP", $drag_content["group"]);
$ttpl->parseCurrentBlock();
}
// disambiguation menues and "insert as first child" flags
if (is_array($this->diss_menues))
{
foreach($this->diss_menues as $node_id => $d_menu)
{
foreach($d_menu as $group => $menu)
{
if (count($menu) > 1)
{
foreach($menu as $menu_item)
{
$ttpl->setCurrentBlock("dmenu_cmd");
$ttpl->setVariable("SUBITEM", (int) $menu_item["subitem"]);
$ttpl->setVariable("TXT_MENU_CMD", $menu_item["text"]);
$ttpl->parseCurrentBlock();
}
$ttpl->setCurrentBlock("disambiguation_menu");
$ttpl->setVariable("DNODE_ID", $node_id);
$ttpl->setVariable("GRP", $group);
$ttpl->parseCurrentBlock();
}
else if (count($menu) == 1)
{
// set first child flag
$ttpl->setCurrentBlock("as_subitem_flag");
$ttpl->setVariable("SI_NODE_ID", $node_id);
$ttpl->setVariable("SI_GRP", $group);
$ttpl->setVariable("SI_SI", (int) $menu[0]["subitem"]);
$ttpl->parseCurrentBlock();
}
}
}
}
$this->diss_menues[$a_id][$a_group][] = array("type" => $a_type, "text" => $a_diss_text);
// help
$ttpl->setCurrentBlock("help_img");
$ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("streaked_area.gif"));
$ttpl->parseCurrentBlock();
$ttpl->setCurrentBlock("help_section");
$ttpl->setVariable("TXT_HELP",
$lng->txt("form_hierarchy_add_elements"));
$ttpl->parseCurrentBlock();
if ($this->getDragIcon() != "")
{
$ttpl->setCurrentBlock("help_img");
$ttpl->setVariable("IMG_HELP", $this->getDragIcon());
$ttpl->parseCurrentBlock();
$ttpl->setCurrentBlock("help_img");
$ttpl->setVariable("IMG_HELP",
ilUtil::getImagePath("drop_streaked_area.gif"));
$ttpl->parseCurrentBlock();
$ttpl->setCurrentBlock("help_section");
$ttpl->setVariable("TXT_HELP",
$lng->txt("form_hierarchy_drag_drop_help"));
$ttpl->parseCurrentBlock();
}
// additional help items
foreach ($this->getHelpItems() as $help)
{
if ($help["image"] != "")
{
$ttpl->setCurrentBlock("help_img");
$ttpl->setVariable("IMG_HELP", $help["image"]);
$ttpl->parseCurrentBlock();
}
$ttpl->setCurrentBlock("help_section");
$ttpl->setVariable("TXT_HELP", $help["text"]);
$ttpl->parseCurrentBlock();
}
if ($this->triggered_update_command != "")
{
$ttpl->setCurrentBlock("tr_update");
$ttpl->setVariable("UPDATE_CMD", $this->triggered_update_command);
$ttpl->parseCurrentBlock();
}
// disambiguation menues and "insert as first child" flags
if (is_array($this->diss_menues))
{
foreach($this->diss_menues as $node_id => $d_menu)
{
foreach($d_menu as $group => $menu)
{
if (count($menu) > 1)
{
foreach($menu as $menu_item)
{
$ttpl->setCurrentBlock("dmenu_cmd");
$ttpl->setVariable("SUBITEM", (int) $menu_item["subitem"]);
$ttpl->setVariable("TXT_MENU_CMD", $menu_item["text"]);
$ttpl->parseCurrentBlock();
}
$ttpl->setCurrentBlock("disambiguation_menu");
$ttpl->setVariable("DNODE_ID", $node_id);
$ttpl->setVariable("GRP", $group);
$ttpl->parseCurrentBlock();
}
else if (count($menu) == 1)
{
// set first child flag
$ttpl->setCurrentBlock("as_subitem_flag");
$ttpl->setVariable("SI_NODE_ID", $node_id);
$ttpl->setVariable("SI_GRP", $group);
$ttpl->setVariable("SI_SI", (int) $menu[0]["subitem"]);
$ttpl->parseCurrentBlock();
}
}
}
}
$this->diss_menues[$a_id][$a_group][] = array("type" => $a_type, "text" => $a_diss_text);
// nodes
$ttpl->setVariable("NODES", $nodes_html);
// title
//echo "<br>".htmlentities($this->getTitle())." --- ".htmlentities(ilUtil::prepareFormOutput($this->getTitle()));
$ttpl->setVariable("TITLE", $this->getTitle());
return $ttpl->get();
}

+ Here is the call graph for this function:

ilHierarchyFormGUI::getCurrentTopNodeId ( )

Get Current Top Node ID.

Returns
string Current Top Node ID

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

Referenced by getChilds(), and getContent().

{
return $this->currenttopnodeid;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getDragIcon ( )

Get Drag Icon Path.

Returns
string Drag Icon Path

Definition at line 206 of file class.ilHierarchyFormGUI.php.

Referenced by getContent().

{
return $this->dragicon;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getExpanded ( )

Get expanded array.

Returns
array expanded array

Definition at line 406 of file class.ilHierarchyFormGUI.php.

Referenced by renderChild().

{
return $this->expanded;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getExpandVariable ( )

Get expand variable.

Returns

Definition at line 386 of file class.ilHierarchyFormGUI.php.

Referenced by getContent(), renderChild(), and updateExpanded().

{
return $this->expand_variable;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getFocusId ( )

Get focus id.

Returns
int node id

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

Referenced by renderChild().

{
return $this->focus_id;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getHelpItems ( )

Get all help items.

Definition at line 265 of file class.ilHierarchyFormGUI.php.

Referenced by getContent().

{
return $this->help_items;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getHighlightedNodes ( )

Get highlighted nodes.

Returns
array highlighted nodes

Definition at line 346 of file class.ilHierarchyFormGUI.php.

Referenced by renderChild().

{
return $this->highlighted_nodes;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getIcon ( )

Get Icon.

Returns
string Icon

Definition at line 166 of file class.ilHierarchyFormGUI.php.

Referenced by getContent().

{
return $this->icon;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getId ( )

Get Id.

Returns
string Id

Reimplemented from ilFormGUI.

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

{
return "hform";
}
ilHierarchyFormGUI::getLevelHTML (   $a_par_node,
  $a_depth,
$a_childs 
)

Get Form HTML.

Definition at line 719 of file class.ilHierarchyFormGUI.php.

References getChilds(), ilUtil\getImagePath(), getMaxDepth(), getMenuItems(), manageDragAndDrop(), nodeAllowsChilds(), and renderChild().

Referenced by getContent(), and renderChild().

{
if ($this->getMaxDepth() > -1 && $this->getMaxDepth() < $a_depth)
{
return "";
}
$childs = $this->getChilds($a_par_node["node_id"]);
$a_childs = $childs;
$html = "";
$last_child = null;
$ttpl = new ilTemplate("tpl.hierarchy_form_nodes.html", true, true, "Services/Form");
// prepended drop area
if ($this->nodeAllowsChilds($a_par_node) && (count($childs) > 0 || $a_depth == 0))
{
$ttpl->setCurrentBlock("drop_area");
$ttpl->setVariable("DNODE_ID", $a_par_node["node_id"]."fc"); // fc means "first child"
$ttpl->setVariable("IMG_BLANK", ilUtil::getImagePath("spacer.gif"));
$ttpl->parseCurrentBlock();
$this->manageDragAndDrop($a_par_node, $a_depth, true, null, $childs);
$menu_items = $this->getMenuItems($a_par_node, $a_depth, true, null, $childs);
//var_dump($menu_items);
if (count($menu_items) > 0)
{
// determine maximum of multi add numbers
$max = 1;
foreach($menu_items as $menu_item)
{
if ($menu_item["multi"] > $max)
{
$max = $menu_item["multi"];
}
}
reset($menu_items);
$mcnt = 1;
foreach($menu_items as $menu_item)
{
if ($menu_item["multi"] > 1)
{
for($i = 1; $i <= $menu_item["multi"]; $i++)
{
$ttpl->setCurrentBlock("multi_add");
$ttpl->setVariable("MA_NUM", $i);
$ttpl->setVariable("MENU_CMD", $menu_item["cmd"]);
$ttpl->setVariable("FC", "1");
$ttpl->setVariable("CMD_NODE", $a_par_node["node_id"]);
$ttpl->setVariable("MCNT", $mcnt."fc");
$ttpl->parseCurrentBlock();
}
}
// buffer td for lower multis
if ($max > $menu_item["multi"])
{
$ttpl->setCurrentBlock("multi_buffer");
$ttpl->setVariable("BUF_SPAN", $max - $menu_item["multi"]);
$ttpl->parseCurrentBlock();
}
$ttpl->setCurrentBlock("menu_cmd");
$ttpl->setVariable("TXT_MENU_CMD", $menu_item["text"]);
$ttpl->setVariable("MENU_CMD", $menu_item["cmd"]);
$ttpl->setVariable("CMD_NODE", $a_par_node["node_id"]);
$ttpl->setVariable("FC", "1");
$ttpl->setVariable("MCNT", $mcnt."fc");
$ttpl->parseCurrentBlock();
$mcnt++;
}
$ttpl->setCurrentBlock("drop_area_menu");
$ttpl->setVariable("MNODE_ID", $a_par_node["node_id"]."fc");
$ttpl->parseCurrentBlock();
$ttpl->setCurrentBlock("element");
$ttpl->parseCurrentBlock();
}
}
// insert childs
if (count($childs) > 0)
{
for($i = 0; $i < count($childs); $i++)
{
$next_sibling = ($i < (count($childs) - 1))
? $next_sibling = $childs[$i+1]
: null;
$this->renderChild($ttpl, $childs[$i], $a_depth, $next_sibling);
$last_child = $child;
}
}
$html = $ttpl->get();
unset($ttpl);
return $html;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getMaxDepth ( )

Get Maximum Depth.

Returns
int Maximum Depth

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

Referenced by getLevelHTML(), ilChapterHierarchyFormGUI\getMenuItems(), and ilChapterHierarchyFormGUI\manageDragAndDrop().

{
return $this->maxdepth;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getMenuItems (   $a_node,
  $a_depth,
  $a_first_child = false,
  $a_next_sibling = null,
  $a_childs = null 
)

Get menu items for drop area of node.

This function will be most likely overwritten by sub class

Parameters
array$a_childnode array ("title", "node_id", "type")
boolean$a_first_childif false, the menu of the drop area right after the node (same level) is set if true, the menu of the drop area before the first child (if nodes are allowed) of the node is set

Reimplemented in ilSCORM2004OrganizationHFormGUI, and ilChapterHierarchyFormGUI.

Definition at line 1044 of file class.ilHierarchyFormGUI.php.

Referenced by getLevelHTML(), and renderChild().

{
return array();
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getParentCommand ( )

Get parent command.

Returns
string parent command

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

Referenced by renderChild().

{
return $this->parent_cmd;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getParentObject ( )

Get Parent object.

Returns
object parent gui object

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

Referenced by renderChild().

{
return $this->parent_obj;
}

+ Here is the caller graph for this function:

static ilHierarchyFormGUI::getPostMulti ( )
static
ilHierarchyFormGUI::getTitle ( )

Get Title.

Returns
string Title

Definition at line 146 of file class.ilHierarchyFormGUI.php.

References $title.

Referenced by getContent().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::getTree ( )

Get Tree Object.

Returns
object Tree Object

Definition at line 106 of file class.ilHierarchyFormGUI.php.

Referenced by getChilds(), getContent(), and updateExpanded().

{
return $this->tree;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::makeDragContent (   $a_id,
  $a_group 
)

Makes a node a drag content.

Parameters
string$a_idnode ID
string$a_groupdrag and drop group

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

Referenced by ilChapterHierarchyFormGUI\manageDragAndDrop(), and ilSCORM2004OrganizationHFormGUI\manageDragAndDrop().

{
if ($a_id != "")
{
$this->drag_content[] = array("id" => $a_id, "group" => $a_group);
}
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::makeDragTarget (   $a_id,
  $a_group,
  $a_first_child_drop_area = false,
  $a_as_subitem = false,
  $a_diss_text = "" 
)

Makes a nodes (following droparea) a drag target.

Parameters
string$a_idnode ID
string$a_groupdrag and drop group

Definition at line 276 of file class.ilHierarchyFormGUI.php.

Referenced by ilChapterHierarchyFormGUI\manageDragAndDrop(), and ilSCORM2004OrganizationHFormGUI\manageDragAndDrop().

{
if ($a_first_child_drop_area == true) // first child drop areas only insert as subitems
{
$a_as_subitem = true;
}
if ($a_id != "")
{
if ($a_first_child_drop_area)
{
$a_id.= "fc";
}
$this->drag_target[] = array("id" => $a_id, "group" => $a_group);
$this->diss_menues[$a_id][$a_group][] = array("subitem" => $a_as_subitem, "text" => $a_diss_text);
}
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::manageDragAndDrop (   $a_node,
  $a_depth,
  $a_first_child = false,
  $a_next_sibling = null,
  $a_childs = null 
)

Makes nodes drag and drop content and targets.

Must be overwritten to support drag and drop.

Parameters
object$a_nodenode array

Reimplemented in ilSCORM2004OrganizationHFormGUI, and ilChapterHierarchyFormGUI.

Definition at line 1064 of file class.ilHierarchyFormGUI.php.

Referenced by getLevelHTML(), and renderChild().

{
//$this->makeDragTarget($a_node["id"], $a_group);
//$this->makeDragTarget($a_node["id"], $a_group);
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::nodeAllowsChilds (   $a_node)

Checks, whether current nodes allows childs at all.

Should be overwritten.

Reimplemented in ilSCORM2004OrganizationHFormGUI, and ilChapterHierarchyFormGUI.

Definition at line 1053 of file class.ilHierarchyFormGUI.php.

Referenced by getLevelHTML().

{
return true;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::renderChild (   $a_tpl,
  $a_child,
  $a_depth,
  $next_sibling = null 
)

Render a single child (including grandchilds)

Definition at line 821 of file class.ilHierarchyFormGUI.php.

References $command, $ilCtrl, getCheckboxName(), getChildCommands(), getChildIcon(), getChildIconAlt(), getExpanded(), getExpandVariable(), getFocusId(), getHighlightedNodes(), ilUtil\getImagePath(), getLevelHTML(), getMenuItems(), getParentCommand(), getParentObject(), manageDragAndDrop(), and ilUtil\prepareFormOutput().

Referenced by getLevelHTML().

{
global $ilCtrl;
// image
$a_tpl->setCurrentBlock("img");
$a_tpl->setVariable("IMGPATH", $this->getChildIcon($a_child));
$a_tpl->setVariable("IMGALT", $this->getChildIconAlt($a_child));
$a_tpl->setVariable("IMG_NODE", $a_child["node_id"]);
$a_tpl->setVariable("NODE_ID", $a_child["node_id"]);
$a_tpl->setVariable("TYPE", $a_child["type"]);
$a_tpl->parseCurrentBlock();
// checkbox
$a_tpl->setCurrentBlock("cbox");
$a_tpl->setVariable("CNODE_ID", $a_child["node_id"]);
$a_tpl->setVariable("CBOX_NAME", $this->getCheckboxName());
$a_tpl->parseCurrentBlock();
// commands of child node
$child_commands = $this->getChildCommands($a_child);
if (is_array($child_commands))
{
foreach($child_commands as $command)
{
$a_tpl->setCurrentBlock("node_cmd");
$a_tpl->setVariable("HREF_NODE_CMD", $command["link"]);
$a_tpl->setVariable("TXT_NODE_CMD", $command["text"]);
$a_tpl->parseCurrentBlock();
}
}
// title
$a_tpl->setCurrentBlock("text");
$hl = $this->getHighlightedNodes();
if (is_array($hl) && in_array($a_child["node_id"], $hl))
{
$a_tpl->setVariable("CLASS", ' class="ilHFormHighlighted" ');
}
$a_tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_child["title"]));
$a_tpl->setVariable("TNODE_ID", $a_child["node_id"]);
$a_tpl->parseCurrentBlock();
$grandchilds = null;
$grandchilds_html = $this->getLevelHTML($a_child, $a_depth + 1, $grandchilds);
// focus
if ($this->getFocusId() == $a_child["node_id"])
{
$a_tpl->setCurrentBlock("focus");
$a_tpl->setVariable("FNODE_ID", $a_child["node_id"]);
$a_tpl->parseCurrentBlock();
}
// expander
if ($this->getExpandVariable() != "")
{
$a_tpl->setCurrentBlock("expand_icon");
if (!is_null($grandchilds) && count($grandchilds) > 0)
{
if (!in_array($a_child["node_id"],$this->getExpanded()))
{
$ilCtrl->setParameter($this->getParentObject(), $this->getExpandVariable(), $a_child["node_id"]);
$a_tpl->setVariable("IMG_EXPAND", ilUtil::getImagePath("browser/plus.gif"));
$a_tpl->setVariable("HREF_NAME", "n".$a_child["node_id"]);
$a_tpl->setVariable("HREF_EXPAND",
$ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCommand(), "n".$a_child["node_id"]));
$grandchilds_html = "";
}
else
{
$ilCtrl->setParameter($this->getParentObject(), $this->getExpandVariable(), -$a_child["node_id"]);
$a_tpl->setVariable("IMG_EXPAND", ilUtil::getImagePath("browser/minus.gif"));
$a_tpl->setVariable("HREF_NAME", "n".$a_child["node_id"]);
$a_tpl->setVariable("HREF_EXPAND",
$ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCommand(), "n".$a_child["node_id"]));
}
$ilCtrl->setParameter($this->getParentObject(), $this->getExpandVariable(), "");
}
else
{
$a_tpl->setVariable("IMG_EXPAND", ilUtil::getImagePath("spacer.gif"));
}
$a_tpl->parseCurrentBlock();
}
// childs
$a_tpl->setCurrentBlock("list_item");
$a_tpl->setVariable("CHILDS", $grandchilds_html);
$a_tpl->parseCurrentBlock();
$a_tpl->setCurrentBlock("element");
$a_tpl->parseCurrentBlock();
// drop area after child
$a_tpl->setCurrentBlock("drop_area");
$a_tpl->setVariable("DNODE_ID", $a_child["node_id"]);
$a_tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("spacer.gif"));
$a_tpl->parseCurrentBlock();
// manage drag and drop areas
$this->manageDragAndDrop($a_child, $a_depth, false, $next_sibling, $grandchilds);
// drop area menu
$menu_items = $this->getMenuItems($a_child, $a_depth, false, $next_sibling, $grandchilds);
if (count($menu_items) > 0)
{
// determine maximum of multi add numbers
$max = 1;
foreach($menu_items as $menu_item)
{
if ($menu_item["multi"] > $max)
{
$max = $menu_item["multi"];
}
}
reset($menu_items);
$mcnt = 1;
foreach($menu_items as $menu_item)
{
if ($menu_item["multi"] > 1 )
{
for($i = 1; $i <= $menu_item["multi"]; $i++)
{
$a_tpl->setCurrentBlock("multi_add");
$a_tpl->setVariable("MA_NUM", $i);
$a_tpl->setVariable("MENU_CMD", $menu_item["cmd"]);
if ($menu_item["as_subitem"])
{
$a_tpl->setVariable("FC", "1");
$a_tpl->setVariable("MCNT", $mcnt."fc");
}
else
{
$a_tpl->setVariable("FC", "0");
$a_tpl->setVariable("MCNT", $mcnt);
}
$a_tpl->setVariable("CMD_NODE", $a_child["node_id"]);
$a_tpl->parseCurrentBlock();
}
}
// buffer td for lower multis
if ($max > $menu_item["multi"])
{
$a_tpl->setCurrentBlock("multi_buffer");
$a_tpl->setVariable("BUF_SPAN", $max - $menu_item["multi"]);
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("menu_cmd");
$a_tpl->setVariable("TXT_MENU_CMD", $menu_item["text"]);
$a_tpl->setVariable("MENU_CMD", $menu_item["cmd"]);
if ($menu_item["as_subitem"])
{
$a_tpl->setVariable("FC", "1");
$a_tpl->setVariable("MCNT", $mcnt."fc");
}
else
{
$a_tpl->setVariable("FC", "0");
$a_tpl->setVariable("MCNT", $mcnt);
}
$a_tpl->setVariable("CMD_NODE", $a_child["node_id"]);
$a_tpl->parseCurrentBlock();
$mcnt++;
}
$a_tpl->setCurrentBlock("drop_area_menu");
$a_tpl->setVariable("MNODE_ID", $a_child["node_id"]);
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("element");
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilHierarchyFormGUI::setCheckboxName (   $a_checkboxname)

Set Checkbox Name.

Parameters
string$a_checkboxnameCheckbox Name

Definition at line 176 of file class.ilHierarchyFormGUI.php.

Referenced by __construct(), ilSCORM2004OrganizationHFormGUI\__construct(), and ilChapterHierarchyFormGUI\__construct().

{
$this->checkboxname = $a_checkboxname;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::setCurrentTopNodeId (   $a_currenttopnodeid)

Set Current Top Node ID.

Parameters
string$a_currenttopnodeidCurrent Top Node ID

Definition at line 116 of file class.ilHierarchyFormGUI.php.

{
$this->currenttopnodeid = $a_currenttopnodeid;
}
ilHierarchyFormGUI::setDragIcon (   $a_dragicon)

Set Drag Icon Path.

Parameters
string$a_dragiconDrag Icon Path

Definition at line 196 of file class.ilHierarchyFormGUI.php.

{
$this->dragicon = $a_dragicon;
}
ilHierarchyFormGUI::setExpanded (   $a_val)

Set expanded Array.

Parameters
arrayexpanded array

Definition at line 396 of file class.ilHierarchyFormGUI.php.

Referenced by updateExpanded().

{
$this->expanded = $a_val;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::setExpandVariable (   $a_val)

Set expand variable.

Parameters

Definition at line 376 of file class.ilHierarchyFormGUI.php.

Referenced by ilSCORM2004OrganizationHFormGUI\__construct().

{
$this->expand_variable = $a_val;
}

+ Here is the caller graph for this function:

ilHierarchyFormGUI::setExplorerUpdater (   $a_exp_frame,
  $a_exp_id,
  $a_exp_target_script 
)

Set Explorer Updater.

Parameters
object$a_treeTree Object

Definition at line 236 of file class.ilHierarchyFormGUI.php.

{
$this->exp_frame = $a_exp_frame;
$this->exp_id = $a_exp_id;
$this->exp_target_script = $a_exp_target_script;
}
ilHierarchyFormGUI::setFocusId (   $a_val)

Set focus if.

Parameters
intnode id

Definition at line 356 of file class.ilHierarchyFormGUI.php.

{
$this->focus_id = $a_val;
}
ilHierarchyFormGUI::setHighlightedNodes (   $a_val)

Set highlighted nodes.

Parameters
arrayhighlighted nodes

Definition at line 336 of file class.ilHierarchyFormGUI.php.

{
$this->highlighted_nodes = $a_val;
}
ilHierarchyFormGUI::setIcon (   $a_icon)

Set Icon.

Parameters
string$a_iconIcon

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

{
$this->icon = $a_icon;
}
ilHierarchyFormGUI::setId (   $a_id)

Set Id.

Currently not possible, due to js handling (ID must always be "hform")

Parameters
string$a_idId

Reimplemented from ilFormGUI.

Definition at line 76 of file class.ilHierarchyFormGUI.php.

{
die("ilHierarchyFormGUI does currently not support multiple forms (multiple IDs). ID is always hform.");
}
ilHierarchyFormGUI::setMaxDepth (   $a_maxdepth)

Set Maximum Depth.

Parameters
int$a_maxdepthMaximum Depth

Definition at line 216 of file class.ilHierarchyFormGUI.php.

{
$this->maxdepth = $a_maxdepth;
}
ilHierarchyFormGUI::setParentCommand (   $a_parent_obj,
  $a_parent_cmd 
)

Set parent gui object/cmd.

This is needed, if the expand feature is used.

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

{
$this->parent_obj = $a_parent_obj;
$this->parent_cmd = $a_parent_cmd;
}
ilHierarchyFormGUI::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle

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

{
$this->title = $a_title;
}
ilHierarchyFormGUI::setTree (   $a_tree)

Set Tree Object.

Parameters
object$a_treeTree Object

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

{
$this->tree = $a_tree;
}
ilHierarchyFormGUI::setTriggeredUpdateCommand (   $a_triggered_update_command)

Set Explorer Updater.

Parameters
object$a_treeTree Object

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

{
$this->triggered_update_command = $a_triggered_update_command;
}
ilHierarchyFormGUI::updateExpanded ( )

Update expand information in session.

Parameters
stringnode id

Definition at line 416 of file class.ilHierarchyFormGUI.php.

References $_GET, $_POST, $_SESSION, $key, getExpandVariable(), getTree(), and setExpanded().

Referenced by getContent().

{
$ev = $this->getExpandVariable();
if ($ev == "")
{
return;
}
// init empty session
if (!is_array($_SESSION[$ev]))
{
$_SESSION[$ev] = array($this->getTree()->getRootId());
}
if ($_POST["il_hform_expand"] != "")
{
$node_id = $_POST["il_hform_expand"];
}
if ($_GET[$ev] != "")
{
$node_id = $_GET[$ev];
}
// if positive => expand this node
if ($node_id > 0 && !in_array($node_id,$_SESSION[$ev]))
{
array_push($_SESSION[$ev], $node_id);
}
// if negative => compress this node
if ($node_id < 0)
{
$key = array_keys($_SESSION[$ev],-(int) $node_id);
unset($_SESSION[$ev][$key[0]]);
}
$this->setExpanded($_SESSION[$ev]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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