Advertisement
Guest User

sfWidgetFormSelectDoubleList

a guest
Sep 24th, 2010
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. ### my schema.yml
  2.  
  3. Codecs:
  4. tableName: codecs
  5. columns:
  6. ...
  7. relations:
  8. DetalhamentoSip:
  9. class: DetalhamentoSip
  10. refClass: DetalhamentoSipCodecs
  11. local: codecs_id
  12. foreign: detalhamento_sip_id
  13.  
  14. DetalhamentoSipCodecs:
  15. tableName: detalhamento_sip_codecs
  16. columns:
  17. id:
  18. type: integer(4)
  19. primary: true
  20. autoincrement: true
  21. codecs_id:
  22. type: integer(4)
  23. detalhamento_sip_id:
  24. type: integer(4)
  25.  
  26. DetalhamentoSip:
  27. tableName: detalhamento_sip
  28. columns:
  29. ...
  30. relations:
  31. Codecs:
  32. class: Codecs
  33. refClass: DetalhamentoSipCodecs
  34. local: detalhamento_sip_id
  35. foreign: codecs_id
  36.  
  37. #### my form:
  38.  
  39. <?php
  40.  
  41. /**
  42. * DetalhamentoSip form.
  43. *
  44. * @package neuwald
  45. * @subpackage form
  46. * @author Your name here
  47. * @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
  48. */
  49. class DetalhamentoSipForm extends BaseDetalhamentoSipForm
  50. {
  51. public function configure()
  52. {
  53. $this->setWidgets(array(
  54. 'id' => new sfWidgetFormInputHidden(),
  55. 'nome_do_dispositivo' => new sfWidgetFormInputText(),
  56. 'habilitado' => new sfWidgetFormInputCheckbox(),
  57. 'type' => new sfWidgetFormChoice(array('choices' => array('USER' => 'USER', 'PEER' => 'PEER', 'FRIEND' => 'FRIEND'))),
  58. 'username' => new sfWidgetFormInputText(),
  59. 'host' => new sfWidgetFormInputText(),
  60. 'caller_id' => new sfWidgetFormInputText(),
  61. 'secret' => new sfWidgetFormInputText(),
  62. 'context' => new sfWidgetFormInputText(),
  63. 'codecs' => $this->widgetSchema['codecs_list']->setOption('renderer_class', 'sfWidgetFormSelectDoubleList'),
  64. 'dtmf_mode' => new sfWidgetFormChoice(array('choices' => array('rfc2833' => 'rfc2833', 'info' => 'info', 'inband' => 'inband', 'auto' => 'auto'))),
  65. 'can_reinvite' => new sfWidgetFormChoice(array('choices' => array('yes' => 'yes', 'no' => 'no', 'nonat' => 'nonat'))),
  66. 'nat' => new sfWidgetFormInputCheckbox(),
  67. 'qualify' => new sfWidgetFormInputCheckbox(),
  68. 'from_domain' => new sfWidgetFormInputText(),
  69. 'from_user' => new sfWidgetFormInputText(),
  70. 'port' => new sfWidgetFormInputText(),
  71. 'call_limit' => new sfWidgetFormInputText(),
  72. 'allow_transfer' => new sfWidgetFormInputCheckbox(),
  73. 'account_code' => new sfWidgetFormInputText(),
  74. 'in_secure' => new sfWidgetFormChoice(array('choices' => array('no' => 'no', 'invite' => 'invite', 'port' => 'port', 'port, invite' => 'port, invite'))),
  75. 'progress_in_band' => new sfWidgetFormChoice(array('choices' => array('no' => 'no', 'yes' => 'yes', 'never' => 'never'))),
  76. 'promisc_redirect' => new sfWidgetFormInputCheckbox(),
  77. 'user_client_code' => new sfWidgetFormInputCheckbox(),
  78. 'set_var' => new sfWidgetFormInputText(),
  79. 'mail_box' => new sfWidgetFormInputText(),
  80. 'video_support' => new sfWidgetFormInputCheckbox(),
  81. 'language' => new sfWidgetFormChoice(array('choices' => array('en' => 'en', 'pt_br' => 'pt_br'))),
  82. 'md5_secret' => new sfWidgetFormInputText(),
  83. ));
  84.  
  85.  
  86. $this->setValidators(array(
  87. 'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
  88. 'nome_do_dispositivo' => new sfValidatorRegex(array('max_length' => 32, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => true)),
  89. 'habilitado' => new sfValidatorBoolean(array('required' => false)),
  90. 'type' => new sfValidatorChoice(array('choices' => array(0 => 'USER', 1 => 'PEER', 2 => 'FRIEND'), 'required' => true)),
  91. 'username' => new sfValidatorRegex(array('max_length' => 32, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => false)),
  92. 'host' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
  93. 'caller_id' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
  94. 'secret' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
  95. 'context' => new sfValidatorRegex(array('max_length' => 32, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => true)),
  96. 'codecs' => new sfValidatorDoctrineChoice(array('model' => 'Codecs', 'multiple' => true, 'required' => false)),
  97. 'dtmf_mode' => new sfValidatorChoice(array('choices' => array(0 => 'rfc2833', 1 => 'info', 2 => 'inband', 3 => 'auto'), 'required' => false)),
  98. 'can_reinvite' => new sfValidatorChoice(array('choices' => array(0 => 'yes', 1 => 'no', 2 => 'nonat'), 'required' => false)),
  99. 'nat' => new sfValidatorBoolean(array('required' => false)),
  100. 'qualify' => new sfValidatorBoolean(array('required' => false)),
  101. 'from_domain' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
  102. 'from_user' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
  103. 'port' => new sfValidatorInteger(array('required' => false)),
  104. 'call_limit' => new sfValidatorInteger(array('required' => false)),
  105. 'allow_transfer' => new sfValidatorBoolean(array('required' => false)),
  106. 'account_code' => new sfValidatorRegex(array('max_length' => 8, 'pattern' => '/^[a-zA-Z0-9_-]+$/', 'required' => false)),
  107. 'in_secure' => new sfValidatorChoice(array('choices' => array(0 => 'no', 1 => 'invite', 2 => 'port', 3 => 'port, invite'), 'required' => false)),
  108. 'progress_in_band' => new sfValidatorChoice(array('choices' => array(0 => 'no', 1 => 'yes', 2 => 'never'), 'required' => false)),
  109. 'promisc_redirect' => new sfValidatorBoolean(array('required' => false)),
  110. 'user_client_code' => new sfValidatorBoolean(array('required' => false)),
  111. 'set_var' => new sfValidatorString(array('max_length' => 64, 'required' => false)),
  112. 'mail_box' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
  113. 'video_support' => new sfValidatorBoolean(array('required' => false)),
  114. 'language' => new sfValidatorChoice(array('choices' => array(0 => 'en', 1 => 'pt_br'), 'required' => false)),
  115. 'md5_secret' => new sfValidatorString(array('max_length' => 32, 'required' => false)),
  116. ));
  117.  
  118. $this->widgetSchema->setNameFormat('detalhamento_sip[%s]');
  119.  
  120. $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
  121.  
  122. $this->setupInheritance();
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement