123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
- function tripal_pub_configuration_form() {
- $cv_options = tripal_cv_get_cv_options();
-
- $form['node_form'] = array(
- '#type' => 'fieldset',
- '#title' => t('Create/Edit Publication Settings'),
- );
- $form['node_form']['tripal_pub_types_cv'] = array(
- '#type' => 'select',
- '#title' => t('Controlled Vocabularies'),
- '#options' => $cv_options,
- '#default_value' => variable_get('tripal_pub_types_cv', 0),
- '#description' => 'Set the controlled vocabulary to pull publication type options from. Terms in this vocabulary will be available is the Publication Type select box on both the create and edit pages.',
- );
- $form['pubmed'] = array(
- '#type' => 'fieldset',
- '#title' => t('Create Nodes via PubMed Search'),
- );
- $form['pubmed']['description'] = array(
- '#type' => 'item',
- '#value' => 'Publication nodes are created based on the results of a PubMed publication search using '
- .'the keywords entered below. No content is created until the sync is clicked below and the registered tripal job is '
- .'run. This script attempts to only load new publications (ones which don\'t already have nodes from a previous search) '
- .'by comparing the pub_id thus if a publication is added manually which also appears in the pubmed search it will likely '
- .'get added twice.'
- );
-
- $form['pubmed']['unique_name'] = array(
- '#type' => 'textfield',
- '#title' => t('Search Keywords'),
- '#description' => t('Specific search terms. Must be seperated by a single space.'),
- '#required' => FALSE,
- '#default_value' => variable_get('unique_name', NULL)
- );
-
-
- $form['pubmed']['sync_info'] = array(
- '#type' => 'submit',
- '#title' => t('Sync Publications Jobs'),
- '#value' => t('Sync'),
- );
- $form['submit'] = array(
- '#type' => 'submit',
- '#weight' => 10,
- '#value' => t('Save Configuration')
- );
- return $form;
- }
- function tripal_pub_configuration_form_submit($form, $form_state) {
- global $user;
- if ($form_state['values']['op'] == t('Save Configuration')) {
- variable_set('tripal_pub_types_cv', $form_state['values']['tripal_pub_types_cv']);
- variable_set('unique_name', $form_state['values']['unique_name'] );
- }
-
- if ($form_state['values']['op'] == t('Sync')) {
- variable_set('unique_name', $form_state['values']['unique_name'] );
- $job_args = array($form_state['values']['unique_name']);
- $job_id = tripal_add_job('Search & Load PubMed Publications', 'tripal_pub', 'tripal_pub_search_load_pubmed_publications', $job_args, $user->uid);
- }
- }
|