advanced_settings.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Class HTML_QuickForm_advanced_settings
  4. */
  5. class HTML_QuickForm_advanced_settings extends HTML_QuickForm_static
  6. {
  7. /**
  8. * Class constructor
  9. *
  10. * @param string $text raw HTML to add
  11. * @access public
  12. * @return void
  13. */
  14. public function __construct($name = '', $label = '')
  15. {
  16. if (empty($label)) {
  17. $label = get_lang('AdvancedParameters');
  18. }
  19. $this->updateAttributes(
  20. array(
  21. 'label' => $label,
  22. 'name' => $name
  23. )
  24. );
  25. $this->_type = 'html';
  26. }
  27. /**
  28. * Accepts a renderer
  29. *
  30. * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!)
  31. * @access public
  32. * @return void
  33. */
  34. function accept(&$renderer, $required = false, $error = null)
  35. {
  36. $renderer->renderHtml($this);
  37. }
  38. /**
  39. * @return string
  40. */
  41. public function toHtml()
  42. {
  43. $name = $this->getAttribute('name');
  44. $text = $this->getAttribute('label');
  45. $label = is_array($text) ? $text[0] : $text;
  46. $html = '<div class="form-group"><div class="col-sm-10 col-sm-offset-2">';
  47. if (is_array($text) && isset($text[1])) {
  48. $html .= '<span class="clearfix">'.$text[1].'</span>';
  49. }
  50. $html .= '
  51. <button id="'.$name.'" type="button" class="btn btn-default advanced_options"
  52. data-toggle="button" aria-pressed="false" autocomplete="off">
  53. <em class="fa fa-bars"></em> '.$label.'
  54. </button>
  55. ';
  56. if (is_array($text) && isset($text[2])) {
  57. $html .= '<div class="help-block">'.$text[2].'</div>';
  58. }
  59. $html .= '</div></div>';
  60. return $html;
  61. }
  62. }