Commit 6ff93088 authored by Aaron Wells's avatar Aaron Wells

Add collections to "My pages" block (Bug 1476492)

Change-Id: I0d56152566ac9ca3e2a13c4404ba6841756fe344
parent c2a427e2
......@@ -76,7 +76,23 @@ class PluginBlocktypeMyviews extends SystemBlocktype {
$smarty = smarty_core();
// Get viewable views
$views = View::view_search(null, null, (object) array('owner' => $userid), null, 10, 0, true, null, array('portfolio'));
$views = View::view_search(
null, // $query
null, // $ownerquery
(object) array('owner' => $userid), // $ownedby
null, // $copyableby
10, // $limit
0, // $offset
true, // $extra
null, // $sort
array('portfolio'), // $types
null, // $collection
null, // $accesstypes
null, // $tag
null, // $viewid
null, // $excludeowner
true // $groupbycollection
);
$views = (array)$views;
$viewid = $instance->get_view()->get('id');
$baseurl = $instance->get_view()->get_url();
......
......@@ -32,7 +32,23 @@ if (!can_view_view($dashboard)) {
json_reply(true, get_string('accessdenied', 'error'));
}
$views = View::view_search(null, null, (object) array('owner' => $dashboard->get('owner')), null, 10, $offset, true, null, array('portfolio'));
$views = View::view_search(
null, // $query
null, // $ownerquery
(object) array('owner' => $userid), // $ownedby
null, // $copyableby
10, // $limit
$offset, // $offset
true, // $extra
null, // $sort
array('portfolio'), // $types
null, // $collection
null, // $accesstypes
null, // $tag
null, // $viewid
null, // $excludeowner
true // $groupbycollection
);
$views = (array)$views;
$baseurl = $dashboard->get_url();
$baseurl .= (strpos($baseurl, '?') === false ? '?' : '&') . 'view=' . $viewid . '&editing=' . $editing;
......
{foreach from=$items item=view}
<div class="{cycle values='r0,r1'} list-group-item">
<h4 class="title list-group-item-heading"><a href="{$view.fullurl}">{$view.title}</a></h4>
<h4 class="title list-group-item-heading"><a href="{$view.fullurl}">{$view.title}</a>{if $view.collid} ({str tag=nviews section=view arg1=$view.numpages}){/if}</h4>
{if $view.description}
<div class="detail list-group-item-text">{$view.description|str_shorten_html:100:true|strip_tags|safe}</div>
{/if}
......
@javascript @blocktype @blocktype_myviews
Feature: The "My pages" block
In order to be able to see a list of my pages and collections on my dashboard
Background:
Given the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| userA | Password1 | test01@example.com | Pete | Mc | mahara | internal | member |
And the following "pages" exist:
| title | description| ownertype | ownername |
| P1A | page P1A | user | userA |
| P1B | page P1B | user | userA |
| P2 | page P2 | user | userA |
And the following "collections" exist:
| title | description| ownertype | ownername | pages |
| C1 | collection C1 | user | userA | P1A, P1B |
Scenario: Testing that views & collections are collated properly in the "My pages" block
Given I log in as "userA" with password "Password1"
# I should see collections & individual pages
Then I should see "C1 (2 pages)" in the "div.bt-myviews" "css_element"
And I should see "page P2" in the "div.bt-myviews" "css_element"
And I should not see "page P1A" in the "div.bt-myviews" "css_element"
\ No newline at end of file
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