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
20f58600
Commit
20f58600
authored
Jun 23, 2009
by
Richard Mansfield
Browse files
Allow views with a type of portfolio or profile to appear in view listings
parent
c28081db
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/blocktype/myviews/lib.php
View file @
20f58600
...
...
@@ -58,7 +58,7 @@ class PluginBlocktypeMyviews extends SystemBlocktype {
// Get viewable views
$views
=
array
();
if
(
$allviews
=
get_records_select_array
(
'view'
,
'owner = ? AND type = ?'
,
array
(
$userid
,
'p
ortfolio
'
)))
{
if
(
$allviews
=
get_records_select_array
(
'view'
,
'owner = ? AND type
!
= ?'
,
array
(
$userid
,
'p
rofile
'
)))
{
foreach
(
$allviews
as
$view
)
{
if
(
can_view_view
(
$view
->
id
))
{
$views
[
$view
->
id
]
=
$view
;
...
...
htdocs/lib/mahara.php
View file @
20f58600
...
...
@@ -1515,11 +1515,10 @@ function get_view_from_token($token, $visible=true) {
* @param array $users users to fetch views owned by
* @param int $userlooking (optional, defaults to logged in user)
* @param int $limit grab this many views. (setting this null means get all)
* @param string $type the type of views to return
*
* @return array Associative array keyed by userid, of arrays of view ids
*/
function
get_views
(
$users
,
$userlooking
=
null
,
$limit
=
5
,
$type
=
'portfolio'
)
{
function
get_views
(
$users
,
$userlooking
=
null
,
$limit
=
5
,
$type
=
null
)
{
$userlooking
=
optional_userid
(
$userlooking
);
if
(
is_int
(
$users
))
{
$users
=
array
(
$users
);
...
...
@@ -1552,8 +1551,10 @@ function get_views($users, $userlooking=null, $limit=5, $type='portfolio') {
}
}
$typesql
=
''
;
if
(
$type
!=
null
)
{
if
(
is_null
(
$type
))
{
$typesql
=
"AND v.type != 'profile'"
;
}
else
{
$typesql
=
'AND v.type = '
.
db_quote
(
$type
);
}
...
...
htdocs/lib/view.php
View file @
20f58600
...
...
@@ -1711,14 +1711,14 @@ class View {
ORDER BY v.title, v.id'
,
array
(
$institution
),
$offset
,
$limit
);
}
else
{
$count
=
count_records
(
'view'
,
'owner
'
,
$userid
,
'type'
,
'portfolio'
);
$count
=
count_records
_select
(
'view'
,
'owner
= ? AND type != ?'
,
array
(
$userid
,
'profile'
)
);
$viewdata
=
get_records_sql_array
(
'SELECT v.id,v.title,v.startdate,v.stopdate,v.description, v.template,
g.id AS submitgroupid, g.name AS submitgroupname, h.wwwroot AS submithostwwwroot, h.name AS submithostname
FROM {view} v
LEFT OUTER JOIN {group} g ON (v.submittedgroup = g.id AND g.deleted = 0)
LEFT OUTER JOIN {host} h ON (v.submittedhost = h.wwwroot)
WHERE v.owner = '
.
$userid
.
'
AND v.type = \'p
ortfolio
\'
AND v.type
!
= \'p
rofile
\'
ORDER BY v.title, v.id'
,
''
,
$offset
,
$limit
);
}
...
...
Write
Preview
Markdown
is supported
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