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 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 ConferenceDetailsForm extends Horde_Form {
13: 
14:     function __construct(&$vars)
15:     {
16:         $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
17:         if ($vars->exists('roomno')) {
18:             $title = sprintf(_("Edit Conference Room - Account: %s"), $accountname);
19:             $roomno = $vars->get('roomno');
20:             $this->addHidden('', 'oldroomno', 'text', true);
21:             $vars->set('oldroomno', $roomno);
22:             $edit = true;
23:         } else {
24:             $title = sprintf(_("Create Conference Room - Account: %s"), $accountname);
25:             $edit = false;
26:         }
27: 
28:         ;
29:         parent::__construct($vars, $title);
30: 
31:         $this->addHidden('', 'action', 'text', true);
32:         $this->addVariable(_("Room Name"), 'name', 'text', true);
33:         $this->addVariable(_("Room Number"), 'roomno', 'number', true);
34:         $this->addVariable(_("PIN"), 'pin', 'number', false);
35:         return true;
36:     }
37: 
38:     public function execute()
39:     {
40:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
41: 
42:         $action = $this->_vars->get('action');
43:         $account = $this->_vars->get('account');
44:         $roomno = $this->_vars->get('roomno');
45:         $details = array(
46:             'name' => $this->_vars->get('name'),
47:             'pin' => $this->_vars->get('pin')
48:         );
49: 
50: 
51:         // For safety, we force the device ID and password rather than rely
52:         // on the form to pass them around.
53:         if ($action != 'add') { // $action must be 'edit'
54:             $oldroomno = $this->_vars->get('oldroomno');
55:             $conferences = $shout->storage->getConferences($account);
56:             if (!isset($conferences[$roomno])) {
57:                 // The device requested doesn't already exist.  This can't
58:                 // be a valid edit.
59:                 throw new Shout_Exception(_("That conference room does not exist."),
60:                                             'horde.error');
61:             }
62:             $details['oldroomno'] = $oldroomno;
63:         }
64: 
65:         $shout->storage->saveConference($account, $roomno, $details);
66:     }
67: 
68: }
69: 
70: class ConferenceDeleteForm extends Horde_Form
71: {
72:     function __construct(&$vars)
73:     {
74:         $devid = $vars->get('devid');
75:         $account = $vars->get('account');
76: 
77:         $title = _("FIXME Delete Device %s - Account: %s");
78:         $account_config = $GLOBALS['session']->get('shout', 'accounts/' . $account);
79:         $title = sprintf($title, $devid, $account_config['name']);
80:         parent::__construct($vars, $title);
81: 
82:         $this->addHidden('', 'account', 'text', true);
83:         $this->addHidden('', 'devid', 'text', true);
84:         $this->addHidden('', 'action', 'text', true);
85:         $this->setButtons(array(_("Delete"), _("Cancel")));
86:     }
87: 
88:     function execute()
89:     {
90:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
91:         $account = $this->_vars->get('account');
92:         $devid = $this->_vars->get('devid');
93:         $shout->devices->deleteDevice($account, $devid);
94:     }
95: }
96: 
API documentation generated by ApiGen