| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- class NTKListView
- {
- function NTKListView($id, $cols, $action)
- {
- $this->id = $id;
- $this->cols = $cols;
- $this->action = $action;
-
- $this->rows = array();
- }
-
- function addLine($cols)
- {
- $this->rows[] =& $cols;
- }
-
- function addLines($rows)
- {
- for($i = 0; $i < count($rows); $i++)
- $this->rows[] =& $rows[$i];
- }
-
- function getHtml()
- {
- $html = "";
- $actions = "";
-
- $html .= "<table id=\"$this->id\" class=\"listview\" cellspacing=\"0\">\n";
- $html .= "<tr>\n";
-
- $actions .= " onmousedown=\"this.className = 'listview_head_down'\"";
- $actions .= " onmouseup=\"this.className = 'listview_head'\"";
- $actions .= " onmouseover=\"this.className = 'listview_head_over'\"";
- $actions .= " onmouseout=\"this.className = 'listview_head'\"";
-
- for($i = 0; $i < count($this->cols); $i++)
- {
- $html .= "<td class=\"listview_head\" $actions>\n";
- $html .= $this->cols[$i];
- $html .= "</td>\n";
- }
-
- $html .= "</tr>\n";
-
- $color = False;
- $color_actions = "";
- $plain_actions = "";
-
- $color_actions .= " onmousedown=\"this.className = 'listview_line_down'\"";
- $color_actions .= " onmouseup=\"this.className = 'listview_line_over'\"";
- $color_actions .= " onmouseover=\"this.className = 'listview_line_over'\"";
- $color_actions .= " onmouseout=\"this.className = 'listview_color_line'\"";
-
- $plain_actions .= " onmousedown=\"this.className = 'listview_line_down'\"";
- $plain_actions .= " onmouseup=\"this.className = 'listview_line_over'\"";
- $plain_actions .= " onmouseover=\"this.className = 'listview_line_over'\"";
- $plain_actions .= " onmouseout=\"this.className = 'listview_plain_line'\"";
-
- for($i = 0; $i < count($this->rows); $i++)
- {
- if($color)
- {
- $html .= "<tr class=\"listview_color_line\" $color_actions>\n";
- $color = False;
- }
- else
- {
- $html .= "<tr class=\"listview_plain_line\"$plain_actions>\n";
- $color = True;
- }
-
- for($j = 0; $j < count($this->cols); $j++)
- {
- $html .= "<td onclick=\"".str_replace("%0%", $this->rows[$i][0], $this->action)."\">\n";
- $html .= $this->rows[$i][$j];
- $html .= "</td>\n";
- }
-
- $html .= "</tr>\n";
- }
-
- $html .= "<tr class=\"listview_spacer\"><td colspan=\"".count($this->cols)."\"> </td></tr>\n";
-
- $html .= "</table>\n";
-
- return $html;
- }
- }
- ?>
|