/[drupal]/contributions/modules/similarterms/similarterms.admin.inc
ViewVC logotype

Contents of /contributions/modules/similarterms/similarterms.admin.inc

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


Revision 1.7 - (show annotations) (download) (as text)
Sun Mar 29 22:13:52 2009 UTC (8 months ago) by rmiddle
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +15 -1 lines
File MIME type: text/x-php
[#408262] Patch by Mark Theunissen to add a hook so people can change the node list before going to the theme.  Plus to use VID instead of NID in query.
1 <?php
2 // $Id: similarterms.admin.inc,v 1.6 2009/01/26 01:46:55 rmiddle Exp $
3
4 /**
5 * @file
6 * Settings form.
7 */
8
9 /**
10 * Module settings page.
11 */
12 function similarterms_admin_settings(&$form_state) {
13 $vocabularies_options = array(
14 'multi_select_and_tags' => t('Display multi-select and tags types only'),
15 'all' => t('Display all vocabularies types'),
16 );
17 $form['similarterms_vocabularies'] = array(
18 '#type' => 'radios',
19 '#title' => t('Vocabularies types to list'),
20 '#default_value' => variable_get("similarterms_vocabularies", 'multi_select_and_tags'),
21 '#options' => $vocabularies_options,
22 '#required' => FALSE,
23 );
24 $display_options = array(
25 'title_only' => t('Display titles only'),
26 'teaser' => t('Display titles and teaser'),
27 );
28 $form['similarterms_display_options'] = array(
29 '#type' => 'radios',
30 '#title' => t('Display Options'),
31 '#default_value' => variable_get('similarterms_display_options', 'title_only'),
32 '#options' => $display_options,
33 '#required' => FALSE,
34 '#prefix' => '<div>',
35 '#suffix' => '</div>',
36 );
37
38 $ncount_options = array(
39 'default' => t('Default sort order'),
40 'unique' => t('Prefer more unique order'),
41 );
42 $form['similarterms_ncount_options'] = array(
43 '#type' => 'radios',
44 '#title' => t('Unique Order Options'),
45 '#default_value' => variable_get('similarterms_ncount_options', 'default'),
46 '#options' => $ncount_options,
47 '#required' => FALSE,
48 '#prefix' => '<div>',
49 '#suffix' => '</div>',
50 );
51
52 $yesno_opts = array(
53 1 => t('yes'),
54 0 => t('no'),
55 );
56 $form['similarterms_override_options'] = array(
57 '#title' => t('Override Options'),
58 '#description' => t('Allow override of similarterms choices.'),
59 '#default_value' => variable_get('similarterms_override_options', 0),
60 '#options' => $yesno_opts,
61 '#required' => FALSE,
62 '#prefix' => '<div>',
63 '#suffix' => '</div>',
64 );
65
66 $cache_options = drupal_map_assoc(array(0, 300, 600, 900, 1800, 3600, 7200, 21600, 43200, 86400, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), 'format_interval');
67 $cache_options[0] = t('Never');
68
69 $form['similarterms_cache_options'] = array(
70 '#type' => 'select',
71 '#title' => t('Cache Options'),
72 '#default_value' => variable_get('similarterms_cache_options', 3600),
73 '#options' => $cache_options,
74 '#required' => FALSE,
75 // '#prefix' => '<div>',
76 // '#suffix' => '</div>',
77 );
78
79 $form['similarterms_clear_cache'] = array(
80 '#type' => 'checkbox',
81 '#title' => t('Clear Cache'),
82 '#description' => t('Clear Similarterms Block Cache'),
83 // '#prefix' => '<div>',
84 // '#suffix' => '</div>',
85 );
86 // Get the weblinks categories to add to the blogroll
87 // $result = db_query('SELECT tid, name FROM {term_data} WHERE vid = %d ORDER BY weight, name', _weblinks_get_vocid());
88
89 // while ($row = db_fetch_object($result)) {
90 // Set which link categories get displayed on the links page
91
92 // $form[$row->tid]['weblinks_page_'. $row->tid] = array(
93 // '#type' => 'checkbox',
94 // '#title' => t($row->name),
95 // '#default_value' => variable_get('weblinks_page_'. $row->tid, 1),
96 // '#required' => FALSE,
97 // '#description' => t('Check to enable this category'),
98 // );
99 // }
100 $form['#submit'][] = 'similarterms_admin_settings_submit';
101 return system_settings_form($form);
102 }
103
104 function similarterms_admin_settings_submit($form, &$form_state) {
105 if ($form_state['values']['similarterms_clear_cache']) {
106 cache_clear_all('*', 'cache_similarterms', TRUE);
107 drupal_set_message(t('Similarterms Block Cache is now cleared'));
108 }
109 }
110
111

  ViewVC Help
Powered by ViewVC 1.1.2