1<?php
2/*****************************************************************************
3 *
4 * NagVisContainer.php - Class of a container object in NagVis with all necessary
5 *                  information which belong to the object handling in NagVis
6 *
7 * Copyright (c) 2004-2016 NagVis Project (Contact: info@nagvis.org)
8 *
9 * License:
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *****************************************************************************/
25
26class NagVisContainer extends NagVisStatelessObject {
27    protected $type = 'container';
28
29    /**
30     * PUBLIC parseJson()
31     * Parses the object in json format
32     */
33    public function parseJson() {
34        // Prepare the URL attribute. If it is an absolute url, leave it as it is
35        // If it is a simple filename add the url to the scripts path
36        $parts = parse_url($this->url);
37        if(!isset($parts['scheme']) && $parts['path'][0] !== '/') {
38            $this->url = cfg('paths', 'htmlbase') . '/userfiles/scripts/' . $this->url;
39        }
40
41        return parent::parseJson();
42    }
43
44    /**
45     * PUBLIC fetchIcon()
46     * Just a dummy here (Container won't need an icon)
47     */
48    public function fetchIcon() {
49        // Nothing to do here, icon is set in constructor
50    }
51}
52?>
53