Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 47 lines (38 sloc) 1.441 kB
6d617e1 PSR-0
Pranjal Prabhash authored
1 <?php
2 include ("./../../lib/OsrfSession.php");
3
4 /* print_names()
5 *
6 * A simple function to print only the name field in a tree of objects
7 * where child nodes are stored in an array in the "children" field.
8 */
9 function print_names($node, $depth = 0) {
10 echo str_repeat(" ", $depth) . $node->name . "\n";
11 foreach ($node->children as $child) {
12 print_names($child, $depth + 1);
13 }
14 }
15
fb6a0a2 @pranjal710 Update examples/open-ils_actor/retrieve.php
authored
16 $ses = new osrfSession("hostname"); // e.g.: localhost remembers server & loads fieldmapper.
6d617e1 PSR-0
Pranjal Prabhash authored
17 if ($ses->checkhost() == 200) {
18
19 try {
20 $ses->loadFieldmapper(false); //FALSE to parse fieldmapper anew and create classes no matter what. TRUE to rely on cached fieldmapper classes if found.
21 } catch (Exception $e_load_idl) {
22 echo 'Error: ', $e_load_idl->getMessage() , "\n";
23 }
24 $result = $ses->request("open-ils.actor", "open-ils.actor.org_tree.retrieve", 1)->parse();
25 if ($result) {
26 if (Is_Open_Ils_event($result)) {
27 echo "Could not place hold because of error: " . $result["desc"];
28 }
29 else {
30 echo "<pre>";
31
32 /* This would print a tree of aou objects. */
33 //print_r($result);
34
35 /* This will print only the name field of each aou object */
36 print_names($result);
37
38 echo "</pre>";
39 }
40 }
41 else echo "Errors were encountered.";
42 }
43 else echo "Could not locate fieldmapper. Invalid hostname!";
44 ?>
45
46
Something went wrong with that request. Please try again.