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
3f160dbc
Commit
3f160dbc
authored
Sep 08, 2009
by
Richard Mansfield
Browse files
List view tags on my views page
Signed-off-by:
Richard Mansfield
<
richardm@catalyst.net.nz
>
parent
22661edc
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/smarty/mahara/function.list_tags.php
0 → 100644
View file @
3f160dbc
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {list_tags} function plugin
*
* Type: function<br>
* Name: str<br>
* Date: June 22, 2006<br>
* Purpose: Render a list of tags
* @author Catalyst IT Ltd
* @version 1.0
* @param array
* @param Smarty
* @return Internationalized string
*/
function
smarty_function_list_tags
(
$params
,
&
$smarty
)
{
if
(
empty
(
$params
[
'tags'
])
||
!
is_array
(
$params
[
'tags'
]))
{
return
''
;
}
if
(
empty
(
$params
[
'owntags'
]))
{
return
join
(
', '
,
array_map
(
'hsc'
,
$params
[
'tags'
]));
}
foreach
(
$params
[
'tags'
]
as
&
$t
)
{
$t
=
'<a class="tag" href="'
.
get_config
(
'wwwroot'
)
.
'tags.php?tag='
.
urlencode
(
$t
)
.
'">'
.
hsc
(
$t
)
.
'</a>'
;
}
return
join
(
', '
,
$params
[
'tags'
]);
}
?>
htdocs/lib/view.php
View file @
3f160dbc
...
...
@@ -1788,6 +1788,7 @@ class View {
WHERE view in ('
.
$viewidlist
.
')
ORDER BY view, accesstype, grouptype, role, name, id
'
,
array
());
$tags
=
get_records_select_array
(
'view_tag'
,
'view IN ('
.
$viewidlist
.
')'
);
}
$data
=
array
();
...
...
@@ -1853,6 +1854,11 @@ class View {
);
}
}
if
(
$tags
)
{
foreach
(
$tags
as
$tag
)
{
$data
[
$index
[
$tag
->
view
]][
'tags'
][]
=
$tag
->
tag
;
}
}
}
return
(
object
)
array
(
...
...
htdocs/theme/raw/templates/view/index.tpl
View file @
3f160dbc
...
...
@@ -30,6 +30,9 @@
<h4><a
href=
"
{
$WWWROOT
}
view/edit.php?id=
{
$view.id
}
"
id=
"editviewdetails"
>
{
str
tag
=
"editviewnameanddescription"
section
=
"view"
}
</a></h4>
{
if
$view.description
}
<div
class=
"videsc"
>
{
$view.description
}
</div>
{/
if
}
{
if
$view.tags
}
<div
class=
"tags"
>
{
str
tag
=
tags
}
:
{
list_tags
owntags
=
true
tags
=
$view.tags
}
</div>
{/
if
}
</div>
<div
class=
"vi"
>
...
...
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