/[drupal]/contributions/modules/inline_registration/inline_registration.pages.inc
ViewVC logotype

Diff of /contributions/modules/inline_registration/inline_registration.pages.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Fri Mar 20 18:30:37 2009 UTC revision 1.1.2.1, Fri Mar 20 18:30:37 2009 UTC
# Line 0  Line 1 
1    <?php
2    // $Id$
3    
4    /**
5     * @file
6     *
7     */
8    
9    function inline_registration_admin_settings() {
10    
11      $content_types = node_get_types();
12      foreach ($content_types as $type) {
13        $types[$type->type] = $type->name;
14      }
15    
16      $form['content_types'] = array(
17        '#title' => 'Content types to retrieve',
18        '#type' => 'checkboxes',
19        '#options' => $types,
20        '#default_value' => variable_get('inline_registration_content_types', array()),
21      );
22    
23      $form['submit'] = array(
24        '#value' => 'Save settings',
25        '#type' => 'submit',
26      );
27    
28      return $form;
29    }
30    
31    /**
32     * submit function for the 'Content Types' form sets variables for this module:
33     *
34     * inline_registration_content_types
35     * an array of content types to be retrieved
36     *
37     */
38    function inline_registration_admin_settings_submit($form, &$form_state) {
39      //organise the content types in to the correct format
40      $selected_types = array();
41      $selected_types = $form_state['values']['content_types'];
42      $save_types = array();
43      $count = 0;
44      foreach ($selected_types as $selected_type) {
45        if ($selected_type != '0') {
46          $count++;
47          $save_types[] = $selected_type;
48        }
49      }
50      //inform user if the module is disabled by their content choices
51      if ($count == 0) {
52        drupal_set_message(t('No content types were selected. Module disabled.'), 'error');
53      }
54    
55      //save the variables
56      variable_set('inline_registration_content_types', $save_types);
57    
58      drupal_set_message(t('Settings saved.'));
59    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2