PubBulkImporter.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. class PubBulkImporter extends TripalImporter {
  3. /**
  4. * The name of this loader. This name will be presented to the site
  5. * user.
  6. */
  7. public static $name = 'Chado Bulk Publication Importer';
  8. /**
  9. * The machine name for this loader. This name will be used to construct
  10. * the URL for the loader.
  11. */
  12. public static $machine_name = 'chado_pub_bulk';
  13. /**
  14. * A brief description for this loader. This description will be
  15. * presented to the site user.
  16. */
  17. public static $description = 'Create and modify importers that can connect to and retrieve publications from remote databases.';
  18. /**
  19. * An array containing the extensions of allowed file types.
  20. */
  21. public static $file_types = [];
  22. /**
  23. * Provides information to the user about the file upload. Typically this
  24. * may include a description of the file types allowed.
  25. */
  26. public static $upload_description = '';
  27. /**
  28. * The title that should appear above the upload button.
  29. */
  30. public static $upload_title = 'File Upload';
  31. /**
  32. * If the loader should require an analysis record. To maintain provenance
  33. * we should always indicate where the data we are uploading comes from.
  34. * The method that Tripal attempts to use for this by associating upload files
  35. * with an analysis record. The analysis record provides the details for
  36. * how the file was created or obtained. Set this to FALSE if the loader
  37. * should not require an analysis when loading. if $use_analysis is set to
  38. * true then the form values will have an 'analysis_id' key in the $form_state
  39. * array on submitted forms.
  40. */
  41. public static $use_analysis = FALSE;
  42. /**
  43. * If the $use_analysis value is set above then this value indicates if the
  44. * analysis should be required.
  45. */
  46. public static $require_analysis = FALSE;
  47. /**
  48. * Text that should appear on the button at the bottom of the importer
  49. * form.
  50. */
  51. public static $button_text = 'Import';
  52. /**
  53. * Indicates the methods that the file uploader will support.
  54. */
  55. public static $methods = [
  56. // Allow the user to upload a file to the server.
  57. 'file_upload' => FALSE,
  58. // Allow the user to provide the path on the Tripal server for the file.
  59. 'file_local' => FALSE,
  60. // Allow the user to provide a remote URL for the file.
  61. 'file_remote' => FALSE,
  62. ];
  63. /**
  64. * Indicates if the file must be provided. An example when it may not be
  65. * necessary to require that the user provide a file for uploading if the
  66. * loader keeps track of previous files and makes those available for
  67. * selection.
  68. */
  69. public static $file_required = FALSE;
  70. /**
  71. * The array of arguments used for this loader. Each argument should
  72. * be a separate array containing a machine_name, name, and description
  73. * keys. This information is used to build the help text for the loader.
  74. */
  75. public static $argument_list = [];
  76. /**
  77. * Indicates how many files are allowed to be uploaded. By default this is
  78. * set to allow only one file. Change to any positive number. A value of
  79. * zero indicates an unlimited number of uploaded files are allowed.
  80. */
  81. public static $cardinality = 0;
  82. /**
  83. * Be default, all loaders are automatically added to the Admin >
  84. * Tripal > Data Loaders menu. However, if this loader should be
  85. * made available via a different menu path, then set it here. If the
  86. * value is empty then the path will be the default.
  87. */
  88. public static $menu_path = '';
  89. /**
  90. * If your importer requires more flexibility and advance features than
  91. * the TripalImporter provides you can indicate a callback function. If set,
  92. * the callback will be used to provide the importer interface to the
  93. * end-user. However, because this bypasses the class infrastructure the
  94. * run() function will also not be available and your importer must be
  95. * fully self-sufficient outside of this class. The benefit for using a
  96. * TripalImporter despite your loader being self-sufficient is that Tripal
  97. * will treat your loader like all others providing a consistent location
  98. * in the menu and set of permissions.
  99. */
  100. public static $callback = 'tripal_pub_importers_list';
  101. /**
  102. * The name of the module that provides the callback function.
  103. */
  104. public static $callback_module = 'tripal_chado';
  105. /**
  106. * An include path for the callback function. Use a relative path within
  107. * this scope of this module
  108. * (e.g. includes/loaders/tripal_chado_pub_importers).
  109. */
  110. public static $callback_path = 'includes/loaders/tripal_chado.pub_importers.inc';
  111. }