IOTransformationsPlugin.class.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Abstract class for the I/O transformations plugins
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. if (! defined('PHPMYADMIN')) {
  9. exit;
  10. }
  11. /* It extends the transformations plugin class */
  12. require_once 'TransformationsPlugin.class.php';
  13. /**
  14. * Provides a common interface that will have to be implemented
  15. * by all of the Input/Output transformations plugins.
  16. *
  17. * @package PhpMyAdmin
  18. */
  19. abstract class IOTransformationsPlugin extends TransformationsPlugin
  20. {
  21. // specifies whether transformation was successful or not
  22. protected $success = true;
  23. // to store the error message in case of failed transformations
  24. protected $error = '';
  25. /**
  26. * Returns the html for input field to override default textarea.
  27. * Note: Return empty string if default textarea is required.
  28. *
  29. * @param array $column column details
  30. * @param int $row_id row number
  31. * @param string $column_name_appendix the name attribute
  32. * @param array $options transformation options
  33. * @param string $value Current field value
  34. * @param string $text_dir text direction
  35. * @param int $tabindex tab index
  36. * @param int $tabindex_for_value offset for the values tabindex
  37. * @param int $idindex id index
  38. *
  39. * @return string the html for input field
  40. */
  41. public function getInputHtml(
  42. $column, $row_id, $column_name_appendix, $options, $value, $text_dir,
  43. $tabindex, $tabindex_for_value, $idindex
  44. ) {
  45. return '';
  46. }
  47. /**
  48. * Returns the array of scripts (filename) required for plugin
  49. * initialization and handling
  50. *
  51. * @return array javascripts to be included
  52. */
  53. public function getScripts()
  54. {
  55. return array();
  56. }
  57. /**
  58. * Returns the error message
  59. *
  60. * @return string error
  61. */
  62. public function getError()
  63. {
  64. return $this->error;
  65. }
  66. /**
  67. * Returns the success status
  68. *
  69. * @return bool
  70. */
  71. public function isSuccess()
  72. {
  73. return $this->success;
  74. }
  75. /**
  76. * Resets the object properties
  77. *
  78. * @return void
  79. */
  80. public function reset()
  81. {
  82. $this->success = true;
  83. $this->error = '';
  84. }
  85. }