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: * Special prefs handling for the 'newmail_soundselect' preference.
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_Prefs_Special_NewmailSound implements Horde_Core_Prefs_Ui_Special
24: {
25: /**
26: */
27: public function init(Horde_Core_Prefs_Ui $ui)
28: {
29: }
30:
31: /**
32: */
33: public function display(Horde_Core_Prefs_Ui $ui)
34: {
35: global $prefs;
36:
37: $view = new Horde_View(array(
38: 'templatePath' => IMP_TEMPLATES . '/prefs'
39: ));
40: $view->addHelper('FormTag');
41: $view->addHelper('Tag');
42: $view->addHelper('Text');
43:
44: $newmail_audio = $view->newmail_audio = $prefs->getValue('newmail_audio');
45:
46: $sounds = array();
47: foreach (Horde_Themes::soundList() as $key => $val) {
48: $sounds[] = array(
49: 'c' => ($newmail_audio == $key),
50: 'l' => $key,
51: 's' => $val->uri,
52: 'v' => $key
53: );
54: }
55: $view->sounds = $sounds;
56:
57: return $view->render('newmailaudio');
58: }
59:
60: /**
61: */
62: public function update(Horde_Core_Prefs_Ui $ui)
63: {
64: return $GLOBALS['prefs']->setValue('newmail_audio', $ui->vars->newmail_audio);
65: }
66:
67: }
68: