r1050: Adding a language API
[bugdar.git] / includes / api_language.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $GLOBALS['isso:callback']->load('api', null);
23
24 require_once('./includes/functions_datastore.php');
25
26 /**
27 * API: Language
28 *
29 * @author Blue Static
30 * @copyright Copyright ©2002 - [#]year[#], Blue Static
31 * @version $Revision$
32 * @package Bugdar
33 *
34 */
35 class LanguageAPI extends API
36 {
37 /**
38 * Fields
39 * @var array
40 * @access private
41 */
42 var $fields = array(
43 'languageid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'),
44 'title' => array(TYPE_STR, REQ_YES, 'verify_noempty'),
45 'direction' => array(TYPE_STR, REQ_NO, ':self'),
46 'userselect' => array(TYPE_BOOL, REQ_NO),
47 'filename' => array(TYPE_STR, REQ_YES)
48 );
49
50 /**
51 * Table
52 * @var string
53 * @access private
54 */
55 var $table = 'language';
56
57 /**
58 * Table prefix
59 * @var string
60 * @access private
61 */
62 var $prefix = TABLE_PREFIX;
63
64 // ###################################################################
65 /**
66 * Post-insert
67 *
68 * @access private
69 */
70 function post_insert()
71 {
72 build_languages();
73 build_language_cache($this->insertid);
74 }
75
76 // ###################################################################
77 /**
78 * Post-update
79 *
80 * @access private
81 */
82 function post_update()
83 {
84 build_languages();
85 }
86
87 // ###################################################################
88 /**
89 * Post-delete
90 *
91 * @access private
92 */
93 function post_delete()
94 {
95 build_languages();
96 }
97
98 // ###################################################################
99 /**
100 * Verify: direction
101 *
102 * @access private
103 */
104 function verify_direction()
105 {
106 if (!in_array(array('ltr', 'rtl'), $this->values['direction']))
107 {
108 return _('The direction must be ltr (left-to-right) or rtl (right-to-left)');
109 }
110 return true;
111 }
112 }
113
114 /*=====================================================================*\
115 || ###################################################################
116 || # $HeadURL$
117 || # $Id$
118 || ###################################################################
119 \*=====================================================================*/
120 ?>