/[drupal]/contributions/modules/og_settings/og_info.module
ViewVC logotype

Contents of /contributions/modules/og_settings/og_info.module

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


Revision 1.1 - (show annotations) (download) (as text)
Thu Jun 5 17:47:46 2008 UTC (17 months, 3 weeks ago) by ferdi
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
initial release of og_info
1 <?php
2 // $Id$
3 /**
4 * This is a simple module which allows group administrators to provide some
5 * information about their groups. It depends on og_settings module and it's
6 * mostly an example which shows how developers would use og_settings api.
7 * Please see README.txt file distributed with this package.
8 */
9
10
11
12 /**
13 * menu hook
14 */
15 function og_info_menu($may_cache) {
16 $items = array();
17 if ($may_cache){
18 //
19 } else {
20 global $user;
21 $gid = arg(1);
22 if (arg(0) == 'node' && is_numeric($gid)) {
23 $node = node_load($gid);
24 if ($user -> uid && og_is_group_type($node->type) && node_access('update', $node)) {
25 $items[] = array(
26 'path' => "node/$gid/admin/settings",
27 'title' => t('Group Settings'),
28 'callback' => 'drupal_get_form',
29 'callback arguments' => array('og_info_settings', $gid),
30 'type' => MENU_CALLBACK
31 );
32
33 $items[] = array(
34 // Tip to developers: If you want to extend group admin/settings
35 // provide a menu path similar to this one (i.e. node/$gid/admin/settings/xxxx).
36 // Following this practice, group admins. will have to go in just one place for
37 // admin settings, your settings menu will be rendered as a tab, the group theme
38 // will be preserved and a lot of other good stuff :)
39 'path' => "node/$gid/admin/settings/info",
40 'title' => t('Group Info'),
41 'weight' => 0,
42 'type' => MENU_DEFAULT_LOCAL_TASK
43 );
44 }
45 }
46 }
47 return $items;
48 }
49
50 /**
51 * the setting form
52 */
53 function og_info_settings($gid) {
54
55 $form['og_info_name'] = array(
56 '#type' => 'textfield',
57 '#title' => t('Group Name'),
58 '#default_value' => og_settings_variable_get($gid, 'og_info_name', ''),
59 '#description' => t('The name of your group')
60 );
61
62 $form['og_info_mail'] = array(
63 '#type' => 'textfield',
64 '#title' => t('Group E-mail address'),
65 '#default_value' => og_settings_variable_get($gid, 'og_info_mail', ''),
66 '#description' => t('A valid e-mail address for your group.')
67 );
68
69 $form['og_info_slogan'] = array(
70 '#type' => 'textfield',
71 '#title' => t('Group Slogan'),
72 '#default_value' => og_settings_variable_get($gid, 'og_info_slogan', ''),
73 '#description' => t('The slogan of your group. Some themes display a slogan of your group when available.')
74 );
75
76 $form['og_info_mission'] = array(
77 '#type' => 'textarea',
78 '#title' => t('Mission'),
79 '#default_value' => og_settings_variable_get($gid, 'og_info_mission', ''),
80 '#description' => t('Your group mission statement or focus.')
81 );
82
83 $form['og_info_footer'] = array(
84 '#type' => 'textarea',
85 '#title' => t('Footer message'),
86 '#default_value' => og_settings_variable_get($gid, 'og_info_footer', ''),
87 '#description' => t('This text will be displayed at the bottom of each page of your group.')
88 );
89
90 return og_settings_form($form, $gid);
91 }
92
93

  ViewVC Help
Powered by ViewVC 1.1.2