]> git.andy128k.dev Git - ipf-xmlrpc.git/commitdiff
add README
authorAndrey Kutejko <andy128k@gmail.com>
Sun, 28 Jul 2013 11:56:29 +0000 (14:56 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sun, 28 Jul 2013 11:56:29 +0000 (14:56 +0300)
README.org [new file with mode: 0644]

diff --git a/README.org b/README.org
new file mode 100644 (file)
index 0000000..4a9022d
--- /dev/null
@@ -0,0 +1,32 @@
+#+TITLE: IPF XML-RPC
+
+XML-RPC engine extracted from IPF web framework
+
+* Example
+
+  #+BEGIN_SRC php
+  function Api_Views_Handler($request, $match)
+  {
+      $server = new IPF_XmlRpc_Server();
+
+      $server->addFunction('getCustomers');
+      $server->addFunction('getProducts');
+
+      return new IPF_Http_Response($server->handle());
+  }
+
+  function getCustomers()
+  {
+      return IPF_ORM_Manager::connection()->fetchAll('select * from customer');
+  }
+
+  function getProducts($parameters)
+  {
+      $customer = (int)$parameters['customer'];
+      $query = 'select * from product';
+      if ($customer)
+          $query .= ' where customer_id = ' . $customer;
+      return IPF_ORM_Manager::connection()->fetchAll($query);
+  }
+  #+END_SRC
+