function listObjects() { global $tpl, $ilToolbar, $lng, $ilCtrl, $objDefinition; $objects = ilObject::getAllOwnedRepositoryObjects($this->user_id); if (sizeof($objects)) { include_once "Services/Form/classes/class.ilSelectInputGUI.php"; $sel = new ilSelectInputGUI($lng->txt("type"), "type"); $ilToolbar->addInputItem($sel, true); $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "listObjects")); $ilToolbar->addFormButton($lng->txt("ok"), "listObjects"); $options = array(); foreach (array_keys($objects) as $type) { // #11050 if (!$objDefinition->isPlugin($type)) { $options[$type] = $lng->txt("obj_" . $type); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $options[$type] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); } } asort($options); $sel->setOptions($options); $sel_type = (string) $_REQUEST["type"]; if ($sel_type) { $sel->setValue($sel_type); } else { $sel_type = array_keys($options); $sel_type = array_shift($sel_type); } $ilCtrl->setParameter($this, "type", $sel_type); } include_once "Services/Object/classes/class.ilObjectOwnershipManagementTableGUI.php"; $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id, $objects[$sel_type]); $tpl->setContent($tbl->getHTML()); }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $objDefinition; $img = ilObject::_getIcon($obj_id, "small", $a_set["type"]); if (is_file($img)) { $alt = $objDefinition->isPlugin($a_set["type"]) ? $lng->txt("icon") . " " . ilPlugin::lookupTxt("rep_robj", $a_set["type"], "obj_" . $a_set["type"]) : $lng->txt("icon") . " " . $lng->txt("obj_" . $a_set["type"]); $this->tpl->setVariable("IMG_TYPE", ilUtil::img($img, $alt)); } $this->tpl->setVariable("ID", $a_set["ref_id"]); $this->tpl->setVariable("VAL_TITLE", $a_set["title"]); $this->tpl->setVariable("VAL_LAST_CHANGE", $a_set["last_update"]); }
/** * Show delete confirmation table */ function showDeleteConfirmation($a_ids, $a_supress_message = false) { global $lng, $ilSetting, $ilCtrl, $tpl, $objDefinition; if (!is_array($a_ids) || count($a_ids) == 0) { ilUtil::sendFailure($lng->txt("no_checkbox"), true); return false; } // Remove duplicate entries $a_ids = array_unique((array) $a_ids); include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; $cgui = new ilConfirmationGUI(); if (!$a_supress_message) { $msg = $lng->txt("info_delete_sure"); if (!$ilSetting->get('enable_trash')) { $msg .= "<br/>" . $lng->txt("info_delete_warning_no_trash"); } $cgui->setHeaderText($msg); } $cgui->setFormAction($ilCtrl->getFormAction($this->parent_gui)); $cgui->setCancel($lng->txt("cancel"), "cancelDelete"); $cgui->setConfirm($lng->txt("confirm"), "confirmedDelete"); $form_name = "cgui_" . md5(uniqid()); $cgui->setFormName($form_name); $deps = array(); foreach ($a_ids as $ref_id) { $obj_id = ilObject::_lookupObjId($ref_id); $type = ilObject::_lookupType($obj_id); $title = call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id); $alt = $objDefinition->isPlugin($type) ? $lng->txt("icon") . " " . ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type) : $lng->txt("icon") . " " . $lng->txt("obj_" . $type); $title .= $this->handleMultiReferences($obj_id, $ref_id, $form_name); $cgui->addItem("id[]", $ref_id, $title, ilObject::_getIcon($obj_id, "small", $type), $alt); ilObject::collectDeletionDependencies($deps, $ref_id, $obj_id, $type); } $deps_html = ""; if (is_array($deps) && count($deps) > 0) { include_once "./Services/Repository/classes/class.ilRepDependenciesTableGUI.php"; $tab = new ilRepDependenciesTableGUI($deps); $deps_html = "<br/><br/>" . $tab->getHTML(); } $tpl->setContent($cgui->getHTML() . $deps_html); return true; }
public function fillRow($row) { global $lng, $objDefinition; // #11050 if (!$objDefinition->isPlugin($row["type"])) { $txt_type = $lng->txt("obj_" . $row["type"]); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $txt_type = ilPlugin::lookupTxt("rep_robj", $row["type"], "obj_" . $row["type"]); } $this->tpl->setVariable("TITLE", $row["title"]); $this->tpl->setVariable("ALT_ICON", $txt_type); $this->tpl->setVariable("SRC_ICON", ilObject::_getIcon("", "tiny", $row["type"])); $this->tpl->setVariable("PATH", $row["path"]); if ($row["readable"]) { $this->tpl->setCurrentBlock("actions"); $this->tpl->setVariable("ACTIONS", $this->buildActions($row["ref_id"], $row["type"])); $this->tpl->parseCurrentBlock(); } }
/** * Prepare copy wizard object selection * * @access public * @static * * @param array int array of ref ids */ public static function _prepareCloneSelection($a_ref_ids, $new_type, $show_path = true) { global $ilDB, $lng, $objDefinition; $query = "SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree " . "JOIN object_reference obj_ref ON child = obj_ref.ref_id " . "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id " . "JOIN object_reference path_ref ON parent = path_ref.ref_id " . "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id " . "WHERE " . $ilDB->in("child", $a_ref_ids, false, "integer") . " " . "ORDER BY obj_data.title "; $res = $ilDB->query($query); if (!$objDefinition->isPlugin($new_type)) { $options[0] = $lng->txt('obj_' . $new_type . '_select'); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $options[0] = ilPlugin::lookupTxt("rep_robj", $new_type, "obj_" . $new_type . "_select"); } while ($row = $ilDB->fetchObject($res)) { if (strlen($title = $row->obj_title) > 40) { $title = substr($title, 0, 40) . '...'; } if ($show_path) { if (strlen($path = $row->path_title) > 40) { $path = substr($path, 0, 40) . '...'; } $title .= ' (' . $lng->txt('path') . ': ' . $path . ')'; } $options[$row->child] = $title; } return $options ? $options : array(); }
/** * Show template permissions * @return void */ protected function permObject($a_show_admin_permissions = false) { global $ilTabs, $ilErr, $ilToolbar, $objDefinition, $rbacreview; $ilTabs->setTabActive('default_perm_settings'); $this->setSubTabs('default_perm_settings'); if ($a_show_admin_permissions) { $ilTabs->setSubTabActive('rbac_admin_permissions'); } else { $ilTabs->setSubTabActive('rbac_repository_permissions'); } if (!$this->checkAccess('write', 'edit_permission')) { $ilErr->raiseError($this->lng->txt('msg_no_perm_perm'), $ilErr->MESSAGE); return true; } // Show copy role button $ilToolbar->setFormAction($this->ctrl->getFormAction($this)); $ilToolbar->addButton($this->lng->txt("adopt_perm_from_template"), $this->ctrl->getLinkTarget($this, 'adoptPerm')); if ($rbacreview->isDeleteable($this->object->getId(), $this->rolf_ref_id)) { $ilToolbar->addButton($this->lng->txt('rbac_delete_role'), $this->ctrl->getLinkTarget($this, 'confirmDeleteRole')); } $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rbac_template_permissions.html', 'Services/AccessControl'); $this->tpl->setVariable('PERM_ACTION', $this->ctrl->getFormAction($this)); include_once './Services/Accordion/classes/class.ilAccordionGUI.php'; $acc = new ilAccordionGUI(); $acc->setBehaviour(ilAccordionGUI::FORCE_ALL_OPEN); $acc->setId('template_perm_' . $this->getParentRefId()); if ($this->rolf_ref_id == ROLE_FOLDER_ID) { if ($a_show_admin_permissions) { $subs = $objDefinition->getSubObjectsRecursively('adm', true, true); } else { $subs = $objDefinition->getSubObjectsRecursively('root', true, $a_show_admin_permissions); } } else { $subs = $objDefinition->getSubObjectsRecursively($this->getParentType(), true, $a_show_admin_permissions); } $sorted = array(); foreach ($subs as $subtype => $def) { if ($objDefinition->isPlugin($subtype)) { $translation = ilPlugin::lookupTxt("rep_robj", $subtype, "obj_" . $subtype); } elseif ($objDefinition->isSystemObject($subtype)) { $translation = $this->lng->txt("obj_" . $subtype); } else { $translation = $this->lng->txt('objs_' . $subtype); } $sorted[$subtype] = $def; $sorted[$subtype]['translation'] = $translation; } $sorted = ilUtil::sortArray($sorted, 'translation', 'asc', true, true); foreach ($sorted as $subtype => $def) { if ($objDefinition->isPlugin($subtype)) { $translation = ilPlugin::lookupTxt("rep_robj", $subtype, "obj_" . $subtype); } elseif ($objDefinition->isSystemObject($subtype)) { $translation = $this->lng->txt("obj_" . $subtype); } else { $translation = $this->lng->txt('objs_' . $subtype); } include_once 'Services/AccessControl/classes/class.ilObjectRoleTemplatePermissionTableGUI.php'; $tbl = new ilObjectRoleTemplatePermissionTableGUI($this, 'perm', $this->getParentRefId(), $this->object->getId(), $subtype, $a_show_admin_permissions); $tbl->parse(); $acc->addItem($translation, $tbl->getHTML()); } $this->tpl->setVariable('ACCORDION', $acc->getHTML()); // Add options table include_once './Services/AccessControl/classes/class.ilObjectRoleTemplateOptionsTableGUI.php'; $options = new ilObjectRoleTemplateOptionsTableGUI($this, 'perm', $this->rolf_ref_id, $this->object->getId(), $a_show_admin_permissions); $options->addMultiCommand($a_show_admin_permissions ? 'adminPermSave' : 'permSave', $this->lng->txt('save')); $options->parse(); $this->tpl->setVariable('OPTIONS_TABLE', $options->getHTML()); }
/** * Fill template row * @param array $a_set */ protected function fillRow($a_set) { global $objDefinition; include_once './Services/Link/classes/class.ilLink.php'; $this->tpl->setCurrentBlock('item_row'); $this->tpl->setVariable('ITEM_ID', $a_set['id']); $this->tpl->setVariable('COLL_TITLE', $a_set['title']); $this->tpl->setVariable('COLL_DESC', $a_set['description']); if ($this->getMode() == ilLPObjSettings::LP_MODE_SCORM) { $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_sco_s.png')); $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_sco')); } else { if ($objDefinition->isPluginTypeName($a_set["type"])) { $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_" . $a_set['type']); } else { $alt = $this->lng->txt('obj_' . $a_set['type']); } $this->tpl->setVariable('ALT_IMG', $alt); $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type'])); if ($this->getMode() != ilLPObjSettings::LP_MODE_COLLECTION_MANUAL && $this->getMode() != ilLPObjSettings::LP_MODE_COLLECTION_TLT) { $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type'])); $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type'])); include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path->getPath($this->getNode(), $a_set['ref_id'])); $mode = $a_set['mode_id']; if ($mode != ilLPObjSettings::LP_MODE_DEACTIVATED && $mode != ilLPObjSettings::LP_MODE_UNDEFINED) { $this->tpl->setVariable("COLL_MODE", $a_set['mode']); } else { $this->tpl->setVariable("COLL_MODE", ""); $this->tpl->setVariable("COLL_MODE_DEACTIVATED", $a_set['mode']); } if ($a_set["anonymized"]) { $this->tpl->setVariable("ANONYMIZED", $this->lng->txt('trac_anonymized_info_short')); } } else { if ($this->getMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) { // handle tlt settings $this->tpl->setCurrentBlock("tlt"); $this->tpl->setVariable("TXT_MONTH", $this->lng->txt('md_months')); $this->tpl->setVariable("TXT_DAYS", $this->lng->txt('md_days')); $this->tpl->setVariable("TXT_TIME", $this->lng->txt('md_time')); $this->tpl->setVariable("TLT_HINT", '(hh:mm)'); // seconds to units $mon = floor($a_set["tlt"] / (60 * 60 * 24 * 30)); $tlt = $a_set["tlt"] % (60 * 60 * 24 * 30); $day = floor($tlt / (60 * 60 * 24)); $tlt = $tlt % (60 * 60 * 24); $hr = floor($tlt / (60 * 60)); $tlt = $tlt % (60 * 60); $min = floor($tlt / 60); $options = array(); for ($i = 0; $i <= 24; $i++) { $options[$i] = sprintf('%02d', $i); } $this->tpl->setVariable("SEL_MONTHS", ilUtil::formSelect($mon, 'tlt[' . $a_set['id'] . '][mo]', $options, false, true)); for ($i = 0; $i <= 31; $i++) { $options[$i] = sprintf('%02d', $i); } $this->tpl->setVariable("SEL_DAYS", ilUtil::formSelect($day, 'tlt[' . $a_set['id'] . '][d]', $options, false, true)); $this->tpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect('tlt[' . $a_set['id'] . ']', true, $hr, $min, null, false)); $this->tpl->parseCurrentBlock(); } } } // Assigned ? $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status'] ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png')); $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status'] ? $this->lng->txt('trac_assigned') : $this->lng->txt('trac_not_assigned')); $this->tpl->parseCurrentBlock(); // Parse grouped items foreach ((array) $a_set['grouped'] as $item) { $this->fillRow($item); } // show num obligatory info if (count($a_set['grouped'])) { $this->tpl->setCurrentBlock('num_passed_items'); $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed')); $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']); $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']); $this->tpl->parseCurrentBlock(); } }
function __showPermissionsCreateSection() { global $objDefinition, $ilSetting; // no create operation for roles/role templates in local role folders // access is controlled by 'administrate' (change permission settings) only if ($this->gui_obj->object->getType() == 'rolf' and $this->gui_obj->object->getRefId() != ROLE_FOLDER_ID) { return; } // create pointer to first role (only the permission list is needed) reset($this->roles); $first_role =& current($this->roles); if (count($first_role['permissions']['create'])) { $this->tpl->setCurrentBlock("perm_subtitle"); $this->tpl->setVariable("TXT_PERM_CLASS", $this->lng->txt('perm_class_create')); $this->tpl->setVariable("TXT_PERM_CLASS_DESC", $this->lng->txt('perm_class_create_desc')); $this->tpl->setVariable("COLSPAN", $this->num_roles); $this->tpl->parseCurrentBlock(); // add a checkbox 'select all' for create permissions of the following object types $container_arr = array('cat', 'grp', 'crs', 'fold'); if (in_array($this->gui_obj->object->getType(), $container_arr)) { $chk_toggle_create = true; } foreach ($this->roles as $role) { $ops_ids = array(); foreach ($role['permissions']['create'] as $perm) { $ops_ids[] = $perm['ops_id']; } if ($chk_toggle_create) { $this->tpl->setCurrentBlock('chk_toggle_create'); $this->tpl->setVariable('PERM_NAME', $this->lng->txt('check_all') . "/" . $this->lng->txt('uncheck_all')); $this->tpl->setVariable('PERM_TOOLTIP', $this->lng->txt('check_all')); $this->tpl->setVariable('ROLE_ID', $role['obj_id']); $this->tpl->setVariable('JS_VARNAME', 'perm_' . $role['obj_id']); $this->tpl->setVariable('JS_ONCLICK', ilUtil::array_php2js($ops_ids)); $this->tpl->parseCurrentBlock(); } foreach ($role['permissions']['create'] as $perm) { if ($perm["name"] == "create_icrs" and !$ilSetting->get("ilinc_active")) { continue; } $box = ilUtil::formCheckBox($perm['checked'], "perm[" . $role["obj_id"] . "][]", $perm["ops_id"], $role["protected"]); $this->tpl->setCurrentBlock("perm_item"); $this->tpl->setVariable("PERM_CHECKBOX", $box); if ($objDefinition->isPlugin(substr($perm['name'], 7))) { $this->tpl->setVariable("PERM_NAME", ilPlugin::lookupTxt("rep_robj", substr($perm['name'], 7), "obj_" . substr($perm['name'], 7))); $this->tpl->setVariable("PERM_TOOLTIP", ilPlugin::lookupTxt("rep_robj", substr($perm['name'], 7), $this->gui_obj->object->getType() . "_" . $perm['name'])); } else { $this->tpl->setVariable("PERM_NAME", $this->lng->txt("obj" . substr($perm['name'], 6))); $this->tpl->setVariable("PERM_TOOLTIP", $this->lng->txt($this->gui_obj->object->getType() . "_" . $perm['name'])); } $this->tpl->setVariable("PERM_LABEL", 'perm_' . $role['obj_id'] . '_' . $perm['ops_id']); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("perm_table"); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("perm_settings"); $this->tpl->parseCurrentBlock(); } }
/** * Fill one permission row * @param object $row * @return */ public function fillRow($row) { global $objDefinition; // local policy if (isset($row['show_local_policy_row'])) { foreach ($row['roles'] as $role_id => $role_info) { $this->tpl->setCurrentBlock('role_option'); $this->tpl->setVariable('INHERIT_ROLE_ID', $role_id); $this->tpl->setVariable('INHERIT_CHECKED', $role_info['local_policy'] ? 'checked=checked' : ''); $this->tpl->setVariable('INHERIT_DISABLED', ($role_info['protected'] or $role_info['isLocal']) ? 'disabled="disabled"' : ''); $this->tpl->setVariable('TXT_INHERIT', $this->lng->txt('rbac_local_policy')); $this->tpl->setVariable('INHERIT_LONG', $this->lng->txt('perm_use_local_policy_desc')); $this->tpl->parseCurrentBlock(); } return true; } // protected if (isset($row['show_protected_row'])) { foreach ($row['roles'] as $role_id => $role_info) { $this->tpl->setCurrentBlock('role_protect'); $this->tpl->setVariable('PROTECT_ROLE_ID', $role_id); $this->tpl->setVariable('PROTECT_CHECKED', $role_info['protected_status'] ? 'checked=checked' : ''); $this->tpl->setVariable('PROTECT_DISABLED', $role_info['protected_allowed'] ? '' : 'disabled="disabled"'); $this->tpl->setVariable('TXT_PROTECT', $this->lng->txt('role_protect_permissions')); $this->tpl->setVariable('PROTECT_LONG', $this->lng->txt('role_protect_permissions_desc')); $this->tpl->parseCurrentBlock(); } return true; } // block role if (isset($row['show_block_row'])) { foreach ($this->getVisibleRoles() as $counter => $role_info) { $this->tpl->setCurrentBlock('role_block'); $this->tpl->setVariable('BLOCK_ROLE_ID', $role_info['obj_id']); $this->tpl->setVariable('TXT_BLOCK', $this->lng->txt('role_block_role')); $this->tpl->setVariable('BLOCK_LONG', $this->lng->txt('role_block_role_desc')); if ($role_info['protected'] == 'y') { $this->tpl->setVariable('BLOCK_DISABLED', 'disabled="disabled'); } $this->tpl->parseCurrentBlock(); } return true; } // Select all if (isset($row['show_select_all'])) { foreach ($this->getVisibleRoles() as $role) { $this->tpl->setCurrentBlock('role_select_all'); $this->tpl->setVariable('JS_ROLE_ID', $role['obj_id']); $this->tpl->setVariable('JS_SUBID', $row['subtype']); $this->tpl->setVariable('JS_ALL_PERMS', "['" . implode("','", $row['ops']) . "']"); $this->tpl->setVariable('JS_FORM_NAME', $this->getFormName()); $this->tpl->setVariable('TXT_SEL_ALL', $this->lng->txt('select_all')); $this->tpl->parseCurrentBlock(); } return true; } // Object permissions if (isset($row['show_start_info'])) { $this->tpl->setCurrentBlock('section_info'); $this->tpl->setVariable('SECTION_TITLE', $this->lng->txt('perm_class_object')); $this->tpl->setVariable('SECTION_DESC', $this->lng->txt('perm_class_object_desc')); $this->tpl->parseCurrentBlock(); return true; } if (isset($row['show_create_info'])) { $this->tpl->setCurrentBlock('section_info'); $this->tpl->setVariable('SECTION_TITLE', $this->lng->txt('perm_class_create')); $this->tpl->setVariable('SECTION_DESC', $this->lng->txt('perm_class_create_desc')); $this->tpl->parseCurrentBlock(); return true; } foreach ((array) $row['roles'] as $role_id => $role_info) { $this->tpl->setCurrentBlock('role_td'); $this->tpl->setVariable('PERM_ROLE_ID', $role_id); $this->tpl->setVariable('PERM_PERM_ID', $row['perm']['ops_id']); if (substr($row['perm']['operation'], 0, 6) == 'create') { if ($objDefinition->isPlugin(substr($row['perm']['operation'], 7))) { $perm = ilPlugin::lookupTxt("rep_robj", substr($row['perm']['operation'], 7), "obj_" . substr($row['perm']['operation'], 7)); } else { $perm = $this->lng->txt('obj_' . substr($row['perm']['operation'], 7)); } } else { if ($this->lng->exists($this->getObjType() . '_' . $row['perm']['operation'] . '_short')) { $perm = $this->lng->txt($this->getObjType() . '_' . $row['perm']['operation'] . '_short'); } else { $perm = $this->lng->txt($row['perm']['operation']); } } $this->tpl->setVariable('TXT_PERM', $perm); if ($objDefinition->isPlugin($this->getObjType())) { $this->tpl->setVariable('PERM_LONG', ilPlugin::lookupTxt("rep_robj", $this->getObjType(), $this->getObjType() . "_" . $row['perm']['operation'])); } elseif (substr($row['perm']['operation'], 0, 6) == 'create') { $this->tpl->setVariable('PERM_LONG', $this->lng->txt('rbac_' . $row['perm']['operation'])); } else { $this->tpl->setVariable('PERM_LONG', $this->lng->txt($this->getObjType() . '_' . $row['perm']['operation'])); } if ($role_info['protected']) { $this->tpl->setVariable('PERM_DISABLED', $role_info['protected'] ? 'disabled="disabled"' : ''); } if ($role_info['permission_set']) { $this->tpl->setVariable('PERM_CHECKED', 'checked="checked"'); } $this->tpl->parseCurrentBlock(); } }
/** * add message row */ function addMessageRow(&$a_tpl, $a_message, $a_type) { global $lng, $objDefinition; $this->cur_row_type = $this->cur_row_type == "row_type_1" ? "row_type_2" : "row_type_1"; $a_tpl->touchBlock($this->cur_row_type); if (!$objDefinition->isPlugin($type)) { $type = $lng->txt("obj_" . $a_type); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_" . $a_type); } $a_message = str_replace("[type]", $type, $a_message); $a_tpl->setVariable("ROW_NBSP", " "); $a_tpl->setCurrentBlock("container_standard_row"); $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_message); $a_tpl->parseCurrentBlock(); $a_tpl->touchBlock("container_row"); }
/** * Fill template row * @param array $a_set */ protected function fillRow($a_set) { global $objDefinition; include_once './Services/Link/classes/class.ilLink.php'; $this->tpl->setCurrentBlock('item_row'); $this->tpl->setVariable('ITEM_ID', $a_set['id']); $this->tpl->setVariable('COLL_TITLE', $a_set['title']); $this->tpl->setVariable('COLL_DESC', $a_set['description']); if ($this->getMode() == LP_MODE_SCORM) { $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_sco_s.png')); $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_sco')); } else { if ($objDefinition->isPluginTypeName($a_set["type"])) { $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_" . $a_set['type']); } else { $alt = $this->lng->txt('obj_' . $a_set['type']); } $this->tpl->setVariable('ALT_IMG', $alt); $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type'])); $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type'])); $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type'])); include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path->getPath($this->getNode(), $a_set['ref_id'])); $mode = $a_set['mode_id']; if ($mode != LP_MODE_DEACTIVATED && $mode != LP_MODE_UNDEFINED) { $this->tpl->setVariable("COLL_MODE", $a_set['mode']); } else { $this->tpl->setVariable("COLL_MODE", ""); $this->tpl->setVariable("COLL_MODE_DEACTIVATED", $a_set['mode']); } if ($this->isAnonymized($a_set)) { $this->tpl->setVariable("ANONYMIZED", $this->lng->txt('trac_anonymized_info_short')); } } // Assigned ? $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status'] ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png')); $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status'] ? $this->lng->txt('trac_assigned') : $this->lng->txt('trac_not_assigned')); $this->tpl->parseCurrentBlock(); // Parse grouped items foreach ((array) $a_set['grouped'] as $item) { $this->fillRow($item); } // show num obligatory info if (count($a_set['grouped'])) { $this->tpl->setCurrentBlock('num_passed_items'); $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed')); $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']); $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']); $this->tpl->parseCurrentBlock(); } }
function __getPermissionDefinitions() { global $ilDB, $lng, $objDefinition, $rbacreview; $operation_info = $rbacreview->getOperationAssignment(); foreach ($operation_info as $info) { if ($objDefinition->getDevMode($info['type'])) { continue; } $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'], "type" => $info['type']); // handle plugin permission texts $txt = $objDefinition->isPlugin($info['type']) ? ilPlugin::lookupTxt("rep_robj", $info['type'], $info['type'] . "_" . $info['operation']) : $lng->txt($info['type'] . "_" . $info['operation']); if (substr($info['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($info['operation'], 7))) { $txt = ilPlugin::lookupTxt("rep_robj", substr($info['operation'], 7), $info['type'] . "_" . $info['operation']); } $rbac_operations[$info['typ_id']][$info['ops_id']] = array("ops_id" => $info['ops_id'], "title" => $info['operation'], "name" => $txt); } return array($rbac_objects, $rbac_operations); }
/** * displays system check menu * * @access public */ function checkObject() { global $rbacsystem, $ilias, $objDefinition, $ilSetting; $this->setSystemCheckSubTabs("system_check_sub"); if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } //echo "1"; if ($_POST['count_limit'] !== null || $_POST['age_limit'] !== null || $_POST['type_limit'] !== null) { $ilias->account->writePref('systemcheck_count_limit', is_numeric($_POST['count_limit']) && $_POST['count_limit'] > 0 ? $_POST['count_limit'] : ''); $ilias->account->writePref('systemcheck_age_limit', is_numeric($_POST['age_limit']) && $_POST['age_limit'] > 0 ? $_POST['age_limit'] : ''); $ilias->account->writePref('systemcheck_type_limit', trim($_POST['type_limit'])); } if ($_POST["mode"]) { //echo "3"; $this->writeCheckParams(); $this->startValidator($_POST["mode"], $_POST["log_scan"]); } else { //echo "4"; include_once "./Services/Repository/classes/class.ilValidator.php"; $validator = new ilValidator(); $hasScanLog = $validator->hasScanLog(); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_check.html", "Modules/SystemFolder"); if ($hasScanLog) { $this->tpl->setVariable("TXT_VIEW_LOG", $this->lng->txt("view_last_log")); } $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("systemcheck")); $this->tpl->setVariable("COLSPAN", 3); $this->tpl->setVariable("TXT_ANALYZE_TITLE", $this->lng->txt("analyze_data")); $this->tpl->setVariable("TXT_ANALYSIS_OPTIONS", $this->lng->txt("analysis_options")); $this->tpl->setVariable("TXT_REPAIR_OPTIONS", $this->lng->txt("repair_options")); $this->tpl->setVariable("TXT_OUTPUT_OPTIONS", $this->lng->txt("output_options")); $this->tpl->setVariable("TXT_SCAN", $this->lng->txt("scan")); $this->tpl->setVariable("TXT_SCAN_DESC", $this->lng->txt("scan_desc")); $this->tpl->setVariable("TXT_DUMP_TREE", $this->lng->txt("dump_tree")); $this->tpl->setVariable("TXT_DUMP_TREE_DESC", $this->lng->txt("dump_tree_desc")); $this->tpl->setVariable("TXT_CLEAN", $this->lng->txt("clean")); $this->tpl->setVariable("TXT_CLEAN_DESC", $this->lng->txt("clean_desc")); $this->tpl->setVariable("TXT_RESTORE", $this->lng->txt("restore_missing")); $this->tpl->setVariable("TXT_RESTORE_DESC", $this->lng->txt("restore_missing_desc")); $this->tpl->setVariable("TXT_PURGE", $this->lng->txt("purge_missing")); $this->tpl->setVariable("TXT_PURGE_DESC", $this->lng->txt("purge_missing_desc")); $this->tpl->setVariable("TXT_RESTORE_TRASH", $this->lng->txt("restore_trash")); $this->tpl->setVariable("TXT_RESTORE_TRASH_DESC", $this->lng->txt("restore_trash_desc")); $this->tpl->setVariable("TXT_PURGE_TRASH", $this->lng->txt("purge_trash")); $this->tpl->setVariable("TXT_PURGE_TRASH_DESC", $this->lng->txt("purge_trash_desc")); $this->tpl->setVariable("TXT_COUNT_LIMIT", $this->lng->txt("purge_count_limit")); $this->tpl->setVariable("TXT_COUNT_LIMIT_DESC", $this->lng->txt("purge_count_limit_desc")); $this->tpl->setVariable("COUNT_LIMIT_VALUE", $ilias->account->getPref("systemcheck_count_limit")); $this->tpl->setVariable("TXT_AGE_LIMIT", $this->lng->txt("purge_age_limit")); $this->tpl->setVariable("TXT_AGE_LIMIT_DESC", $this->lng->txt("purge_age_limit_desc")); $this->tpl->setVariable("AGE_LIMIT_VALUE", $ilias->account->getPref("systemcheck_age_limit")); $this->tpl->setVariable("TXT_TYPE_LIMIT", $this->lng->txt("purge_type_limit")); $this->tpl->setVariable("TXT_TYPE_LIMIT_DESC", $this->lng->txt("purge_type_limit_desc")); if ($ilias->account->getPref('systemcheck_mode_scan')) { $this->tpl->touchBlock('mode_scan_checked'); } if ($ilias->account->getPref('systemcheck_mode_dump_tree')) { $this->tpl->touchBlock('mode_dump_tree_checked'); } if ($ilias->account->getPref('systemcheck_mode_clean')) { $this->tpl->touchBlock('mode_clean_checked'); } if ($ilias->account->getPref('systemcheck_mode_restore')) { $this->tpl->touchBlock('mode_restore_checked'); $this->tpl->touchBlock('mode_purge_disabled'); } elseif ($ilias->account->getPref('systemcheck_mode_purge')) { $this->tpl->touchBlock('mode_purge_checked'); $this->tpl->touchBlock('mode_restore_disabled'); } if ($ilias->account->getPref('systemcheck_mode_restore_trash')) { $this->tpl->touchBlock('mode_restore_trash_checked'); $this->tpl->touchBlock('mode_purge_trash_disabled'); } elseif ($ilias->account->getPref('systemcheck_mode_purge_trash')) { $this->tpl->touchBlock('mode_purge_trash_checked'); $this->tpl->touchBlock('mode_restore_trash_disabled'); } if ($ilias->account->getPref('systemcheck_log_scan')) { $this->tpl->touchBlock('log_scan_checked'); } // #9520 - restrict to types which can be found in tree $obj_types_in_tree = array(); global $ilDB; $set = $ilDB->query('SELECT type FROM object_data od' . ' JOIN object_reference ref ON (od.obj_id = ref.obj_id)' . ' JOIN tree ON (tree.child = ref.ref_id)' . ' WHERE tree.tree < 1' . ' GROUP BY type'); while ($row = $ilDB->fetchAssoc($set)) { $obj_types_in_tree[] = $row['type']; } $types = $objDefinition->getAllObjects(); $ts = array("" => ""); foreach ($types as $t) { if ($t != "" && !$objDefinition->isSystemObject($t) && $t != "root" && in_array($t, $obj_types_in_tree)) { if ($objDefinition->isPlugin($t)) { $ts[$t] = ilPlugin::lookupTxt("rep_robj", $t, "obj_" . $t); } else { $ts[$t] = $this->lng->txt("obj_" . $t); } } } asort($ts); $this->tpl->setVariable("TYPE_LIMIT_CHOICE", ilUtil::formSelect($ilias->account->getPref("systemcheck_type_limit"), 'type_limit', $ts, false, true)); $this->tpl->setVariable("TXT_LOG_SCAN", $this->lng->txt("log_scan")); $this->tpl->setVariable("TXT_LOG_SCAN_DESC", $this->lng->txt("log_scan_desc")); $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("start_scan")); $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save_params_for_cron")); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $cron_form = new ilPropertyFormGUI(); $cron_form->setFormAction($this->ctrl->getFormAction($this)); $cron_form->setTitle($this->lng->txt('systemcheck_cronform')); $radio_group = new ilRadioGroupInputGUI($this->lng->txt('systemcheck_cron'), 'cronjob'); $radio_group->setValue($ilSetting->get('systemcheck_cron')); $radio_opt = new ilRadioOption($this->lng->txt('disabled'), 0); $radio_group->addOption($radio_opt); $radio_opt = new ilRadioOption($this->lng->txt('enabled'), 1); $radio_group->addOption($radio_opt); $cron_form->addItem($radio_group); $cron_form->addCommandButton('saveCheckCron', $this->lng->txt('save')); $this->tpl->setVariable('CRON_FORM', $cron_form->getHTML()); } }
/** * Confirmation for trash * * @param array $a_ids ref_ids */ public function confirmRemoveFromSystemObject($a_ids) { global $ilCtrl, $lng, $objDefinition, $tpl; include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; if (!is_array($a_ids)) { $a_ids = array($a_ids); } $cgui = new ilConfirmationGUI(); $cgui->setFormAction($ilCtrl->getFormAction($this->parent_gui)); $cgui->setCancel($lng->txt("cancel"), "trash"); $cgui->setConfirm($lng->txt("confirm"), "removeFromSystem"); $cgui->setFormName("trash_confirmation"); $cgui->setHeaderText($lng->txt("info_delete_sure")); foreach ($a_ids as $id) { $obj_id = ilObject::_lookupObjId($id); $type = ilObject::_lookupType($obj_id); $title = call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id); $alt = $objDefinition->isPlugin($type) ? $lng->txt("icon") . " " . ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type) : $lng->txt("icon") . " " . $lng->txt("obj_" . $type); $cgui->addItem("trash_id[]", $id, $title, ilObject::_getIcon($obj_id, "small", $type), $alt); } $tpl->setContent($cgui->getHTML()); }
function getItems() { include_once "Services/Tracking/classes/class.ilTrQuery.php"; $res = ilTrQuery::getObjectTypeStatisticsPerMonth($this->filter["aggregation"], $this->filter["year"]); // get plugin titles include_once "./Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php"; $plugins = array(); $plugins = ilRepositoryObjectPluginSlot::addCreatableSubObjects($plugins); $data = array(); foreach ($res as $type => $months) { $data[$type]["type"] = $type; // to enable sorting by title if (array_key_exists($type, $plugins)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } foreach ($months as $month => $row) { $value = $row[$this->filter["measure"]]; $data[$type]["month_" . $month] = $value; } } // add live data if ($this->filter["year"] == date("Y")) { $live = ilTrQuery::getObjectTypeStatistics(); foreach ($live as $type => $item) { $data[$type]["type"] = $type; // to enable sorting by title if (array_key_exists($type, $plugins)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } $value = $item[$this->filter["measure"]]; $data[$type]["month_live"] = $value; } } $this->setData($data); }
/** * Get pages for list. */ function getComponents() { global $objDefinition, $ilSetting, $lng, $ilPluginAdmin; // unassigned objects should be last $this->pos_group_options = array(0 => $lng->txt("rep_new_item_group_unassigned")); $pos_group_map[0] = "9999"; include_once "Services/Repository/classes/class.ilObjRepositorySettings.php"; foreach (ilObjRepositorySettings::getNewItemGroups() as $item) { $this->pos_group_options[$item["id"]] = $item["title"]; $pos_group_map[$item["id"]] = $item["pos"]; } $obj_types = array(); // parse modules include_once "./Services/Component/classes/class.ilModule.php"; foreach (ilModule::getAvailableCoreModules() as $mod) { $has_repo = false; $rep_types = $objDefinition->getRepositoryObjectTypesForComponent(IL_COMP_MODULE, $mod["subdir"]); if (sizeof($rep_types) > 0) { foreach ($rep_types as $ridx => $rt) { // we only want to display repository modules if ($rt["repository"]) { $has_repo = true; } else { unset($rep_types[$ridx]); } } } if ($has_repo) { foreach ($rep_types as $rt) { $obj_types[$rt["id"]] = array("object" => $rt["class_name"], "caption" => $lng->txt("obj_" . $rt["id"]), "subdir" => $mod["subdir"], "grp" => $rt["grp"], "default_pos" => $rt["default_pos"]); } } } // parse plugins include_once "./Services/Component/classes/class.ilPlugin.php"; $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj"); foreach ($pl_names as $pl_name) { $pl_id = ilPlugin::lookupIdForName(IL_COMP_SERVICE, "Repository", "robj", $pl_name); if ($pl_id) { $obj_types[$pl_id] = array("object" => $pl_name, "caption" => ilPlugin::lookupTxt("rep_robj", $pl_id, "obj_" . $pl_id), "subdir" => $lng->txt("cmps_plugin"), "grp" => "", "default_pos" => 2000); } } // parse positions $data = array(); foreach ($obj_types as $obj_type => $item) { $org_pos = $ilSetting->get("obj_add_new_pos_" . $obj_type); if (!(int) $org_pos) { // no setting yet, use default $org_pos = $item["default_pos"]; } if (strlen($org_pos) < 8) { // "old" setting without group part, add "unassigned" group $org_pos = $pos_group_map[0] . str_pad($org_pos, 4, "0", STR_PAD_LEFT); } $pos_grp_id = $ilSetting->get("obj_add_new_pos_grp_" . $obj_type, 0); $group = null; if ($item["grp"] != "") { $group = $objDefinition->getGroup($item["grp"]); $group = $group["name"]; } $data[] = array("id" => $obj_type, "object" => $item["object"], "caption" => $item["caption"], "subdir" => $item["subdir"], "pos" => (int) substr($org_pos, 4), "pos_group" => $pos_grp_id, "creation" => !(bool) $ilSetting->get("obj_dis_creation_" . $obj_type, false), "group_id" => $item["grp"], "group" => $group, "sort_key" => (int) $org_pos); } $data = ilUtil::sortArray($data, "sort_key", "asc", true); $this->setData($data); }
function getPermissionInfo() { global $ilAccess, $lng, $rbacreview, $ilUser, $ilObjDataCache, $objDefinition; // icon handlers $icon_ok = "<img src=\"" . ilUtil::getImagePath("icon_ok.png") . "\" alt=\"" . $lng->txt("info_assigned") . "\" title=\"" . $lng->txt("info_assigned") . "\" border=\"0\" vspace=\"0\"/>"; $icon_not_ok = "<img src=\"" . ilUtil::getImagePath("icon_not_ok.png") . "\" alt=\"" . $lng->txt("info_not_assigned") . "\" title=\"" . $lng->txt("info_not_assigned") . "\" border=\"0\" vspace=\"0\"/>"; // get all possible operation of current object $ops_list = ilRbacReview::_getOperationList($this->object->getType()); $counter = 0; // check permissions of user foreach ($ops_list as $ops) { $access = $ilAccess->doRBACCheck($ops['operation'], "info", $this->object->getRefId(), $this->user->getId(), $this->object->getType()); $result_set[$counter][] = $access ? $icon_ok : $icon_not_ok; if (substr($ops['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($ops['operation'], 7))) { $result_set[$counter][] = ilPlugin::lookupTxt("rep_robj", substr($ops['operation'], 7), 'rbac_' . $ops['operation']); } else { if ($objDefinition->isPlugin($this->object->getType())) { $result_set[$counter][] = ilPlugin::lookupTxt("rep_robj", $this->object->getType(), $this->object->getType() . "_" . $ops['operation']); } elseif (substr($ops['operation'], 0, 7) == 'create_') { $result_set[$counter][] = $lng->txt('rbac_' . $ops['operation']); } else { $result_set[$counter][] = $lng->txt($this->object->getType() . "_" . $ops['operation']); } } $list_role = ""; // Check ownership if ($this->user->getId() == $ilObjDataCache->lookupOwner($this->object->getId())) { if (substr($ops['operation'], 0, 7) != 'create_' and $ops['operation'] != 'edit_permission' and $ops['operation'] != 'edit_leanring_progress') { $list_role[] = $lng->txt('info_owner_of_object'); } } // get operations on object for each assigned role to user foreach ($this->assigned_valid_roles as $role) { if (in_array($ops['ops_id'], $role['ops'])) { $list_role[] = $role['translation']; } } if (empty($list_role)) { $roles_formatted = $lng->txt('none'); } else { $roles_formatted = implode("<br/>", $list_role); } $result_set[$counter][] = $roles_formatted; ++$counter; } return $this->__showPermissionsTable($result_set); }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $objDefinition, $ilCtrl; // $this->tpl->setVariable("", ); // surpress checkbox for particular object types AND the system role if (!$objDefinition->hasCheckbox($a_set["type"]) || $a_set["obj_id"] == SYSTEM_ROLE_ID || $a_set["obj_id"] == SYSTEM_USER_ID || $a_set["obj_id"] == ANONYMOUS_ROLE_ID) { $this->tpl->touchBlock("no_checkbox"); } else { $this->tpl->setCurrentBlock("checkbox"); $this->tpl->setVariable("ID", $a_set["ref_id"]); $this->tpl->parseCurrentBlock(); } //build link $class_name = $objDefinition->getClassName($a_set["type"]); $class = strtolower("ilObj" . $class_name . "GUI"); $ilCtrl->setParameterByClass($class, "ref_id", $a_set["ref_id"]); $this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass($class, "view")); $ilCtrl->setParameterByClass($class, "ref_id", $_GET["ref_id"]); // TODO: broken! fix me $title = $a_set["title"]; if (is_array($_SESSION["clipboard"]["ref_ids"])) { if (in_array($a_set["ref_id"], $_SESSION["clipboard"]["ref_ids"])) { switch ($_SESSION["clipboard"]["cmd"]) { case "cut": $title = "<del>" . $title . "</del>"; break; case "copy": $title = "<font color=\"green\">+</font> " . $title; break; case "link": $title = "<font color=\"black\"><</font> " . $title; break; } } } $this->tpl->setVariable("VAL_TITLE", $title); $this->tpl->setVariable("VAL_DESC", ilUtil::shortenText($a_set["desc"], MAXLENGTH_OBJ_DESC, true)); $this->tpl->setVariable("VAL_LAST_CHANGE", $a_set["last_update"]); $alt = $objDefinition->isPlugin($a_set["type"]) ? $lng->txt("icon") . " " . ilPlugin::lookupTxt("rep_robj", $a_set["type"], "obj_" . $a_set["type"]) : $lng->txt("icon") . " " . $lng->txt("obj_" . $a_set["type"]); $this->tpl->setVariable("IMG_TYPE", ilUtil::img(ilObject::_getIcon($a_set["obj_id"], "small"), $alt)); //$this->tpl->setVariable("IMG_TYPE", ilObject::_getIcon($a_set["obj_id"], "small", $this->getIconImageType()), // $lng->txt("icon")." ".$lng->txt("obj_".$a_set["type"]))); }
function getItems() { global $objDefinition; include_once "Services/Tracking/classes/class.ilTrQuery.php"; $res = ilTrQuery::getObjectTypeStatisticsPerMonth($this->filter["aggregation"], $this->filter["year"]); $data = array(); foreach ($res as $type => $months) { // inactive plugins, etc. if (!$objDefinition->getLocation($type)) { continue; } $data[$type]["type"] = $type; // to enable sorting by title if ($objDefinition->isPluginTypeName($type)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } foreach ($months as $month => $row) { $value = $row[$this->filter["measure"]]; $data[$type]["month_" . $month] = $value; } } // add live data if ($this->filter["year"] == date("Y")) { $live = ilTrQuery::getObjectTypeStatistics(); foreach ($live as $type => $item) { // inactive plugins, etc. if (!$objDefinition->getLocation($type)) { continue; } $data[$type]["type"] = $type; // to enable sorting by title if ($objDefinition->isPluginTypeName($type)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } $value = $item[$this->filter["measure"]]; $data[$type]["month_live"] = $value; } } $this->setData($data); }
/** * Render block header * * @param ilTemplate $a_tpl * @param string $a_type * @param string $a_text * @param array $a_types_in_block * @param string $a_commands_html * @param int $a_order_id */ protected function addHeaderRow(ilTemplate $a_tpl, $a_type = "", $a_text = "", array $a_types_in_block = null, $a_commands_html = null, $a_order_id = null) { global $lng, $ilSetting, $objDefinition; $a_tpl->setVariable("CB_ID", ' id="bl_cntr_' . ++$this->bl_cnt . '"'); if ($this->enable_manage_select_all) { $this->renderSelectAllBlock($a_tpl); } else { if ($this->enable_multi_download) { if ($a_type) { $a_types_in_block = array($a_type); } foreach ($a_types_in_block as $type) { if (in_array($type, $this->getDownloadableTypes())) { $this->renderSelectAllBlock($a_tpl); break; } } } } if ($a_text == "" && $a_type != "") { if (!$objDefinition->isPlugin($a_type)) { $title = $lng->txt("objs_" . $a_type); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_" . $a_type); } } else { $title = $a_text; } if ($ilSetting->get("icon_position_in_lists") != "item_rows" && $a_type != "") { $icon = ilUtil::getImagePath("icon_" . $a_type . ".svg"); $a_tpl->setCurrentBlock("container_header_row_image"); $a_tpl->setVariable("HEADER_IMG", $icon); $a_tpl->setVariable("HEADER_ALT", $title); } else { $a_tpl->setCurrentBlock("container_header_row"); } if ($a_order_id) { $a_tpl->setVariable("BLOCK_HEADER_ORDER_NAME", "position[blocks][" . $a_order_id . "]"); $a_tpl->setVariable("BLOCK_HEADER_ORDER_NUM", ++$this->order_cnt * 10); } $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title); $a_tpl->setVariable("CHR_COMMANDS", $a_commands_html); $a_tpl->parseCurrentBlock(); $a_tpl->touchBlock("container_row"); $this->resetRowType(); }
/** * Access Permissions Table Data * @return array */ function getAccessPermissionTableData() { global $ilAccess, $ilObjDataCache, $objDefinition; // get all possible operation of current object $ops_list = ilRbacReview::_getOperationList($this->object->getType()); $counter = 0; $result_set = array(); // check permissions of user foreach ($ops_list as $ops) { $access = $ilAccess->doRBACCheck($ops['operation'], "info", $this->object->getRefId(), $this->user->getId(), $this->object->getType()); $result_set[$counter]["img"] = $access ? self::IMG_OK : self::IMG_NOT_OK; if (substr($ops['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($ops['operation'], 7))) { $result_set[$counter]["operation"] = ilPlugin::lookupTxt("rep_robj", substr($ops['operation'], 7), 'rbac_' . $ops['operation']); } else { if ($objDefinition->isPlugin($this->object->getType())) { $result_set[$counter]["operation"] = ilPlugin::lookupTxt("rep_robj", $this->object->getType(), $this->object->getType() . "_" . $ops['operation']); } elseif (substr($ops['operation'], 0, 7) == 'create_') { $result_set[$counter]["operation"] = $this->lng->txt('rbac_' . $ops['operation']); } else { $result_set[$counter]["operation"] = $this->lng->txt($this->object->getType() . "_" . $ops['operation']); } } $list_role = ""; // Check ownership if ($this->user->getId() == $ilObjDataCache->lookupOwner($this->object->getId())) { if (substr($ops['operation'], 0, 7) != 'create_' and $ops['operation'] != 'edit_permission' and $ops['operation'] != 'edit_leanring_progress') { $list_role[] = $this->lng->txt('info_owner_of_object'); } } // get operations on object for each assigned role to user foreach ($this->getAssignedValidRoles() as $role) { if (in_array($ops['ops_id'], $role['ops'])) { $list_role[] = $role['translation']; } } if (empty($list_role)) { $list_role[] = $this->lng->txt('none'); } $result_set[$counter]["role_ownership"] = $list_role; ++$counter; } return $result_set; }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $objDefinition; $obj_id = $a_set["obj_id"]; $ref_id = $a_set["ref_id"]; $type = $a_set['type']; $title = $a_set['title']; $description = $a_set['description']; $relevance = $a_set['relevance']; if (!$type) { return false; } include_once './Services/Search/classes/Lucene/class.ilLuceneSearchObjectListGUIFactory.php'; $item_list_gui = ilLuceneSearchObjectListGUIFactory::factory($type); $item_list_gui->initItem($ref_id, $obj_id, $title, $description); $item_list_gui->setContainerObject($this->parent_obj); $item_list_gui->setSearchFragment($this->presenter->lookupContent($obj_id, 0)); $item_list_gui->setSeparateCommands(true); ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_set); $this->presenter->appendAdditionalInformation($item_list_gui, $ref_id, $obj_id, $type); $this->tpl->setVariable("ACTION_HTML", $item_list_gui->getCommandsHTML()); if ($html = $item_list_gui->getListItemHTML($ref_id, $obj_id, $title, $description)) { $item_html[$ref_id]['html'] = $html; $item_html[$ref_id]['type'] = $type; } $this->tpl->setVariable("HREF_IMG", $item_list_gui->default_command["link"]); global $lng; if ($this->enabledRelevance()) { $width1 = (int) ((int) $relevance / 2); $width2 = (int) (50 - $width1); $this->tpl->setCurrentBlock('relev'); $this->tpl->setVariable('VAL_REL', sprintf("%d %%", $relevance)); $this->tpl->setVariable('WIDTH_A', $width1); $this->tpl->setVariable('WIDTH_B', $width2); $this->tpl->setVariable('IMG_A', ilUtil::getImagePath("relevance_blue.png")); $this->tpl->setVariable('IMG_B', ilUtil::getImagePath("relevance_dark.png")); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("ITEM_HTML", $html); if (!$objDefinition->isPlugin($type)) { $type_txt = $lng->txt('icon') . ' ' . $lng->txt('obj_' . $type); $icon = ilUtil::getImagePath('icon_' . $type . '.png'); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $type_txt = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $icon = ilObject::_getIcon($obj_id, 'small', $type); } $this->tpl->setVariable("TYPE_IMG", ilUtil::img($icon, $type_txt)); }
/** * Parse creatable sub objects for repository incl. grouping * * @return bool */ protected function parseRepository() { global $objDefinition, $lng, $ilAccess; $this->sub_objects = array(); if (!is_array($this->disabled_object_types)) { $this->disabled_object_types = array(); } $this->disabled_object_types[] = "rolf"; $parent_type = ilObject::_lookupType($this->parent_ref_id, true); $subtypes = $objDefinition->getCreatableSubObjects($parent_type, $this->mode); if (count($subtypes) > 0) { // grouping of object types $grp_map = $pos_group_map = array(); include_once "Services/Repository/classes/class.ilObjRepositorySettings.php"; $groups = ilObjRepositorySettings::getNewItemGroups(); // no groups => use default if (!$groups) { $default = ilObjRepositorySettings::getDefaultNewItemGrouping(); $groups = $default["groups"]; $grp_map = $default["items"]; // reset positions (9999 = "other"/unassigned) $pos = 0; foreach ($subtypes as $item_type => $item) { // see ilObjectDefinition if (substr($item_type, 0, 1) == "x") { $subtypes[$item_type]["pos"] = "99992000"; } else { $subtypes[$item_type]["pos"] = "9999" . str_pad(++$pos, 4, "0", STR_PAD_LEFT); } } // assign default positions foreach ($default["sort"] as $item_type => $pos) { if (array_key_exists($item_type, $subtypes)) { $subtypes[$item_type]["pos"] = $pos; } } // sort by default positions $subtypes = ilUtil::sortArray($subtypes, "pos", "asc", true, true); } else { foreach (ilObjRepositorySettings::getNewItemGroupSubItems() as $grp_id => $subitems) { foreach ($subitems as $subitem) { $grp_map[$subitem] = $grp_id; } } } $group_separators = array(); $pos_group_map[0] = $lng->txt("rep_new_item_group_other"); $old_grp_ids = array(); foreach ($groups as $item) { if ($item["type"] == ilObjRepositorySettings::NEW_ITEM_GROUP_TYPE_GROUP) { $pos_group_map[$item["id"]] = $item["title"]; } else { if (sizeof($old_grp_ids)) { $group_separators[$item["id"]] = $old_grp_ids; } } $old_grp_ids[] = $item["id"]; } $current_grp = null; foreach ($subtypes as $type => $subitem) { if (!in_array($type, $this->disabled_object_types)) { // #9950 if ($ilAccess->checkAccess("create_" . $type, "", $this->parent_ref_id, $parent_type)) { // if only assigned - do not add groups if (sizeof($pos_group_map) > 1) { $obj_grp_id = (int) $grp_map[$type]; if ($obj_grp_id !== $current_grp) { // add seperator after last group? $sdone = false; foreach ($group_separators as $idx => $spath) { // #11986 - all separators up to next group if ($current_grp && !in_array($obj_grp_id, $spath)) { // 1 only separator between groups if (!$sdone) { $this->sub_objects[] = array("type" => "column_separator"); $sdone = true; } unset($group_separators[$idx]); } } $title = $pos_group_map[$obj_grp_id]; $this->sub_objects[] = array("type" => "group", "title" => $title); $current_grp = $obj_grp_id; } } if ($subitem["plugin"]) { include_once "./Services/Component/classes/class.ilPlugin.php"; $title = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); } else { // #13088 $title = $lng->txt("obj_" . $type); } $this->sub_objects[] = array("type" => "object", "value" => $type, "title" => $title); } } } } return (bool) sizeof($this->sub_objects); }
/** * Insert icons and checkboxes */ function insertIconsAndCheckboxes() { global $lng, $objDefinition; $cnt = 0; if ($this->getCheckboxStatus()) { $this->tpl->setCurrentBlock("check"); $this->tpl->setVariable("VAL_ID", $this->getCommandId()); $this->tpl->parseCurrentBlock(); $cnt += 1; } else { if ($this->getDownloadCheckboxState() != self::DOWNLOAD_CHECKBOX_NONE) { $this->tpl->setCurrentBlock("check_download"); if ($this->getDownloadCheckboxState() == self::DOWNLOAD_CHECKBOX_ENABLED) { $this->tpl->setVariable("VAL_ID", $this->getCommandId()); } else { $this->tpl->setVariable("VAL_VISIBILITY", "visibility: hidden;\" disabled=\"disabled"); } $this->tpl->parseCurrentBlock(); $cnt += 1; } elseif ($this->getExpandStatus()) { $this->tpl->setCurrentBlock('expand'); if ($this->isExpanded()) { $this->ctrl->setParameter($this->container_obj, 'expand', -1 * $this->obj_id); $this->tpl->setVariable('EXP_HREF', $this->ctrl->getLinkTarget($this->container_obj, '', $this->getUniqueItemId(true))); $this->ctrl->clearParameters($this->container_obj); $this->tpl->setVariable('EXP_IMG', ilUtil::getImagePath('tree_exp.svg')); $this->tpl->setVariable('EXP_ALT', $this->lng->txt('collapse')); } else { $this->ctrl->setParameter($this->container_obj, 'expand', $this->obj_id); $this->tpl->setVariable('EXP_HREF', $this->ctrl->getLinkTarget($this->container_obj, '', $this->getUniqueItemId(true))); $this->ctrl->clearParameters($this->container_obj); $this->tpl->setVariable('EXP_IMG', ilUtil::getImagePath('tree_col.svg')); $this->tpl->setVariable('EXP_ALT', $this->lng->txt('expand')); } $this->tpl->parseCurrentBlock(); $cnt += 1; } } if ($this->getIconStatus()) { if ($cnt == 1) { $this->tpl->touchBlock("i_1"); // indent } // icon link if ($this->title_link_disabled || !$this->default_command || !$this->getCommandsStatus() && !$this->restrict_to_goto) { } else { $this->tpl->setCurrentBlock("icon_link_s"); if ($this->default_command["frame"] != "") { $this->tpl->setVariable("ICON_TAR", "target='" . $this->default_command["frame"] . "'"); } $this->tpl->setVariable("ICON_HREF", $this->default_command["link"]); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("icon_link_e"); } $this->tpl->setCurrentBlock("icon"); if (!$objDefinition->isPlugin($this->getIconImageType())) { $this->tpl->setVariable("ALT_ICON", $lng->txt("icon") . " " . $lng->txt("obj_" . $this->getIconImageType())); } else { include_once "Services/Component/classes/class.ilPlugin.php"; $this->tpl->setVariable("ALT_ICON", $lng->txt("icon") . " " . ilPlugin::lookupTxt("rep_robj", $this->getIconImageType(), "obj_" . $this->getIconImageType())); } $this->tpl->setVariable("SRC_ICON", ilObject::_getIcon($this->obj_id, "small", $this->getIconImageType())); $this->tpl->parseCurrentBlock(); $cnt += 1; } $this->tpl->touchBlock("d_" . $cnt); // indent main div }
/** * display permissions * * @access public */ function permObject() { global $rbacadmin, $rbacreview, $rbacsystem, $objDefinition; if (!$rbacsystem->checkAccess('write', $this->rolf_ref_id)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"), $this->ilias->error_obj->WARNING); exit; } $to_filter = $objDefinition->getSubobjectsToFilter(); $tpl_filter = array(); $internal_tpl = false; if ($internal_tpl = $this->object->isInternalTemplate()) { $tpl_filter = $this->object->getFilterOfInternalTemplate(); } $operation_info = $rbacreview->getOperationAssignment(); foreach ($operation_info as $info) { if ($objDefinition->getDevMode($info['type'])) { continue; } // FILTER SUBOJECTS OF adm OBJECT if (in_array($info['type'], $to_filter)) { continue; } if ($internal_tpl and $tpl_filter and !in_array($info['type'], $tpl_filter)) { continue; } $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'], "type" => $info['type']); $txt = $objDefinition->isPlugin($info['type']) ? ilPlugin::lookupTxt("rep_robj", $info['type'], $info['type'] . "_" . $info['operation']) : $this->lng->txt($info['type'] . "_" . $info['operation']); if (substr($info['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($info['operation'], 7))) { $txt = ilPlugin::lookupTxt("rep_robj", substr($info['operation'], 7), $info['type'] . "_" . $info['operation']); } elseif (substr($info['operation'], 0, 6) == 'create') { $txt = $this->lng->txt('rbac_' . $info['operation']); } $rbac_operations[$info['typ_id']][$info['ops_id']] = array("ops_id" => $info['ops_id'], "title" => $info['operation'], "name" => $txt); } foreach ($rbac_objects as $key => $obj_data) { if ($objDefinition->isPlugin($obj_data["type"])) { $rbac_objects[$key]["name"] = ilPlugin::lookupTxt("rep_robj", $obj_data["type"], "obj_" . $obj_data["type"]); } else { $rbac_objects[$key]["name"] = $this->lng->txt("obj_" . $obj_data["type"]); } $rbac_objects[$key]["ops"] = $rbac_operations[$key]; } sort($rbac_objects); foreach ($rbac_objects as $key => $obj_data) { sort($rbac_objects[$key]["ops"]); } // sort by (translated) name of object type $rbac_objects = ilUtil::sortArray($rbac_objects, "name", "asc"); // BEGIN CHECK_PERM foreach ($rbac_objects as $key => $obj_data) { $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data["type"], $this->rolf_ref_id); $arr_checked = array_intersect($arr_selected, array_keys($rbac_operations[$obj_data["obj_id"]])); foreach ($rbac_operations[$obj_data["obj_id"]] as $operation) { $checked = in_array($operation["ops_id"], $arr_checked); $disabled = false; // Es wird eine 2-dim Post Variable �bergeben: perm[rol_id][ops_id] $box = ilUtil::formCheckBox($checked, "template_perm[" . $obj_data["type"] . "][]", $operation["ops_id"], $disabled); $output["perm"][$obj_data["obj_id"]][$operation["ops_id"]] = $box; } } // END CHECK_PERM $output["col_anz"] = count($rbac_objects); $output["txt_save"] = $this->lng->txt("save"); $output["check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id, $this->object->getId()), "protected", 1); $output["text_protected"] = $this->lng->txt("role_protect_permissions"); /************************************/ /* adopt permissions form */ /************************************/ $output["message_middle"] = $this->lng->txt("adopt_perm_from_template"); // send message for system role if ($this->object->getId() == SYSTEM_ROLE_ID) { $output["adopt"] = array(); ilUtil::sendFailure($this->lng->txt("msg_sysrole_not_editable")); } else { // BEGIN ADOPT_PERMISSIONS $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id, true); // sort output for correct color changing ksort($parent_role_ids); foreach ($parent_role_ids as $key => $par) { if ($par["obj_id"] != SYSTEM_ROLE_ID) { $radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]); $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2"); $output["adopt"][$key]["check_adopt"] = $radio; $output["adopt"][$key]["type"] = $par["type"] == 'role' ? 'Role' : 'Template'; $output["adopt"][$key]["role_name"] = $par["title"]; } } $output["formaction_adopt"] = $this->ctrl->getFormAction($this); // END ADOPT_PERMISSIONS } $output["formaction"] = $this->ctrl->getFormAction($this); $this->data = $output; /************************************/ /* generate output */ /************************************/ $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html"); $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator"); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_perm_role.html", "Services/AccessControl"); foreach ($rbac_objects as $obj_data) { // BEGIN object_operations $this->tpl->setCurrentBlock("object_operations"); foreach ($obj_data["ops"] as $operation) { $ops_ids[] = $operation["ops_id"]; $css_row = ilUtil::switchColor($key, "tblrow1", "tblrow2"); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable("PERMISSION", $operation["name"]); $this->tpl->setVariable("CHECK_PERMISSION", $this->data["perm"][$obj_data["obj_id"]][$operation["ops_id"]]); $this->tpl->parseCurrentBlock(); } // END object_operations // BEGIN object_type $this->tpl->setCurrentBlock("object_type"); $this->tpl->setVariable("TXT_OBJ_TYPE", $obj_data["name"]); // TODO: move this if in a function and query all objects that may be disabled or inactive if ($this->objDefinition->getDevMode($obj_data["type"])) { $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_implemented_yet") . ")"); } else { if ($obj_data["type"] == "icrs" and !$this->ilias->getSetting("ilinc_active")) { $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_enabled_or_configured") . ")"); } } // js checkbox toggles $this->tpl->setVariable("JS_VARNAME", "template_perm_" . $obj_data["type"]); $this->tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($ops_ids)); $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all")); $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all")); $this->tpl->parseCurrentBlock(); // END object_type } /* // BEGIN ADOPT PERMISSIONS foreach ($this->data["adopt"] as $key => $value) { $this->tpl->setCurrentBlock("ADOPT_PERM_ROW"); $this->tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]); $this->tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]); $this->tpl->setVariable("TYPE",$value["type"]); $this->tpl->setVariable("ROLE_NAME",$value["role_name"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("ADOPT_PERM_FORM"); $this->tpl->setVariable("MESSAGE_MIDDLE",$this->data["message_middle"]); $this->tpl->setVariable("FORMACTION_ADOPT",$this->data["formaction_adopt"]); $this->tpl->setVariable("ADOPT",$this->lng->txt('copy')); $this->tpl->parseCurrentBlock(); // END ADOPT PERMISSIONS */ $this->tpl->setCurrentBlock("tblfooter_protected"); $this->tpl->setVariable("COL_ANZ", 3); $this->tpl->setVariable("CHECK_BOTTOM", $this->data["check_protected"]); $this->tpl->setVariable("MESSAGE_TABLE", $this->data["text_protected"]); $this->tpl->parseCurrentBlock(); $this->tpl->setVariable("COL_ANZ_PLUS", 4); $this->tpl->setVariable("TXT_SAVE", $this->data["txt_save"]); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath("icon_" . $this->object->getType() . ".png")); $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt($this->object->getType())); $this->tpl->setVariable("TBL_HELP_IMG", ilUtil::getImagePath("icon_help.png")); $this->tpl->setVariable("TBL_HELP_LINK", "tbl_help.php"); $this->tpl->setVariable("TBL_HELP_IMG_ALT", $this->lng->txt("help")); // compute additional information in title if (substr($this->object->getTitle(), 0, 3) == "il_") { $desc = $this->lng->txt("predefined_template"); //$this->lng->txt("obj_".$parent_node['type'])." (".$parent_node['obj_id'].") : ".$parent_node['title']; } $description = "<br/> <span class=\"small\">" . $desc . "</span>"; // translation for autogenerated roles if (substr($this->object->getTitle(), 0, 3) == "il_") { include_once './Services/AccessControl/classes/class.ilObjRole.php'; $title = ilObjRole::_getTranslation($this->object->getTitle()) . " (" . $this->object->getTitle() . ")"; } else { $title = $this->object->getTitle(); } $this->tpl->setVariable("TBL_TITLE", $title . $description); $this->tpl->setVariable("TXT_PERMISSION", $this->data["txt_permission"]); $this->tpl->setVariable("FORMACTION", $this->data["formaction"]); $this->tpl->parseCurrentBlock(); }
/** * show material assignment * * @access protected * @param * @return */ public function materialsObject() { global $tree, $objDefinition, $ilAccess; $this->tabs_gui->setTabActive('crs_materials'); // #11337 - support ANY parent container (crs, grp, fld) $parent_ref_id = $tree->getParentId($this->object->getRefId()); $parent_type = ilObject::_lookupType($parent_ref_id, true); // add new item $subtypes = $objDefinition->getCreatableSubObjects($parent_type, ilObjectDefinition::MODE_REPOSITORY); if ($subtypes) { $subobj = array(); foreach ($subtypes as $type => $sub_item) { if (!in_array($type, array("itgr", "sess"))) { // #9950 if ($ilAccess->checkAccess("create_" . $type, "", $parent_ref_id, $parent_type)) { // #10787 $title = $this->lng->txt('obj_' . $type); if ($sub_item["plugin"]) { include_once "./Services/Component/classes/class.ilPlugin.php"; $title = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); } $subobj[] = array('value' => $type, 'title' => $title, 'img' => ilObject::_getIcon('', 'tiny', $type), 'alt' => $title); } } } if (sizeof($subobj)) { // add new object to parent container instead $this->ctrl->setParameter($this, 'ref_id', $parent_ref_id); // $this->ctrl->setParameter($this, 'crtptrefid', $parent_ref_id); // force after creation callback $this->ctrl->setParameter($this, 'crtcb', $this->ref_id); $this->lng->loadLanguageModule('cntr'); $this->tpl->setCreationSelector($this->ctrl->getFormAction($this), $subobj, 'create', $this->lng->txt('add')); $this->ctrl->setParameter($this, 'ref_id', $this->ref_id); // $this->ctrl->setParameter($this, 'crtptrefid', ''); $this->ctrl->setParameter($this, 'crtcb', ''); } } include_once 'Modules/Session/classes/class.ilEventItems.php'; $this->event_items = new ilEventItems($this->object->getId()); $items = $this->event_items->getItems(); $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_materials.html', 'Modules/Session'); #$this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html"); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, 'materials')); $this->tpl->setVariable("COLL_TITLE_IMG", ilUtil::getImagePath('icon_sess.png')); $this->tpl->setVariable("COLL_TITLE_IMG_ALT", $this->lng->txt('events')); $this->tpl->setVariable("TABLE_TITLE", $this->lng->txt('event_assign_materials_table')); $this->tpl->setVariable("TABLE_INFO", $this->lng->txt('event_assign_materials_info')); $materials = array(); $nodes = $tree->getSubTree($tree->getNodeData($parent_ref_id)); foreach ($nodes as $node) { // No side blocks here if ($node['child'] == $parent_ref_id || $objDefinition->isSideBlock($node['type']) || in_array($node['type'], array('sess', 'itgr', 'rolf'))) { continue; } if ($node['type'] == 'rolf') { continue; } $node["sorthash"] = (int) (!in_array($node['ref_id'], $items)) . $node["title"]; $materials[] = $node; } $materials = ilUtil::sortArray($materials, "sorthash", "ASC"); $counter = 1; foreach ($materials as $node) { $counter++; $this->tpl->setCurrentBlock("material_row"); $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_' . $node['type'] . '_s.png')); $this->tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $node['type'])); $this->tpl->setVariable("ROW_CLASS", ilUtil::switchColor($counter, 'tblrow1', 'tblrow2')); $this->tpl->setVariable("CHECK_COLL", ilUtil::formCheckbox(in_array($node['ref_id'], $items) ? 1 : 0, 'items[]', $node['ref_id'])); $this->tpl->setVariable("COLL_TITLE", $node['title']); if (strlen($node['description'])) { $this->tpl->setVariable("COLL_DESC", $node['description']); } $this->tpl->setVariable("ASSIGNED_IMG_OK", in_array($node['ref_id'], $items) ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png')); $this->tpl->setVariable("ASSIGNED_STATUS", $this->lng->txt('event_material_assigned')); $this->tpl->setVariable("COLL_PATH", $this->formatPath($node['ref_id'])); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("SELECT_ROW", ilUtil::switchColor(++$counter, 'tblrow1', 'tblrow2')); $this->tpl->setVariable("SELECT_ALL", $this->lng->txt('select_all')); $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png')); $this->tpl->setVariable("BTN_SAVE", $this->lng->txt('save')); }
/** * Fill row template * @return */ public function fillRow($row) { global $objDefinition; if (isset($row['show_ce'])) { $this->tpl->setCurrentBlock('ce_td'); $this->tpl->setVariable('CE_TYPE', $this->getTemplateType()); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('ce_desc_td'); $this->tpl->setVariable('CE_DESC_TYPE', $this->getTemplateType()); $this->tpl->setVariable('CE_LONG', $this->lng->txt('change_existing_object_type_desc')); if ($objDefinition->isSystemObject($this->getTemplateType())) { $this->tpl->setVariable("TXT_CE", $this->lng->txt("change_existing_prefix_single") . " " . $this->lng->txt("obj_" . $this->getTemplateType()) . " " . $this->lng->txt("change_existing_suffix_single")); } else { $pl_txt = $objDefinition->isPlugin($this->getTemplateType()) ? ilPlugin::lookupTxt("rep_robj", $this->getTemplateType(), "objs_" . $this->getTemplateType()) : $this->lng->txt('objs_' . $this->getTemplateType()); $this->tpl->setVariable('TXT_CE', $this->lng->txt('change_existing_prefix') . ' ' . $pl_txt . ' ' . $this->lng->txt('change_existing_suffix')); $this->tpl->parseCurrentBlock(); } return true; } else { $this->tpl->setCurrentBlock('perm_td'); $this->tpl->setVariable('OBJ_TYPE', $this->getTemplateType()); $this->tpl->setVariable('PERM_PERM_ID', $row['ops_id']); $this->tpl->setVariable('PERM_CHECKED', $row['set'] ? 'checked="checked"' : ''); if ($this->getRoleId() == SYSTEM_ROLE_ID) { $this->tpl->setVariable('PERM_DISABLED', 'disabled="disabled"'); } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('perm_desc_td'); $this->tpl->setVariable('DESC_TYPE', $this->getTemplateType()); $this->tpl->setVariable('DESC_PERM_ID', $row['ops_id']); if ($row["create_type"] != "" && $objDefinition->isPlugin($row['create_type'])) { $this->tpl->setVariable('TXT_PERMISSION', ilPlugin::lookupTxt("rep_robj", $row['create_type'], $this->getTemplateType() . "_" . $row['name'])); } else { if ($row["create_type"] == "" && $objDefinition->isPlugin($this->getTemplateType())) { $this->tpl->setVariable('TXT_PERMISSION', ilPlugin::lookupTxt("rep_robj", $this->getTemplateType(), $this->getTemplateType() . "_" . $row['name'])); } else { if (substr($row['name'], 0, 6) == 'create') { #$perm = $this->lng->txt($this->getTemplateType().'_'.$row['name']); $perm = $this->lng->txt('rbac' . '_' . $row['name']); } elseif ($this->lng->exists($this->getTemplateType() . '_' . $row['name'] . '_short')) { $perm = $this->lng->txt($this->getTemplateType() . '_' . $row['name'] . '_short') . ': ' . $this->lng->txt($this->getTemplateType() . '_' . $row['name']); } else { $perm = $this->lng->txt($row['name']) . ': ' . $this->lng->txt($this->getTemplateType() . '_' . $row['name']); } $this->tpl->setVariable('TXT_PERMISSION', $perm); } } $this->tpl->parseCurrentBlock(); return true; } }
/** * Get possible subtypes * * @param bool $a_split_learning_resources * @param bool $a_include_digilib * @param bool $a_allow_undefined_lp */ protected function getPossibleTypes($a_split_learning_resources = false, $a_include_digilib = false, $a_allow_undefined_lp = false) { global $lng, $ilPluginAdmin; $options = array(); if ($a_split_learning_resources) { $options['lm'] = $lng->txt('objs_lm'); $options['sahs'] = $lng->txt('objs_sahs'); $options['htlm'] = $lng->txt('objs_htlm'); if ($a_include_digilib) { $options['dbk'] = $lng->txt('objs_dbk'); } } else { $options['lres'] = $lng->txt('learning_resources'); } $options['crs'] = $lng->txt('objs_crs'); $options['grp'] = $lng->txt('objs_grp'); $options['exc'] = $lng->txt('objs_exc'); $options['tst'] = $lng->txt('objs_tst'); if ($a_allow_undefined_lp) { $options["file"] = $lng->txt("objs_file"); $options["webr"] = $lng->txt("objs_webr"); $options["wiki"] = $lng->txt("objs_wiki"); } // repository plugins (currently only active) include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php'; $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj"); foreach ($pl_names as $pl) { $pl_id = $ilPluginAdmin->getId(IL_COMP_SERVICE, "Repository", "robj", $pl); if (ilRepositoryObjectPluginSlot::isTypePluginWithLP($pl_id)) { $options[$pl_id] = ilPlugin::lookupTxt("rep_robj", $pl_id, "objs_" . $pl_id); } } asort($options); return $options; }
/** * adds a header row to a block template * * @param object $a_tpl block template * @param string $a_type object type * @access private */ function addHeaderRow(&$a_tpl, $a_type, $a_show_image = true) { global $objDefinition; $icon = ilUtil::getImagePath("icon_" . $a_type . ".png"); if (!$objDefinition->isPlugin($a_type)) { $title = $this->lng->txt("objs_" . $a_type); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_" . $a_type); } $header_id = "th_" . $a_type; if ($a_show_image) { $a_tpl->setCurrentBlock("container_header_row_image"); $a_tpl->setVariable("HEADER_IMG", $icon); $a_tpl->setVariable("HEADER_ALT", $title); } else { $a_tpl->setCurrentBlock("container_header_row"); } $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title); $a_tpl->setVariable("BLOCK_HEADER_ID", $header_id); $a_tpl->parseCurrentBlock(); $a_tpl->touchBlock("container_row"); }
/** * show material assignment * * @access protected * @param * @return */ public function listMaterials() { global $tree, $objDefinition, $ilTabs, $tpl, $ilAccess; $this->checkPermission("write"); $ilTabs->activateTab("materials"); // add new item $parent_node = $tree->getNodeData($tree->getParentId($this->object->getRefId())); $subtypes = $objDefinition->getCreatableSubObjects($parent_node['type'], ilObjectDefinition::MODE_REPOSITORY); if ($subtypes) { $subobj = array(); foreach ($subtypes as $type => $sub_item) { if (!in_array($type, array("itgr", "sess"))) { // #9950 if ($ilAccess->checkAccess("create_" . $type, "", $parent_node["child"], $parent_node["type"])) { // #10787 $title = $this->lng->txt('obj_' . $type); if ($sub_item["plugin"]) { include_once "./Services/Component/classes/class.ilPlugin.php"; $title = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); } $subobj[] = array('value' => $type, 'title' => $title, 'img' => ilObject::_getIcon('', 'tiny', $type), 'alt' => $title); } } } if (sizeof($subobj)) { // add new object to parent container instead $this->ctrl->setParameter($this, 'ref_id', $parent_node["child"]); // $this->ctrl->setParameter($this, 'crtptrefid', $parent_node["child"]); // force after creation callback $this->ctrl->setParameter($this, 'crtcb', $this->object->getRefId()); $this->lng->loadLanguageModule('cntr'); $this->tpl->setCreationSelector($this->ctrl->getFormAction($this), $subobj, 'create', $this->lng->txt('add')); $this->ctrl->setParameter($this, 'ref_id', $this->object->getRefId()); // $this->ctrl->setParameter($this, 'crtptrefid', ''); $this->ctrl->setParameter($this, 'crtcb', ''); } } include_once "./Modules/ItemGroup/classes/class.ilItemGroupItemsTableGUI.php"; $tab = new ilItemGroupItemsTableGUI($this, "listMaterials"); $tpl->setContent($tab->getHTML()); }