} define('SUBTITLE', ''); $urlparams['institution'] = $institutionname; } else { define('MENUITEM', 'myportfolio/collection'); $owner = $USER->get('id'); $canedit = true; define('SUBTITLE', ''); define('TITLE', get_string('Collections', 'collection')); } } $baseurl = get_config('wwwroot') . 'collection/index.php'; if ($urlparams) { $baseurl .= '?' . http_build_query($urlparams); } $data = Collection::get_mycollections_data($offset, $limit, $owner, $groupid, $institutionname); foreach ($data->data as $value) { $collection = new Collection($value->id); $views = $collection->get('views'); if (!empty($views)) { $value->views = $views['views']; } } $pagination = build_pagination(array('id' => 'collectionslist_pagination', 'class' => 'center', 'url' => $baseurl, 'count' => $data->count, 'limit' => $data->limit, 'offset' => $data->offset, 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'resultcounttextsingular' => get_string('collection', 'collection'), 'resultcounttextplural' => get_string('collections', 'collection'))); $smarty = smarty(array('paginator'), array(), array(), array('PAGEICON' => $pageIcon)); $urlparamsstr = ''; if ($urlparams) { $urlparamsstr = '&' . http_build_query($urlparams); } if ($canedit) { $smarty->assign('addonelink', get_config('wwwroot') . 'collection/edit.php?new=1' . $urlparamsstr);
function get_views_for_user($username, $query = null) { global $REMOTEWWWROOT, $USER; list($user, $authinstance) = find_remote_user($username, $REMOTEWWWROOT); if (!$user) { return false; } $USER->reanimate($user->id, $authinstance->instanceid); require_once 'view.php'; $data = View::view_search($query, null, (object) array('owner' => $USER->get('id')), null, null, 0, true, null, null, true); require_once 'collection.php'; $data->collections = Collection::get_mycollections_data(0, 0, $USER->get('id')); foreach ($data->collections->data as $c) { $cobj = new Collection($c->id); if ($c->numviews > 0) { $c->url = $cobj->get_url(); } else { $c->url = ''; } } $data->displayname = display_name($user); return $data; }
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); define('MENUITEM', 'myportfolio/collection'); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'collection'); define('SECTION_PAGE', 'index'); require dirname(dirname(__FILE__)) . '/init.php'; require_once 'pieforms/pieform.php'; require_once 'collection.php'; define('TITLE', get_string('mycollections', 'collection')); // offset and limit for pagination $offset = param_integer('offset', 0); $limit = param_integer('limit', 5); $data = Collection::get_mycollections_data($offset, $limit); foreach ($data->data as $value) { $collection = new Collection($value->id); $views = $collection->get('views'); if (!empty($views)) { $value->views = $views['views']; } } $pagination = build_pagination(array('id' => 'collectionslist_pagination', 'class' => 'center', 'url' => get_config('wwwroot') . 'collection/index.php', 'jsonscript' => 'collection/collections.json.php', 'datatable' => 'collectionslist', 'count' => $data->count, 'limit' => $data->limit, 'offset' => $data->offset, 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'resultcounttextsingular' => get_string('collection', 'collection'), 'resultcounttextplural' => get_string('collections', 'collection'))); $smarty = smarty(array('paginator')); $smarty->assign('collections', $data->data); $smarty->assign('pagination', $pagination['html']); $smarty->assign('strnocollectionsaddone', get_string('nocollectionsaddone', 'collection', '<a href="' . get_config('wwwroot') . 'collection/edit.php?new=1">', '</a>')); $smarty->assign('PAGEHEADING', hsc(get_string('mycollections', 'collection'))); $smarty->display('collection/index.tpl');