advanced_settings.php 1.7 KB

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