1: <?php
2: /**
3: * Copyright 2012-2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2012-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * View helper class for all dynamic pages.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2012-2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl GPL
21: * @package IMP
22: */
23: class IMP_Dynamic_Helper_Base extends Horde_View_Helper_Base
24: {
25: /**
26: * Output an action button.
27: *
28: * @param array $params A list of parameters:
29: * - class: (string) The CSS classname to use for the link.
30: * - htmltitle: (string) The string to use for the HTML title attribute,
31: * if different than 'title'.
32: * - icon: (string) The icon CSS classname.
33: * - id: (string) The DOM ID of the link.
34: * - title: (string) The title string.
35: *
36: * @return string An HTML link to $url.
37: */
38: public function actionButton(array $params = array())
39: {
40: $class = '';
41: if (!empty($params['icon'])) {
42: $class .= 'dimpaction' . $params['icon'];
43: }
44: if (!empty($params['class'])) {
45: $class .= ' ' . $params['class'];
46: }
47:
48: return Horde::link(
49: '',
50: '',
51: $class,
52: '',
53: '',
54: isset($params['htmltitle']) ? $params['htmltitle'] : $params['title'],
55: '',
56: empty($params['id']) ? array() : array('id' => $params['id']),
57: true
58: )
59: . $params['title'] . '</a>';
60: }
61:
62: }
63: