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'));
33 $strcapabilities = s(get_string('capabilities', 'role'));
35 foreach ($capabilities as $capability) {
37 // legacy caps should not be overriden - we must use proper capabilities if needed
38 if (islegacy($capability->name
)) {
42 // prints a breaker if component or name or context level
43 if ($capability->component
!= $component or $capability->contextlevel
!= $contextlevel) {
44 echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component
, $capability->contextlevel
).'</strong></td></tr>');
47 // these 2 are used to see to group same mod/core capabilities together
48 $contextlevel = $capability->contextlevel
;
49 $component = $capability->component
;
51 // check the capability override for this cap, this role in this context
52 if (isset($localoverrides[$capability->name
])) {
53 $localpermission = $localoverrides[$capability->name
]->permission
;
55 $localpermission = 0; // Just inherit
58 if (isset($r_caps[$capability->name
])) {
59 $isallow = $r_caps[$capability->name
] > 0;
60 $isprevent = $r_caps[$capability->name
] < 0 && $r_caps[$capability->name
] > -500;
61 $isprohibit = $r_caps[$capability->name
] <= -500;
68 $isdisabled = $isprohibit;
70 $riskinfo = '<td class="risk managetrust">';
72 if (RISK_MANAGETRUST
& (int)$capability->riskbitmask
) {
73 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
74 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
75 $rowclasses .= ' riskmanagetrust';
77 $riskinfo .= '</td><td class="risk config">';
78 if (RISK_CONFIG
& (int)$capability->riskbitmask
) {
79 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
80 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
81 $rowclasses .= ' riskconfig';
83 $riskinfo .= '</td><td class="risk xss">';
84 if (RISK_XSS
& (int)$capability->riskbitmask
) {
85 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
86 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
87 $rowclasses .= ' riskxss';
89 $riskinfo .= '</td><td class="risk personal">';
90 if (RISK_PERSONAL
& (int)$capability->riskbitmask
) {
91 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
92 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
93 $rowclasses .= ' riskpersonal';
95 $riskinfo .= '</td><td class="risk spam">';
96 if (RISK_SPAM
& (int)$capability->riskbitmask
) {
97 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
98 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
99 $rowclasses .= ' riskspam';
101 $riskinfo .= '</td>';
106 <tr class=
"rolecap <?php echo $rowclasses; ?>">
107 <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>
110 <input type=
"radio" title=
"<?php p($strinherit); ?>" name
="<?php echo $capability->name; ?>" value
="0"
112 if ($localpermission == CAP_INHERIT
) {echo 'checked="checked" ';}
113 if ($isdisabled) {echo 'disabled="disabled"';}?> />
116 <td class=
"allow <?php if ($isallow) {echo ' capcurrent';} ?>">
117 <input type
="radio" title
="<?php p($strallow); ?>" name
="<?php echo $capability->name; ?>"
118 <?php
echo ' value="'.CAP_ALLOW
.'"';
119 if ($localpermission == CAP_ALLOW
) {echo ' checked="checked" ';}
120 if ($isdisabled) {echo ' disabled="disabled"';}?> />
123 <td class=
"prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
124 <input type
="radio" title
="<?php p($strprevent); ?>" name
="<?php echo $capability->name; ?>"
125 <?php
echo ' value="'.CAP_PREVENT
.'"';
126 if ($localpermission == CAP_PREVENT
) {echo ' checked="checked" ';}
127 if ($isdisabled) {echo ' disabled="disabled"';}?> />
130 <td class=
"prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
131 <input type
="radio" title
="<?php p($strprohibit); ?>" name
="<?php echo $capability->name; ?>"
132 <?php
echo ' value="'.CAP_PROHIBIT
.'"';
133 if ($localpermission == CAP_PROHIBIT
) {echo ' checked="checked" ';}
134 if ($isdisabled) {echo ' disabled="disabled"';}?> />
136 <?php echo $riskinfo; ?>
141 <div class=
"submit buttons">
142 <input type=
"submit" value=
"<?php print_string('savechanges') ?>" />
143 <input type
="submit" name
="cancel" value
="<?php print_string('cancel') ?>" />