Commit 9b5b4549 authored by Son Nguyen's avatar Son Nguyen
Browse files

Enable Navigation block for group, institution and site collections


(Bug #886080)

Change-Id: I49b245f7dbe0cf6ccf8240c39ebea7d2f7e122ef
Signed-off-by: default avatarSon Nguyen <son.nguyen@catalyst.net.nz>
parent 168bebdf
......@@ -81,12 +81,24 @@ class PluginBlocktypeNavigation extends SystemBlocktype {
public static function instance_config_form($instance) {
$configdata = $instance->get('configdata');
$userid = $instance->get_view()->get('owner');
$view = $instance->get_view();
$groupid = $view->get('group');
$institutionid = $view->get('institution');
$userid = $view->get('owner');
if (!empty($groupid)) {
$where = 'c.group = ?'; $values = array($groupid);
}
else if (!empty($institutionid)) {
$where = 'c.institution = ?'; $values = array($institutionid);
}
else {
$where = 'c.owner = ?'; $values = array($userid);
}
($collections = get_records_sql_array("
SELECT c.id, c.name
FROM {collection} c
WHERE c.owner = ?
ORDER BY c.name, c.ctime ASC", array($userid)))
WHERE " . $where . "
ORDER BY c.name, c.ctime ASC", $values))
|| ($collections = array());
$default = false;
......@@ -126,11 +138,4 @@ class PluginBlocktypeNavigation extends SystemBlocktype {
return 'full';
}
/**
* Navigation only makes sense for personal views
*/
public static function allowed_in_view(View $view) {
return $view->get('owner') != null;
}
}
Markdown is supported
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