2 $strinherit = get_string('inherit','role');
3 $strallow = get_string('allow','role');
4 $strprevent = get_string('prevent','role');
5 $strprohibit = get_string('prohibit','role');
6 $strsafewarning = get_string('safeoverridenotice', 'role');
9 <form id=
"overrideform" action=
"override.php" method=
"post">
10 <fieldset class=
"invisiblefieldset">
11 <input type=
"hidden" name=
"contextid" value=
"<?php p($contextid) ?>" />
12 <input type
="hidden" name
="roleid" value
="<?php p($roleid) ?>" />
13 <input type
="hidden" name
="sesskey" value
="<?php p(sesskey()) ?>" />
14 <input type
="hidden" name
="userid" value
="<?php p($userid) ?>" />
15 <input type
="hidden" name
="courseid" value
="<?php p($courseid) ?>" />
18 <table
class="rolecap">
20 <th
class="name" align
="left" scope
="col"><?php
print_string('capability','role') ?></th>
21 <th class=
"inherit" scope=
"col"><?php p($strinherit); ?></th>
22 <th class=
"allow" scope=
"col"><?php p($strallow); ?></th>
23 <th class=
"prevent" scope=
"col"><?php p($strprevent); ?></th>
24 <th class=
"prohibit" scope=
"col"><?php p($strprohibit); ?></th>
25 <th class=
"risk" colspan=
"5" scope=
"col"><?php print_string('risks','role') ?></th>
33 $strrisks = s(get_string('risks', 'role'));
35 $strcapabilities = 'Capabilities';//s(get_string('capabilities', 'role'));
37 foreach ($capabilities as $capability) {
39 // legacy caps should not be overriden - we must use proper capabilities if needed
40 if (islegacy($capability->name
)) {
44 // prints a breaker if component or name or context level
45 //if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
46 if (component_level_changed($capability, $component, $contextlevel)) {
47 echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component
, $capability->contextlevel
).'</strong></td></tr>');
50 // these 2 are used to see to group same mod/core capabilities together
51 $contextlevel = $capability->contextlevel
;
52 $component = $capability->component
;
54 // check the capability override for this cap, this role in this context
55 if (isset($localoverrides[$capability->name
])) {
56 $localpermission = $localoverrides[$capability->name
]->permission
;
58 $localpermission = 0; // Just inherit
61 if (isset($r_caps[$capability->name
])) {
62 $isallow = $r_caps[$capability->name
] > 0;
63 $isprevent = $r_caps[$capability->name
] < 0 && $r_caps[$capability->name
] > -500;
64 $isprohibit = $r_caps[$capability->name
] <= -500;
71 $isdisabled = $isprohibit ||
$capability->locked
;
73 $riskinfo = '<td class="risk managetrust">';
75 if (RISK_MANAGETRUST
& (int)$capability->riskbitmask
) {
76 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
77 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
78 $rowclasses .= ' riskmanagetrust';
80 $riskinfo .= '</td><td class="risk config">';
81 if (RISK_CONFIG
& (int)$capability->riskbitmask
) {
82 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
83 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
84 $rowclasses .= ' riskconfig';
86 $riskinfo .= '</td><td class="risk xss">';
87 if (RISK_XSS
& (int)$capability->riskbitmask
) {
88 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
89 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
90 $rowclasses .= ' riskxss';
92 $riskinfo .= '</td><td class="risk personal">';
93 if (RISK_PERSONAL
& (int)$capability->riskbitmask
) {
94 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
95 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
96 $rowclasses .= ' riskpersonal';
98 $riskinfo .= '</td><td class="risk spam">';
99 if (RISK_SPAM
& (int)$capability->riskbitmask
) {
100 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
101 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
102 $rowclasses .= ' riskspam';
104 $riskinfo .= '</td>';
109 <tr class=
"rolecap <?php echo $rowclasses; ?>">
110 <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>
113 <input type=
"radio" title=
"<?php p($strinherit); ?>" name
="<?php echo $capability->name; ?>" value
="0"
115 if ($localpermission == CAP_INHERIT
) {echo 'checked="checked" ';}
116 if ($isdisabled) {echo 'disabled="disabled"';}?> />
119 <td class=
"allow <?php if ($isallow) {echo ' capcurrent';} ?>">
120 <input type
="radio" title
="<?php p($strallow); ?>" name
="<?php echo $capability->name; ?>"
121 <?php
echo ' value="'.CAP_ALLOW
.'"';
122 if ($localpermission == CAP_ALLOW
) {echo ' checked="checked" ';}
123 if ($isdisabled) {echo ' disabled="disabled"';}?> />
126 <td class=
"prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
127 <input type
="radio" title
="<?php p($strprevent); ?>" name
="<?php echo $capability->name; ?>"
128 <?php
echo ' value="'.CAP_PREVENT
.'"';
129 if ($localpermission == CAP_PREVENT
) {echo ' checked="checked" ';}
130 if ($isdisabled) {echo ' disabled="disabled"';}?> />
133 <td class=
"prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
134 <input type
="radio" title
="<?php p($strprohibit); ?>" name
="<?php echo $capability->name; ?>"
135 <?php
echo ' value="'.CAP_PROHIBIT
.'"';
136 if ($localpermission == CAP_PROHIBIT
) {echo ' checked="checked" ';}
137 if ($isdisabled) {echo ' disabled="disabled"';}?> />
139 <?php echo $riskinfo; ?>
144 <div class=
"submit buttons">
145 <input type=
"submit" value=
"<?php print_string('savechanges') ?>" />
146 <input type
="submit" name
="cancel" value
="<?php print_string('cancel') ?>" />
150 if ($safeoverridenotice) {
151 echo '<div class="sefeoverridenotice">'.$strsafewarning.'</div>';