Commit d76d7816 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix myplans pagination url after first ajax call


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 91021e3e
......@@ -46,20 +46,20 @@ class PluginBlocktypePlans extends PluginBlocktype {
safe_require('artefact','plans');
$plans = ArtefactTypePlan::get_plans();
self::build_plans_html($plans, $editing);
self::build_plans_html($plans, $editing, $instance);
$smarty = smarty_core();
$smarty->assign('plans', $plans);
return $smarty->fetch('blocktype:plans:content.tpl');
}
public static function build_plans_html(&$plans, $editing=false) {
public static function build_plans_html(&$plans, $editing=false, BlockInstance $instance) {
$smarty = smarty_core();
$smarty->assign_by_ref('plans', $plans);
$plans['tablerows'] = $smarty->fetch('blocktype:plans:planrows.tpl');
if ($editing) {
return;
}
$baseurl = $_SERVER['REQUEST_URI'];
$baseurl = $instance->get_view()->get_url() . '&block=' . $instance->get('id');
$pagination = build_pagination(array(
'id' => 'planstable_pagination',
'class' => 'center nojs-hidden-block',
......
......@@ -35,8 +35,9 @@ require_once(get_config('docroot') . 'artefact/plans/blocktype/plans/lib.php');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$bi = new BlockInstance(param_integer('block'));
$plans = ArtefactTypePlan::get_plans($offset, $limit);
PluginBlocktypePlans::build_plans_html($plans);
PluginBlocktypePlans::build_plans_html($plans, false, $bi);
json_reply(false, (object) array('message' => false, 'data' => $plans));
......@@ -2970,6 +2970,19 @@ class View {
}
/**
* Makes a URL for a view page
*/
public function get_url() {
if ($this->type == 'profile') {
$url = 'user/view.php?id=' . (int) $this->owner;
}
else {
$url = 'view/view.php?id=' . (int) $this->id;
}
return get_config('wwwroot') . $url;
}
/**
* Get all view access records relevant to a user
......
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