MDL-24210, make site/course/private repositories more clear

This commit is contained in:
Dongsheng Cai 2010-09-21 10:09:14 +00:00
parent 4461a18e73
commit 47fffd8d60
2 changed files with 35 additions and 7 deletions

View File

@ -103,8 +103,9 @@ $string['iconview'] = 'View as icons';
$string['instance'] = 'instance';
$string['instancedeleted'] = 'Instance deleted';
$string['instances'] = 'Repository instances';
$string['instancesforadmin'] = 'common instance(s)';
$string['instancesforothers'] = 'private instance(s)';
$string['instancesforsite'] = '{$a} Site-wide common instance(s)';
$string['instancesforcourses'] = '{$a} Course-wide common instance(s)';
$string['instancesforusers'] = '{$a} User private instance(s)';
$string['invalidjson'] = 'Invalid JSON string';
$string['invalidplugin'] = 'Invalid repository {$a} plug-in';
$string['invalidfiletype'] = '{$a} filetype cannot be accepted.';

View File

@ -6303,16 +6303,43 @@ class admin_setting_managerepository extends admin_setting {
$params['onlyvisible'] = false;
$params['type'] = $typename;
$admininstancenumber = count(repository::static_function($typename, 'get_instances', $params));
$admininstancenumbertext = " <br/> ". $admininstancenumber . " " . get_string('instancesforadmin', 'repository');
// site instances
$admininstancenumbertext = get_string('instancesforsite', 'repository', $admininstancenumber);
$params['context'] = array();
$instancenumber = count(repository::static_function($typename, 'get_instances', $params)) - $admininstancenumber;
$instancenumbertext = "<br/>" . $instancenumber . " " . get_string('instancesforothers', 'repository');
$instances = repository::static_function($typename, 'get_instances', $params);
$courseinstances = array();
$userinstances = array();
foreach ($instances as $instance) {
if ($instance->context->contextlevel == CONTEXT_COURSE) {
$courseinstances[] = $instance;
} else if ($instance->context->contextlevel == CONTEXT_USER) {
$userinstances[] = $instance;
}
}
// course instances
$instancenumber = count($courseinstances);
$courseinstancenumbertext = get_string('instancesforcourses', 'repository', $instancenumber);
// user private instances
$instancenumber = count($userinstances);
$userinstancenumbertext = get_string('instancesforusers', 'repository', $instancenumber);
} else {
$admininstancenumbertext = "";
$instancenumbertext = "";
$courseinstancenumbertext = "";
$userinstancenumbertext = "";
}
$settings .= '<a href="' . $this->baseurl . '&amp;action=edit&amp;repos=' . $typename . '">' . $settingsstr .'</a>' . $admininstancenumbertext . $instancenumbertext . "\n";
$settings .= '<a href="' . $this->baseurl . '&amp;action=edit&amp;repos=' . $typename . '">' . $settingsstr .'</a>';
$settings .= $OUTPUT->container_start('mdl-left');
$settings .= '<br/>';
$settings .= $admininstancenumbertext;
$settings .= '<br/>';
$settings .= $courseinstancenumbertext;
$settings .= '<br/>';
$settings .= $userinstancenumbertext;
$settings .= $OUTPUT->container_end();
}
// Get the current visibility
if ($i->get_visible()) {