1<?php 2 3/** 4 * Class ilOrgUnitPermissionTableGUI 5 * 6 * @author Fabian Schmid <fs@studer-raimann.ch> 7 */ 8class ilOrgUnitDefaultPermissionTableGUI extends ilTable2GUI 9{ 10 11 /** 12 * @var string 13 */ 14 protected $context_string; 15 /** 16 * @var ilOrgUnitPermission 17 */ 18 private $ilOrgUnitPermission = null; 19 20 21 /** 22 * ilOrgUnitDefaultPermissionTableGUI constructor. 23 * 24 * @param object $a_parent_obj 25 * @param string $a_parent_cmd 26 * @param \ilOrgUnitPermission $ilOrgUnitPermission 27 */ 28 public function __construct($a_parent_obj, $a_parent_cmd, ilOrgUnitPermission $ilOrgUnitPermission) 29 { 30 parent::__construct($a_parent_obj, $a_parent_cmd); 31 $this->ilOrgUnitPermission = $ilOrgUnitPermission; 32 if ($this->ilOrgUnitPermission->getId() !== 0) { 33 $this->context_string = $this->ilOrgUnitPermission->getContext()->getContext(); 34 } 35 $this->dic()->language()->loadLanguageModule('orgu'); 36 37 $this->setId('objpositionperm_' . $this->type); 38 39 $this->dic() 40 ->ui() 41 ->mainTemplate() 42 ->addJavaScript('./Services/AccessControl/js/ilPermSelect.js'); 43 44 $this->setTitle($this->dic()->language()->txt('orgu_permission_settings_' 45 . $this->context_string)); 46 $this->setEnableHeader(true); 47 $this->disable('sort'); 48 $this->setFormAction($this->dic()->ctrl()->getFormAction($a_parent_obj, $a_parent_cmd)); 49 $this->disable('numinfo'); 50 $this->setRowTemplate("tpl.obj_role_template_perm_row.html", "Modules/OrgUnit"); 51 $this->setShowRowsSelector(false); 52 $this->setDisableFilterHiding(true); 53 $this->setData($this->ilOrgUnitPermission->getPossibleOperations()); 54 $this->setOpenFormTag(false); 55 $this->setCloseFormTag(false); 56 } 57 58 59 public function start() 60 { 61 $this->setEnableHeader(false); 62 $this->setOpenFormTag(true); 63 $this->setNoEntriesText(''); 64 $this->setData(array()); 65 $this->addMultiCommand(ilOrgUnitDefaultPermissionGUI::CMD_UPDATE, $this->lng->txt('save')); 66 } 67 68 69 public function end() 70 { 71 $this->setCloseFormTag(true); 72 $this->addCommandButton(ilOrgUnitDefaultPermissionGUI::CMD_UPDATE, $this->lng->txt('save')); 73 } 74 75 76 /** 77 * @param \ilOrgUnitOperation $row 78 * 79 * @return bool 80 */ 81 public function fillRow($row) 82 { 83 $this->tpl->setVariable('OBJ_TYPE', $this->context_string); 84 $this->tpl->setVariable('PERM_PERM_ID', $row->getOperationId()); 85 if ($this->ilOrgUnitPermission->isOperationIdSelected($row->getOperationId())) { 86 $this->tpl->setVariable('PERM_CHECKED', "checked=checked"); 87 } 88 // $this->tpl->setVariable('PERM_DISABLED', "disabled=disabled"); 89 $this->tpl->setVariable('DESC_TYPE', $this->context_string); 90 $this->tpl->setVariable('DESC_PERM_ID', $row->getOperationId()); 91 $this->tpl->setVariable('TXT_PERMISSION', $this->dic()->language()->txt('orgu_op_' 92 . $row->getOperationString())); 93 } 94 95 96 public function collectData() 97 { 98 } 99 100 101 /** 102 * @return \ILIAS\DI\Container 103 */ 104 private function dic() 105 { 106 return $GLOBALS['DIC']; 107 } 108} 109