Commit f320b394 authored by Nigel McNie's avatar Nigel McNie
Browse files

Fix up mahara_pagelinks plugin so admin user search pagination works.


Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent 3204dbfd
<?php <?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/** /**
* Creates pagination links for a table * Dwoo {mahara_pagelinks} function pluging
*
* appends an 'offset=n' parameter to the url to get the url for a different page * appends an 'offset=n' parameter to the url to get the url for a different page
* @param integer $limit number of items per page * @param integer $limit number of items per page
* @param integer $offset offset of first data item on this page * @param integer $offset offset of first data item on this page
* @param integer $count total number of items * @param integer $count total number of items
* @param string $url where to get results from * @param string $url where to get results from
* @param string $assign the template var to assign the result to
* @return string * @return string
* *
* THIS IS DEPRECATED. The build_pagelinks function in lib/mahara.php should be * THIS IS DEPRECATED. Pagination is done differently almost everywhere else
* used instead. * (e.g. find friends). One place this is being used is the admin user search.
* One place this is being used is the admin user search. Hopefully that can be * Hopefully that can be converted away soon.
* converted away soon.
*/ */
function smarty_function_mahara_pagelinks($params, &$smarty) { function Dwoo_Plugin_mahara_pagelinks(Dwoo $dwoo, $offset, $limit, $count, $url, $assign='') {
$params = array(
'offset' => $offset,
'limit' => $limit,
'count' => $count,
'url' => $url,
'assign' => $assign,
);
$id = substr(md5(microtime()), 0, 4); $id = substr(md5(microtime()), 0, 4);
$output = '<div class="pagination" id="' . $id . '">'; $output = '<div class="pagination" id="' . $id . '">';
...@@ -111,7 +113,7 @@ EOF; ...@@ -111,7 +113,7 @@ EOF;
$output .= '</div>'; $output .= '</div>';
if (!empty($params['assign'])) { if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $output); $dwoo->assignInScope($output, $params['assign']);
return; return;
} }
......
Supports Markdown
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