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 if (component_level_changed($capability, $component, $contextlevel)) {
45 echo ('<tr class="rolecapheading header"><td colspan="10" class="header"><strong>'.get_component_string($capability->component
, $capability->contextlevel
).'</strong></td></tr>');
48 // these 2 are used to see to group same mod/core capabilities together
49 $contextlevel = $capability->contextlevel
;
50 $component = $capability->component
;
52 // check the capability override for this cap, this role in this context
53 if (isset($localoverrides[$capability->name
])) {
54 $localpermission = $localoverrides[$capability->name
]->permission
;
56 $localpermission = 0; // Just inherit
59 if (isset($r_caps[$capability->name
])) {
60 $isallow = $r_caps[$capability->name
] > 0;
61 $isprevent = $r_caps[$capability->name
] < 0 && $r_caps[$capability->name
] > -500;
62 $isprohibit = $r_caps[$capability->name
] <= -500;
69 $isdisabled = $isprohibit;
71 $riskinfo = '<td class="risk managetrust">';
73 if (RISK_MANAGETRUST
& (int)$capability->riskbitmask
) {
74 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskmanagetrust', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
75 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_managetrust.gif" alt="'.get_string('riskmanagetrustshort', 'admin').'" /></a>';
76 $rowclasses .= ' riskmanagetrust';
78 $riskinfo .= '</td><td class="risk config">';
79 if (RISK_CONFIG
& (int)$capability->riskbitmask
) {
80 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskconfig', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
81 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_config.gif" alt="'.get_string('riskconfigshort', 'admin').'" /></a>';
82 $rowclasses .= ' riskconfig';
84 $riskinfo .= '</td><td class="risk xss">';
85 if (RISK_XSS
& (int)$capability->riskbitmask
) {
86 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskxss', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
87 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_xss.gif" alt="'.get_string('riskxssshort', 'admin').'" /></a>';
88 $rowclasses .= ' riskxss';
90 $riskinfo .= '</td><td class="risk personal">';
91 if (RISK_PERSONAL
& (int)$capability->riskbitmask
) {
92 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskpersonal', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
93 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_personal.gif" alt="'.get_string('riskpersonalshort', 'admin').'" /></a>';
94 $rowclasses .= ' riskpersonal';
96 $riskinfo .= '</td><td class="risk spam">';
97 if (RISK_SPAM
& (int)$capability->riskbitmask
) {
98 $riskinfo .= '<a onclick="this.target=\'docspopup\'" title="'.get_string('riskspam', 'admin').'" href="'.$CFG->docroot
.'/'.$lang.'/'.$strrisks.'">';
99 $riskinfo .= '<img src="'.$CFG->pixpath
.'/i/risk_spam.gif" alt="'.get_string('riskspamshort', 'admin').'" /></a>';
100 $rowclasses .= ' riskspam';
102 $riskinfo .= '</td>';
107 <tr class=
"rolecap <?php echo $rowclasses; ?>">
108 <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>
111 <input type=
"radio" title=
"<?php p($strinherit); ?>" name
="<?php echo $capability->name; ?>" value
="0"
113 if ($localpermission == CAP_INHERIT
) {echo 'checked="checked" ';}
114 if ($isdisabled) {echo 'disabled="disabled"';}?> />
117 <td class=
"allow <?php if ($isallow) {echo ' capcurrent';} ?>">
118 <input type
="radio" title
="<?php p($strallow); ?>" name
="<?php echo $capability->name; ?>"
119 <?php
echo ' value="'.CAP_ALLOW
.'"';
120 if ($localpermission == CAP_ALLOW
) {echo ' checked="checked" ';}
121 if ($isdisabled) {echo ' disabled="disabled"';}?> />
124 <td class=
"prevent <?php if ($isprevent) {echo ' capcurrent';} ?>">
125 <input type
="radio" title
="<?php p($strprevent); ?>" name
="<?php echo $capability->name; ?>"
126 <?php
echo ' value="'.CAP_PREVENT
.'"';
127 if ($localpermission == CAP_PREVENT
) {echo ' checked="checked" ';}
128 if ($isdisabled) {echo ' disabled="disabled"';}?> />
131 <td class=
"prohibit <?php if ($isprohibit) {echo ' capcurrent';} ?>">
132 <input type
="radio" title
="<?php p($strprohibit); ?>" name
="<?php echo $capability->name; ?>"
133 <?php
echo ' value="'.CAP_PROHIBIT
.'"';
134 if ($localpermission == CAP_PROHIBIT
) {echo ' checked="checked" ';}
135 if ($isdisabled) {echo ' disabled="disabled"';}?> />
137 <?php echo $riskinfo; ?>
142 <div class=
"submit buttons">
143 <input type=
"submit" value=
"<?php print_string('savechanges') ?>" />
144 <input type
="submit" name
="cancel" value
="<?php print_string('cancel') ?>" />