NTKActionList.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. class NTKActionList
  3. {
  4. function NTKActionList($id)
  5. {
  6. $this->id = $id;
  7. $this->rows = array();
  8. }
  9. function addAction($label, $action, $icon, $details)
  10. {
  11. $this->rows[] = array($label, $action, $icon, $details);
  12. }
  13. function getHtml()
  14. {
  15. $html .= "<div style=\"overflow: auto;\">";
  16. $html .= "<table id=\"$this->id\" class=\"actionlist\" cellspacing=\"0\" style=\"width: 100%;\">\n";
  17. $color = False;
  18. $color_actions .= " onmousedown=\"this.className = 'actionlist_line_down'\"";
  19. $color_actions .= " onmouseup=\"this.className = 'actionlist_line_over'\"";
  20. $color_actions .= " onmouseover=\"this.className = 'actionlist_line_over'\"";
  21. $color_actions .= " onmouseout=\"this.className = 'actionlist_color_line'\"";
  22. $plain_actions .= " onmousedown=\"this.className = 'actionlist_line_down'\"";
  23. $plain_actions .= " onmouseup=\"this.className = 'actionlist_line_over'\"";
  24. $plain_actions .= " onmouseover=\"this.className = 'actionlist_line_over'\"";
  25. $plain_actions .= " onmouseout=\"this.className = 'actionlist_plain_line'\"";
  26. for($i = 0; $i < count($this->rows); $i++)
  27. {
  28. if($color)
  29. {
  30. $html .= "<tr class=\"listview_color_line\" onclick=\"$this->rows[$i][1]\" $color_actions>\n";
  31. $color = False;
  32. }
  33. else
  34. {
  35. $html .= "<tr class=\"listview_plain_line\" onclick=\"$this->rows[$i][1]\" $plain_actions>\n";
  36. $color = True;
  37. }
  38. $html .= "<td>\n";
  39. $html .= "<img src=\"".$this->rows[$i][2]."\" border=\"0\">".$this->rows[$i][0]."\n";
  40. $html .= "</td>\n";
  41. $html .= "</tr>\n";
  42. }
  43. $html .= "</table>\n";
  44. $html .= "</div>";
  45. return $html;
  46. }
  47. }
  48. ?>