SoundcloudPreferences.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. require_once 'customvalidators/ConditionalNotEmpty.php';
  3. require_once 'customvalidators/PasswordNotEmpty.php';
  4. class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
  5. {
  6. public function init()
  7. {
  8. $this->setDecorators(array(
  9. array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml'))
  10. ));
  11. //enable soundcloud uploads
  12. $this->addElement('checkbox', 'UseSoundCloud', array(
  13. 'label' => _('Automatically Upload Recorded Shows'),
  14. 'required' => false,
  15. 'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(),
  16. 'decorators' => array(
  17. 'ViewHelper'
  18. )
  19. ));
  20. //enable soundcloud uploads option
  21. $this->addElement('checkbox', 'UploadToSoundcloudOption', array(
  22. 'label' => _('Enable SoundCloud Upload'),
  23. 'required' => false,
  24. 'value' => Application_Model_Preference::GetUploadToSoundcloudOption(),
  25. 'decorators' => array(
  26. 'ViewHelper'
  27. )
  28. ));
  29. //enable downloadable for soundcloud
  30. $this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
  31. 'label' => _('Automatically Mark Files "Downloadable" on SoundCloud'),
  32. 'required' => false,
  33. 'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(),
  34. 'decorators' => array(
  35. 'ViewHelper'
  36. )
  37. ));
  38. //SoundCloud Username
  39. $this->addElement('text', 'SoundCloudUser', array(
  40. 'class' => 'input_text',
  41. 'label' => _('SoundCloud Email'),
  42. 'filters' => array('StringTrim'),
  43. 'autocomplete' => 'off',
  44. 'value' => Application_Model_Preference::GetSoundCloudUser(),
  45. 'decorators' => array(
  46. 'ViewHelper'
  47. ),
  48. // By default, 'allowEmpty' is true. This means that our custom
  49. // validators are going to be skipped if this field is empty,
  50. // which is something we don't want
  51. 'allowEmpty' => false,
  52. 'validators' => array(
  53. new ConditionalNotEmpty(array('UploadToSoundcloudOption'=>'1'))
  54. )
  55. ));
  56. //SoundCloud Password
  57. $this->addElement('password', 'SoundCloudPassword', array(
  58. 'class' => 'input_text',
  59. 'label' => _('SoundCloud Password'),
  60. 'filters' => array('StringTrim'),
  61. 'autocomplete' => 'off',
  62. 'value' => Application_Model_Preference::GetSoundCloudPassword(),
  63. 'decorators' => array(
  64. 'ViewHelper'
  65. ),
  66. // By default, 'allowEmpty' is true. This means that our custom
  67. // validators are going to be skipped if this field is empty,
  68. // which is something we don't want
  69. 'allowEmpty' => false,
  70. 'validators' => array(
  71. new ConditionalNotEmpty(array('UploadToSoundcloudOption'=>'1'))
  72. ),
  73. 'renderPassword' => true
  74. ));
  75. // Add the description element
  76. $this->addElement('textarea', 'SoundCloudTags', array(
  77. 'label' => _('SoundCloud Tags: (separate tags with spaces)'),
  78. 'required' => false,
  79. 'class' => 'input_text_area',
  80. 'value' => Application_Model_Preference::GetSoundCloudTags(),
  81. 'decorators' => array(
  82. 'ViewHelper'
  83. )
  84. ));
  85. //SoundCloud default genre
  86. $this->addElement('text', 'SoundCloudGenre', array(
  87. 'class' => 'input_text',
  88. 'label' => _('Default Genre:'),
  89. 'required' => false,
  90. 'filters' => array('StringTrim'),
  91. 'value' => Application_Model_Preference::GetSoundCloudGenre(),
  92. 'decorators' => array(
  93. 'ViewHelper'
  94. )
  95. ));
  96. $select = new Zend_Form_Element_Select('SoundCloudTrackType');
  97. $select->setLabel(_('Default Track Type:'));
  98. $select->setAttrib('class', 'input_select');
  99. $select->setMultiOptions(array(
  100. "" => "",
  101. "original" => _("Original"),
  102. "remix" => _("Remix"),
  103. "live" => _("Live"),
  104. "recording" => _("Recording"),
  105. "spoken" => _("Spoken"),
  106. "podcast" => _("Podcast"),
  107. "demo" => _("Demo"),
  108. "in progress" => _("Work in progress"),
  109. "stem" => _("Stem"),
  110. "loop" => _("Loop"),
  111. "sound effect" => _("Sound Effect"),
  112. "sample" => _("One Shot Sample"),
  113. "other" => _("Other")
  114. ));
  115. $select->setRequired(false);
  116. $select->setValue(Application_Model_Preference::GetSoundCloudTrackType());
  117. $select->setDecorators(array('ViewHelper'));
  118. $this->addElement($select);
  119. $select = new Zend_Form_Element_Select('SoundCloudLicense');
  120. $select->setLabel(_('Default License:'));
  121. $select->setAttrib('class', 'input_select');
  122. $select->setMultiOptions(array(
  123. "" => "",
  124. "no-rights-reserved" => _("The work is in the public domain"),
  125. "all-rights-reserved" => _("All rights are reserved"),
  126. "cc-by" => _("Creative Commons Attribution"),
  127. "cc-by-nc" => _("Creative Commons Attribution Noncommercial"),
  128. "cc-by-nd" => _("Creative Commons Attribution No Derivative Works"),
  129. "cc-by-sa" => _("Creative Commons Attribution Share Alike"),
  130. "cc-by-nc-nd" => _("Creative Commons Attribution Noncommercial Non Derivate Works"),
  131. "cc-by-nc-sa" => _("Creative Commons Attribution Noncommercial Share Alike")
  132. ));
  133. $select->setRequired(false);
  134. $select->setValue(Application_Model_Preference::GetSoundCloudLicense());
  135. $select->setDecorators(array('ViewHelper'));
  136. $this->addElement($select);
  137. }
  138. }