当前位置: 首页>>代码示例>>PHP>>正文


PHP table::get_html方法代码示例

本文整理汇总了PHP中table::get_html方法的典型用法代码示例。如果您正苦于以下问题:PHP table::get_html方法的具体用法?PHP table::get_html怎么用?PHP table::get_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在table的用法示例。


在下文中一共展示了table::get_html方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_html

 /**
  * Return the complete HTML
  *
  * Navigation links appear before and after the table
  *
  * @return string
  */
 public function get_html()
 {
     if (!$this->custom_html_rows) {
         $this->build_sql();
     }
     if (empty($this->custom_html_rows_are_strings) or empty($this->custom_html_rows)) {
         // we'll just use the table helper to format a table
         include_helper('table');
         $table = new table('sample_table');
         // we need to change the headings to add the html links for sorting...
         if ($this->sql_results) {
             foreach ($this->sql_results as &$row) {
                 $new_row = new \stdClass();
                 foreach ($row as $fname => $val) {
                     $other_order = 'asc';
                     $current_order = '  ';
                     // sorting?
                     if ($this->sort_by == $fname) {
                         if ($this->sort_ord == 'asc') {
                             $current_order = ' ↑';
                             $other_order = 'desc';
                         } else {
                             $current_order = ' ↓';
                             $other_order = 'asc';
                         }
                     }
                     if (!$this->suppress_sort and !in_array($fname, $this->do_not_allow_sort_on_these_columns)) {
                         $key = '<a href="' . $this->base_url . '1/0/' . 'sort-' . urlencode($fname) . '-' . $other_order . '#' . $this->pager_id . '">' . esc_html_recursive($fname) . '</a>';
                         $key .= "<span style=\"width:2em;\">{$current_order}</span>";
                     } else {
                         $key = esc_html_recursive($fname);
                     }
                     $new_row->{$key} = $val;
                 }
                 break;
             }
             $this->sql_results[0] = $new_row;
             reset($this->sql_results);
             $table->set_data($this->sql_results);
             $table->do_not_esc_th(TRUE);
             $table->do_not_esc_td(TRUE);
             $html_results = $table->get_html();
         } else {
             $html_results = '';
         }
     } else {
         // we have custom HTML ready to go
         $html_results = '';
         if (!empty($this->custom_html_headings)) {
             $html_results .= $this->custom_html_headings;
         }
         foreach ($this->sql_results as $row) {
             $html_results .= $row . "\r\n";
         }
     }
     $html = '';
     // default
     if ($html_results) {
         $html = '<div id="' . $this->get_id() . '">' . "\r\n";
         $html .= $this->get_filter_box_html();
         $html .= parent::display_pages();
         $html .= $html_results;
         $html .= parent::display_pages();
         $html .= "\r\n</div>";
     }
     return $html;
 }
开发者ID:RA2WP,项目名称:RA2WP,代码行数:74,代码来源:tina_mvc_pagination_helper_class.php

示例2: table

            $pagination->initialize();
            //END page navigation
            //Execute query limitng the resultset
            $my_test_rows = $my_test_db->get_results($query->limit_qy_to($pagination->item_start - 1, $pagination->pg_interval), 'ARRAY_N');
            $my_test_cols = $my_test_db->get_col_info('name');
            //Output table
            $table = new table();
            $table->set_table_tpl_path($wpbi_url['tpl']);
            $table->set_table_pagination($pagination->get_html());
            $table->set_css_class('widefat');
            $table->set_rows($my_test_rows);
            $table->set_cols($my_test_cols);
            $table->has_header(true);
            $table->has_footer(true);
            $table->encode_html(true);
            $test_output = $test_output . $table->get_html();
        }
        //Prepare output
        $template_site->assign_vars(array('PG_TITLE' => $wpbi_dialog['page']['queries']['title'], 'PG_DESCRIPTION' => sprintf($wpbi_dialog['query']['saved']['test'], $vo_query->name, htmlentities($query->stmt))));
        $template_site->pparse('header');
        echo $test_output;
        $template_site->pparse('footer');
    }
}
?>

<?php 
/***********************/
/***   EDIT ACTION   ***/
/***********************/
/**** Edit query form ***/
开发者ID:RA2WP,项目名称:RA2WP,代码行数:31,代码来源:queries.php

示例3: get_html_4_table

