private function getItems($a_user_id) { global $lng; require_once 'Services/OrgUnit/classes/class.ilOrgUnit.php'; $units = ilOrgUnit::getInstancesByAssignedUser($a_user_id); $data = array(); foreach ($units as $unit) { $data[] = array('title' => $unit->getTitle(), 'subtitle' => $unit->getSubTitle(), 'reporting_access' => $unit->hasUserReportingAccess($a_user_id)); } $this->setData($data); }
public function getRecursiveOrgUnitTree($root_node = self::ROOT_UNIT_ID) { $root_node_data = $this->getNodeData($root_node); $nodes = $this->getSubTree($root_node_data); $root_unit = null; $index = array(); foreach ($nodes as &$node) { $index[$node['child']] = $unit = ilOrgUnit::getInstance($node['child']); if ($node['parent']) { $unit->setParent($index[$node['parent']]); $index[$node['parent']]->addChild($unit); } else { $root_unit = $unit; } } $root_unit->sortChilds(); return $root_unit; }
public function getTabs(&$tabs_gui) { if ($this->ilAccess->checkAccess('read', '', $this->object->getRefId())) { $this->tabs_gui->addTab("view_content", $this->lng->txt("content"), $this->ctrl->getLinkTarget($this, "")); $this->tabs_gui->addTab("info_short", "Info", $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")); } //Tabs for OrgUnits exclusive root! if ($this->object->getRefId() != ilObjOrgUnit::getRootOrgRefId()) { if (ilObjOrgUnitAccess::_checkAccessStaff($this->object->getRefId())) { $this->tabs_gui->addTab("orgu_staff", $this->lng->txt("orgu_staff"), $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", "showStaff")); } if ($this->ilAccess->checkAccess('write', '', $this->object->getRefId())) { $this->tabs_gui->addTab("settings", $this->lng->txt("settings"), $this->ctrl->getLinkTargetByClass("ilTranslationGUI", "editTranslations")); } if (ilObjOrgUnitAccess::_checkAccessAdministrateUsers($this->object->getRefId())) { $this->tabs_gui->addTab("administrate_users", $this->lng->txt("administrate_users"), $this->ctrl->getLinkTargetByClass("ilLocalUserGUI", "index")); } } if ($this->ilAccess->checkAccess('write', '', $this->object->getRefId())) { $this->tabs_gui->addTarget('export', $this->ctrl->getLinkTargetByClass('ilorgunitexportgui', ''), 'export', 'ilorgunitexportgui'); } parent::getTabs($tabs_gui); }
private function renderUnit(ilOrgUnit $a_unit, $a_depth) { global $lng; $a_unit->initAssigns(); $this->tpl->setCurrentBlock('exp_item_begin'); $this->tpl->setVariable('CLASSNAME', 'depth_' . $a_depth); $this->tpl->parseCurrentBlock(); for ($i = 1; $i < $a_depth; $i++) { $this->tpl->setCurrentBlock('exp_item_indent'); $this->tpl->touchBlock('exp_item_indent'); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('exp_item_icon'); $this->tpl->setVariable('ITEM_ICON_SRC', ilUtil::getImagePath('icon_root_s.png')); $this->tpl->parseCurrentBlock(); if ($a_unit->getId() == ilOrgUnitTree::ROOT_UNIT_ID) { $this->tpl->setCurrentBlock('exp_item_title'); $this->tpl->setVariable('ITEM_TITLE', $lng->txt('org_unit_tree_root')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock('exp_item_title'); $this->tpl->setVariable('ITEM_TITLE', $a_unit->getTitle()); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('exp_item_subtitle'); $this->tpl->setVariable('ITEM_SUBTITLE', $a_unit->getSubTitle()); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('explorer'); $this->tpl->parseCurrentBlock(); #$assigned_users = $a_unit->getAssignedUsers(); $assigned_users = array(); if (count($assigned_users)) { $this->tpl->setCurrentBlock('exp_list_begin'); $this->tpl->setVariable('CLASSNAME', 'depth_' . ($a_depth + 1)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('explorer'); $this->tpl->parseCurrentBlock(); foreach ($assigned_users as $user_id => $properties) { $user = ilObjectFactory::getInstanceByObjId($user_id); $this->tpl->setCurrentBlock('exp_item_begin'); $this->tpl->setVariable('CLASSNAME', 'depth_' . ($a_depth + 1)); $this->tpl->parseCurrentBlock(); for ($i = 1; $i < $a_depth + 1; $i++) { $this->tpl->setCurrentBlock('exp_item_indent'); $this->tpl->touchBlock('exp_item_indent'); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('exp_item_icon'); $this->tpl->setVariable('ITEM_ICON_SRC', ilUtil::getImagePath('icon_usr_s.png')); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('exp_item_title'); $this->tpl->setVariable('ITEM_TITLE', $user->getLastName() . ', ' . $user->getFirstName()); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('exp_item_end'); $this->tpl->touchBlock('exp_item_end'); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('explorer'); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('exp_list_end'); $this->tpl->touchBlock('exp_list_end'); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('explorer'); $this->tpl->parseCurrentBlock(); } if ($a_unit->hasChilds()) { $this->tpl->setCurrentBlock('exp_list_begin'); $this->tpl->setVariable('CLASSNAME', 'depth_' . ($a_depth + 1)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('explorer'); $this->tpl->parseCurrentBlock(); foreach ($a_unit->getChilds() as $child_unit) { $this->renderUnit($child_unit, $a_depth + 1); } $this->tpl->setCurrentBlock('exp_list_end'); $this->tpl->touchBlock('exp_list_end'); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('explorer'); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('exp_item_end'); $this->tpl->touchBlock('exp_item_end'); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('explorer'); $this->tpl->parseCurrentBlock(); }