/**
  * Generate header
  * 
  * @param array $options
  * @return string
  */
 private function header($options)
 {
     $result = '';
     $result .= '<table cellpadding="2" cellspacing="0" width="100%" class="editor footer top">';
     $result .= '<tr>';
     $result .= '<td><span>Displaying:</span> ';
     $result .= h::select(array('options' => array(20 => array('name' => 20), 30 => array('name' => 30), 50 => array('name' => 50), 100 => array('name' => 100), 200 => array('name' => 200), 500 => array('name' => 500)), 'value' => $options['limit'], 'no_choose' => true, 'onchange' => 'document.getElementById(\'offset\').value = 0; document.getElementById(\'limit\').value = this.value; this.form.submit();'));
     $result .= '</td>';
     // separator
     $result .= '<td class="editor separator">|</td>';
     $result .= '<td>';
     $result .= ' <span>Fetched: ' . $options['num_rows'] . (@$options['count_rows'] ? ' of ' . $options['count_rows'] : '') . '</span>';
     $result .= '</td>';
     // separator
     $result .= '<td class="editor separator">|</td>';
     // time
     $result .= '<td><span>Query took:</span> ' . $options['took'] . ' seconds</td>';
     // separator
     $result .= '<td class="editor separator">|</td>';
     // building pages
     $result .= '<td align="right">';
     $result_pages = array();
     $current_page = intval($options['offset'] / $options['limit']);
     if ($current_page >= 2) {
         $result_pages[] = h::button2(array('value' => '<span class="ui-icon ui-icon-seek-first"></span>', 'class' => 'button button_short', 'onclick' => 'document.getElementById(\'offset\').value = 0;this.form.submit();'));
     }
     if ($current_page >= 1) {
         $result_pages[] = h::button2(array('value' => '<span class="ui-icon ui-icon-seek-prev"></span>', 'class' => 'button button_short', 'onclick' => 'document.getElementById(\'offset\').value = ' . ($current_page - 1) * $options['limit'] . ';this.form.submit();'));
     }
     // select with number of pages
     if (isset($options['count_rows'])) {
         $pages = ceil($options['count_rows'] / $options['limit']);
         $temp = array();
         for ($i = 0; $i < $pages; $i++) {
             $temp[$i * $options['limit']] = array('name' => $i + 1);
         }
         $result_pages[] = '<span>Page:</span> ' . h::select(array('options' => $temp, 'value' => $options['offset'], 'no_choose' => true, 'onchange' => 'document.getElementById(\'offset\').value = this.value; this.form.submit();'));
         // checking for next and last pages
         $options['flag_next_row_exists'] = $pages - $current_page - 2 > 0 ? true : false;
         $options['flag_last_row_exists'] = $pages - $current_page - 1 > 0 ? true : false;
     } else {
         // showing hidden element
         $result_pages[] = 'Page: ' . ($current_page + 1);
     }
     if (@$options['flag_next_row_exists']) {
         $result_pages[] = h::button2(array('value' => '<span class="ui-icon ui-icon-seek-next"></span>', 'class' => 'button button_short', 'onclick' => '$(\'#offset\').val(' . ($current_page + 1) * $options['limit'] . '); this.form.submit();'));
     }
     if (@$options['flag_last_row_exists']) {
         $result_pages[] = h::button2(array('value' => '<span class="ui-icon ui-icon-seek-end"></span>', 'class' => 'button button_short', 'onclick' => '$(\'#offset\').val(' . ($pages - 1) * $options['limit'] . '); this.form.submit();'));
     }
     $result .= implode('&nbsp;&nbsp;|&nbsp;&nbsp;', $result_pages);
     $result .= '</td>';
     $result .= '</tr>';
     $result .= '</table>';
     return $result;
 }