gglnltcs_build_table

The BestWebSoft Google Analytics 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 ABSPATH . PLUGINDIR . 'bestwebsoft-google-analytics/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="gglnltcs"> 
  5. <tr> 
  6. <th> 
  7. <h3 class="gglnltcs-table-name"><?php echo $table_type; ?></h3> 
  8. </th><?php 
  9. foreach ( $data as $item ) { 
  10. $rows_counter++; 
  11. $curr_category = $item['category']; 
  12. if ( $curr_category != $prev_category ) { 
  13. echo '<td><hr><strong>' . $curr_category . '</strong><hr>'; 
  14. $rows_counter = 0; 
  15. } /** Build checkboxes for dimensions or metrics options. */ 
  16. echo '<p><input id="' . $item['id'] . '" name="' . $item['name'] . '" type="checkbox" value="' . $item['value'] .'"'; 
  17. if ( isset( $settings[ $item['name'] ] ) || ( ! $settings && $item['name'] == 'gglnltcs-ga-visitors' ) ) {  
  18. echo ' checked = "checked">'; 
  19. } else { 
  20. echo '>'; 
  21. echo '<label title="' . $item['title'] . '" for="' . $item['for'] . '"> ' . $item['label'] . '</label></p>'; 
  22. $prev_category = $curr_category; 
  23. if ( $curr_category != $prev_category ) { 
  24. echo '</td>'; 
  25. if ( $rows_counter == 10 ) { 
  26. echo '</td><td>'; 
  27. $rows_counter = 0; 
  28. } /** close foreach.*/?> 
  29. </tr> 
  30. </table><?php