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->
setRowTemplate(
"tpl.obj_role_template_perm_row.html",
"Services/AccessControl");
78 if(self::$template_permissions !== NULL)
82 self::$template_permissions = $rbacreview->getAllOperationsOfRole(
95 return self::$template_permissions[$a_type] ? self::$template_permissions[$a_type] : array();
158 global $objDefinition;
160 if(isset(
$row[
'show_ce']))
162 $this->tpl->setCurrentBlock(
'ce_td');
164 $this->tpl->parseCurrentBlock();
166 $this->tpl->setCurrentBlock(
'ce_desc_td');
168 $this->tpl->setVariable(
'CE_LONG',$this->lng->txt(
'change_existing_object_type_desc'));
170 if($objDefinition->isSystemObject($this->getTemplateType()))
172 $this->tpl->setVariable(
"TXT_CE",
173 $this->lng->txt(
"change_existing_prefix_single").
" ".
175 $this->lng->txt(
"change_existing_suffix_single")
182 "objs_".$this->getTemplateType())
183 : $this->lng->txt(
'objs_'.$this->getTemplateType());
185 $this->tpl->setVariable(
'TXT_CE',
186 $this->lng->txt(
'change_existing_prefix').
' '.
188 $this->lng->txt(
'change_existing_suffix'));
189 $this->tpl->parseCurrentBlock();
195 $this->tpl->setCurrentBlock(
'perm_td');
197 $this->tpl->setVariable(
'PERM_PERM_ID',
$row[
'ops_id']);
198 $this->tpl->setVariable(
'PERM_CHECKED',
$row[
'set'] ?
'checked="checked"' :
'');
202 $this->tpl->setVariable(
'PERM_DISABLED',
'disabled="disabled"');
205 $this->tpl->parseCurrentBlock();
207 $this->tpl->setCurrentBlock(
'perm_desc_td');
209 $this->tpl->setVariable(
'DESC_PERM_ID',
$row[
'ops_id']);
211 if (
$row[
"create_type"] !=
"" && $objDefinition->isPlugin(
$row[
'create_type']))
213 $this->tpl->setVariable(
'TXT_PERMISSION',
217 else if (
$row[
"create_type"] ==
"" && $objDefinition->isPlugin($this->getTemplateType()))
219 $this->tpl->setVariable(
'TXT_PERMISSION',
225 if(substr(
$row[
'name'],0,6) ==
'create')
227 #$perm = $this->lng->txt($this->getTemplateType().'_'.$row['name']);
228 $perm = $this->lng->txt(
'rbac'.
'_'.
$row[
'name']);
230 elseif($this->lng->exists($this->getTemplateType().
'_'.
$row[
'name'].
'_short'))
240 $this->tpl->setVariable(
'TXT_PERMISSION',$perm);
242 $this->tpl->parseCurrentBlock();
254 global $rbacreview, $objDefinition;
261 foreach($rbacreview->getOperationsByTypeAndClass($this->getTemplateType(),
'object') as $ops_id)
265 $operation = $rbacreview->getOperation($ops_id);
267 $perm[
'ops_id'] = $ops_id;
268 $perm[
'set'] = (in_array($ops_id,$operations) or $this->
getRoleId() == SYSTEM_ROLE_ID);
269 $perm[
'name'] = $operation[
'operation'];
275 $objects = $objDefinition->getCreatableSubObjects($this->
getTemplateType());
278 foreach($objects as $type => $info)
280 $ops_id = $ops_ids[$type];
287 $perm[
'ops_id'] = $ops_id;
288 $perm[
'set'] = (in_array($ops_id,$operations) or $this->
getRoleId() == SYSTEM_ROLE_ID);
290 $perm[
'name'] =
'create_'.$info[
'name'];
291 $perm[
'create_type'] = $info[
'name'];
296 if(!$this->show_admin_permissions)
298 $rows[] = array(
'show_ce' => 1);