ExportEntry

The Contact Form DB ExportEntry class.

Defined (1)

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

/ExportEntry.php  
  1. class ExportEntry extends ExportToHtmlTemplate implements CFDBExport { 
  2.  
  3. var $submitTime; 
  4.  
  5. var $tableId = 'cfdb_entry'; 
  6.  
  7. /** 
  8. * @param $formName string 
  9. * @param $options array of option_name => option_value 
  10. * @return void 
  11. */ 
  12. public function export($formName, $options = null) { 
  13.  
  14. if (!isset($options['submit_time'])) { 
  15. return; 
  16. $this->submitTime = $options['submit_time']; 
  17. unset($options['submit_time']); 
  18. $options['content'] = 'TO BE REPLACED'; 
  19. $options['filter'] = 'submit_time=' . $this->submitTime; 
  20.  
  21. parent::export($formName, $options); 
  22.  
  23. public function modifyContent($template) { 
  24. $cssUrl = $this->plugin->getPluginDirUrl() . '/css/misctable.css'; 
  25. $cssTag = '<link rel="stylesheet" href="' . $cssUrl . '">'; 
  26.  
  27. $javascript = ''; 
  28. if ($this->plugin->isEditorActive()) { 
  29. $cfdbEditUrl = admin_url('admin-ajax.php') . '?action=cfdb-edit'; 
  30. $cfdbGetValueUrl = admin_url('admin-ajax.php') . '?action=cfdb-getvalue'; 
  31. $loadImg = plugins_url('/../contact-form-to-database-extension-edit/img/load.gif', __FILE__); 
  32. $javascript = sprintf( 
  33. <script type="text/javascript"> 
  34. jQuery(document).ready( 
  35. function () { 
  36. cfdbEntryEditable("%s", "%s", "%s", "%s"); 
  37. }); 
  38. </script>',  
  39. $this->tableId, $cfdbEditUrl, $cfdbGetValueUrl, $loadImg); 
  40.  
  41. $template = "{{BEFORE}}$cssTag{{/BEFORE}}" ; 
  42. $template .= '<table id="' . $this->tableId . '"><tbody></tbody>'; 
  43. $cols = $this->dataIterator->getDisplayColumns(); 
  44. foreach ($cols as $aCol) { 
  45. $colDisplayValue = $aCol; 
  46. if ($this->headers && isset($this->headers[$aCol])) { 
  47. $colDisplayValue = $this->headers[$aCol]; 
  48. $template .= sprintf('<tr><td><div>%s</div></td><td title="%s"><div id="%s, %s">${%s}</div></td></tr>',  
  49. $colDisplayValue, $aCol, $this->submitTime, $aCol, $aCol); 
  50. $template .= '</tbody></table>'; 
  51. $template .= "{{AFTER}}$javascript{{/AFTER}}"; 
  52. return $template; 
  53.