forked from AKSW/csvimport.ontowiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CsvimportPlugin.php
61 lines (55 loc) · 1.93 KB
/
CsvimportPlugin.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
61
<?php
/**
* This file is part of the {@link http://ontowiki.net OntoWiki} project.
*
* @copyright Copyright (c) 2012, {@link http://aksw.org AKSW}
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
*/
/**
* The main class for the csv import plugin.
*
* @category OntoWiki
* @package Extensions_Csvimport
* @copyright Copyright (c) 2012 {@link http://aksw.org aksw}
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
* @author Tim Ermilov <[email protected]>
*/
class CsvimportPlugin extends OntoWiki_Plugin
{
// ------------------------------------------------------------------------
// --- Plugin handler methods ---------------------------------------------
// ------------------------------------------------------------------------
/**
* Event handler method, which is called on menu creation. Adds some
* datagathering relevant menu entries.
*
* @param Erfurt_Event $event
*
* @return bool
*/
public function onCreateMenu($event)
{
if ($event->isModel) {
$url = new OntoWiki_Url(array('controller' => 'csvimport'), array());
$menu = $event->menu;
$menu->appendEntry('Import CSV Data', (string) $url);
}
return true;
}
/*
* add another import action
*/
public function onProvideImportActions($event)
{
$myImportActions = array(
'csvimport-upload' => array(
'controller' => 'csvimport',
'action' => 'upload',
'label' => 'Upload a CSV file with statistical or tabular data.',
'description' => 'Tabular data import uses property mapping and Statistical data import uses DataCube mapping.'
)
);
$event->importActions = array_merge($event->importActions, $myImportActions);
return $event;
}
}