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

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

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


Revision 1.1 - (show annotations) (download) (as text)
Fri Oct 3 16:36:58 2008 UTC (13 months, 3 weeks ago) by febbraro
Branch: MAIN
CVS Tags: DRUPAL-6--0-9, HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-php
initial commit of new module
1 <?php
2 /*
3 Copyright (C) 2008 by Phase2 Technology.
4 Author(s): Frank Febbraro
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY. See the LICENSE.txt file for more details.
10
11 $Id$
12 */
13 /**
14 * @file morelikethis.admin.inc
15 */
16
17 /**
18 * Settings for More Like This functionality.
19 */
20 function morelikethis_settings_form() {
21
22 node_types_rebuild();
23 $types = node_get_types('types', NULL, TRUE);
24
25 $options = array();
26 foreach ($types as $type) {
27 $options[$type->type] = $type->name;
28 }
29
30 $form = array();
31 foreach ($types as $type) {
32 $key = drupal_strtolower($type->type);
33 $name = $type->name;
34 $param_name = array('@name' => $name);
35
36 $form["morelikethis_{$key}"] = array(
37 '#type' => 'fieldset',
38 '#title' => t('@name', $param_name),
39 '#collapsible' => TRUE,
40 '#collapsed' => FALSE,
41 );
42
43 $form["morelikethis_{$key}"]["morelikethis_enabled_{$key}"] = array(
44 '#type' => 'checkbox',
45 '#title' => t('Enable More Like This'),
46 '#default_value' => variable_get("morelikethis_enabled_{$key}", FALSE),
47 '#description' => t('Should searches for more content like this be enabled for this content type.'),
48 );
49 $form["morelikethis_{$key}"]["morelikethis_target_types_{$key}"] = array(
50 '#type' => 'select',
51 '#title' => t('Target Content Types'),
52 '#default_value' => variable_get("morelikethis_target_types_{$key}", NULL),
53 '#options' => $options,
54 '#multiple' => TRUE,
55 '#size' => 4,
56 '#description' => t('Select which type of site content types you would like returned in more like this searches for @name. You can select multiple types by ctrl+click or apple+click.', $param_name),
57 );
58 $form["morelikethis_{$key}"]["morelikethis_count_{$key}"] = array(
59 '#type' => 'textfield',
60 '#title' => t('Number of results'),
61 '#size' => 4,
62 '#maxlength' => 4,
63 '#default_value' => variable_get("morelikethis_count_{$key}", NULL),
64 '#description' => t('Specify the number of items to include in the listing of More Like This results. Default: 10'),
65 );
66 $form["morelikethis_{$key}"]["morelikethis_threshold_{$key}"] = array(
67 '#type' => 'textfield',
68 '#size' => 6,
69 '#maxlength' => 6,
70 '#title' => t('Threshold'),
71 '#default_value' => variable_get("morelikethis_threshold_{$key}", NULL),
72 '#description' => t('The relevancy threshold for More Like This association. Only items with a threshold score <em>greater</em> than or equal to this threshold will be matched. The threshold score is a percentage of terms that match. Specify the threshold in the range 0.0 - 1.0 (If 2 of 3 terms match, the threshold score is 0.667. 1 of 4 terms match is 0.25). Default: 0.0'),
73 );
74 }
75
76 return system_settings_form($form);
77 }

  ViewVC Help
Powered by ViewVC 1.1.2