wikiplugin_trackercomments.php 1.75 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
3 4 5
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6
// $Id$
7

8 9
function wikiplugin_trackercomments_info()
{
10
	return array(
11 12
		'name' => tra('Tracker Comments'),
		'documentation' => 'PluginTrackerComments',
13
		'description' => tra('Display the number of tracker comments'),
14
		'prefs' => array( 'feature_trackers', 'wikiplugin_trackercomments' ),	
15
		'icon' => 'img/icons/comments.png',
16 17 18 19
		'params' => array(
			'trackerId' => array(
				'required' => true,
				'name' => tra('Tracker ID'),
20 21 22
				'description' => tra('Numeric value representing the tracker ID'),
				'filter' => 'digits',
				'default' => '',
23
				'profile_reference' => 'tracker',
24 25 26
			),
			'shownbitems' => array(
				'required' => false,
27 28 29 30
				'name' => tra('Item Count'),
				'description' => tra('Determines whether the number of items will be shown (not shown by default)'),
				'filter' => 'alpha',
				'default' => '',
31
				'options' => array(
32 33 34 35
					array('text' => '', 'value' => ''), 
					array('text' => tra('Yes'), 'value' => 'y'), 
					array('text' => tra('No'), 'value' => 'n')
				)
36 37 38 39
			),
			'view' => array(
				'required' => false,
				'name' => tra('View'),
40 41 42 43
				'description' => tra('Enter a user name to select the items of the current user'),
				'accepted' => tra('a user name'),
				'filter' => 'alpha',
				'default' => ''
44 45 46 47
			),
		)
	);
}
48 49
function wikiplugin_trackercomments($data, $params)
{
lphuberdeau's avatar
lphuberdeau committed
50
	$trklib = TikiLib::lib('trk');
51
	global $user;
52
	extract($params, EXTR_SKIP);
53 54 55 56 57
	$ret = '';
	if ($shownbitems == 'y') {
		$ret .= tra('Comments found:').' '.$trklib->nbComments($user);
	}
	return $ret;
58
}