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-2009 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:  * @author Ben Klang <ben@alkaloid.net>
 10:  * @package Shout
 11:  */
 12: 
 13: class ExtensionDetailsForm extends Horde_Form {
 14: 
 15:     /**
 16:      * ExtensionDetailsForm constructor.
 17:      *
 18:      * @global <type> $shout->extensions
 19:      * @param <type> $vars
 20:      * @return <type>
 21:      */
 22:     function __construct(&$vars)
 23:     {
 24:         $action = $vars->get('action');
 25:         if ($action == 'edit') {
 26:             $formtitle = "Edit User";
 27:         } else {
 28:             $formtitle = "Add User";
 29:         }
 30: 
 31:         $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
 32:         $title = sprintf(_("$formtitle - Account: %s"), $accountname);
 33:         parent::__construct($vars, $title);
 34: 
 35: 
 36:         $extension = $vars->get('extension');
 37: 
 38:         $this->addHidden('', 'action', 'text', true);
 39:         $this->addHidden('', 'oldextension', 'text', false);
 40:         $this->addVariable(_("Full Name"), 'name', 'text', true);
 41:         $this->addVariable(_("Extension"), 'extension', 'int', true);
 42:         $this->addVariable(_("E-Mail Address"), 'email', 'email', true);
 43:         //$this->addVariable(_("Pager E-Mail Address"), 'pageremail', 'email', false);
 44:         $this->addVariable(_("PIN"), 'mailboxpin', 'int', true);
 45: 
 46:         return true;
 47:     }
 48: 
 49:     /**
 50:      * Process this form, saving its information to the backend.
 51:      *
 52:      * @param string $account  Account in which to execute this save
 53:      * FIXME: is there a better way to get the $account and $shout->extensions?
 54:      */
 55:     function execute()
 56:     {
 57:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
 58: 
 59:         $extension = $this->_vars->get('extension');
 60:         $account = $this->_vars->get('account');
 61: 
 62:         // FIXME: Input Validation (Text::??)
 63:         $details = array(
 64:             'name' => $this->_vars->get('name'),
 65:             'oldextension' => $this->_vars->get('oldextension'),
 66:             'email' => $this->_vars->get('email'),
 67:             //'pager' => $this->_vars->get('pageremail')
 68:             'mailboxpin' => $this->_vars->get('mailboxpin'),
 69:             );
 70: 
 71:         $shout->extensions->saveExtension($account, $extension, $details);
 72:     }
 73: 
 74: }
 75: 
 76: class ExtensionDeleteForm extends Horde_Form
 77: {
 78:     function __construct(&$vars)
 79:     {
 80:         $extension = $vars->get('extension');
 81:         $account = $vars->get('account');
 82: 
 83:         $title = _("Delete Extension %s - Account: %s");
 84:         $title = sprintf($title, $extension, $GLOBALS['session']->get('shout', 'curaccount_name'));
 85:         parent::__construct($vars, $title);
 86: 
 87:         $this->addHidden('', 'account', 'text', true);
 88:         $this->addHidden('', 'extension', 'int', true);
 89:         $this->addHidden('', 'action', 'text', true);
 90:         $this->setButtons(array(_("Delete"), _("Cancel")));
 91:     }
 92: 
 93:     function execute()
 94:     {
 95:         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
 96:         $account = $this->_vars->get('account');
 97:         $extension = $this->_vars->get('extension');
 98:         $shout->extensions->deleteExtension($account, $extension);
 99:     }
100: }
101: 
API documentation generated by ApiGen