Xataface
2.0alpha2
Xataface Application Framework
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
actions
ajax_valuelist_append.php
Go to the documentation of this file.
1
<?php
2
import
(
'Dataface/JSON.php'
);
3
import
(
'Dataface/ValuelistTool.php'
);
4
5
class
dataface_actions_ajax_valuelist_append
{
6
7
function
handle
(&$params){
8
$app
=&
Dataface_Application::getInstance
();
9
10
if
( !@$_POST[
'-valuelist'
] ){
11
echo
JSON::error
(
"No valuelist specified."
);
12
exit
;
13
}
14
15
$valuelist = $_POST[
'-valuelist'
];
16
$query =&
$app
->getQuery();
17
18
$table
=&
Dataface_Table::loadTable
($query[
'-table'
]);
19
20
21
if
( !@$_POST[
'-value'
] ){
22
echo
JSON::error
(
"No value was provided to be appended to the valuelist."
);
23
exit
;
24
}
25
26
$value = $_POST[
'-value'
];
27
if
( @$_POST[
'-key'
] ){
28
$key = $_POST[
'-key'
];
29
}
else
{
30
$key = null;
31
}
32
33
$vt =&
Dataface_ValuelistTool::getInstance
();
34
$res = $vt->addValueToValuelist(
$table
, $valuelist, $value, $key,
true
);
35
if
(
PEAR::isError
($res) ){
36
echo
JSON::error
($res->getMessage());
37
exit
;
38
}
39
echo
JSON::json
(array(
40
'success'
=>1,
41
'value'
=>array(
'key'
=>$res[
'key'
],
'value'
=>$res[
'value'
])
42
)
43
);
44
exit
;
45
46
47
}
48
49
}
50
51
?>
Generated on Fri Mar 22 2013 09:40:33 for Xataface by
1.8.1.2