2 $strinherit = get_string('inherit','role');
3 $strallow = get_string('allow','role');
4 $strprevent = get_string('prevent','role');
5 $strprohibit = get_string('prohibit','role');
8 <form id=
"overrideform" action=
"override.php" method=
"post">
9 <fieldset class=
"invisiblefieldset">
10 <input type=
"hidden" name=
"contextid" value=
"<?php p($contextid) ?>" />
11 <input type
="hidden" name
="roleid" value
="<?php p($roleid) ?>" />
12 <input type
="hidden" name
="sesskey" value
="<?php p(sesskey()) ?>" />
13 <input type
="hidden" name
="userid" value
="<?php p($userid) ?>" />
14 <input type
="hidden" name
="courseid" value
="<?php p($courseid) ?>" />
17 <table
class="rolecap">
19 <th
class="name" align
="left" scope
="col"><?php
print_string('capability','role') ?></th>
20 <th class=
"inherit" scope=
"col"><?php p($strinherit); ?></th>
21 <th class=
"allow" scope=
"col"><?php p($strallow); ?></th>
22 <th class=
"prevent" scope=
"col"><?php p($strprevent); ?></th>
23 <th class=
"prohibit" scope=
"col"><?php p($strprohibit); ?></th>
24 <th class=
"risk" colspan=
"5" scope=
"col"><?php print_string('risks','role') ?></th>
32 $strrisks = s(get_string('risks', 'role'));
34 $strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
36 foreach ($capabilities as $capability) {
38 // legacy caps should not be overriden - we must use proper capabilities if needed
39 if (islegacy($capability->name
)) {
43 // prints a breaker if component or name or context level
44 //if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
45 if (component_level_changed($capability, $component, $contextlevel)) {
46 echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component
, $capability->contextlevel
).'</strong></td></tr>');
49 // these 2 are used to see to group same mod/core capabilities together
50 $contextlevel = $capability->contextlevel
;
51 $component = $capability->component
;
53 // check the capability override for this cap, this role in this context
54 if (isset($localoverrides[$capability->name
])) {
55 $localpermission = $localoverrides[$capability->name
]->permission
;
57 $localpermission = 0; // Just inherit
60 if (isset($r_caps[$capability->name
])) {
61 $isallow = $r_caps[$capability->name
] > 0;
62 $isprevent = $r_caps[$capability->name
] < 0 && $r_caps[$capability->name
] > -500;
63 $isprohibit = $r_caps[$capability->name
] <= -500;
70 $isdisabled = $isprohibit;
72 $riskinfo = '<td class="risk managetrust">';
74 if (RISK_MANAGETRUST
& (int)$capability->riskbitmask
) {
75 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
76 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
77 $rowclasses .= ' riskmanagetrust';
79 $riskinfo .= '</td><td class="risk config">';
80 if (RISK_CONFIG
& (int)$capability->riskbitmask
) {
81 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
82 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
83 $rowclasses .= ' riskconfig';
85 $riskinfo .= '</td><td class="risk xss">';
86 if (RISK_XSS
& (int)$capability->riskbitmask
) {
87 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
88 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
89 $rowclasses .= ' riskxss';
91 $riskinfo .= '</td><td class="risk personal">';
92 if (RISK_PERSONAL
& (int)$capability->riskbitmask
) {
93 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
94 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
95 $rowclasses .= ' riskpersonal';
97 $riskinfo .= '</td><td class="risk spam">';
98 if (RISK_SPAM
& (int)$capability->riskbitmask
) {
99 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
100 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
101 $rowclasses .= ' riskspam';
103 $riskinfo .= '</td>';
108 <tr class=
"rolecap <?php echo $rowclasses; ?>">
109 <td
class="name"><span
class="cap-desc"><a onclick
="this.target='docspopup'" href
="<?php echo $CFG->docroot.'/'.$lang.'/'.$strcapabilities.'/'.$capability->name ?>"><?php
echo get_capability_string($capability->name
); ?></a><span class=
"cap-name"><?php echo $capability-
>name
?></span></span></td>
112 <input type=
"radio" title=
"<?php p($strinherit); ?>" name
="<?php echo $capability->name; ?>" value
="0"
114 if ($localpermission == CAP_INHERIT
) {echo 'checked="checked" ';}
115 if ($isdisabled) {echo 'disabled="disabled"';}?> />
118 <td class=
"allow <?php if ($isallow) {echo ' capcurrent';} ?>">
119 <input type
="radio" title
="<?php p($strallow); ?>" name
="<?php echo $capability->name; ?>"
120 <?php
echo ' value="'.CAP_ALLOW
.'"';
121 if ($localpermission == CAP_ALLOW
) {echo ' checked="checked" ';}
122 if ($isdisabled) {echo ' disabled="disabled"';}?> />
125 <td class=
"prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
126 <input type
="radio" title
="<?php p($strprevent); ?>" name
="<?php echo $capability->name; ?>"
127 <?php
echo ' value="'.CAP_PREVENT
.'"';
128 if ($localpermission == CAP_PREVENT
) {echo ' checked="checked" ';}
129 if ($isdisabled) {echo ' disabled="disabled"';}?> />
132 <td class=
"prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
133 <input type
="radio" title
="<?php p($strprohibit); ?>" name
="<?php echo $capability->name; ?>"
134 <?php
echo ' value="'.CAP_PROHIBIT
.'"';
135 if ($localpermission == CAP_PROHIBIT
) {echo ' checked="checked" ';}
136 if ($isdisabled) {echo ' disabled="disabled"';}?> />
138 <?php echo $riskinfo; ?>
143 <div class=
"submit buttons">
144 <input type=
"submit" value=
"<?php print_string('savechanges') ?>" />
145 <input type
="submit" name
="cancel" value
="<?php print_string('cancel') ?>" />