function tripal_analysis_admin
2.x tripal_analysis.admin.inc | tripal_analysis_admin() |
3.x tripal_analysis.admin.inc | tripal_analysis_admin() |
1.x tripal_analysis.admin.inc | tripal_analysis_admin() |
Administration page callbacks for the Tripal Analysis module
We have defined a hook_get_settings() function. When a sub-module is enabled, we'll look for this function to provide a form for the administrative setting.
Return value
A form API array describing an administrative form
Related topics
2 string references to 'tripal_analysis_admin'
- tripal_analysis_menu in tripal_analysis/
tripal_analysis.module - Implementation of hook_menu(). Entry points and paths of the module
- tripal_analysis_theme in tripal_analysis/
tripal_analysis.module - We need to let drupal know about our theme functions and their arguments. We create theme functions to allow users of the module to customize the look and feel of the output generated in this module
File
- tripal_analysis/
includes/ tripal_analysis.admin.inc, line 21 - Contains functions displaying administrative pages and forms
Code
function tripal_analysis_admin() {
// Create a new administrative form. We'll add main functions to the form
// first (Sync, Reindex, Clean, Taxonify). Thereafter, any sub-module that
// has a setting will be added.
$form = array();
// before proceeding check to see if we have any
// currently processing jobs. If so, we don't want
// to give the opportunity to sync libraries
$active_jobs = FALSE;
if (tripal_get_module_active_jobs('tripal_organism')) {
$active_jobs = TRUE;
}
// add the field set for syncing libraries
if (!$active_jobs) {
// add the field set for syncing analyses
get_tripal_analysis_admin_form_sync_set($form);
// get_tripal_analysis_admin_form_reindex_set($form);
// get_tripal_analysis_admin_form_taxonomy_set($form);
get_tripal_analysis_admin_form_cleanup_set($form);
}
else {
$form['notice'] = array(
'#type' => 'fieldset',
'#title' => t('Analysis Management Temporarily Unavailable')
);
$form['notice']['message'] = array(
'#value' => t('Currently, analysis management jobs are waiting or are running. . Managemment features have been hidden until these jobs complete. Please check back later once these jobs have finished. You can view the status of pending jobs in the Tripal jobs page.'),
);
}
// Add sub-module settings. Pull all sub-module information from
// {tripal_analysis} table
$sql = "SELECT modulename FROM {tripal_analysis}";
$result = db_query($sql);
$counter = 0; //keep track of the number of sub-modules
while ($data = db_fetch_object($result)) {
// Check if the hook_get_settings() function is already defined.
$func = $data->modulename . "_get_settings";
$functions = get_defined_functions();
$settings;
foreach ($functions['user'] as $function) {
if ($function == $func) {
$settings = $func();
}
}
// Add sub-module's specific settings to the administrative view
if ($settings) {
// Define a fieldset for the sub-module
$form["field$counter"] = array(
'#type' => 'fieldset',
'#title' => "$settings->title",
'#collapsible' => TRUE
);
$form["field$counter"]["$settings->title"] = $settings->form;
}
$counter++;
}
return system_settings_form($form);
}