NTKImageButton.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. class NTKImageButton
  3. {
  4. function NTKImageButton($id, $icon, $label, $action, $tooltip = "")
  5. {
  6. $this->id = $id;
  7. $this->icon = $icon;
  8. $this->label = $label;
  9. $this->action = $action;
  10. $this->tooltip = $tooltip;
  11. }
  12. function setTooltip($tooltip)
  13. {
  14. $this->tooltip = $tooltip;
  15. }
  16. function getHtml()
  17. {
  18. $actions = "";
  19. $html = "";
  20. $actions .= " onclick=\"$this->action\"";
  21. $actions .= " onmousedown=\"this.className = 'imagebutton_down'\"";
  22. $actions .= " onmouseup=\"this.className = 'imagebutton'\"";
  23. $actions .= " onmouseover=\"this.className = 'imagebutton_over'\"";
  24. if($this->tooltip != "")
  25. {
  26. $actions .= " onmouseout=\"this.className = 'imagebutton'; ntk_tooltip_stop = true; ntk_hide_tooltip();\"";
  27. $actions .= " onmousemove=\"ntk_show_tooltip('".$this->tooltip."');\"";
  28. }
  29. else
  30. {
  31. $actions .= " onmouseout=\"this.className = 'imagebutton';\"";
  32. $actions .= " onmousemove=\"\"";
  33. }
  34. $html .= "<div id=\"$this->id\" class=\"imagebutton\" style=\"background-image: url('$this->icon');\" $actions></div>\n";
  35. return $html;
  36. }
  37. }
  38. ?>