CFDBShortcodeTable

The Contact Form DB CFDBShortcodeTable class.

Defined (1)

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

/CFDBShortcodeTable.php  
  1. class CFDBShortcodeTable extends ShortCodeLoader { 
  2.  
  3. /** 
  4. * Shortcode callback for writing the table of form data. Can be put in a page or post to show that data. 
  5. * Shortcode options: 
  6. * [cfdb-table form="your-form"] (shows the whole table with default options) 
  7. * Controlling the Display: Apply your CSS to the table; set the table's 'class' or 'id' attribute: 
  8. * [cfdb-table form="your-form" class="css_class"] (outputs <table class="css_class"> (default: class="cf7-db-table") 
  9. * [cfdb-table form="your-form" id="css_id"] (outputs <table id="css_id"> (no default id) 
  10. * [cfdb-table form="your-form" id="css_id" class="css_class"] (outputs <table id="css_id" class="css_class"> 
  11. * Filtering Columns: 
  12. * [cfdb-table form="your-form" show="field1, field2, field3"] (optionally show selected fields) 
  13. * [cfdb-table form="your-form" hide="field1, field2, field3"] (optionally hide selected fields) 
  14. * [cfdb-table form="your-form" show="f1, f2, f3" hide="f1"] (hide trumps show) 
  15. * Filtering Rows: 
  16. * [cfdb-table form="your-form" filter="field1=value1"] (show only rows where field1=value1) 
  17. * [cfdb-table form="your-form" filter="field1!=value1"] (show only rows where field1!=value1) 
  18. * [cfdb-table form="your-form" filter="field1=value1&&field2!=value2"] (Logical AND the filters using '&&') 
  19. * [cfdb-table form="your-form" filter="field1=value1||field2!=value2"] (Logical OR the filters using '||') 
  20. * [cfdb-table form="your-form" filter="field1=value1&&field2!=value2||field3=value3&&field4=value4"] (Mixed &&, ||) 
  21. * @param $atts array of short code attributes 
  22. * @param $content string inner content of short code 
  23. * @return string HTML output of shortcode 
  24. */ 
  25. public function handleShortcode($atts, $content = null) { 
  26. if (isset($atts['form'])) { 
  27. $atts = $this->decodeAttributes($atts); 
  28. $atts['content'] = $content; 
  29. $atts['canDelete'] = false; 
  30. $atts['fromshortcode'] = true; 
  31. require_once('ExportToHtmlTable.php'); 
  32. $export = new ExportToHtmlTable(); 
  33. return $export->export($atts['form'], $atts); 
  34. return ''; 
  35.