示例#1
0
{
    echo str_repeat("    ", $depth) . $node->name . "\n";
    foreach ($node->children as $child) {
        print_names($child, $depth + 1);
    }
}
$ses = new osrfSession("hostname");
// e.g.: localhost  remembers server & loads fieldmapper.
if ($ses->checkhost() == 200) {
    try {
        $ses->loadFieldmapper(false);
        //FALSE to parse fieldmapper anew and create classes no matter what. TRUE to rely on cached fieldmapper classes if found.
    } catch (Exception $e_load_idl) {
        echo 'Error: ', $e_load_idl->getMessage(), "\n";
    }
    $result = $ses->request("open-ils.actor", "open-ils.actor.org_tree.retrieve", 1)->parse();
    if ($result) {
        if (Is_Open_Ils_event($result)) {
            echo "Could not place hold because of error: " . $result["desc"];
        } else {
            echo "<pre>";
            /* This would print a tree of aou objects. */
            //print_r($result);
            /* This will print only the name field of each aou object */
            print_names($result);
            echo "</pre>";
        }
    } else {
        echo "Errors were encountered.";
    }
} else {
示例#2
0
文件: index.php 项目: JohnField/osrf
 try {
     $ses->loadFieldmapper(false);
     //FALSE to parse fieldmapper and create new fieldmapper class, TRUE for all other cases.
 } catch (Exception $e_load_idl) {
     echo 'Error: ', $e_load_idl->getMessage(), "\n";
 }
 $authtoken = $ses->login('username', 'password');
 ////  Authentication token
 $hold = new ahr();
 $hold->target = 3;
 $hold->hold_type = "T";
 $hold->pickup_lib = 4;
 $hold->request_lib = 4;
 $hold->requestor = 1;
 $hold->usr = 1;
 $result = $ses->request("open-ils.circ", "open-ils.circ.holds.create", $authtoken, $hold)->parse();
 if ($result) {
     /* Upon failure, result can be one OpenILS::Event object (represented
      * an an associative array here) *or* an array of them. */
     if (is_array($result)) {
         if ($result[0]) {
             foreach ($result as $r) {
                 echo "Could not place hold because of error: " . $r["desc"];
             }
         } else {
             echo "Could not place hold because of error: " . $result["desc"];
         }
     } else {
         echo "Placed hold successfully. ID is {$result}.";
     }
 } else {