function get_html_4_table($id)
{
    global $wpdb, $qy_table_databases, $qy_table_queries, $wpbi_sql, $wpbi_settings, $wpbi_url, $wpbi_dialog, $lng, $language, $template_site;
    $template_site->set_filenames(array('css' => $wpbi_url['tpl']['root-path'] . $wpbi_url['tpl']['css']));
    $table_id = $id;
    //id or key
    $search_by_key = false;
    if (!is_numeric($table_id)) {
        if (strlen($table_id) == 32 && strpos($table_id, ' ') === false) {
            $search_by_key = true;
        } else {
            return '<p>Could not create table. Wrong ID provided.</p>';
        }
    }
    $test_output = '';
    //Store the test output
    //Get table metadata
    $vo_table = new vo_table($table_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $table_id, NULL);
    $dao_table = new dao_table($wpdb, $wpbi_sql['tname']['tables']);
    $vo_table = $search_by_key ? $dao_table->select_by_key($vo_table) : $dao_table->select($vo_table);
    $vo_table = $vo_table[0];
    //Get cols metadata
    $selected_table = $vo_table->id;
    $vo_tb_cols = new vo_tb_cols(NULL, $selected_table, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
    $dao_tb_cols = new dao_tb_cols($wpdb, $wpbi_sql['tname']['cols']);
    $vo_tb_cols = $dao_tb_cols->select($vo_tb_cols);
    //Get selected query
    $dao_query = new dao_query($wpdb, $wpbi_sql['tname']['queries']);
    $tgt_query = new vo_query($vo_table->query_id, NULL, NULL, NULL, NULL);
    $vo_query = $dao_query->select($tgt_query);
    $vo_query = $vo_query[0];
    //Select associated db
    $dao_database = new dao_database($wpdb, $wpbi_sql['tname']['databases']);
    $tgt_database = new vo_database($vo_query->db_id, NULL, NULL, NULL, NULL);
    $vo_database = $dao_database->select($tgt_database);
    $vo_database = $vo_database[0];
    //Create wpdb object and execute the query
    $my_test_db = new wpdb($vo_database->user, $vo_database->pass, $vo_database->name, $vo_database->host);
    $query = new query($vo_query->statement, $wpdb, $wpbi_sql['tname']['vars']);
    $total_rows = $my_test_db->get_results($query->count_qy_results(), 'ARRAY_N');
    $total_rows = intval($total_rows[0][0]);
    if ($total_rows == 0) {
        $test_output = $test_output . $wpbi_dialog['msg']['query']['no-records'];
    } else {
        //Add page navigation if requested
        if ($vo_table->rows_per_pg > 0) {
            //Page navigation
            $pagination = new pagination();
            $pagination->set_pagination_tpl_path($wpbi_url['tpl']);
            $pagination->set_pg_interval($vo_table->rows_per_pg);
            $pagination->set_pg_parameter($table_id . '_paged');
            $pagination->set_current_page(isset($_GET[$pagination->pg_parameter]) ? abs((int) $_GET[$pagination->pg_parameter]) : 1);
            $pagination->set_rows($total_rows);
            //$pagination->set_css_class(basename($vo_table->style_id,'.css'));
            $pagination->set_css_style(basename($vo_table->style_id, '.css'));
            $pagination->set_pagination_stats($wpbi_dialog['table']['pagination']['stats']);
            $pagination->set_paginate_links(paginate_links(array('base' => esc_url(add_query_arg($pagination->pg_parameter, '%#%')), 'format' => '', 'prev_text' => __($wpbi_dialog['table']['pagination']['prev_text']), 'next_text' => __($wpbi_dialog['table']['pagination']['next_text']), 'total' => ceil($pagination->rows / $pagination->pg_interval), 'current' => $pagination->current_page)));
            $pagination->initialize();
            $pagination_html = $pagination->get_html();
            //END page navigation
            //Execute query limitng the resultset
            $my_test_rows = $my_test_db->get_results($query->limit_qy_to($pagination->item_start - 1, $pagination->pg_interval), 'ARRAY_N');
        } else {
            $my_test_rows = $my_test_db->get_results($query->stmt, 'ARRAY_N');
        }
        //get columns
        $my_test_cols = array();
        $my_test_cols_visible = array();
        $col_idx = 0;
        foreach ($vo_tb_cols as $vo_tb_col) {
            array_push($my_test_cols, $vo_tb_col->col_label);
            if ($vo_tb_col->is_visible) {
                array_push($my_test_cols_visible, $col_idx);
            }
            $col_idx++;
        }
        //Output table
        $table = new table();
        $table->set_table_tpl_path($wpbi_url['tpl']);
        $table->set_table_pagination($pagination_html);
        $table->set_css_class(basename($vo_table->style_id, '.css'));
        $table->set_css_style(basename($vo_table->style_id, '.css'));
        $table->set_rows($my_test_rows);
        $table->set_cols($my_test_cols);
        $table->set_visible_cols($my_test_cols_visible);
        $table->set_title($vo_table->title);
        $table->has_header($vo_table->has_header);
        $table->has_footer($vo_table->has_footer);
        $table->set_can_download($vo_table->can_download);
        $table->encode_html(!$vo_table->encode_html);
        $test_output = $test_output . $table->get_html();
    }
    //Prepare output
    $template_site->assign_vars(array('TPL_CSS' => $wpbi_url['styles']['url'] . "tables/" . $table->css_style . '.css'));
    ob_start();
    $template_site->pparse('css');
    $css_output = ob_get_contents();
    ob_end_clean();
    return $css_output . $test_output;
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:100,代码来源:functions.php


注:本文中的table::get_html方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。