Skip to content
GitLab
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
7a43ff77
Commit
7a43ff77
authored
Aug 27, 2010
by
Richard Mansfield
Browse files
Group views by collection in html export view summary (bug #617125)
Signed-off-by:
Richard Mansfield
<
richardm@catalyst.net.nz
>
parent
cf6eab67
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/export/html/lib.php
View file @
7a43ff77
...
...
@@ -177,6 +177,22 @@ class PluginExportHtml extends PluginExport {
}
}
// Views in collections
if
(
!
$this
->
exportingoneview
&&
$this
->
collections
)
{
$viewlist
=
join
(
','
,
array_keys
(
$this
->
views
));
$collectionlist
=
join
(
','
,
array_keys
(
$this
->
collections
));
$records
=
get_records_select_array
(
'collection_view'
,
"view IN (
$viewlist
) AND collection IN (
$collectionlist
)"
);
if
(
$records
)
{
foreach
(
$records
as
&
$r
)
{
$this
->
collectionview
[
$r
->
collection
][]
=
$r
->
view
;
$this
->
viewcollection
[
$r
->
view
]
=
$r
->
collection
;
}
}
}
// Get the view data
$this
->
notify_progress_callback
(
55
,
get_string
(
'exportingviews'
,
'export'
));
$this
->
dump_view_export_data
();
...
...
@@ -345,25 +361,43 @@ class PluginExportHtml extends PluginExport {
private
function
get_view_summary
()
{
$smarty
=
$this
->
get_smarty
(
'../'
);
$views
=
array
();
foreach
(
$this
->
views
as
$view
)
{
$list
=
array
();
foreach
(
$this
->
collections
as
$id
=>
$collection
)
{
$list
[
'c'
.
$id
]
=
array
(
'title'
=>
$collection
->
get
(
'name'
),
'views'
=>
array
(),
);
}
$nviews
=
0
;
foreach
(
$this
->
views
as
$id
=>
$view
)
{
if
(
$view
->
get
(
'type'
)
!=
'profile'
)
{
$
views
[]
=
array
(
$
item
=
array
(
'title'
=>
$view
->
get
(
'title'
),
'folder'
=>
self
::
text_to_path
(
$view
->
get
(
'title'
)),
);
if
(
isset
(
$this
->
viewcollection
[
$id
]))
{
$list
[
'c'
.
$this
->
viewcollection
[
$id
]][
'views'
][]
=
$item
;
}
else
{
$list
[
$id
]
=
$item
;
}
$nviews
++
;
}
}
function
sort_by_title
(
$a
,
$b
)
{
return
strnatcasecmp
(
$a
[
'title'
],
$b
[
'title'
]);
}
usort
(
$views
,
'sort_by_title'
);
$smarty
->
assign
(
'views'
,
$views
);
foreach
(
array_keys
(
$this
->
collections
)
as
$id
)
{
usort
(
$list
[
'c'
.
$id
][
'views'
],
'sort_by_title'
);
}
usort
(
$list
,
'sort_by_title'
);
$smarty
->
assign
(
'list'
,
$list
);
if
(
$
views
)
{
$stryouhaveviews
=
(
count
(
$views
)
==
1
)
if
(
$
list
)
{
$stryouhaveviews
=
(
$
n
views
==
1
)
?
get_string
(
'youhaveoneview'
,
'view'
)
:
get_string
(
'youhaveviews'
,
'view'
,
count
(
$views
)
)
;
:
get_string
(
'youhaveviews'
,
'view'
,
$
n
views
);
}
else
{
$stryouhaveviews
=
get_string
(
'youhavenoviews'
,
'view'
);
...
...
htdocs/export/html/theme/raw/viewsummary.tpl
View file @
7a43ff77
<p>
{
$stryouhaveviews
}
</p>
<ul>
{
foreach
from
=
$views
item
=
view
}
<li><a
href=
"views/
{
$view.folder
}
/index.html"
>
{
$view.title
}
</a></li>
{
foreach
from
=
$list
item
=
item
}
{
if
$item.folder
}
<li><a
href=
"views/
{
$item.folder
}
/index.html"
>
{
$item.title
}
</a></li>
{
elseif
$item.views
}
<li>
{
$item.title
}
<ul>
{
foreach
from
=
$item.views
item
=
view
}
<li><a
href=
"views/
{
$view.folder
}
/index.html"
>
{
$view.title
}
</a></li>
{/
foreach
}
</ul>
</li>
{/
if
}
{/
foreach
}
</ul>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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