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_set_preference.php
Go to the documentation of this file.
1
<?php
2
class
dataface_actions_ajax_set_preference
{
3
function
handle
(&$params){
4
$app
=&
Dataface_Application::getInstance
();
5
$record =&
$app
->getRecord();
6
$out
= array();
7
if
( !isset($_POST[
'--name'
]) ){
8
$out
[
'error'
] =
'No name specified'
;
9
$this->
respond
(
$out
);
10
exit
;
11
}
12
13
if
( !isset($_POST[
'--value'
]) ){
14
$out
[
'error'
] =
'No value specified'
;
15
$this->
respond
(
$out
);
16
exit
;
17
}
18
19
if
( isset($_POST[
'--record_id'
]) ){
20
$recordid = $_POST[
'--record_id'
];
21
}
else
{
22
$recordid = $recordd->getId();
23
}
24
25
import
(
'Dataface/PreferencesTool.php'
);
26
$pt =&
Dataface_PreferencesTool::getInstance
();
27
28
$pt->savePreference($recordid, $_POST[
'--name'
], $_POST[
'--value'
]);
29
$out
[
'message'
] =
'Successfully saved preference '
.$_POST[
'--name'
].
' to '
.$_POST[
'--value'
].
' for '
.$recordid;
30
$this->
respond
(
$out
);
31
32
}
33
34
function
respond
(
$out
){
35
import
(
'Services/JSON.php'
);
36
$json =
new
Services_JSON;
37
38
header(
'Content-type: application/json'
);
39
echo $json->encode(
$out
);
40
exit
;
41
42
}
43
}
Generated on Fri Mar 22 2013 09:40:33 for Xataface by
1.8.1.2