$string['confirmremove'] = 'Are you sure you want to remove this repository plugin and <strong style=color:red>all of its instances</strong> - $a?';
$string['create'] = 'Create';
$string['createrepository'] = 'Create a repository instance';
+$string['createinstance'] = 'Create a repository instance';
$string['date'] = 'Date';
$string['deleterepository'] = 'Delete this repository';
$string['deleted'] = 'Repository deleted';
$string['filenotnull'] = 'You must select a file to upload.';
$string['filesaved'] = 'The file has been saved';
$string['getfile'] = 'Select this file';
+$string['hiddenshow'] = 'Hide/Show';
$string['instance'] = 'instance';
$string['instancedeleted'] = 'Instance deleted';
$string['instances'] = 'Repository instances';
$string['settings'] = 'Settings';
$string['search'] = 'Search ';
$string['searching'] = 'What are you searching for?';
+$string['siteinstances'] = 'Repositories instances of the site';
$string['size'] = 'Size';
$string['submit'] = 'Submit';
$string['sync'] = 'Sync';
global $CFG, $USER;
$output = print_box_start('generalbox','',true);
$namestr = get_string('name');
- $stropt = get_string('operation', 'repository');
- $updown = get_string('updown', 'repository');
+ $settingsstr = get_string('settings');
+ $updownstr = get_string('updown', 'repository');
+ $hiddenstr = get_string('hiddenshow', 'repository');
+ $deletestr = get_string('delete');
$plugins = get_list_of_plugins('repository');
$instances = repository_get_types();
$instancesnumber = count($instances);
$alreadyplugins = array();
$table = new StdClass;
- $table->head = array($namestr, $updown, $stropt);
- $table->align = array('left', 'center', 'center');
+ $table->head = array($namestr, $updownstr, $hiddenstr, $deletestr, $settingsstr);
+ $table->align = array('left', 'center', 'center','center','center');
$table->data = array();
$updowncount=1;
foreach ($instances as $i) {
- $row = '';
+ $settings = '';
//display edit link only if you can config the type or its instances
if ( repository_static_function($i->get_typename(), 'has_admin_config')
|| repository_static_function($i->get_typename(), 'has_instance_config')
|| repository_static_function($i->get_typename(), 'has_multiple_instances')) {
- $row .= '<a href="' . $this->baseurl . '&edit=' . $i->get_typename() . '"><img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . get_string('edit') . '" /></a>' . "\n";
+ $settings .= '<a href="' . $this->baseurl . '&edit=' . $i->get_typename() . '">'. $settingsstr .'</a>' . "\n";
}
- $row .= '<a href="' . $this->baseurl . '&delete=' . $i->get_typename() . '"><img src="' . $CFG->pixpath . '/t/delete.gif" alt="' . get_string('delete') . '" /></a>' . "\n";
- $row .= ' <a href="' . $this->baseurl . '&hide=' . $i->get_typename() . '"><img src="' . $CFG->pixpath . '/t/' . ($i->get_visible() ? 'hide' : 'show') . '.gif" alt="' . get_string($i->get_visible() ? 'hide' : 'show') . '" /></a>' . "\n";
+ $delete = '<a href="' . $this->baseurl . '&delete=' . $i->get_typename() . '">' . $deletestr . '</a>' . "\n";
+
+ $hiddenshow = ' <a href="' . $this->baseurl . '&hide=' . $i->get_typename() . '"><img src="' . $CFG->pixpath . '/i/' . ($i->get_visible() ? 'hide' : 'show') . '.gif" alt="' . get_string($i->get_visible() ? 'hide' : 'show') . '" /></a>' . "\n";
// display up/down link
$updown = '';
$updowncount++;
- $table->data[] = array($i->get_readablename(), $updown,$row);
+ $table->data[] = array($i->get_readablename(), $updown, $hiddenshow, $delete, $settings);
//display a grey row if the type is defined as not visible
if (!$i->get_visible()){
$mform =& $this->_form;
$strrequired = get_string('required');
-
+
$mform->addElement('hidden', 'edit', ($this->instance) ? $this->instance->get_typename() : 0);
$mform->addElement('hidden', 'new', $this->plugin);
$mform->addElement('hidden', 'plugin', $this->plugin);
}
$output = print_simple_box_start(true);
- $output .= "<div ><h2 style='text-align: center'>" . get_string('instances', 'repository') . "</h2></div>";
+
+ if ($admin) {
+ $output .= "<div ><h2 style='text-align: center'>" . get_string('siteinstances', 'repository') . " ";
+ }
+ $output .= "</h2></div>";
$namestr = get_string('name');
$pluginstr = get_string('plugin', 'repository');
- $stropt = get_string('operation', 'repository');
+ $settingsstr = get_string('settings');
+ $deletestr = get_string('delete');
$updown = get_string('updown', 'repository');
$plugins = get_list_of_plugins('repository');
//retrieve list of instances. In administration context we want to display all
$instancesnumber = count($instances);
$alreadyplugins = array();
$table = new StdClass;
- $table->head = array($namestr, $pluginstr, $stropt);
- $table->align = array('left', 'left', 'center');
+ $table->head = array($namestr, $pluginstr, $deletestr, $settingsstr);
+ $table->align = array('left', 'left', 'center','center');
$table->data = array();
$updowncount=1;
foreach ($instances as $i) {
- $row = '';
- $row .= '<a href="' . $baseurl . '&type='.$typename.'&edit=' . $i->id . '"><img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . get_string('edit') . '" /></a>' . "\n";
- $row .= '<a href="' . $baseurl . '&type='.$typename.'&delete=' . $i->id . '"><img src="' . $CFG->pixpath . '/t/delete.gif" alt="' . get_string('delete') . '" /></a>' . "\n";
- //$row .= ' <a href="' . $baseurl . '&type='.$typename.'&hide=' . $i->id . '"><img src="' . $CFG->pixpath . '/t/' . ($i->visible ? 'hide' : 'show') . '.gif" alt="' . get_string($i->visible ? 'hide' : 'show') . '" /></a>' . "\n";
+ $settings = '';
+ $settings .= '<a href="' . $baseurl . '&type='.$typename.'&edit=' . $i->id . '">' . $settingsstr . '</a>' . "\n";
+ $delete = '<a href="' . $baseurl . '&type='.$typename.'&delete=' . $i->id . '">' . $deletestr . '</a>' . "\n";
+
+ $table->data[] = array($i->name, $type->get_readablename(), $delete, $settings);
+
- $table->data[] = array($i->name, $type->get_readablename(),$row);
//display a grey row if the type is defined as not visible
if (isset($type) && !$type->get_visible()){
$table->rowclass[] = 'dimmed_text';
}
}
$output .= print_table($table, true);
- $instancehtml = '<div><h3>';
- $addable = 0;
- $instancehtml .= get_string('createrepository', 'repository');
- $instancehtml .= '</h3><ul>';
+ $instancehtml = '<div>';
$addable = 0;
//if no type is set, we can create all type of instance
if (!$typename) {
+ $instancehtml .= '<h3>';
+ $instancehtml .= get_string('createrepository', 'repository');
+ $instancehtml .= '</h3><ul>';
foreach ($plugins as $p) {
if (!in_array($p, $alreadyplugins)) {
if (repository_static_function($p->get_typename(), 'has_multiple_instances')){
}
}
}
+ $instancehtml .= '</ul>';
}
//create a unique type of instance
else {
if (repository_static_function($typename, 'has_multiple_instances')){
$addable = 1;
- $instancehtml .= '<li><a href="'.$baseurl.'&new='.$typename.'">'.get_string('create', 'repository')
- .' "'.get_string('repositoryname', 'repository_'.$typename).'" '
- .get_string('instance', 'repository').'</a></li>';
+ $instancehtml .= "<form action='".$baseurl."&new=".$typename."' method='post'>
+ <p style='text-align:center'><input type='submit' value='".get_string('createinstance', 'repository')."'/></p>
+ </form>";
}
}
- $instancehtml .= '</ul>';
+
if ($addable) {
$instancehtml .= '</div>';