Updated ninja spyc test package to require http-api
[ninja.git] / application / widgets / nagvis / nagvis.php
blob505f9f132884c73ecd76080e34af0134437b72cf
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
3 /**
4 * Nagvis widget
6 * @author op5 Valerij Stukanov
7 */
8 class Nagvis_Widget extends widget_Base {
9 protected $duplicatable = true;
10 public function options() {
11 $maps = nagvisconfig::get_map_list();
12 $default = false;
13 if (count($maps)) {
14 $default = $maps[0];
15 foreach (array_keys($maps) as $key) {
16 $name = $maps[$key];
17 unset($maps[$key]);
18 $maps[$name] = $name;
20 $tmp = array_values($maps);
23 # don't call parent, nagvis reloads itself
24 $map = new option('nagvis', 'map', 'Map', 'dropdown', array('options' => $maps), $default);
25 $height = new option('nagvis', 'height', 'Height (px)', 'input', array('size'=>3), 400);
26 $height->should_render_js(false);
27 return array($map, $height);
30 public function index() {
31 # fetch widget view path
32 $view_path = $this->view_path('view');
34 # set required extra resources
35 $this->js = array('/js/nagvis');
37 $arguments = $this->get_arguments();
39 # fetch widget content
40 require($view_path);