/
depselect.php
79 lines (66 loc) · 2.29 KB
/
depselect.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/*
* Xataface Depselect Module
* Copyright (C) 2011 Steve Hannah <steve@weblite.ca>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
/**
* @brief The main depselect module class. This loads all of the dependencies for the
* module.
*
* Of note, this module depends on the XataJax module for the loading
* of its javascripts.
*
*/
class modules_depselect {
/**
* @brief The base URL to the depselect module. This will be correct whether it is in the
* application modules directory or the xataface modules directory.
*
* @see getBaseURL()
*/
private $baseURL = null;
/**
* @brief Initializes the depselect module and registers all of the event listener.
*
*/
function __construct(){
$app = Dataface_Application::getInstance();
// Now work on our dependencies
$mt = Dataface_ModuleTool::getInstance();
// We require the XataJax module
// The XataJax module activates and embeds the Javascript and CSS tools
$mt->loadModule('modules_XataJax', 'modules/XataJax/XataJax.php');
// Register the tagger widget with the form tool so that it responds
// to widget:type=tagger
import('Dataface/FormTool.php');
$ft = Dataface_FormTool::getInstance();
$ft->registerWidgetHandler('depselect', dirname(__FILE__).'/widget.php', 'Dataface_FormTool_depselect');
}
/**
* @brief Returns the base URL to this module's directory. Useful for including
* Javascripts and CSS.
*
*/
public function getBaseURL(){
if ( !isset($this->baseURL) ){
$this->baseURL = Dataface_ModuleTool::getInstance()->getModuleURL(__FILE__);
}
return $this->baseURL;
}
}