get('configdata'); if (!isset($configdata['showsharedcollections'])) { $configdata['showsharedcollections'] = 1; } $limit = isset($configdata['count']) ? intval($configdata['count']) : 5; $limit = ($limit > 0) ? $limit : 5; // Find out what order to sort them by (default is titles) if (!isset($configdata['sortsharedviewsby']) || $configdata['sortsharedviewsby'] == PluginBlocktypeGroupViews::SORTBY_TITLE) { $sortsharedcollectionsby = array(array('type' => 'name')); } else { $sortsharedcollectionsby = array( array( 'type' => 'lastchanged', 'desc' => true ) ); } // For group members, display a list of collections that others have // shared to the group $hidesubmitted = group_user_can_assess_submitted_views($groupid, $USER->get('id')); if (empty($configdata['showsharedcollections'])) { $sharedcollections = array( 'data' => array(), 'count' => 0, 'limit' => $limit, 'offset' => 0 ); } else { $sharedcollections = (array) View::get_sharedcollections_data( $limit, $offset, $groupid, ($configdata['showsharedcollections'] == 2 ? false : true), $sortsharedcollectionsby, $hidesubmitted ); } if (!empty($configdata['showsharedcollections'])) { $baseurl = $group_homepage_view->get_url(); $baseurl .= (strpos($baseurl, '?') === false ? '?' : '&') . 'group=' . $groupid . '&editing=' . $editing; $pagination = array( 'baseurl' => $baseurl, 'id' => 'sharedcollections_pagination', 'datatable' => 'sharedcollectionlist', 'jsonscript' => 'blocktype/groupviews/sharedcollections.json.php', 'resultcounttextsingular' => get_string('collection', 'collection'), 'resultcounttextplural' => get_string('collections', 'collection'), ); PluginBlocktypeGroupViews::render_items($sharedcollections, 'blocktype:groupviews:sharedviews.tpl', $configdata, $pagination); } json_reply(false, array('data' => $sharedcollections));