ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilOrgUnitTreeExplorerGUI Class Reference

Organisation Unit Tree. More...

+ Collaboration diagram for ilOrgUnitTreeExplorerGUI:

Public Member Functions

 __construct (ilOrgUnit $a_root_unit)
 
 getHTML ()
 

Private Member Functions

 renderUnit (ilOrgUnit $a_unit, $a_depth)
 

Private Attributes

 $tpl = null
 

Detailed Description

Organisation Unit Tree.

Author
Bjoern Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitTreeExplorerGUI::__construct ( ilOrgUnit  $a_root_unit)

Definition at line 18 of file class.ilOrgUnitTreeExplorerGUI.php.

19  {
20  $this->root_unit = $a_root_unit;
21 
22  $this->tpl = new ilTemplate('tpl.org_unit_tree_explorer.html', true, true, 'Services/OrgUnit');
23  }
special template class to simplify handling of ITX/PEAR

Member Function Documentation

◆ getHTML()

ilOrgUnitTreeExplorerGUI::getHTML ( )

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

References renderUnit().

147  {
148  $depth = 1;
149 
150  $this->tpl->setCurrentBlock('exp_list_begin');
151  $this->tpl->setVariable('CLASSNAME', 'depth_'.$depth);
152  $this->tpl->parseCurrentBlock();
153 
154  $this->tpl->setCurrentBlock('explorer');
155  $this->tpl->parseCurrentBlock();
156 
157  $this->renderUnit($this->root_unit, $depth);
158 
159  $this->tpl->setCurrentBlock('exp_list_end');
160  $this->tpl->touchBlock('exp_list_end');
161  $this->tpl->parseCurrentBlock();
162 
163  $this->tpl->setCurrentBlock('explorer');
164  $this->tpl->parseCurrentBlock();
165 
166  $html = $this->tpl->get();
167 
168  return $html;
169  }
renderUnit(ilOrgUnit $a_unit, $a_depth)
+ Here is the call graph for this function:

◆ renderUnit()

ilOrgUnitTreeExplorerGUI::renderUnit ( ilOrgUnit  $a_unit,
  $a_depth 
)
private

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

References $lng, ilOrgUnit\getChilds(), ilOrgUnit\getId(), ilUtil\getImagePath(), ilObjectFactory\getInstanceByObjId(), ilOrgUnit\getSubTitle(), ilOrgUnit\getTitle(), ilOrgUnit\hasChilds(), ilOrgUnit\initAssigns(), and ilOrgUnitTree\ROOT_UNIT_ID.

Referenced by getHTML().

