forked from aarpon/hrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
omero_treeloader.php
34 lines (26 loc) · 1.03 KB
/
omero_treeloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
// This file is part of the Huygens Remote Manager
// Copyright and license notice: see license.txt
// === OMERO Tree Loader ===
// This file is handling the requests sent by jqTree when an on-demand node
// gets expanded by the user. It ensures the user is logged in, has a valid
// OMERO connection and finally asks the connector for the JSON data.
use hrm\user\UserV2;
require_once dirname(__FILE__) . "/inc/bootstrap.php";
require_once dirname(__FILE__) . "/inc/OmeroConnection.php";
session_start();
if (!isset($_SESSION['user']) || !$_SESSION['user']->isLoggedIn()) {
$req = $_SERVER['REQUEST_URI'];
$_SESSION['request'] = $req;
header("Location: " . "login.php");
exit();
}
$omeroConnection = $_SESSION['omeroConnection'];
// default value to request the base tree (groups and users):
$node_id = 'ROOT';
// override the default if a specific part is requested:
if (isset($_GET['node'])) {
$node_id = $_GET['node'];
}
// fetch the child nodes and return the JSON:
print($omeroConnection->getChildren($node_id));