Skip to content
Snippets Groups Projects
Commit 24844c10 authored by Matt Petro's avatar Matt Petro
Browse files

Merging missing capability fix from trunk

parents fd8447fc 0dc2c119
Branches main
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
* UW Madison Services Block
*
* Display roster to Moodle associations and course information.
*
*
* Author: Nick Koeppen
******************************************************************************/
class block_uwservices extends block_list {
......@@ -15,14 +15,14 @@ class block_uwservices extends block_list {
// Default case: the block can be used in courses and site index, but not in activities
return array('all' => true, 'site' => true);
}
function has_config() {
return true;
}
function get_content() {
global $USER, $OUTPUT;
if ($this->content !== NULL) {
return $this->content;
}
......@@ -41,32 +41,32 @@ class block_uwservices extends block_list {
$uwservices = array();
$uwservices[] = array(
'service' => 'MyUW',
'relayurl' => 'https://my.wisc.edu/portal',
'relayurl' => 'https://my.wisc.edu/portal',
'icon_name' => 'myuw');
$uwservices[] = array(
'service' => 'WiscMail',
'relayurl' => 'https://wiscmail.wisc.edu',
'relayurl' => 'https://wiscmail.wisc.edu',
'icon_name' => 'wiscmail');
$domain = strstr($USER->email,'@');
if($domain != "@wisc.edu"){
$uwservices[] = array(
'service' => 'WiscMailPlus',
'relayurl' => 'https://wiscmail.wisc.edu/mailplus/',
'relayurl' => 'https://wiscmail.wisc.edu/mailplus/',
'icon_name' => 'wiscmailplus');
}
$uwservices[] = array(
'service' => 'WiscCal',
'relayurl' => 'http://webcal.services.wisc.edu',
'relayurl' => 'http://webcal.services.wisc.edu',
'icon_name' => 'wisccal');
$uwservices[] = array(
'service' => 'Learn@UW',
'relayurl' => 'http://learnuw.wisc.edu',
'icon_name' => 'learnuw');
'relayurl' => 'http://learnuw.wisc.edu',
'icon_name' => 'learnuw');
$uwservices[] = array(
'service' => 'GoogleDocs',
'relayurl' => 'http://docs.google.com/a/wisc.edu',
'relayurl' => 'http://docs.google.com/a/wisc.edu',
'icon_name' => 'googledocs');
/* Determine origin of settings */
$config = get_config('blocks/uwservices');
if(!$config->sitesettings){
......@@ -76,12 +76,12 @@ class block_uwservices extends block_list {
if(!isset($config)){
$config->display = "text";
}
/* Display links */
$target = 'target=\"_new\"'; //Link target
foreach ($uwservices as $s) {
$link = "<a ".$target.". title=\"".$s['service']."\" href=\"".$s['relayurl']."\">&nbsp;";
/* Add icons if not text only */
if($config->display != "text"){
if($config->display == "both"){
......@@ -94,13 +94,13 @@ class block_uwservices extends block_list {
$link .= '<img src="'.$url.'" alt="'.$s['service'].'" />';
}
}
/* Add text if not only icons */
if($config->display != "icons"){
$link .= $s['service'];
}
$link .= '</a>';
$this->content->items[] = $link;
}
......
......@@ -25,7 +25,15 @@
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'block/uwservices:myaddinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/uwservices:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment