Overview

Packages

  • None
  • Shout

Classes

  • AccountDetailsForm
  • ConferenceDetailsForm
  • DeviceDetailsForm
  • ExtensionDetailsForm
  • MenuForm
  • NumberDetailsForm
  • RecordingDetailsForm
  • Shout
  • Shout_Ajax_Application
  • Shout_Driver
  • Shout_Driver_Ldap
  • Shout_Driver_Sql
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2005-2010 Alkaloid Networks LLC (http://projects.alkaloid.net)
 4:  *
 5:  * See the enclosed file LICENSE for license information (BSD). If you
 6:  * did not receive this file, see
 7:  * http://www.opensource.org/licenses/bsd-license.php.
 8:  *
 9:  * @package Shout
10:  */
11: 
12: class MenuForm extends Horde_Form {
13: 
14:     function __construct(&$vars)
15:     {
16:         if ($vars->exists('menu')) {
17:             $formtitle = _("Edit Menu");
18:             $menu = $vars->get('menu');
19:             $edit = true;
20:         } else {
21:             $formtitle = _("Add Device");
22:             $edit = false;
23:         }
24: 
25:         $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
26:         $title = sprintf(_("%s - Account: %s"), $formtitle, $accountname);
27:         parent::__construct($vars, $title);
28: 
29:         $this->addHidden('', 'action', 'text', true);
30: 
31:         if ($edit) {
32:             $this->addHidden('', 'oldname', 'text', true);
33:             $vars->set('oldname', $menu);
34:         }
35:         $this->addVariable(_("Menu Name"), 'name', 'text', true);
36:         $this->addVariable(_("Description"), 'description', 'text', false);
37: 
38:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
39:         $recordings = $shout->storage->getRecordings($GLOBALS['session']->get('shout', 'curaccount_code'));
40:         $list = array();
41:         foreach ($recordings as $id => $info) {
42:             $list[$id] = $info['filename'];
43:         }
44:         $this->addVariable(_("Recording"), 'recording_id', 'enum', true, false,
45:                            null, array($list));
46: 
47:         return true;
48:     }
49: 
50:     public function execute()
51:     {
52:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
53: 
54:         $account = $GLOBALS['session']->get('shout', 'curaccount_code');
55: 
56:         $details = array(
57:             'name' => $this->_vars->get('name'),
58:             'description' => $this->_vars->get('description'),
59:             'recording_id' => $this->_vars->get('recording_id')
60:         );
61: 
62:         if ($action == 'edit') {
63:             $details['oldname'] = $this->_vars->get('oldname');
64:         }
65: 
66:         $shout->devices->saveMenuInfo($account, $details);
67:     }
68: 
69: }
70: 
71: class DeviceMenuForm extends Horde_Form
72: {
73:     function __construct(&$vars)
74:     {
75:         $menu = $vars->get('$menu');
76:         $account = $vars->get('account');
77: 
78:         $title = _("Delete Menu %s - Account: %s");
79:         $title = sprintf($title, $menu, $GLOBALS['session']->get('shout', 'curaccount_name'));
80:         parent::__construct($vars, $title);
81: 
82:         $this->setButtons(array(_("Delete"), _("Cancel")));
83:     }
84: 
85:     function execute()
86:     {
87:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
88:         $account = $this->_vars->get('account');
89:         $menu = $this->_vars->get('menu');
90:         $shout->devices->deleteMenu($account, $menu);
91:     }
92: }
93: 
API documentation generated by ApiGen