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
cafa2f50
Commit
cafa2f50
authored
Dec 17, 2010
by
Richard Mansfield
Browse files
Remove some queries no longer needed by my views page
Signed-off-by:
Richard Mansfield
<
richard.mansfield@catalyst.net.nz
>
parent
1c319312
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/view.php
View file @
cafa2f50
...
...
@@ -2291,7 +2291,7 @@ class View {
if
(
$groupid
)
{
$count
=
count_records
(
'view'
,
'group'
,
$groupid
);
$viewdata
=
get_records_sql_array
(
'SELECT v.id,v.title,v.
startdate,v.stopdate,v.description, v.template,
v.type
$viewdata
=
get_records_sql_array
(
'SELECT v.id,v.title,v.
description,
v.type
FROM {view} v
WHERE v.group = ?
'
.
(
group_user_access
(
$groupid
)
!=
'admin'
?
' AND v.type != \'grouphomepage\''
:
''
)
.
'
...
...
@@ -2299,14 +2299,14 @@ class View {
}
else
if
(
$institution
)
{
$count
=
count_records
(
'view'
,
'institution'
,
$institution
);
$viewdata
=
get_records_sql_array
(
'SELECT v.id,v.title,v.
startdate,v.stopdate,v.description, v.template,
v.type
$viewdata
=
get_records_sql_array
(
'SELECT v.id,v.title,v.
description,
v.type
FROM {view} v
WHERE v.institution = ?
ORDER BY v.title, v.id'
,
array
(
$institution
),
$offset
,
$limit
);
}
else
{
$count
=
count_records_select
(
'view'
,
'owner = ?'
,
array
(
$userid
));
$viewdata
=
get_records_sql_array
(
'SELECT v.id,v.title,v.
startdate,v.stopdate,v.description, v.template,
v.type,
v.submittedtime,
$viewdata
=
get_records_sql_array
(
'SELECT v.id,v.title,v.
description,
v.type,v.submittedtime,
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)
...
...
@@ -2316,24 +2316,6 @@ class View {
$owner
=
$userid
;
}
if
(
$viewdata
)
{
$viewidlist
=
implode
(
', '
,
array_map
(
create_function
(
'$a'
,
'return (int)$a->id;'
),
$viewdata
));
$artefacts
=
get_records_sql_array
(
'SELECT va.view, va.artefact, a.title, a.artefacttype, t.plugin
FROM {view_artefact} va
INNER JOIN {artefact} a ON va.artefact = a.id
INNER JOIN {artefact_installed_type} t ON a.artefacttype = t.name
WHERE va.view IN ('
.
$viewidlist
.
')
GROUP BY va.view, va.artefact, a.title, a.artefacttype, t.plugin
ORDER BY a.title, va.artefact'
,
''
);
$tags
=
get_records_select_array
(
'view_tag'
,
'"view" IN ('
.
$viewidlist
.
')'
);
$collections
=
get_records_sql_array
(
'
SELECT c.name, c.id, cv.view
FROM {collection} c JOIN {collection_view} cv ON c.id = cv.collection
WHERE cv.view IN ('
.
$viewidlist
.
')'
,
array
()
);
}
$data
=
array
();
if
(
$viewdata
)
{
for
(
$i
=
0
;
$i
<
count
(
$viewdata
);
$i
++
)
{
...
...
@@ -2374,39 +2356,6 @@ class View {
);
}
}
$data
[
$i
][
'artefacts'
]
=
array
();
$data
[
$i
][
'template'
]
=
$viewdata
[
$i
]
->
template
;
}
// Go through all the artefact records and put them in with the
// views they belong to.
if
(
$artefacts
)
{
foreach
(
$artefacts
as
$artefactrec
)
{
safe_require
(
'artefact'
,
$artefactrec
->
plugin
);
// Perhaps I shouldn't have to construct the entire
// artefact object to render the name properly.
$classname
=
generate_artefact_class_name
(
$artefactrec
->
artefacttype
);
$artefactobj
=
new
$classname
(
0
,
array
(
'title'
=>
$artefactrec
->
title
));
$artefactobj
->
set
(
'dirty'
,
false
);
if
(
!
$artefactobj
->
in_view_list
())
{
continue
;
}
$artname
=
$artefactobj
->
display_title
(
30
);
if
(
strlen
(
$artname
))
{
$data
[
$index
[
$artefactrec
->
view
]][
'artefacts'
][]
=
array
(
'id'
=>
$artefactrec
->
artefact
,
'title'
=>
$artname
);
}
}
}
if
(
$tags
)
{
foreach
(
$tags
as
$tag
)
{
$data
[
$index
[
$tag
->
view
]][
'tags'
][]
=
$tag
->
tag
;
}
}
if
(
$collections
)
{
foreach
(
$collections
as
$c
)
{
$data
[
$index
[
$c
->
view
]][
'collection'
]
=
$c
;
}
}
}
...
...
htdocs/view/index.php
View file @
cafa2f50
...
...
@@ -45,16 +45,6 @@ $data = View::get_myviews_data($limit, $offset);
$userid
=
$USER
->
get
(
'id'
);
/* Get a list of groups that the user belongs to which views can
be submitted. */
$tutorgroupdata
=
group_get_user_course_groups
();
foreach
(
$data
->
data
as
&
$view
)
{
if
(
$view
[
'type'
]
==
'portfolio'
&&
$tutorgroupdata
&&
empty
(
$view
[
'submittedto'
]))
{
$view
[
'submitto'
]
=
view_group_submission_form
(
$view
[
'id'
],
$tutorgroupdata
);
}
}
$pagination
=
build_pagination
(
array
(
'url'
=>
get_config
(
'wwwroot'
)
.
'view/'
,
'count'
=>
$data
->
count
,
...
...
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