-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinit.php
60 lines (49 loc) · 1.66 KB
/
init.php
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
<?php defined('SYSPATH') OR die('No direct script access.');
//
// Routing setup and registration of event callbacks
//
/**
* Register callback function to be executed when the plugin
* is activated for the first time
*/
Swiftriver_Plugins::register('ushahidi', array('Ushahidi_Installer', 'install'));
/**
* Add navigation link on the user's dashboard
*/
Swiftriver_Event::add("swiftriver.dashboard.nav", function() {
// Get the event data
$dashboard_tabs = & Swiftriver_Event::$data;
$dashboard_tabs[] = array(
'id' => 'ushahidi-deployments-link',
'url' => '/application/ushahidi',
'label' => __('Ushahidi')
);
});
/**
* Add navigation link in the bucket settings section
*/
Swiftriver_Event::add("swiftriver.bucket.settings.nav", function(){
list($base_url, $active) = Swiftriver_Event::$data;
$active_css = ($active === "ushahidi") ? "active" : "";
$link_url = $base_url.'/settings/ushahidi';
// Build the HTML for the nav item
$nav_html = '<li class="touchcarousel-item %s"><a href="%s">%s</a></li>';
// Display
echo sprintf($nav_html, $active_css, $link_url, __("Ushahidi"));
});
// Add drop to the push log
Swiftriver_Event::add('swiftriver.bucket.droplet.add', array('Model_Deployment_Push_Log', 'add_entry'));
// Remove drop from the push log
Swiftriver_Event::add('swiftriver.bucket.droplet.remove', array('Model_Deployment_Push_Log', 'remove_entry'));
/**
* Route for setting up ushahidi deployments
*/
Route::set('ushahidi_deployments', '<account>/<directory>/ushahidi(/<action>(/<id>))',
array(
'directory' => '(application)'
))
->defaults(array(
'controller' => 'ushahidi',
'action' => 'index',
'id' => '\d+'
));