public function getCheckList($type, $columns, $rows, $link = null, $class = 'items', $textalign = "left", $report = false, $id = "table") { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); /* * Define string of pagination Sophen 27 June 2012 */ $stringPagination = '<script type="text/javascript"> $(document).ready(function(){ $("#' . $id . '").tablesorter(); $("#' . $id . '").tablesorter().tablesorterPager({container: $("#pagination_' . $id . '")}); $("input:.pagedisplay").focus(function(){ this.blur(); }); function changeColor(){ alert("change color on mouse over"); } }); </script> <div id="pagination_' . $id . '" class="pager" > <form > <table style="width: 200px;border: 0px;background-color: #EDF7F8;margin: 0px"><tr> <td><img src="' . BASE_URL . '/images/first.gif" class="first"/></td> <td><img src="' . BASE_URL . '/images/previous.gif" class="prev"/></td> <td><input type="text" style="margin-bottom: 5px;" class="pagedisplay"/></td> <td><img src="' . BASE_URL . '/images/next.gif" class="next"/></td> <td><img src="' . BASE_URL . '/images/last.gif" class="last"/></td> <td><select class="pagesize" > <option selected="selected" value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> <option value="50">50</option> <option value="60">60</option> <option value="70">70</option> <option value="80">80</option> <option value="90">90</option> <option value="100">100</option> </select> </td> </tr> </table> </form> </div> '; /* end define string*/ $head = '<table class="collape tablesorter" id="' . $id . '" width="100%">'; $col_str = ''; if ($type != null) { $col_str = '<thead><tr><th class="tdheader">' . $tr->translate("NUM") . '</th>'; } //add columns foreach ($columns as $column) { if ($column == "DELETE") { $col_str = $col_str . '<th class="tdheader-delete">' . $tr->translate($column) . '</th>'; } else { $col_str = $col_str . '<th class="tdheader">' . $tr->translate($column) . '</th>'; } } $col_str .= '</tr></thead>'; $row_str = '<tbody>'; //add element rows if ($rows == NULL) { return $head . $col_str . '</table><center style="font-size:18pt;">No record</center></form>'; } $temp = 0; /*------------------------Check param id----------------------------------*/ /*------------------------End check---------------------------------------*/ $r = 0; foreach ($rows as $row) { if ($r % 2 == 0) { $attb = 'normal'; } else { $attb = 'alternate'; } $r++; //-------------------check select----------------- //-------------------end check select----------------- $row_str .= '<tr class="' . $attb . '"> '; $i = 0; foreach ($row as $key => $read) { if ($read == null) { $read = ' '; } if ($i == 0) { $temp = $read; if ($type != null) { $row_str .= '<td class="items-no" style="padding:7px" align="center">' . $r . '</td>'; } } else { if ($link != null) { foreach ($link as $column => $url) { if ($key == $column) { //$img='<img src="'.BASE_URL.'/css/link.png"/> '; $img = ''; $array = array('tag' => 'a', 'attribute' => array('href' => Application_Form_FrmMessage::redirectorview($url) . '/id/' . $temp)); $read = $this->formSubElement($array, $img . $read); } } } //$link==null $text = ''; if ($i != 0) { $text = $this->textAlign($read); $read = $this->checkValue($read); if ($textalign !== 'left') { $text = " align=" . $textalign; } } if ($i === 1) { $text = " align=" . $textalign; } $row_str .= '<td class="' . $class . '" ' . $text . '>' . $read . '</td>'; } //$i==0 $i++; } $row_str .= '</tr>'; } $counter = '<strong style="float:right;padding-right:5px">' . $tr->translate('NUM-RECORD') . count($rows) . '</strong>'; $row_str .= '</tbody>'; $footer = '</table>' . $counter . '<br/>'; if (!$report) { $footer .= $stringPagination; } return $head . $col_str . $row_str . $footer; }
public function getCheckList($delete = 0, $columns, $rows, $link = null, $editLink = "", $class = 'items', $textalign = "left", $report = false, $id = "table") { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); /* * Define string of pagination Sophen 27 June 2012 */ $stringPagination = '<script type="text/javascript"> $(document).ready(function(){ $("#' . $id . '").tablesorter(); $("#' . $id . '").tablesorter().tablesorterPager({container: $("#pagination_' . $id . '")}); $("input:.pagedisplay").focus(function(){ this.blur(); }); function changeColor(){ alert("change color on mouse over"); } }); </script> <div id="pagination_' . $id . '" class="pager" > <form > <table style="width: 200px;"><tr> <td><img src="' . BASE_URL . '/images/first.gif" class="first"/></td> <td><img src="' . BASE_URL . '/images/previous.gif" class="prev"/></td> <td><input type="text" class="pagedisplay"/></td> <td><img src="' . BASE_URL . '/images/next.gif" class="next"/></td> <td><img src="' . BASE_URL . '/images/last.gif" class="last"/></td> <td><select class="pagesize" > <option selected="selected" value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> <option value="50">50</option> <option value="60">60</option> <option value="70">70</option> <option value="80">80</option> <option value="90">90</option> <option value="100">100</option> </select> </td> </tr> </table> </form> </div> '; /* end define string*/ $head = '<form name="list"><div style="overflow:scroll; max-height: 300px; overflow-x:hidden;" ><table class="collape tablesorter" id="' . $id . '" width="100%">'; $col_str = ''; $col_str .= '<thead><tr>'; if ($delete == 1) { $col_str .= '<th class="tdheader tdcheck"></td>'; } $col_str .= '<th class="tdheader">' . $tr->translate("NUM") . '</th>'; //add columns foreach ($columns as $column) { $col_str = $col_str . '<th class="tdheader">' . $tr->translate($column) . '</th>'; } if ($editLink != "") { $col_str .= '<th class="tdheader tdedit">' . $tr->translate('EDIT_CAP') . '</th>'; } $col_str .= '</tr></thead>'; $row_str = '<tbody>'; //add element rows if ($rows == NULL) { return $head . $col_str . '</table></div><center style="font-size:18pt;">No record</center></form>'; } $temp = 0; /*------------------------Check param id----------------------------------*/ /*------------------------End check---------------------------------------*/ $r = 0; foreach ($rows as $row) { if ($r % 2 == 0) { $attb = 'normal'; } else { $attb = 'alternate'; } $r++; //-------------------check select----------------- //-------------------end check select----------------- $row_str .= '<tr class="' . $attb . '"> '; $i = 0; foreach ($row as $key => $read) { if ($read == null) { $read = ' '; } if ($i == 0) { $temp = $read; if ($delete == 1) { $row_str .= '<td><input type="checkbox" name="del[]" id="del[]" value="' . $temp . '" /></td>'; } $row_str .= '<td class="items-no">' . $r . '</td>'; } else { if ($link != null) { foreach ($link as $column => $url) { if ($key == $column) { $img = ''; $array = array('tag' => 'a', 'attribute' => array('href' => Application_Form_FrmMessage::redirectorview($url) . '?id=' . $temp)); $read = $this->formSubElement($array, $img . $read); } } } $text = ''; if ($i != 1) { $text = $this->textAlign($read); $read = $this->checkValue($read); if ($textalign != 'left') { $text = " align=" . $textalign; } } $row_str .= '<td class="' . $class . '" ' . $text . '>' . $read . '</td>'; if ($i == count($columns)) { if ($editLink != "") { $row_str .= '<td class="' . $class . '"><a class="edit" href="' . $editLink . '?id=' . $temp . '">' . '</a></td>'; } } } $i++; } $row_str .= '</tr>'; } $counter = '<span class="row_num">' . $tr->translate('NUM-RECORD') . count($rows) . '</span>'; $row_str .= '</tbody>'; $footer = '</table></div></form>'; if (!$report) { $footer .= '<div class="footer_list">' . $stringPagination . $counter . '</div>'; } return $head . $col_str . $row_str . $footer; }