Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
6ff93088
Commit
6ff93088
authored
Jul 21, 2015
by
Aaron Wells
Browse files
Add collections to "My pages" block (Bug 1476492)
Change-Id: I0d56152566ac9ca3e2a13c4404ba6841756fe344
parent
c2a427e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/blocktype/myviews/lib.php
View file @
6ff93088
...
...
@@ -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
();
...
...
htdocs/blocktype/myviews/myviews.json.php
View file @
6ff93088
...
...
@@ -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
;
...
...
htdocs/theme/raw/plugintype/blocktype/myviews/templates/myviewspaginator.tpl
View file @
6ff93088
{
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
}
...
...
test/behat/features/blocktype/myviews.feature
0 → 100644
View file @
6ff93088
@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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment