waramu = new Waramu();
//if ( isset($_SESSION['waramu_session']) ) {
// $this->waramu->setSid($_SESSION['waramu_session']);
//} else {
$conn_status = $this->waramu->connect();
// if ( $conn_status ) {
// die("Invalid Waramu connection parameters");
// }
// $_SESSION['waramu_session'] = $this->waramu->sid;
//}
}
function __destruct() {
$this->waramu->disconnect();
}
/**
* Get a Waramu resource by ID
* */
function waramu_getResource($au, $wid) {
if ( is_null($wid) ) return new WaramuResource(null, '', '');
$obj = $this->waramu->getResource($au, $wid);
return $obj;
}
function getResourceIDs() {
$query = '';
$query .= '';
$query .= 'pairs';
//$query .= 'fillin';
//$query .= '0';
$query .= '';
$idents = $this->waramu->listIdentifiers("", $query);
$wids = array();
//if (array_key_exists('id', $idents['identifiers'][0])) {
$ids = $idents['identifiers'][0]['id'];
foreach ($ids as $wid) {
$wids []= $wid[0];
}
//}
return $wids;
}
function getResources() {
//return $this->getResourceIDs();
$resources = array();
global $user;
$au = ''.$user->getUsername().'';
$wids = $this->getResourceIDs();
foreach ($wids as $wid) {
$resources []= $this->waramu_getResource($au, $wid);
}
return $resources;
}
}
?>