/** * @param ilObjOrgUnitGUI $a_parent_gui * @param null $a_main_obj */ function __construct(ilObjOrgUnitGUI $a_parent_gui, $a_main_obj = null) { global $ilToolbar, $lng, $ilCtrl; parent::__construct($a_parent_gui, $a_main_obj); $this->toolbar = $ilToolbar; $this->lng = $lng; $this->ctrl = $ilCtrl; $this->ilObjOrgUnit = $a_parent_gui->object; if ($this->ilObjOrgUnit->getRefId() == ilObjOrgUnit::getRootOrgRefId()) { //Simple XML and Simple XLS Export should only be available in the root orgunit folder as it always exports the whole tree $this->extendExportGUI(); } }
function __showRolesTable($a_result_set, $a_from = "") { if (!$this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) { ilUtil::sendFailure($this->lng->txt("permission_denied"), true); $this->ctrl->redirect($this, ""); } $tbl =& $this->parent_gui->__initTableGUI(); $tpl =& $tbl->getTemplateObject(); // SET FORMAACTION $tpl->setCurrentBlock("tbl_form_header"); $this->ctrl->setParameter($this, 'obj_id', $_GET['obj_id']); $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tpl->parseCurrentBlock(); // SET FOOTER BUTTONS $tpl->setVariable("COLUMN_COUNTS", 4); $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg")); $tpl->setCurrentBlock("tbl_action_button"); $tpl->setVariable("BTN_NAME", "assignSave"); $tpl->setVariable("BTN_VALUE", $this->lng->txt("change_assignment")); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("tbl_action_row"); $tpl->setVariable("TPLPATH", $this->tpl->tplPath); $tpl->parseCurrentBlock(); $tmp_obj =& ilObjectFactory::getInstanceByObjId($_GET['obj_id']); $title = $this->lng->txt('role_assignment') . ' (' . $tmp_obj->getFullname() . ')'; $tbl->setTitle($title, "icon_role.svg", $this->lng->txt("role_assignment")); $tbl->setHeaderNames(array('', $this->lng->txt("title"), $this->lng->txt('description'), $this->lng->txt("type"))); $tbl->setHeaderVars(array("", "title", "description", "type"), array("ref_id" => $this->object->getRefId(), "cmd" => "assignRoles", "obj_id" => $_GET['obj_id'], "cmdClass" => "ilobjcategorygui", "cmdNode" => $_GET["cmdNode"])); $tbl->setColumnWidth(array("4%", "35%", "45%", "16%")); $this->set_unlimited = true; $this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from, true); $tbl->render(); $this->tpl->setVariable("ROLES_TABLE", $tbl->tpl->get()); return true; }
/** * @param ilTabsGUI $tabs_gui */ public function getTabs(ilTabsGUI $tabs_gui = NULL) { 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->getLinkTarget($this, 'editSettings')); } 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'); // Add OrgUnit types tab if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) { $this->tabs_gui->addTab('orgu_types', $this->lng->txt('orgu_types'), $this->ctrl->getLinkTargetByClass('ilOrgUnitTypeGUI')); } } parent::getTabs($this->tabs_gui); }
function __construct(ilObjOrgUnitGUI $ilObjOrgUnitGUI) { global $tpl, $ilCtrl, $ilDB, $lng, $ilAccess; /** * @var $tpl ilTemplate * @var $ilCtrl ilCtrl * @var $ilDB ilDB */ $this->tpl = $tpl; $this->ctrl = $ilCtrl; $this->lng = $lng; $this->ilObjOrgUnitGui = $ilObjOrgUnitGUI; $this->ilObjectOrgUnit = $ilObjOrgUnitGUI->object; $this->ilAccess = $ilAccess; if (!$ilAccess->checkAccess('write', '', $this->ilObjectOrgUnit->getRefId())) { ilUtil::sendFailure($this->lng->txt("permission_denied"), true); $this->ctrl->redirect($this->parent_gui, ""); } }
public function simpleExportExcel($orgu_ref_id) { $nodes = $this->getStructure($orgu_ref_id); include_once "./Services/Excel/classes/class.ilExcelUtils.php"; include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php"; $adapter = new ilExcelWriterAdapter("org_unit_export_" . $orgu_ref_id . ".xls", true); $workbook = $adapter->getWorkbook(); /** @var Spreadsheet_Excel_Writer_Worksheet $worksheet */ $worksheet = $workbook->addWorksheet(); ob_start(); $worksheet->write(0, 0, "ou_id"); $worksheet->write(0, 1, "ou_id_type"); $worksheet->write(0, 2, "ou_parent_id"); $worksheet->write(0, 3, "ou_parent_id_type"); $worksheet->write(0, 4, "reference_id"); $worksheet->write(0, 5, "external_id"); $worksheet->write(0, 6, "title"); $worksheet->write(0, 7, "description"); $worksheet->write(0, 8, "action"); $row = 0; foreach ($nodes as $node) { $orgu = new ilObjOrgUnit($node); if ($orgu->getRefId() == ilObjOrgUnit::getRootOrgRefId()) { continue; } $row++; $attrs = $this->getAttributesForOrgu($orgu); $worksheet->write($row, 0, $attrs["ou_id"]); $worksheet->write($row, 1, $attrs["ou_id_type"]); $worksheet->write($row, 2, $attrs["ou_parent_id"]); $worksheet->write($row, 3, $attrs["ou_parent_id_type"]); $worksheet->write($row, 4, $orgu->getRefId()); $worksheet->write($row, 5, $orgu->getImportId()); $worksheet->write($row, 6, $orgu->getTitle()); $worksheet->write($row, 7, $orgu->getDescription()); $worksheet->write($row, 8, "create"); } ob_end_clean(); $workbook->close(); }
/** * @param $orgu ilObjOrgUnit * @return array */ private function getAttrForOrgu($orgu) { global $tree; $parent_ref = $tree->getParentId($orgu->getRefId()); if ($parent_ref != ilObjOrgUnit::getRootOrgRefId()) { $parent = new ilObjOrgUnit($parent_ref); $ou_parent_id = $parent->getRefId(); } else { $ou_parent_id = "__ILIAS"; } // Only the ref id is guaranteed to be unique. $ou_id = $orgu->getRefId(); $attr = array("ou_id" => $ou_id, "ou_id_type" => "reference_id", "ou_parent_id" => $ou_parent_id, "ou_parent_id_type" => "reference_id", "action" => "create"); return $attr; }