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/gpl21 GPL
11: * @package IMP
12: */
13:
14: /**
15: * This is a view of the IMP subinfo bar.
16: *
17: * Useful properties:
18: * - label: (string) Prefix label for the content, e.g. "Mailbox:".
19: * - quotaClass: (string) CSS class to be used for the quota section. This is
20: * done automatically.
21: * - quotaText: (string) Text to be added to the quota section. This is done
22: * automatically.
23: * - readonly: (boolean) Whether to add a read-only icon.
24: * - value: (string) The content, e.g. mailbox name.
25: *
26: * Copyright 2012-2014 Horde LLC (http://www.horde.org/)
27: *
28: * See the enclosed file COPYING for license information (GPL). If you
29: * did not receive this file, see http://www.horde.org/licenses/gpl.
30: *
31: * @author Jan Schneider <jan@horde.org>
32: * @category Horde
33: * @copyright 2012-2014 Horde LLC
34: * @license http://www.horde.org/licenses/gpl GPL
35: * @package IMP
36: */
37: class IMP_View_Subinfo extends Horde_View
38: {
39: /**
40: * Constructor.
41: *
42: * @param array $config Configuration key-value pairs. Additional options:
43: * - mailbox: (string) Mailbox to use for quota query.
44: */
45: public function __construct(array $config = array())
46: {
47: $config['templatePath'] = IMP_TEMPLATES . '/basic';
48: parent::__construct($config);
49:
50: $quotadata = $GLOBALS['injector']->getInstance('IMP_Quota_Ui')->quota(isset($config['mailbox']) ? $config['mailbox'] : null, true);
51: if (!empty($quotadata)) {
52: $this->quotaClass = $quotadata['class'];
53: $this->quotaText = $quotadata['message'];
54: }
55: }
56:
57: /**
58: * Returns the HTML code for the subinfo bar.
59: *
60: * @param string $name The template to process.
61: *
62: * @return string The subinfo bar's HTML code.
63: */
64: public function render($name = 'subinfo', $locals = array())
65: {
66: return parent::render($name, $locals);
67: }
68: }
69: