Commit 3f160dbc authored by Richard Mansfield's avatar Richard Mansfield
Browse files

List view tags on my views page


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 22661edc
<?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']);
}
?>
...@@ -1788,6 +1788,7 @@ class View { ...@@ -1788,6 +1788,7 @@ class View {
WHERE view in (' . $viewidlist . ') WHERE view in (' . $viewidlist . ')
ORDER BY view, accesstype, grouptype, role, name, id ORDER BY view, accesstype, grouptype, role, name, id
', array()); ', array());
$tags = get_records_select_array('view_tag', 'view IN (' . $viewidlist . ')');
} }
$data = array(); $data = array();
...@@ -1853,6 +1854,11 @@ class View { ...@@ -1853,6 +1854,11 @@ class View {
); );
} }
} }
if ($tags) {
foreach ($tags as $tag) {
$data[$index[$tag->view]]['tags'][] = $tag->tag;
}
}
} }
return (object) array( return (object) array(
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
<h4><a href="{$WWWROOT}view/edit.php?id={$view.id}" id="editviewdetails">{str tag="editviewnameanddescription" section="view"}</a></h4> <h4><a href="{$WWWROOT}view/edit.php?id={$view.id}" id="editviewdetails">{str tag="editviewnameanddescription" section="view"}</a></h4>
{if $view.description} {if $view.description}
<div class="videsc">{$view.description}</div> <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} {/if}
</div> </div>
<div class="vi"> <div class="vi">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment