Commit 80858bc8 authored by Robert Lyon's avatar Robert Lyon

Bug 1515484: Fix the portfolio page list pagination to use json

This is 3 of 6 patches to standardize pagination

behatnotneeded

Change-Id: I4c563a83ee70b24fc0111fe200a3b2d4514b9590
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent c4d63db6
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('libroot') . 'view.php');
require_once('pieforms/pieform.php');
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 0);
$setlimit = param_boolean('setlimit', false);
list($searchform, $data, $pagination) = View::views_by_owner();
$smarty = smarty_core();
$smarty->assign('views', $data->data);
$smarty->assign('querystring', get_querystring());
$html = $smarty->fetch('view/indexresults.tpl');
json_reply(false, array(
'message' => null,
'data' => array(
'tablerows' => $html,
'pagination' => $pagination['html'],
'pagination_js' => $pagination['javascript'],
'count' => $data->count,
'results' => $data->count . ' ' . ($data->count == 1 ? get_string('result') : get_string('results')),
'offset' => $offset,
'query' => (param_variable('query', null)),
'setlimit' => $setlimit,
)
));
......@@ -3788,6 +3788,8 @@ class View {
'limit' => $limit,
'setlimit' => $setlimit,
'offset' => $offset,
'datatable' => 'myviews',
'jsonscript' => 'json/viewlist.php',
'jumplinks' => 6,
'numbersincludeprevnext' => 2,
));
......
......@@ -21,56 +21,7 @@
<h2 id="searchresultsheading" class="panel-heading">{str tag=Results}</h2>
{if $views}
<div id="myviews" class="list-group">
{foreach from=$views item=view}
<div class="list-group-item {if $view.submittedto} list-group-item-warning {/if}">
{if !$view.issitetemplate}
<a href="{$view.fullurl}" class="outer-link"><span class="sr-only">{$view.displaytitle}</span></a>
{/if}
<div class="row">
<div class="col-md-9">
<h3 class="title list-group-item-heading">
{$view.displaytitle}
</h3>
{if $view.submittedto}
<div class="detail submitted-viewitem">{$view.submittedto|clean_html|safe}</div>
{elseif $view.type == 'profile'}
<div class="detail">{str tag=profiledescription}</div>
{elseif $view.type == 'dashboard'}
<div class="detail">{str tag=dashboarddescription}</div>
{elseif $view.type == 'grouphomepage'}
<div class="detail">{str tag=grouphomepagedescription section=view}</div>
{elseif $view.description}
<div class="detail">
{if $view.owner == 0 && $view.type == 'portfolio'}
{$view.description|strip_tags|safe}
{else}
{$view.description|str_shorten_html:110:true|strip_tags|safe}
{/if}
</div>
{/if}
</div>
<div class="col-md-3">
<div class="inner-link btn-action-list">
<div class="btn-top-right btn-group btn-group-top">
{if !$view.submittedto && (!$view.locked || $editlocked)}
<a href="{$WWWROOT}view/blocks.php?id={$view.id}&{$querystring}" title="{str tag ="editcontentandlayout" section="view"}" class="btn btn-default btn-xs">
<span class="icon icon-pencil icon-lg"></span>
<span class="sr-only">{str(tag=editspecific arg1=$view.displaytitle)|escape:html|safe}</span>
</a>
{/if}
{if !$view.submittedto && $view.removable && (!$view.locked || $editlocked)}
<a href="{$WWWROOT}view/delete.php?id={$view.id}&{$querystring}" title="{str tag=deletethisview section=view}" class="btn btn-default btn-xs">
<span class="icon icon-lg icon-trash text-danger"></span>
<span class="sr-only">{str(tag=deletespecific arg1=$view.displaytitle)|escape:html|safe}</span>
</a>
{/if}
</div>
</div>{* rbuttons *}
</div>
</div>
</div>
{/foreach}
{$viewresults|safe}
</div>
{else}
<div class="no-results">
......
{foreach from=$views item=view}
<div class="list-group-item {if $view.submittedto} list-group-item-warning {/if}">
{if !$view.issitetemplate}
<a href="{$view.fullurl}" class="outer-link"><span class="sr-only">{$view.displaytitle}</span></a>
{/if}
<div class="row">
<div class="col-md-9">
<h3 class="title list-group-item-heading">
{$view.displaytitle}
</h3>
{if $view.submittedto}
<div class="detail submitted-viewitem">{$view.submittedto|clean_html|safe}</div>
{elseif $view.type == 'profile'}
<div class="detail">{str tag=profiledescription}</div>
{elseif $view.type == 'dashboard'}
<div class="detail">{str tag=dashboarddescription}</div>
{elseif $view.type == 'grouphomepage'}
<div class="detail">{str tag=grouphomepagedescription section=view}</div>
{elseif $view.description}
<div class="detail">
{if $view.owner == 0 && $view.type == 'portfolio'}
{$view.description|strip_tags|safe}
{else}
{$view.description|str_shorten_html:110:true|strip_tags|safe}
{/if}
</div>
{/if}
</div>
<div class="col-md-3">
<div class="inner-link btn-action-list">
<div class="btn-top-right btn-group btn-group-top">
{if !$view.submittedto && (!$view.locked || $editlocked)}
<a href="{$WWWROOT}view/blocks.php?id={$view.id}&{$querystring}" title="{str tag ="editcontentandlayout" section="view"}" class="btn btn-default btn-xs">
<span class="icon icon-pencil icon-lg"></span>
<span class="sr-only">{str(tag=editspecific arg1=$view.displaytitle)|escape:html|safe}</span>
</a>
{/if}
{if !$view.submittedto && $view.removable && (!$view.locked || $editlocked)}
<a href="{$WWWROOT}view/delete.php?id={$view.id}&{$querystring}" title="{str tag=deletethisview section=view}" class="btn btn-default btn-xs">
<span class="icon icon-lg icon-trash text-danger"></span>
<span class="sr-only">{str(tag=deletespecific arg1=$view.displaytitle)|escape:html|safe}</span>
</a>
{/if}
</div>
</div>{* rbuttons *}
</div>
</div>
</div>
{/foreach}
......@@ -52,11 +52,13 @@ $createviewform = pieform(create_view_form());
$smarty = smarty(array('paginator'));
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('views', $data->data);
$smarty->assign('querystring', get_querystring());
$html = $smarty->fetch('view/indexresults.tpl');
$smarty->assign('viewresults', $html);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('headingclass', 'page-header');
$smarty->assign('query', param_variable('query', null));
$smarty->assign('querystring', get_querystring());
$smarty->assign('searchform', $searchform);
$smarty->assign('createviewform', $createviewform);
$smarty->display('view/index.tpl');
Markdown is supported
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