Commit eef76074 authored by jerome's avatar jerome
Browse files

repository MDL-15404 display instance number into the administration

parent b8aa76c1
......@@ -51,6 +51,8 @@ $string['keyword'] = 'Keyword';
$string['instance'] = 'instance';
$string['instancedeleted'] = 'Instance deleted';
$string['instances'] = 'Repository instances';
$string['instancesforadmin'] = 'common instance(s)';
$string['instancesforothers'] = 'private instance(s)';
$string['invalidrepositoryid'] = 'Invalid repository ID';
$string['invalidplugin'] = 'Invalid repository $a plug-in';
$string['invalidjson'] = 'Invalid JSON string';
......
......@@ -4698,9 +4698,24 @@ class admin_setting_managerepository extends admin_setting {
//display edit link only if you can config the type or if it has multiple instances (e.g. has instance config)
$typeoptionnames = repository::static_function($i->get_typename(), 'get_type_option_names');
$instanceoptionnames = repository::static_function($i->get_typename(), 'get_instance_option_names');
if ( !empty($typeoptionnames) || !empty($instanceoptionnames)) {
//calculate number of instances in order to display them for the Moodle administrator
if (!empty($instanceoptionnames)) {
$admininstancenumber = count(repository::static_function($i->get_typename(), 'get_instances', array(get_context_instance(CONTEXT_SYSTEM)),null,false,$i->get_typename()));
$admininstancenumbertext = " <br/> ". $admininstancenumber .
" " . get_string('instancesforadmin', 'repository');
$instancenumber = count(repository::static_function($i->get_typename(), 'get_instances', array(),null,false,$i->get_typename())) - $admininstancenumber;
$instancenumbertext = "<br/>" . $instancenumber .
" " . get_string('instancesforothers', 'repository');
} else {
$admininstancenumbertext = "";
$instancenumbertext = "";
}
$settings .= '<a href="' . $this->baseurl . '&amp;edit=' . $i->get_typename() . '">'
. $settingsstr .'</a>' . "\n";
. $settingsstr .'</a>' . $admininstancenumbertext . $instancenumbertext . "\n";
}
$delete = '<a href="' . $this->baseurl . '&amp;delete=' . $i->get_typename() . '">'
. $deletestr . '</a>' . "\n";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment