tripal_contact.admin.inc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * @file
  4. * Handle administration of contacts.
  5. *
  6. * @ingroup tripal_legacy_contact
  7. */
  8. /**
  9. * Launchpage for contact administration. Makes sure views are enabled and if not provides
  10. * links to enable them.
  11. *
  12. * @ingroup tripal_legacy_contact
  13. */
  14. function tripal_contact_admin_contact_view() {
  15. $output = '';
  16. // set the breadcrumb
  17. $breadcrumb = array();
  18. $breadcrumb[] = l('Home', '<front>');
  19. $breadcrumb[] = l('Administration', 'admin');
  20. $breadcrumb[] = l('Tripal', 'admin/tripal');
  21. $breadcrumb[] = l('Chado', 'admin/tripal/legacy');
  22. $breadcrumb[] = l('Contacts', 'admin/tripal/legacy/tripal_contact');
  23. drupal_set_breadcrumb($breadcrumb);
  24. // Add the view
  25. $view = views_embed_view('tripal_contact_admin_contacts','default');
  26. if (isset($view)) {
  27. $output .= $view;
  28. }
  29. else {
  30. $output .= '<p>The Contact module uses primarily views to provide an '
  31. . 'administrative interface. Currently one or more views needed for this '
  32. . 'administrative interface are disabled. <strong>Click each of the following links to '
  33. . 'enable the pertinent views</strong>:</p>';
  34. $output .= '<ul>';
  35. $output .= '<li>'.l('Contacts View', 'admin/tripal/legacy/tripal_contact/views/contacts/enable').'</li>';
  36. $output .= '</ul>';
  37. }
  38. return $output;
  39. }
  40. /**
  41. * Administrative settings form
  42. *
  43. * @ingroup tripal_legacy_contact
  44. */
  45. function tripal_contact_admin() {
  46. $form = array();
  47. // If your module is using the Chado Node: Title & Path API to allow custom titles
  48. // for your node type then you need to add the configuration form for this functionality.
  49. $details = array(
  50. 'module' => 'tripal_contact', // the name of the MODULE implementing the content type
  51. 'content_type' => 'chado_contact', // the name of the content type
  52. // An array of options to use under "Page Titles"
  53. // the key should be the token and the value should be the human-readable option
  54. 'options' => array(
  55. '[contact.name]' => 'Contact Name Only',
  56. // there should always be one options matching the unique constraint.
  57. '[contact.name]' => 'Unique Contraint: The name of the contact'
  58. ),
  59. // the token indicating the unique constraint in the options array
  60. 'unique_option' => '[contact.name]'
  61. );
  62. // This call adds the configuration form to your current form
  63. // This sub-form handles it's own validation & submit
  64. chado_add_admin_form_set_title($form, $form_state, $details);
  65. // URL ALIAS
  66. $details = array(
  67. 'module' => 'tripal_contact',
  68. 'content_type' => 'chado_contact',
  69. 'options' => array(
  70. '/contact/[contact.contact_id]' => 'Contact ID',
  71. '/contact/[contact.name]' => 'Unique Contraint: The name of the contact'
  72. ),
  73. );
  74. // This call adds the configuration form to your current form
  75. // This sub-form handles it's own validation & submit
  76. chado_add_admin_form_set_url($form, $form_state, $details);
  77. return system_settings_form($form);
  78. }
  79. /**
  80. * Reindex nodes for drupal search
  81. *
  82. * @ingroup tripal_legacy_contact
  83. */
  84. function get_tripal_contact_admin_form_reindex_set(&$form) {
  85. }
  86. /**
  87. * Validate the contact settings form.
  88. *
  89. * @ingroup tripal_legacy_contact
  90. */
  91. function tripal_contact_admin_validate($form, &$form_state) {
  92. }