-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcivimobile.module
126 lines (107 loc) · 4.32 KB
/
civimobile.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
// $Id$
/**
* @file
* Main file for the Design review module
*/
/**
* Implementation of hook_menu().
*/
function civimobile_menu() {
$items = array();
// CiviMobile Homepage
$items['civimobile'] = array(
'title' => 'CiviMobile',
'description' => 'A small but very effective mobile interface to your CiviCRM installation.',
'page callback' => '_civimobile_home_page',
'access arguments' => array('access CiviCRM'),
'type' => MENU_NORMAL_ITEM,
);
// Events page listing all events
$items['civimobile/events'] = array(
'title' => 'CiviMobile',
'description' => 'A small but very effective mobile interface to your CiviCRM installation.',
'page callback' => '_civimobile_events_page',
'page arguments' => array('events'),
'access arguments' => array('access CiviCRM'),
'type' => MENU_NORMAL_ITEM,
);
// Events page listing all events
$items['civimobile/participants'] = array(
'title' => 'CiviMobile',
'description' => 'Event Participants',
'page callback' => '_civimobile_participants_page',
'page arguments' => array('events'),
'access arguments' => array('access CiviCRM'),
'type' => MENU_NORMAL_ITEM,
);
// Events page listing all events
$items['civimobile/status'] = array(
'title' => 'CiviMobile',
'description' => 'Participant Status',
'page callback' => '_civimobile_participant_status_page',
'page arguments' => array('events'),
'access arguments' => array('access CiviCRM'),
'type' => MENU_NORMAL_ITEM,
);
$items['civimobile/contact'] = array(
'title' => 'Contacts',
'page callback' => '_civimobile_page',
'page arguments' => array('contact_list',null),
'access arguments' => array('access CiviCRM'),
'type' => MENU_NORMAL_ITEM,
);
$items['civimobile/contact/%'] = array(
'title' => 'Contact',
'page callback' => '_civimobile_page',
'page arguments' => array('contact',2),
'access arguments' => array('access CiviCRM'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
function _civimobile_page($page,$param= null ) {
$civimobile_page_settings = _civimobile_vars_setup();
$pagepath = drupal_get_path('module','civimobile')."/templates/civimobile.$page.tpl.php";
include_once($pagepath);
return NULL;
}
/**
* Callback for menu item civimobile
*/
function _civimobile_home_page() {
$civimobile_page_settings = _civimobile_vars_setup();
include_once(drupal_get_path('module','civimobile').'/templates/civimobile.home.tpl.php');
return NULL;
}
function _civimobile_events_page(&$arguments) {
$civimobile_page_settings = _civimobile_vars_setup();
include_once(drupal_get_path('module','civimobile').'/templates/civimobile.events.tpl.php');
return NULL;
}
function _civimobile_participants_page() {
$civimobile_page_settings = _civimobile_vars_setup();
include_once(drupal_get_path('module','civimobile').'/templates/civimobile.participants.tpl.php');
return NULL;
}
function _civimobile_participant_status_page() {
$civimobile_page_settings = _civimobile_vars_setup();
include_once(drupal_get_path('module','civimobile').'/templates/civimobile.participant_status.tpl.php');
return NULL;
}
function _civimobile_vars_setup() {
// Left to somebody more knowledgeable than me to figure out
// can't figure out how to load civicrm's Config.php file from here
//
civicrm_initialize();
require_once 'api/api.php';
$civimobile_vars['language'] = $GLOBALS['locale'];
$civimobile_vars['title'] = 'CiviMobile';
$civimobile_vars['head'] = drupal_get_html_head();
$civimobile_vars['favicon'] = theme_get_setting("toggle_favicon") ? "<link rel=\"shortcut icon\" href=\"". theme_get_setting("favicon") ."\" type=\"image/x-icon\"/>\n" : "";
$civimobile_vars['styles'] = drupal_get_css();
$civimobile_vars['scripts'] = drupal_get_js();
$civimobile_vars['civimobile_assets'] = base_path().drupal_get_path('module','civimobile');
$civimobile_vars['civicrm_base'] = base_path().drupal_get_path('module','civicrm');
return $civimobile_vars;
}