26  {
27  global $lng;
28 
29  $a_unit->initAssigns();
30 
31  $this->tpl->setCurrentBlock('exp_item_begin');
32  $this->tpl->setVariable('CLASSNAME', 'depth_'.$a_depth);
33  $this->tpl->parseCurrentBlock();
34 
35  for($i = 1; $i < $a_depth; $i++)
36  {
37  $this->tpl->setCurrentBlock('exp_item_indent');
38  $this->tpl->touchBlock('exp_item_indent');
39  $this->tpl->parseCurrentBlock();
40  }
41 
42  $this->tpl->setCurrentBlock('exp_item_icon');
43  $this->tpl->setVariable('ITEM_ICON_SRC', ilUtil::getImagePath('icon_root_s.png'));
44  $this->tpl->parseCurrentBlock();
45 
46  if($a_unit->getId() == ilOrgUnitTree::ROOT_UNIT_ID)
47  {
48  $this->tpl->setCurrentBlock('exp_item_title');
49  $this->tpl->setVariable('ITEM_TITLE', $lng->txt('org_unit_tree_root'));
50  $this->tpl->parseCurrentBlock();
51  }
52  else
53  {
54  $this->tpl->setCurrentBlock('exp_item_title');
55  $this->tpl->setVariable('ITEM_TITLE', $a_unit->getTitle());
56  $this->tpl->parseCurrentBlock();
57 
58  $this->tpl->setCurrentBlock('exp_item_subtitle');
59  $this->tpl->setVariable('ITEM_SUBTITLE', $a_unit->getSubTitle());
60  $this->tpl->parseCurrentBlock();
61  }
62 
63  $this->tpl->setCurrentBlock('explorer');
64  $this->tpl->parseCurrentBlock();
65 
66  #$assigned_users = $a_unit->getAssignedUsers();
67  $assigned_users = array();
68  if( count($assigned_users) )
69  {
70  $this->tpl->setCurrentBlock('exp_list_begin');
71  $this->tpl->setVariable('CLASSNAME', 'depth_'.($a_depth + 1));
72  $this->tpl->parseCurrentBlock();
73 
74  $this->tpl->setCurrentBlock('explorer');
75  $this->tpl->parseCurrentBlock();
76 
77  foreach($assigned_users as $user_id => $properties)
78  {
79  $user = ilObjectFactory::getInstanceByObjId($user_id);
80 
81  $this->tpl->setCurrentBlock('exp_item_begin');
82  $this->tpl->setVariable('CLASSNAME', 'depth_'.($a_depth + 1));
83  $this->tpl->parseCurrentBlock();
84 
85  for($i = 1; $i < ($a_depth + 1); $i++)
86  {
87  $this->tpl->setCurrentBlock('exp_item_indent');
88  $this->tpl->touchBlock('exp_item_indent');
89  $this->tpl->parseCurrentBlock();
90  }
91 
92  $this->tpl->setCurrentBlock('exp_item_icon');
93  $this->tpl->setVariable('ITEM_ICON_SRC', ilUtil::getImagePath('icon_usr_s.png'));
94  $this->tpl->parseCurrentBlock();
95 
96  $this->tpl->setCurrentBlock('exp_item_title');
97  $this->tpl->setVariable('ITEM_TITLE', $user->getLastName().', '.$user->getFirstName());
98  $this->tpl->parseCurrentBlock();
99 
100  $this->tpl->setCurrentBlock('exp_item_end');
101  $this->tpl->touchBlock('exp_item_end');
102  $this->tpl->parseCurrentBlock();
103 
104  $this->tpl->setCurrentBlock('explorer');
105  $this->tpl->parseCurrentBlock();
106  }
107 
108  $this->tpl->setCurrentBlock('exp_list_end');
109  $this->tpl->touchBlock('exp_list_end');
110  $this->tpl->parseCurrentBlock();
111 
112  $this->tpl->setCurrentBlock('explorer');
113  $this->tpl->parseCurrentBlock();
114  }
115 
116  if( $a_unit->hasChilds() )
117  {
118  $this->tpl->setCurrentBlock('exp_list_begin');
119  $this->tpl->setVariable('CLASSNAME', 'depth_'.($a_depth + 1));
120  $this->tpl->parseCurrentBlock();
121 
122  $this->tpl->setCurrentBlock('explorer');
123  $this->tpl->parseCurrentBlock();
124 
125  foreach($a_unit->getChilds() as $child_unit)
126  {
127  $this->renderUnit( $child_unit, ($a_depth + 1) );
128  }
129 
130  $this->tpl->setCurrentBlock('exp_list_end');
131  $this->tpl->touchBlock('exp_list_end');
132  $this->tpl->parseCurrentBlock();
133 
134  $this->tpl->setCurrentBlock('explorer');
135  $this->tpl->parseCurrentBlock();
136  }
137 
138  $this->tpl->setCurrentBlock('exp_item_end');
139  $this->tpl->touchBlock('exp_item_end');
140  $this->tpl->parseCurrentBlock();
141 
142  $this->tpl->setCurrentBlock('explorer');
143  $this->tpl->parseCurrentBlock();
144  }
renderUnit(ilOrgUnit $a_unit, $a_depth)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $tpl

ilOrgUnitTreeExplorerGUI::$tpl = null
private

Definition at line 16 of file class.ilOrgUnitTreeExplorerGUI.php.


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