4 include_once (
'./Services/Table/classes/class.ilTable2GUI.php');
5 include_once
'./Services/AccessControl/classes/class.ilPermissionGUI.php';
33 public function __construct($a_parent_obj,$a_parent_cmd, $a_ref_id,$a_role_id,$a_type,$a_show_admin_permissions =
false)
37 $this->tpl_type = $a_type;
38 $this->show_admin_permissions = $a_show_admin_permissions;
42 $this->
setId(
'role_template_'.$a_ref_id.
'_'.$a_type);
47 $this->lng->loadLanguageModule(
'rbac');
49 $this->ref_id = $a_ref_id;
50 $this->role_id = $a_role_id;
52 $this->role_folder_id = $rbacreview->getRoleFolderIdOfObject($this->
getRefId());
54 $this->
setRowTemplate(
"tpl.obj_role_template_perm_row.html",
"Services/AccessControl");
80 if(self::$template_permissions !== NULL)
84 self::$template_permissions = $rbacreview->getAllOperationsOfRole(
97 return self::$template_permissions[$a_type] ? self::$template_permissions[$a_type] : array();
169 global $objDefinition;
171 if(isset(
$row[
'show_ce']))
173 $this->tpl->setCurrentBlock(
'ce_td');
175 $this->tpl->parseCurrentBlock();
177 $this->tpl->setCurrentBlock(
'ce_desc_td');
179 $this->tpl->setVariable(
'CE_LONG',$this->lng->txt(
'change_existing_object_type_desc'));
181 if($objDefinition->isSystemObject($this->getTemplateType()))
183 $this->tpl->setVariable(
"TXT_CE",
184 $this->lng->txt(
"change_existing_prefix_single").
" ".
186 $this->lng->txt(
"change_existing_suffix_single")
193 "objs_".$this->getTemplateType())
194 : $this->lng->txt(
'objs_'.$this->getTemplateType());
196 $this->tpl->setVariable(
'TXT_CE',
197 $this->lng->txt(
'change_existing_prefix').
' '.
199 $this->lng->txt(
'change_existing_suffix'));
200 $this->tpl->parseCurrentBlock();
206 $this->tpl->setCurrentBlock(
'perm_td');
208 $this->tpl->setVariable(
'PERM_PERM_ID',
$row[
'ops_id']);
209 $this->tpl->setVariable(
'PERM_CHECKED',
$row[
'set'] ?
'checked="checked"' :
'');
213 $this->tpl->setVariable(
'PERM_DISABLED',
'disabled="disabled"');
216 $this->tpl->parseCurrentBlock();
218 $this->tpl->setCurrentBlock(
'perm_desc_td');
220 $this->tpl->setVariable(
'DESC_PERM_ID',
$row[
'ops_id']);
222 if (
$row[
"create_type"] !=
"" && $objDefinition->isPlugin(
$row[
'create_type']))
224 $this->tpl->setVariable(
'TXT_PERMISSION',
228 else if (
$row[
"create_type"] ==
"" && $objDefinition->isPlugin($this->getTemplateType()))
230 $this->tpl->setVariable(
'TXT_PERMISSION',
236 if(substr(
$row[
'name'],0,6) ==
'create')
238 #$perm = $this->lng->txt($this->getTemplateType().'_'.$row['name']);
239 $perm = $this->lng->txt(
'rbac'.
'_'.
$row[
'name']);
241 elseif($this->lng->exists($this->getTemplateType().
'_'.
$row[
'name'].
'_short'))
251 $this->tpl->setVariable(
'TXT_PERMISSION',$perm);
253 $this->tpl->parseCurrentBlock();
265 global $rbacreview, $objDefinition;
272 foreach($rbacreview->getOperationsByTypeAndClass($this->getTemplateType(),
'object') as $ops_id)
276 $operation = $rbacreview->getOperation($ops_id);
278 $perm[
'ops_id'] = $ops_id;
279 $perm[
'set'] = (in_array($ops_id,$operations) or $this->
getRoleId() == SYSTEM_ROLE_ID);
280 $perm[
'name'] = $operation[
'operation'];
286 $objects = $objDefinition->getCreatableSubObjects($this->
getTemplateType());
289 foreach($objects as $type => $info)
291 $ops_id = $ops_ids[$type];
298 $perm[
'ops_id'] = $ops_id;
299 $perm[
'set'] = (in_array($ops_id,$operations) or $this->
getRoleId() == SYSTEM_ROLE_ID);
301 $perm[
'name'] =
'create_'.$info[
'name'];
302 $perm[
'create_type'] = $info[
'name'];
307 if(!$this->show_admin_permissions)
309 $rows[] = array(
'show_ce' => 1);