diff options
author | Kirylka <kirylanoshko@gmail.com> | 2015-04-07 12:27:53 +0300 |
---|---|---|
committer | Kirylka <kirylanoshko@gmail.com> | 2015-04-07 12:27:53 +0300 |
commit | f70c0f119d3aeacbb30fa3ad65ed56cda9640d97 (patch) | |
tree | f1769b415e145da3a836a897450c118f4995d05a /codebase/Data/CommonDataProcessor.php | |
parent | 9c5ae1267c676ca235efb8d78a206cb45d0d714c (diff) | |
download | connector-php-f70c0f119d3aeacbb30fa3ad65ed56cda9640d97.zip connector-php-f70c0f119d3aeacbb30fa3ad65ed56cda9640d97.tar.gz connector-php-f70c0f119d3aeacbb30fa3ad65ed56cda9640d97.tar.bz2 |
Webix grid support
Diffstat (limited to 'codebase/Data/CommonDataProcessor.php')
-rw-r--r-- | codebase/Data/CommonDataProcessor.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/codebase/Data/CommonDataProcessor.php b/codebase/Data/CommonDataProcessor.php new file mode 100644 index 0000000..8f00b94 --- /dev/null +++ b/codebase/Data/CommonDataProcessor.php @@ -0,0 +1,55 @@ +<?php +namespace DHTMLX\Connector\Data; + +use DHTMLX\Connector\XSSFilter\ConnectorSecurity; +use DHTMLX\Connector\Tools\LogMaster; + +class CommonDataProcessor extends DataProcessor{ + protected function get_post_values($ids){ + if (isset($_GET['action'])){ + $data = array(); + if (isset($_POST["id"])){ + $dataset = array(); + foreach($_POST as $key=>$value) + $dataset[$key] = ConnectorSecurity::filter($value); + + $data[$_POST["id"]] = $dataset; + } + else + $data["dummy_id"] = $_POST; + return $data; + } + return parent::get_post_values($ids); + } + + protected function get_ids(){ + if (isset($_GET['action'])){ + if (isset($_POST["id"])) + return array($_POST['id']); + else + return array("dummy_id"); + } + return parent::get_ids(); + } + + protected function get_operation($rid){ + if (isset($_GET['action'])) + return $_GET['action']; + return parent::get_operation($rid); + } + + public function output_as_xml($results){ + if (isset($_GET['action'])){ + LogMaster::log("Edit operation finished",$results); + ob_clean(); + $type = $results[0]->get_status(); + if ($type == "error" || $type == "invalid"){ + echo "false"; + } else if ($type=="insert"){ + echo "true\n".$results[0]->get_new_id(); + } else + echo "true"; + } else + return parent::output_as_xml($results); + } +};
\ No newline at end of file |