IOTransformationsPlugin.php 2.3 KB

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