本文整理汇总了PHP中build_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP build_pagination函数的具体用法?PHP build_pagination怎么用?PHP build_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_pagination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_webservice_log_search_results
/**
* Get results for log search with results containing markup/pagination
*
* @param object Contains:
* - userquery string
* - functionquery string
* - protocol string
* - authtype string
* - sortby string
* - sortdir string
* - offset int
* - limit int
* - onlyerrors string optional
* - institution string optional
* - institution_requested string optional
*
* @return array Contains search results markup/pagination
*/
function build_webservice_log_search_results($search)
{
global $THEME;
$THEME->templatedirs[] = get_config('docroot') . 'auth/webservice/theme/raw/';
$results = get_log_search_results($search);
$params = array();
foreach ($search as $k => $v) {
if (!empty($v)) {
$params[] = $k . '=' . $v;
}
}
$searchurl = get_config('wwwroot') . 'webservice/admin/webservicelogs.php?' . join('&', $params);
$pagination = $results['pagination'] = build_pagination(array('id' => 'admin_usersearch_pagination', 'class' => 'center', 'url' => $searchurl, 'count' => $results['count'], 'limit' => $search->limit, 'setlimit' => true, 'jumplinks' => 8, 'numbersincludeprevnext' => 2, 'offset' => $search->offset, 'datatable' => 'searchresults', 'jsonscript' => 'webservice/admin/logsearch.json.php'));
$cols = array('username' => array('name' => get_string('userauth', 'auth.webservice'), 'template' => 'auth:webservice:username.tpl', 'class' => 'center', 'sort' => true), 'institution' => array('name' => get_string('institution'), 'sort' => true), 'protocol' => array('name' => get_string('protocol', 'auth.webservice'), 'sort' => true), 'auth' => array('name' => get_string('authtype', 'auth.webservice'), 'sort' => true), 'functionname' => array('name' => get_string('function', 'auth.webservice'), 'sort' => true), 'timetaken' => array('name' => get_string('timetaken', 'auth.webservice'), 'sort' => true), 'timelogged' => array('name' => get_string('timelogged', 'auth.webservice'), 'sort' => true), 'info' => array('name' => get_string('info', 'auth.webservice'), 'class' => 'webservicelogs-info'));
$smarty = smarty_core();
$smarty->assign_by_ref('results', $results);
$smarty->assign_by_ref('institutions', $institutions);
$smarty->assign('searchurl', $searchurl);
$smarty->assign('sortby', $search->sortby);
$smarty->assign('sortdir', $search->sortdir);
$smarty->assign('limitoptions', array(10, 50, 100, 200, 500));
$smarty->assign('pagebaseurl', $searchurl . '&sortby=' . $search->sortby . '&sortdir=' . $search->sortdir);
$smarty->assign('cols', $cols);
return array($smarty->fetch('searchresulttable.tpl'), $cols, array('url' => $searchurl . '&sortby=' . $search->sortby . '&sortdir=' . $search->sortdir, 'sortby' => $search->sortby, 'sortdir' => $search->sortdir), $pagination);
}
示例2: render_items
/**
* This function renders a list of items as html
*
* @param array items
* @param string template
* @param array options
* @param array pagination
*/
public function render_items(&$items, $template, $options, $pagination)
{
$smarty = smarty_core();
$smarty->assign('options', $options);
$smarty->assign('items', $items['data']);
$items['tablerows'] = $smarty->fetch($template);
if ($items['limit'] && $pagination) {
$pagination = build_pagination(array('id' => $pagination['id'], 'class' => 'center', 'datatable' => $pagination['datatable'], 'url' => $pagination['baseurl'], 'jsonscript' => $pagination['jsonscript'], 'count' => $items['count'], 'limit' => $items['limit'], 'offset' => $items['offset'], 'numbersincludefirstlast' => false, 'resultcounttextsingular' => $pagination['resultcounttextsingular'] ? $pagination['resultcounttextsingular'] : get_string('result'), 'resultcounttextplural' => $pagination['resultcounttextplural'] ? $pagination['resultcounttextplural'] : get_string('results')));
$items['pagination'] = $pagination['html'];
$items['pagination_js'] = $pagination['javascript'];
}
}
示例3: build_myfriends_html
public static function build_myfriends_html(&$friends, $userid, BlockInstance $instance)
{
$friendarray = array_chunk($friends['data'], 4);
// get the friends into a 4x4 array
$smarty = smarty_core();
$smarty->assign_by_ref('friends', $friendarray);
$friends['tablerows'] = $smarty->fetch('blocktype:myfriends:myfriendrows.tpl');
if ($friends['limit'] === false) {
return;
}
$baseurl = $instance->get_view()->get_url() . '&block=' . $instance->get('id');
$baseurl .= '&user=' . (int) $userid;
$pagination = build_pagination(array('id' => 'userfriendstable_pagination', 'class' => 'center nojs-hidden-block', 'datatable' => 'userfriendstable', 'url' => $baseurl, 'jsonscript' => 'blocktype/myfriends/myfriends.json.php', 'count' => $friends['count'], 'limit' => $friends['limit'], 'offset' => $friends['offset'], 'numbersincludefirstlast' => false, 'resultcounttextsingular' => get_string('friend', 'group'), 'resultcounttextplural' => get_string('friends', 'group')));
$friends['pagination'] = $pagination['html'];
$friends['pagination_js'] = $pagination['javascript'];
}
示例4: group_get_membersearch_data
function group_get_membersearch_data($results, $group, $query, $membershiptype, $setlimit = false, $sortoption = '')
{
global $USER;
$params = array();
if ($query != '') {
$params['query'] = $query;
}
if (!empty($membershiptype)) {
$params['membershiptype'] = $membershiptype;
}
if (!empty($sortoption)) {
$params['sortoption'] = $sortoption;
}
$searchurl = get_config('wwwroot') . 'group/members.php?id=' . $group . (!empty($params) ? '&' . http_build_query($params) : '');
$smarty = smarty_core();
$role = group_user_access($group);
$userid = $USER->get('id');
foreach ($results['data'] as &$r) {
if ($role == 'admin' && ($r['id'] != $userid || group_user_can_leave($group, $r['id']))) {
$r['removeform'] = group_get_removeuser_form($r['id'], $group);
}
// NOTE: this is a quick approximation. We should really check whether,
// for each role in the group, that the user can change to it (using
// group_can_change_role). This only controls whether the 'change
// role' link appears though, so it doesn't matter too much. If the
// user clicks on this link, changerole.php does the full check and
// sends them back here saying that the user has no roles they can
// change to anyway.
$r['canchangerole'] = !group_is_only_admin($group, $r['id']);
}
if (!empty($membershiptype)) {
if ($membershiptype == 'request') {
foreach ($results['data'] as &$r) {
$r['addform'] = group_get_adduser_form($r['id'], $group);
$r['denyform'] = group_get_denyuser_form($r['id'], $group);
// TODO: this will suck when there's quite a few on the page,
// would be better to grab all the reasons in one go
$r['reason'] = get_field('group_member_request', 'reason', 'group', $group, 'member', $r['id']);
}
}
$smarty->assign('membershiptype', $membershiptype);
}
$results['cdata'] = array_chunk($results['data'], 2);
$results['roles'] = group_get_role_info($group);
$smarty->assign_by_ref('results', $results);
$smarty->assign('searchurl', $searchurl);
$smarty->assign('pagebaseurl', $searchurl);
$smarty->assign('caneditroles', group_user_access($group) == 'admin');
$smarty->assign('group', $group);
$html = $smarty->fetch('group/membersearchresults.tpl');
$pagination = build_pagination(array('id' => 'member_pagination', 'class' => 'center', 'url' => $searchurl, 'count' => $results['count'], 'setlimit' => $setlimit, 'limit' => $results['limit'], 'offset' => $results['offset'], 'jumplinks' => 8, 'numbersincludeprevnext' => 2, 'datatable' => 'membersearchresults', 'searchresultsheading' => 'searchresultsheading', 'jsonscript' => 'group/membersearchresults.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'resultcounttextsingular' => get_string('member', 'group'), 'resultcounttextplural' => get_string('members', 'group')));
return array($html, $pagination, $results['count'], $results['offset'], $membershiptype);
}
示例5: define
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configsite/siteviews');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'siteviews');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once get_config('libroot') . 'view.php';
require_once 'pieforms/pieform.php';
$limit = param_integer('limit', 5);
$offset = param_integer('offset', 0);
$title = get_string('siteviews', 'admin');
define('TITLE', $title);
$smarty = smarty();
$smarty->assign('heading', $title);
$data = View::get_myviews_data($limit, $offset, null, 'mahara');
$pagination = build_pagination(array('url' => get_config('wwwroot') . 'admin/site/views.php', 'count' => $data->count, 'limit' => $limit, 'offset' => $offset, 'resultcounttextsingular' => get_string('view', 'view'), 'resultcounttextplural' => get_string('views', 'view')));
$smarty->assign('views', $data->data);
$smarty->assign('institution', 'mahara');
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('createviewform', pieform(create_view_form(null, 'mahara')));
$smarty->assign('createtemplateform', pieform(create_template_form(null, 'mahara')));
$smarty->display('view/index.tpl');
示例6: array
$sortdir = $sort == 'lastchanged' || $sort == 'mtime' ? 'desc' : 'asc';
$share = $queryparams['share'] = $sharedefault = array('user', 'friend', 'group');
$shareoptions = array('user' => get_string('Me', 'view'), 'friend' => get_string('friends', 'view'), 'group' => get_string('mygroups'));
if ($USER->get('institutions')) {
$shareoptions['institution'] = get_string('myinstitutions', 'group');
}
$shareoptions['loggedin'] = get_string('loggedin', 'view');
if (get_config('allowpublicviews')) {
$shareoptions['public'] = get_string('public', 'view');
}
foreach ($shareoptions as $k => &$v) {
$v = array('title' => $v, 'value' => $k, 'defaultvalue' => in_array($k, $sharedefault));
}
$searchform = pieform(array('name' => 'search', 'checkdirtychange' => false, 'dieaftersubmit' => false, 'renderer' => 'div', 'class' => 'search', 'elements' => array('query' => array('type' => 'text', 'title' => get_string('Query') . ': ', 'class' => 'inline', 'defaultvalue' => $searchdefault), 'search' => array('type' => 'submit', 'class' => 'inline', 'value' => get_string('go')), 'advanced' => array('type' => 'fieldset', 'legend' => get_string('moreoptions', 'view'), 'class' => 'advanced', 'collapsible' => true, 'collapsed' => true, 'elements' => array('type' => array('type' => 'select', 'title' => get_string('searchwithin') . ': ', 'options' => $searchoptions, 'defaultvalue' => $searchtype), 'sort' => array('type' => 'select', 'title' => get_string('sortresultsby') . ' ', 'options' => $sortoptions, 'defaultvalue' => $sort), 'share' => array('type' => 'checkboxes', 'title' => get_string('sharedwith', 'view') . ': ', 'elements' => $shareoptions, 'labelwidth' => 0))))));
$data = View::shared_to_user($query, $tag, $limit, $offset, $sort, $sortdir, $share);
$pagination = build_pagination(array('id' => 'sharedviews_pagination', 'url' => get_config('wwwroot') . 'view/sharedviews.php' . (empty($queryparams) ? '' : '?' . http_build_query($queryparams)), 'jsonscript' => '/json/sharedviews.php', 'datatable' => 'sharedviewlist', 'count' => $data->count, 'limit' => $limit, 'offset' => $offset));
// GC OVERWRITE 2 - add create pages form for continuity
$createviewform = pieform(create_view_form());
// END GC OVERWRITE 2
$smarty = smarty(array('paginator'));
$smarty->assign('views', $data->data);
$smarty->assign('searchform', $searchform);
$smarty->assign('pagination', $pagination['html']);
// GC OVERWRITE 3 - send createviewform to template
$smarty->assign('createviewform', $createviewform);
// END GC OVERWRITE 3
$smarty->assign('INLINEJAVASCRIPT', 'addLoadEvent(function() {' . $pagination['javascript'] . '});');
$smarty->assign('PAGEHEADING', TITLE);
$smarty->display('view/sharedviews.tpl');
exit;
function search_submit(Pieform $form, $values)
示例7: render_profile_element
public function render_profile_element()
{
$data = self::get_social_profiles();
// Build pagination for 'socialprofile' artefacts table
$baseurl = get_config('wwwroot') . 'artefact/internal/index.php' . '?' . http_build_query(array('fs' => 'social'));
$count = count($data);
$limit = 500;
$offset = 0;
$pagination = build_pagination(array('id' => 'socialprofiles_pagination', 'url' => $baseurl, 'datatable' => 'socialprofilelist', 'count' => $count, 'limit' => $limit, 'offset' => $offset));
// User may delete social profile if:
// - there is more than 1 social profile and 'socialprofile' is a mandatory field.
// - 'socialprofile' is not mandatory.
$candelete = true;
$mandatory_fields = ArtefactTypeProfile::get_mandatory_fields();
if (isset($mandatory_fields['socialprofile']) && count($data) <= 1) {
$candelete = false;
}
$smarty = smarty_core();
$smarty->assign('controls', true);
$smarty->assign('rows', $data);
$smarty->assign('candelete', $candelete);
$smarty->assign('pagination', $pagination);
return array('type' => 'html', 'value' => $smarty->fetch('artefact:internal:socialprofiles.tpl'));
}
示例8: build_admin_archived_submissions_results
/**
* Returns the search results for the archived submissions
*
* @param array $search The parameters we want to search against
* @param int $offset What result to start showing paginated results from
* @param int $limit How many results to show
*
* @return array A data structure containing results (see top of file).
*/
function build_admin_archived_submissions_results($search, $offset, $limit)
{
global $USER;
$wantedparams = array('query', 'sortby', 'sortdir', 'institution');
$params = array();
foreach ($search as $k => $v) {
if (!in_array($k, $wantedparams)) {
continue;
}
if (!empty($v)) {
$params[] = $k . '=' . $v;
}
}
$searchurl = get_config('wwwroot') . 'admin/groups/archives.php?' . join('&', $params) . '&limit=' . $limit;
// Use get_admin_user_search_results() as it hooks into the same
// funky stuff the user search box query does on user/search.php page.
$search->archivedsubmissions = true;
$results = get_admin_user_search_results($search, $offset, $limit);
// Now that we have the users we need to do some last minute alterations
if (!empty($results['count'])) {
foreach ($results['data'] as $key => $data) {
// alter the archivectime to be human readable
$results['data'][$key]['archivectime'] = format_date($data['archivectime']);
// make sure the archive file is still on server at the path 'filepath' (not moved or deleted by server admin)
$results['data'][$key]['filemissing'] = !file_exists($data['filepath'] . $data['filename']) ? true : false;
// make the deleted group name more human readable
$results['data'][$key]['groupdeleted'] = false;
if (preg_match('/^(.*?)(\\.deleted\\.)(.*)$/', $data['submittedto'], $matches)) {
$results['data'][$key]['groupdeleted'] = true;
$results['data'][$key]['submittedto'] = $matches[1] . ' (' . get_string('deleted') . ' ' . format_date($matches[3]) . ')';
}
}
}
$pagination = build_pagination(array('id' => 'admin_exportqueue_pagination', 'class' => 'center', 'url' => $searchurl, 'count' => $results['count'], 'setlimit' => true, 'limit' => $limit, 'jumplinks' => 8, 'numbersincludeprevnext' => 2, 'offset' => $offset, 'datatable' => 'searchresults', 'searchresultsheading' => 'resultsheading', 'jsonscript' => 'admin/groups/archives.json.php'));
$cols = array('submittedto' => array('name' => get_string('submittedto', 'admin'), 'sort' => true, 'template' => 'admin/groups/submittedtocontentcolumn.tpl'), 'specialid' => array('name' => get_string('ID', 'admin'), 'sort' => true), 'icon' => array('template' => 'admin/users/searchiconcolumn.tpl', 'class' => 'center', 'accessible' => get_string('profileicon')), 'firstname' => array('name' => get_string('firstname'), 'sort' => true, 'template' => 'admin/users/searchfirstnamecolumn.tpl'), 'lastname' => array('name' => get_string('lastname'), 'sort' => true, 'template' => 'admin/users/searchlastnamecolumn.tpl'), 'preferredname' => array('name' => get_string('displayname'), 'sort' => true), 'username' => array('name' => get_string('username'), 'sort' => true, 'template' => 'admin/users/searchusernamecolumn.tpl'), 'filetitle' => array('name' => get_string('filenameleap', 'admin'), 'sort' => true, 'template' => 'admin/groups/leap2acontentcolumn.tpl'), 'archivectime' => array('name' => get_string('archivedon', 'admin'), 'sort' => true));
$smarty = smarty_core();
$smarty->assign_by_ref('results', $results);
$smarty->assign('USER', $USER);
$smarty->assign('limit', $limit);
$smarty->assign('limitoptions', array(10, 50, 100, 200, 500));
$smarty->assign('cols', $cols);
$smarty->assign('ncols', count($cols));
$html = $smarty->fetch('searchresulttable.tpl');
return array($html, $cols, $pagination, array('url' => $searchurl, 'sortby' => $search->sortby, 'sortdir' => $search->sortdir));
}
示例9: build_html
public static function build_html(&$data, $onview)
{
global $USER, $THEME;
$candelete = $data->canedit || $USER->get('admin');
$deletedmessage = array();
foreach (ArtefactTypeAnnotationfeedback::deleted_by_types_description() as $k => $v) {
$deletedmessage[$k] = get_string($v, 'artefact.annotation');
}
$authors = array();
$lastcomment = self::last_public_annotation_feedback($data->annotation, $data->view, $data->artefact);
$editableafter = time() - 60 * get_config_plugin('artefact', 'annotation', 'commenteditabletime');
foreach ($data->data as &$item) {
$isadminfeedback = $item->admin == 1 || $item->staff == 1 || $item->feedbackinstitutionadmin == 1 || $item->feedbackinstitutionstaff == 1;
$item->ts = strtotime($item->ctime);
$item->date = format_date($item->ts, 'strftimedatetime');
if ($item->ts < strtotime($item->lastcontentupdate)) {
$item->updated = format_date(strtotime($item->lastcontentupdate), 'strftimedatetime');
}
$item->isauthor = $item->author && $item->author == $USER->get('id');
if ($item->private) {
$item->pubmessage = get_string('annotationfeedbackisprivate', 'artefact.annotation');
}
if (isset($data->showcomment) && $data->showcomment == $item->id) {
$item->highlight = 1;
}
$is_export_preview = param_integer('export', 0);
if ($item->deletedby) {
$item->deletedmessage = $deletedmessage[$item->deletedby];
} else {
if (($candelete || $item->isauthor) && !$is_export_preview && !$isadminfeedback) {
// If the auther was admin/staff and not the owner of the annotation,
// the feedback can't be deleted.
$item->deleteform = pieform(self::delete_annotation_feedback_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
}
}
// Comment authors can edit recent comments if they're private or if no one has replied yet.
if (!$item->deletedby && $item->isauthor && !$is_export_preview && ($item->private || $item->id == $lastcomment->id) && $item->ts > $editableafter) {
$item->canedit = 1;
}
// Form to make private comment public, or request that a
// private comment be made public.
if (!$item->deletedby && $item->private && $item->author && $data->owner && ($item->isauthor || $data->isowner)) {
if (empty($item->requestpublic) && $data->isowner || $item->isauthor && $item->requestpublic == 'owner' || $data->isowner && $item->requestpublic == 'author') {
if (!$is_export_preview) {
$item->makepublicform = pieform(self::make_annotation_feedback_public_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
}
} else {
if ($item->isauthor && $item->requestpublic == 'author' || $data->isowner && $item->requestpublic == 'owner') {
$item->makepublicrequested = 1;
}
}
} else {
if (!$item->deletedby && $item->private && !$item->author && $data->owner && $data->isowner && $item->requestpublic == 'author' && !$is_export_preview) {
$item->makepublicform = pieform(self::make_annotation_feedback_public_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
} else {
if (!$item->deletedby && $item->private && !$data->owner && $item->group && $item->requestpublic == 'author') {
// no owner as comment is on a group view / artefact
if ($item->isauthor) {
$item->makepublicrequested = 1;
} else {
if ($data->artefact && $data->canedit || $data->view && $data->canedit && !$is_export_preview) {
$item->makepublicform = pieform(self::make_annotation_feedback_public_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
} else {
$item->makepublicrequested = 1;
}
}
}
}
}
if ($item->author) {
if (isset($authors[$item->author])) {
$item->author = $authors[$item->author];
} else {
$item->author = $authors[$item->author] = (object) array('id' => $item->author, 'username' => $item->username, 'firstname' => $item->firstname, 'lastname' => $item->lastname, 'preferredname' => $item->preferredname, 'email' => $item->email, 'staff' => $item->staff, 'admin' => $item->admin, 'deleted' => $item->deleted, 'profileicon' => $item->profileicon, 'profileurl' => profile_url($item->author));
}
}
}
$extradata = array('annotation' => $data->annotation, 'view' => $data->view, 'artefact' => !empty($data->artefact) ? $data->artefact : '', 'blockid' => $data->block);
$data->jsonscript = 'artefact/annotation/annotations.json.php';
$data->baseurl = get_config('wwwroot') . 'artefact/artefact.php?' . 'artefact=' . $data->annotation . '&view=' . $data->view . (isset($data->block) ? '&block=' . $data->block : '');
$smarty = smarty_core();
$smarty->assign_by_ref('data', $data->data);
$smarty->assign('canedit', $data->canedit);
$smarty->assign('viewid', $data->view);
$smarty->assign('position', $data->position);
$smarty->assign('baseurl', $data->baseurl);
$data->tablerows = $smarty->fetch('artefact:annotation:annotationlist.tpl');
$pagination = build_pagination(array('id' => 'annotationfeedback_pagination_' . $data->block, 'class' => 'center', 'url' => $data->baseurl, 'jsonscript' => $data->jsonscript, 'datatable' => 'annotationfeedbacktable_' . $data->block, 'count' => $data->count, 'limit' => $data->limit, 'offset' => $data->offset, 'forceoffset' => isset($data->forceoffset) ? $data->forceoffset : null, 'resultcounttextsingular' => get_string('annotation', 'artefact.annotation'), 'resultcounttextplural' => get_string('annotations', 'artefact.annotation'), 'extradata' => $extradata));
$data->pagination = $pagination['html'];
$data->pagination_js = $pagination['javascript'];
}
示例10: define
* @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');
示例11: build_results_html
/**
* Builds the "results" table seen on the universal search results page
* @param unknown_type $data
*/
public static function build_results_html(&$data)
{
$smarty = smarty_core();
$smarty->assign('data', isset($data['data']) ? $data['data'] : null);
$params = array();
if (isset($data['query'])) {
$params['query'] = $data['query'];
}
if (isset($data['selected'])) {
$params['mainfacetterm'] = $data['selected'];
}
if (isset($data['content-filter-selected'])) {
$params['secfacetterm'] = $data['content-filter-selected'];
}
if (isset($data['owner-filter-selected'])) {
$params['owner'] = $data['owner-filter-selected'];
}
if (isset($data['tagsonly'])) {
$params['tagsonly'] = $data['tagsonly'];
}
if (isset($data['sort'])) {
$params['sort'] = $data['sort'];
}
if (isset($data['license'])) {
$params['license'] = $data['license'];
}
if (!isset($data['count'])) {
$data['count'] = 0;
}
if (!isset($data['limit'])) {
$data['limit'] = 0;
}
if (!isset($data['offset'])) {
$data['offset'] = 0;
}
$smarty->assign('offset', $data['offset']);
$resultcounttextsingular = get_string('record', 'search.elasticsearch');
$resultcounttextplural = get_string('records', 'search.elasticsearch');
if (isset($data['facets'])) {
$smarty->assign('facets', $data['facets']);
}
if (isset($data['content-filter'])) {
$smarty->assign('contentfilter', $data['content-filter']);
}
if (isset($data['content-filter-selected'])) {
$smarty->assign('contentfilterselected', $data['content-filter-selected']);
}
if (isset($data['owner-filter'])) {
$smarty->assign('ownerfilter', $data['owner-filter']);
}
if (isset($data['owner-filter-selected'])) {
$smarty->assign('owner', $data['owner-filter-selected']);
}
if (isset($data['tagsonly'])) {
$smarty->assign('tagsonly', $data['tagsonly']);
}
if (isset($data['selected'])) {
$smarty->assign('selected', $data['selected']);
}
if (isset($data['sort'])) {
$smarty->assign('sort', $data['sort']);
}
if (isset($data['limit'])) {
$smarty->assign('limit', $data['limit']);
}
if (isset($data['offset'])) {
$smarty->assign('offset', $data['offset']);
}
if (isset($data['license'])) {
$smarty->assign('license', $data['license']);
}
if (isset($data['totalresults'])) {
$smarty->assign('totalresults', $data['totalresults']);
}
// Only show licence if Text or Media tab is selected and license metadata site config is set
if (isset($data['license_on']) && isset($data['license_options']) && isset($data['selected']) && ($data['selected'] == 'Media' || $data['selected'] == 'Text')) {
$smarty->assign('license_on', $data['license_on']);
$smarty->assign('license_options', $data['license_options']);
}
if (isset($data['type'])) {
$smarty->assign('type', $data['type']);
}
$smarty->assign('query', $params['query']);
$data['tablerows'] = $smarty->fetch('Search:elasticsearch:searchresults.tpl');
$pagination = build_pagination(array('id' => 'elasticsearch_pagination', 'url' => get_config('wwwroot') . 'search/elasticsearch/index.php?' . http_build_query($params), 'jsonscript' => 'search/elasticsearch/json/elasticsearch.php', 'datatable' => 'universalsearchresult', 'count' => $data['count'], 'setlimit' => $data['limit'], 'limit' => $data['limit'], 'offset' => $data['offset'], 'jumplinks' => 6, 'numbersincludeprevnext' => 2, 'resultcounttextsingular' => $resultcounttextsingular, 'resultcounttextplural' => $resultcounttextplural, 'extradata' => array('page' => 'index')));
$data['pagination'] = $pagination['html'];
$data['pagination_js'] = $pagination['javascript'];
}
示例12: get_templatesearch_data
public static function get_templatesearch_data(&$search)
{
require_once get_config('libroot') . 'pieforms/pieform.php';
$results = self::view_search($search->query, $search->ownerquery, null, $search->copyableby, $search->limit, $search->offset, true);
foreach ($results->data as &$r) {
$r['form'] = pieform(create_view_form($search->copyableby->group, $search->copyableby->institution, $r['id']));
}
$params = array();
if (!empty($search->query)) {
$params[] = 'viewquery=' . $search->query;
}
if (!empty($search->ownerquery)) {
$params[] = 'ownerquery=' . $search->query;
}
if (!empty($search->group)) {
$params[] = 'group=' . $search->group;
}
if (!empty($search->institution)) {
$params[] = 'institution=' . $search->institution;
}
$params[] = 'viewlimit=' . $search->limit;
$smarty = smarty_core();
$smarty->assign_by_ref('results', $results->data);
$search->html = $smarty->fetch('view/templatesearchresults.tpl');
$search->count = $results->count;
$search->pagination = build_pagination(array('id' => 'templatesearch_pagination', 'class' => 'center', 'url' => get_config('wwwroot') . 'view/choosetemplate.php?' . join('&', $params), 'count' => $results->count, 'limit' => $search->limit, 'offset' => $search->offset, 'offsetname' => 'viewoffset', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'resultcounttextsingular' => get_string('view', 'view'), 'resultcounttextplural' => get_string('views', 'view')));
}
示例13: dirname
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'skin.php';
require_once 'pieforms/pieform.php';
define('TITLE', get_string('myskins', 'skin'));
if (!can_use_skins()) {
throw new FeatureNotEnabledException();
}
$filter = param_alpha('filter', 'all');
$limit = param_integer('limit', 6);
// For 2x3 grid, showing thumbnails of view skins (2 rows with 3 thumbs each).
$offset = param_integer('offset', 0);
$metadata = param_integer('metadata', null);
$id = param_integer('id', null);
$data = Skin::get_myskins_data($limit, $offset, $filter);
$form = pieform(array('name' => 'filter', 'method' => 'post', 'renderer' => 'div', 'class' => 'form-inline with-heading', 'elements' => array('inputgroup' => array('type' => 'fieldset', 'title' => get_string('filter'), 'class' => 'input-group', 'elements' => array('options' => array('type' => 'select', 'defaultvalue' => $filter, 'options' => array('all' => get_string('allskins', 'skin'), 'site' => get_string('siteskins', 'skin'), 'user' => get_string('userskins', 'skin'), 'public' => get_string('publicskins', 'skin'))), 'submit' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-primary input-group-btn', 'value' => '<span class="icon icon-filter prs"></span>' . get_string('filter')))))));
$pagination = build_pagination(array('url' => get_config('wwwroot') . 'skin/index.php?filter=' . $filter, 'count' => $data->count, 'limit' => $limit, 'offset' => $offset, 'resultcounttextsingular' => get_string('skin', 'skin'), 'resultcounttextplural' => get_string('skins', 'skin')));
$css = array('<link rel="stylesheet" type="text/css" href="' . $THEME->get_url('style/skin.css') . '">');
$smarty = smarty(array(), $css);
$smarty->assign('skins', $data->data);
$smarty->assign('user', $USER->get('id'));
$smarty->assign('form', $form);
$smarty->assign('id', $id);
$smarty->assign('metadata', $metadata);
$smarty->assign('filter', $filter);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->display('skin/index.tpl');
function filter_submit(Pieform $form, $values)
{
redirect('/skin/index.php?filter=' . $values['options']);
}
示例14: get_records_sql_assoc
$groupids[] = $group->id;
}
$groups['data'] = get_records_sql_assoc("SELECT g1.id, g1.name, g1.description, g1.jointype, g1.membershiptype, g1.membercount, COUNT(gmr.member) AS requests\n FROM (\n SELECT g.id, g.name, g.description, g.jointype, t.membershiptype, COUNT(gm.member) AS membercount\n FROM {group} g\n LEFT JOIN {group_member} gm ON (gm.group = g.id)\n LEFT JOIN (\n SELECT g.id, 'admin' AS membershiptype\n FROM {group} g\n INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')\n UNION\n SELECT g.id, 'member' AS membershiptype\n FROM {group} g\n INNER JOIN {group_member} gm ON (g.id = gm.group AND gm.member = ? AND gm.role != 'admin')\n UNION\n SELECT g.id, 'invite' AS membershiptype\n FROM {group} g\n INNER JOIN {group_member_invite} gmi ON (gmi.group = g.id AND gmi.member = ?)\n UNION\n SELECT g.id, 'request' AS membershiptype\n FROM {group} g\n INNER JOIN {group_member_request} gmr ON (gmr.group = g.id AND gmr.member = ?)\n ) t ON t.id = g.id\n WHERE g.id IN (" . implode($groupids, ',') . ')
GROUP BY g.id, g.name, g.description, g.jointype, t.membershiptype
ORDER BY g.name
) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.jointype, g1.membershiptype, g1.membercount', array($USER->get('id'), $USER->get('id'), $USER->get('id'), $USER->get('id')));
if ($groups['data']) {
// Get 3 members from each group in a separate query -- mysql doesn't like including them as subqueries with limit 1 in the above query
$members = get_records_sql_array("\n SELECT m1.group, m1.member, u.* FROM {group_member} m1\n INNER JOIN {usr} u ON (m1.member = u.id AND u.deleted = 0)\n WHERE 3 > (\n SELECT COUNT(m2.member)\n FROM {group_member} m2\n WHERE m1.group = m2.group AND m2.member < m1.member\n )\n AND m1.group IN (" . implode($groupids, ',') . ')', array());
if ($members) {
foreach ($members as $m) {
$groups['data'][$m->group]->members[] = (object) array('id' => $m->id, 'name' => display_name($m));
}
}
}
$groups['data'] = array_values($groups['data']);
}
group_prepare_usergroups_for_display($groups['data'], 'find');
$pagination = build_pagination(array('url' => get_config('wwwroot') . 'group/find.php?filter=' . $filter . '&query=' . $query, 'count' => $groups['count'], 'limit' => $groupsperpage, 'offset' => $offset, 'resultcounttextsingular' => get_string('group', 'group'), 'resultcounttextplural' => get_string('groups', 'group')));
function search_submit(Pieform $form, $values)
{
redirect('/group/find.php?filter=' . $values['filter'] . (isset($values['query']) ? '&query=' . urlencode($values['query']) : ''));
}
$smarty = smarty();
$smarty->assign('heading', TITLE);
$smarty->assign('form', $searchform);
$smarty->assign('groups', $groups['data']);
$smarty->assign('pagination', $pagination['html']);
$smarty->display('group/find.tpl');
示例15: define
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);
}
if (!empty($institutionname) && $institutionname != 'mahara') {
$smarty->assign('institution', $institutionname);
$smarty->assign('institutionselector', $s['institutionselector']);
$smarty->assign('INLINEJAVASCRIPT', $s['institutionselectorjs']);
}
if ($subsectionheading) {
$smarty->assign('subsectionheading', $subsectionheading);