gglnltcs_build_table

The WordPress Core gglnltcs build table function.

Description

gglnltcs_build_table( $table_type_slug, $table_type, $data, $settings ); 

Parameters (4)

0. $table_type_slug
The table type slug.
1. $table_type
The table type.
2. $data
The data.
3. $settings
The settings.

Usage

  1. if ( !function_exists( 'gglnltcs_build_table' ) ) { 
  2. require_once '/bws-google-analytics.php'; 
  3.  
  4. // The table type slug. 
  5. $table_type_slug = null; 
  6.  
  7. // The table type. 
  8. $table_type = null; 
  9.  
  10. // The data. 
  11. $data = null; 
  12.  
  13. // The settings. 
  14. $settings = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = gglnltcs_build_table($table_type_slug, $table_type, $data, $settings); 
  18.  

Defined (1)

The function is defined in the following location(s).

/bws-google-analytics.php  
  1. function gglnltcs_build_table( $table_type_slug, $table_type, $data, $settings ) { 
  2. $curr_category = $prev_category = ''; 
  3. $rows_counter = 0; ?> 
  4. <table id="gglnltcs-<?php echo $table_type_slug; ?>" class="form-table gglnltcs gglnltcs-metrics"> 
  5. <tr> 
  6. <th class="gglnltcs-table-name"><?php echo $table_type; ?></th> 
  7. <?php foreach ( $data as $item ) { 
  8. $rows_counter++; 
  9. $curr_category = $item['category']; 
  10. if ( $curr_category != $prev_category ) { 
  11. echo '<td><hr><strong>' . $curr_category . '</strong><hr>'; 
  12. $rows_counter = 0; 
  13. } /** Build checkboxes for metrics options. */ 
  14. echo '<p><input id="' . $item['id'] . '" class="gglnltcs_metrics_checkbox" name="' . $item['name'] . '" type="checkbox" value="' . $item['value'] .'"'; 
  15. if ( isset( $settings[ $item['name'] ] ) || ( ! $settings && $item['name'] == 'gglnltcs-ga-visitors' ) ) { 
  16. echo ' checked = "checked">'; 
  17. } else { 
  18. echo '>'; 
  19. echo '<label title="' . $item['title'] . '" for="' . $item['for'] . '"> ' . $item['label'] . '</label></p>'; 
  20. $prev_category = $curr_category; 
  21. if ( $curr_category != $prev_category ) { 
  22. echo '</td>'; 
  23. if ( $rows_counter == 10 ) { 
  24. echo '</td><td>'; 
  25. $rows_counter = 0; 
  26. } /** close foreach.*/?> 
  27. </tr> 
  28. </table><?php