source: Dev/branches/jQueryUI/pages_old/getObject.php @ 246

Last change on this file since 246 was 246, checked in by hendrikvanantwerpen, 13 years ago

Created first page mainmenu in new system.
Moved old pages out of project root.
Fixed RDFAPI.php case for people with proper OS'es.

File size: 910 bytes
RevLine 
[235]1<?php
2
3require "classes/master.php";
4
5//Get post variables
[237]6if (isset($_POST['args']) || !empty($_POST['args'])) {
7    $requestArray = JSON_decode($_POST['args']);
[235]8} else {
9    die("No input passed!");
10}
11
12$resultArray = array();
13
14foreach ($requestArray as $request) {
15    $type = $request->type;
16
[238]17    if (isset($request->uid)) {
18        $results = $type::get(array("uid" => $request->uid));
19    } else if (isset($request->title)) {
20        $results = $type::get(array("title" => $request->title));
21    }
22
23
[235]24    if (isset($results) && !empty($results) && count($results) > 0) {
25        // Add type property for easier identification in JS.
[237]26        $results[0]->objectType = $type;
[235]27        $resultArray[] = $results[0];
[238]28    } else {
29        $resultArray[] = false; //Insert a false return so that the calling JS code knows when an object is not found
[235]30    }
31}
32
[237]33$output = JSON_encode($resultArray);
[235]34echo $output;
35?>
Note: See TracBrowser for help on using the repository browser.