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:  * $Id$
 4:  *
 5:  * Copyright 2005-2009 Alkaloid Networks LLC (http://projects.alkaloid.net)
 6:  *
 7:  * See the enclosed file LICENSE for license information (BSD). If you
 8:  * did not receive this file, see
 9:  * http://www.opensource.org/licenses/bsd-license.php.
10:  *
11:  * @author Ben Klang <ben@alkaloid.net>
12:  * @package Shout
13:  */
14: 
15: class AccountDetailsForm extends Horde_Form {
16: 
17:     /**
18:      * AccountDetailsForm constructor.
19:      *
20:      * @param mixed reference $vars
21:      * @return boolean
22:      */
23:     function __construct(&$vars)
24:     {
25:         $account = $GLOBALS['session']->get('shout', 'curaccount_code');
26:         $action = $vars->get('action');
27:         if ($action == 'edit') {
28:             $formtitle = "Edit Account";
29:             $vars->set('oldaccount', $account);
30:         } else {
31:             $formtitle = "Add Account";
32:         }
33: 
34:         $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
35:         $title = sprintf(_("$formtitle %s"), $accountname);
36:         parent::__construct($vars, $title);
37: 
38:         $this->addHidden('', 'action', 'text', true);
39:         //$this->addHidden('', 'oldaccount', 'text', false);
40:         $this->addVariable(_("Account Name"), 'name', 'text', true);
41:         $this->addVariable(_("Account Code"), 'code', 'text', true);
42:         $this->addVariable(_("Admin PIN"), 'adminpin', 'number', false);
43: 
44:         return true;
45:     }
46: 
47:     /**
48:      * Process this form, saving its information to the backend.
49:      */
50:     function execute()
51:     {
52:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
53: 
54:         $code = $this->_vars->get('code');
55:         $name = $this->_vars->get('name');
56:         $adminpin = $this->_vars->get('adminpin');
57:         if (empty($adminpin)) {
58:             $adminpin = rand(1000, 9999);
59:         }
60: 
61:         $shout->storage->saveAccount($code, $name, $adminpin);
62:     }
63: 
64: }
65: 
66: class AccountDeleteForm extends Horde_Form
67: {
68:     function __construct(&$vars)
69:     {
70:         $extension = $vars->get('extension');
71:         $account = $vars->get('account');
72: 
73:         $title = _("Delete Extension %s - Account: %s");
74:         $account_config = $GLOBALS['session']->get('shout', 'accounts/' . $account);
75:         $title = sprintf($title, $extension, $account_config['name']);
76:         parent::__construct($vars, $title);
77: 
78:         $this->addHidden('', 'account', 'text', true);
79:         $this->addHidden('', 'extension', 'int', true);
80:         $this->addHidden('', 'action', 'text', true);
81:         $this->setButtons(array(_("Delete"), _("Cancel")));
82:     }
83: 
84:     function execute()
85:     {
86:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
87:         $account = $this->_vars->get('account');
88:         $shout->storage->deleteAccount($account);
89:     }
90: }
91: 
API documentation generated by ApiGen