/modules/voip_cdr/voip_cdr.inc.php

https://github.com/axxtel/agilebill · PHP · 174 lines · 106 code · 21 blank · 47 comment · 14 complexity · 7901ea5f56377840b4a7c98392ca9cbc MD5 · raw file

  1. <?php
  2. /**
  3. * AgileBill - Open Billing Software
  4. *
  5. * This body of work is free software; you can redistribute it and/or
  6. * modify it under the terms of the Open AgileBill License
  7. * License as published at http://www.agileco.com/agilebill/license1-4.txt
  8. *
  9. * For questions, help, comments, discussion, etc., please join the
  10. * Agileco community forums at http://forum.agileco.com/
  11. *
  12. * @link http://www.agileco.com/
  13. * @copyright 2004-2008 Agileco, LLC.
  14. * @license http://www.agileco.com/agilebill/license1-4.txt
  15. * @author Tony Landis <tony@agileco.com>
  16. * @package AgileBill
  17. * @version 1.4.93
  18. */
  19. class voip_cdr
  20. {
  21. # Open the constructor for this mod
  22. function voip_cdr()
  23. {
  24. # name of this module:
  25. $this->module = "voip_cdr";
  26. # location of the construct XML file:
  27. $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml";
  28. # open the construct file for parsing
  29. $C_xml = new CORE_xml;
  30. $construct = $C_xml->xml_to_array($this->xml_construct);
  31. $this->method = $construct["construct"]["method"];
  32. $this->trigger = $construct["construct"]["trigger"];
  33. $this->field = $construct["construct"]["field"];
  34. $this->table = $construct["construct"]["table"];
  35. $this->module = $construct["construct"]["module"];
  36. $this->cache = $construct["construct"]["cache"];
  37. $this->order_by = $construct["construct"]["order_by"];
  38. $this->limit = $construct["construct"]["limit"];
  39. }
  40. ##############################
  41. ## ADD ##
  42. ##############################
  43. function add($VAR)
  44. {
  45. $type = "add";
  46. $this->method["$type"] = explode(",", $this->method["$type"]);
  47. $db = new CORE_database;
  48. $db->add($VAR, $this, $type);
  49. }
  50. ##############################
  51. ## VIEW ##
  52. ##############################
  53. function view($VAR)
  54. {
  55. $type = "view";
  56. $this->method["$type"] = explode(",", $this->method["$type"]);
  57. $db = new CORE_database;
  58. $db->view($VAR, $this, $type);
  59. }
  60. ##############################
  61. ## UPDATE ##
  62. ##############################
  63. function update($VAR)
  64. {
  65. $type = "update";
  66. $this->method["$type"] = explode(",", $this->method["$type"]);
  67. $db = new CORE_database;
  68. $db->update($VAR, $this, $type);
  69. }
  70. ##############################
  71. ## DELETE ##
  72. ##############################
  73. function delete($VAR)
  74. {
  75. $db = new CORE_database;
  76. $db->mass_delete($VAR, $this, "");
  77. }
  78. ##############################
  79. ## SEARCH FORM ##
  80. ##############################
  81. function search_form($VAR)
  82. {
  83. $type = "search";
  84. $this->method["$type"] = explode(",", $this->method["$type"]);
  85. $db = new CORE_database;
  86. $db->search_form($VAR, $this, $type);
  87. }
  88. ##############################
  89. ## SEARCH ##
  90. ##############################
  91. function search($VAR)
  92. {
  93. $type = "search";
  94. $this->method["$type"] = explode(",", $this->method["$type"]);
  95. $db = new CORE_database;
  96. $db->search($VAR, $this, $type);
  97. }
  98. ##############################
  99. ## SEARCH SHOW ##
  100. ##############################
  101. function search_show($VAR)
  102. {
  103. $type = "search";
  104. $this->method["$type"] = explode(",", $this->method["$type"]);
  105. $db = new CORE_database;
  106. $db->search_show($VAR, $this, $type);
  107. }
  108. ##############################
  109. ## SEARCH EXPORT ##
  110. ##############################
  111. function search_export($VAR)
  112. {
  113. # require the export class
  114. require_once (PATH_CORE . "export.inc.php");
  115. # Call the correct export function for inline browser display, download, email, or web save.
  116. if($VAR["format"] == "excel")
  117. {
  118. $type = "export_excel";
  119. $this->method["$type"] = explode(",", $this->method["$type"]);
  120. $export = new CORE_export;
  121. $export->search_excel($VAR, $this, $type);
  122. }
  123. else if ($VAR["format"] == "pdf")
  124. {
  125. $type = "export_pdf";
  126. $this->method["$type"] = explode(",", $this->method["$type"]);
  127. $export = new CORE_export;
  128. $export->search_pdf($VAR, $this, $type);
  129. }
  130. else if ($VAR["format"] == "xml")
  131. {
  132. $type = "export_xml";
  133. $this->method["$type"] = explode(",", $this->method["$type"]);
  134. $export = new CORE_export;
  135. $export->search_xml($VAR, $this, $type);
  136. }
  137. else if ($VAR["format"] == "csv")
  138. {
  139. $type = "export_csv";
  140. $this->method["$type"] = explode(",", $this->method["$type"]);
  141. $export = new CORE_export;
  142. $export->search_csv($VAR, $this, $type);
  143. }
  144. else if ($VAR["format"] == "tab")
  145. {
  146. $type = "export_tab";
  147. $this->method["$type"] = explode(",", $this->method["$type"]);
  148. $export = new CORE_export;
  149. $export->search_tab($VAR, $this, $type);
  150. }
  151. }
  152. }
  153. ?>