tripal_analysis.admin.inc

  1. 2.x tripal_analysis/includes/tripal_analysis.admin.inc
  2. 3.x legacy/tripal_analysis/includes/tripal_analysis.admin.inc
  3. 1.x tripal_analysis/includes/tripal_analysis.admin.inc

Contains functions displaying administrative pages and forms.

File

tripal_analysis/includes/tripal_analysis.admin.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains functions displaying administrative pages and forms.
  5. *
  6. * @ingroup tripal_analysis
  7. */
  8. /**
  9. * Landing page for administration. Ensures Views are enabled & if not provides links to do so.
  10. *
  11. * @ingroup tripal_analysis
  12. */
  13. function tripal_analysis_admin_analysis_view() {
  14. $output = '';
  15. // set the breadcrumb
  16. $breadcrumb = array();
  17. $breadcrumb[] = l('Home', '<front>');
  18. $breadcrumb[] = l('Administration', 'admin');
  19. $breadcrumb[] = l('Tripal', 'admin/tripal');
  20. $breadcrumb[] = l('Chado', 'admin/tripal/chado');
  21. $breadcrumb[] = l('Analysis', 'admin/tripal/chado/tripal_analysis');
  22. drupal_set_breadcrumb($breadcrumb);
  23. // Add the view
  24. $view = views_embed_view('tripal_analysis_admin_analyses','default');
  25. if (isset($view)) {
  26. $output .= $view;
  27. }
  28. else {
  29. $output .= '<p>The Analysis module uses primarily views to provide an '
  30. . 'administrative interface. Currently one or more views needed for this '
  31. . 'administrative interface are disabled. <strong>Click each of the following links to '
  32. . 'enable the pertinent views</strong>:</p>';
  33. $output .= '<ul>';
  34. $output .= '<li>'.l('Analysis View', 'admin/tripal/chado/tripal_analysis/views/analyses/enable').'</li>';
  35. $output .= '</ul>';
  36. }
  37. return $output;
  38. }
  39. /**
  40. * Administration page callbacks for the Tripal Analysis module
  41. *
  42. * @return
  43. * A form API array describing an administrative form
  44. *
  45. * @ingroup tripal_analysis
  46. */
  47. function tripal_analysis_admin() {
  48. // Create a new administrative form. We'll add main functions to the form
  49. // first (Sync, Reindex, Clean, Taxonify). Thereafter, any sub-module that
  50. // has a setting will be added.
  51. $form = array();
  52. // If your module is using the Chado Node: Title & Path API to allow custom titles
  53. // for your node type then you need to add the configuration form for this functionality.
  54. $details = array(
  55. 'module' => 'tripal_analysis', // the name of the MODULE implementing the content type
  56. 'content_type' => 'chado_analysis', // the name of the content type
  57. // An array of options to use under "Page Titles"
  58. // the key should be the token and the value should be the human-readable option
  59. 'options' => array(
  60. '[analysis.name]' => 'Analysis Name Only',
  61. // there should always be one options matching the unique constraint.
  62. '[analysis.name] ([analysis.sourcename]) [analysis.program] version [analysis.programversion]' => 'Unique Contraint: Includes the name, source and program name/version'
  63. ),
  64. // the token indicating the unique constraint in the options array
  65. 'unique_option' => '[analysis.name] ([analysis.sourcename]) [analysis.program] version [analysis.programversion]'
  66. );
  67. // This call adds the configuration form to your current form
  68. // This sub-form handles it's own validation & submit
  69. chado_add_admin_form_set_title($form, $form_state, $details);
  70. // URL ALIAS
  71. $details = array(
  72. 'module' => 'tripal_analysis',
  73. 'content_type' => 'chado_analysis',
  74. 'options' => array(
  75. '/analysis/[analysis.analysis_id]' => 'Analysis ID',
  76. '/analysis/[analysis.program]/[analysis.programversion]/[analysis.sourcename]' => 'Unique Contraint: Includes the program name & version as well as the source name'
  77. ),
  78. );
  79. // This call adds the configuration form to your current form
  80. // This sub-form handles it's own validation & submit
  81. chado_add_admin_form_set_url($form, $form_state, $details);
  82. return system_settings_form($form);
  83. }
  84. /**
  85. * Validate the administrative form
  86. * @todo Stephen: Why is validate used rather then submit?
  87. *
  88. * @param $form
  89. * The form API array of the form to be validated
  90. * @form_state
  91. * The user submitted values
  92. *
  93. * @ingroup tripal_analysis
  94. */
  95. function tripal_analysis_admin_validate($form, &$form_state) {
  96. }

Related topics