Пример #1
0
 public function basket($action = FALSE)
 {
     // Disable auto-rendering
     $this->auto_render = FALSE;
     $host = false;
     $service = false;
     $basket = array();
     if ($action == "list") {
         $basket = $this->session->get("basket");
         if (is_array($basket) && sizeof($basket) > 0) {
             foreach ($basket as $item) {
                 echo "<span id=\"basket_action_remove\"><a title=\"Remove " . $item . "\" id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</span><br>\n";
             }
         }
     } elseif ($action == "add") {
         $item = $_POST['item'];
         $basket = $this->session->get("basket");
         if (!is_array($basket)) {
             $basket[] = "{$item}";
         } else {
             if (!in_array($item, $basket)) {
                 $basket[] = $item;
             }
         }
         $this->session->set("basket", $basket);
         foreach ($basket as $item) {
             echo "<span id=\"basket_action_remove\"><a title=\"Remove " . $item . "\" id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</span><br>\n";
         }
     } elseif ($action == "remove") {
         $basket = $this->session->get("basket");
         $item_to_remove = $_POST['item'];
         $new_basket = array();
         foreach ($basket as $item) {
             if ($item == $item_to_remove) {
                 continue;
             }
             $new_basket[] = $item;
         }
         $basket = $new_basket;
         $this->session->set("basket", $basket);
         foreach ($basket as $item) {
             echo "<span id=\"basket_action_remove\"><a title=\"Remove " . $item . "\" id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</span><br>\n";
         }
     } elseif ($action == "remove-all") {
         $this->session->delete("basket");
     } else {
         echo "Action {$action} not known";
     }
     $basket = $this->session->get("basket");
     if (is_array($basket) && sizeof($basket) == 0) {
         echo "basket is empty";
     } else {
         echo "<a class=\"multi0\" href=\"" . url::base(TRUE) . "page/basket\">show basket</a>";
     }
 }
Пример #2
0
 public function index()
 {
     $this->template->graph->graph_content = $this->add_view('graph_content');
     $this->template->graph->graph_content->graph_width = $this->config->conf['graph_width'] + 85;
     $this->template->graph->graph_content->timerange_select = $this->add_view('timerange_select');
     $this->template->graph->header = $this->add_view('header');
     $this->template->graph->search_box = $this->add_view('search_box');
     $this->template->graph->service_box = $this->add_view('service_box');
     $this->template->graph->basket_box = $this->add_view('basket_box');
     $this->template->graph->widget_menu = $this->add_view('widget_menu');
     $this->template->graph->graph_content->widget_graph = $this->add_view('widget_graph');
     // Change the status box while multisite theme is in use
     if ($this->theme == "multisite") {
         $this->template->graph->status_box = $this->add_view('multisite_box');
         $this->template->graph->status_box->base_url = $this->config->conf['multisite_base_url'];
         $this->template->graph->status_box->site = $this->config->conf['multisite_site'];
     } else {
         $this->template->graph->status_box = $this->add_view('status_box');
     }
     // Service Details
     if ($this->host != "" && $this->service != "") {
         $this->service = pnp::clean($this->service);
         $this->host = pnp::clean($this->host);
         $this->url = "?host=" . $this->host . "&srv=" . $this->service;
         $services = $this->data->getServices($this->host);
         #print Kohana::debug($services);
         $this->data->buildDataStruct($this->host, $this->service, $this->view);
         $this->is_authorized = $this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']);
         $this->title = Kohana::lang('common.service-details') . " " . $this->host . " -> " . $this->data->MACRO['DISP_SERVICEDESC'];
         $this->template->graph->graph_content->graph_width = $this->data->STRUCT[0]['GRAPH_WIDTH'] + 85;
         $this->template->zoom_header->graph_width = $this->data->STRUCT[0]['GRAPH_WIDTH'] + 140;
         $this->template->zoom_header->graph_height = $this->data->STRUCT[0]['GRAPH_HEIGHT'] + 230;
         // Status Box Vars
         $this->template->graph->status_box->host = $this->data->MACRO['DISP_HOSTNAME'];
         $this->template->graph->status_box->lhost = $this->data->MACRO['HOSTNAME'];
         $this->template->graph->status_box->service = $this->data->MACRO['DISP_SERVICEDESC'];
         $this->template->graph->status_box->lservice = $this->data->MACRO['SERVICEDESC'];
         $this->template->graph->status_box->timet = date($this->config->conf['date_fmt'], intval($this->data->MACRO['TIMET']));
         // Service Box Vars
         $this->template->graph->service_box->services = $services;
         $this->template->graph->service_box->host = $this->host;
         // Timerange Box Vars
         $this->template->graph->timerange_box = $this->add_view('timerange_box');
         $this->template->graph->timerange_box->timeranges = $this->data->TIMERANGE;
         //
         // Host Overview
     } elseif ($this->host != "") {
         $this->is_authorized = $this->auth->is_authorized($this->host);
         $this->host = pnp::clean($this->host);
         if ($this->view == "") {
             $this->view = $this->config->conf['overview-range'];
         }
         $this->url = "?host=" . $this->host;
         $this->title = Kohana::lang('common.start') . " " . $this->host;
         $services = $this->data->getServices($this->host);
         // Status Box Vars
         $this->template->graph->status_box->host = $this->data->MACRO['DISP_HOSTNAME'];
         $this->template->graph->status_box->lhost = $this->data->MACRO['HOSTNAME'];
         $this->template->graph->status_box->shost = pnp::shorten($this->data->MACRO['DISP_HOSTNAME']);
         $this->template->graph->status_box->timet = date($this->config->conf['date_fmt'], intval($this->data->MACRO['TIMET']));
         // Service Box Vars
         $this->template->graph->service_box->services = $services;
         $this->template->graph->service_box->host = $this->host;
         // Timerange Box Vars
         $this->template->graph->timerange_box = $this->add_view('timerange_box');
         $this->template->graph->timerange_box->timeranges = $this->data->TIMERANGE;
         $this->template->graph->icon_box->xml_icon = FALSE;
         $this->title = Kohana::lang('common.service-overview', $this->host);
         foreach ($services as $service) {
             if ($service['state'] == 'active') {
                 $this->data->buildDataStruct($this->host, $service['name'], $this->view);
             }
         }
     } else {
         if ($this->isAuthorizedFor('host_overview')) {
             $this->host = $this->data->getFirstHost();
             if (isset($this->host)) {
                 url::redirect("graph?host=" . $this->host);
             } else {
                 throw new Kohana_Exception('error.get-first-host');
             }
         } else {
             throw new Kohana_Exception('error.not_authorized_for_host_overview');
         }
     }
     $this->template->graph->logo_box = $this->add_view('logo_box');
     $this->template->graph->header->title = $this->title;
 }
Пример #3
0
<?php

if (!empty($this->templates) && $this->isAuthorizedFor('service_links')) {
    ?>
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php 
    echo Kohana::lang('common.special-templates-box-header');
    ?>
 
</div>
<div class="p4 ui-widget-content ui-corner-bottom">
<?php 
    foreach ($this->templates as $template) {
        $path = pnp::addToUri(array('tpl' => $template));
        echo "<a href=\"" . $path . "\" class=\"multi0\">" . pnp::shorten($template) . "</a><br>\n";
    }
    ?>
</div>
</div>
<p>
<?php 
}
Пример #4
0
<div class="ui-widget">
 <div class="p2 ui-widget-header ui-corner-top">
<?php 
echo Kohana::lang('common.status-box-header');
?>
 </div>
 <div class="p4 ui-widget-content ui-corner-bottom">
<?php 
if (isset($host)) {
    echo "<strong>Host:&nbsp;</strong>" . html::anchor('graph' . "?host=" . $lhost, html::specialchars(pnp::shorten($host)) . "<br>");
}
if (isset($service)) {
    echo "<strong>Service:&nbsp;</strong>" . html::anchor('graph' . "?host=" . $lhost . "&srv=" . $lservice, html::specialchars(pnp::shorten($service)) . "<br>");
}
if (isset($timet)) {
    echo "<strong>Last Check:&nbsp;</strong>{$timet}<br>";
}
?>
 </div>
</div>
<p>

Пример #5
0
<?php

if (!empty($pages) && $this->isAuthorizedFor('pages')) {
    ?>
<div class="ui-widget">
 <div class="p2 ui-widget-header ui-corner-top">
 <?php 
    echo Kohana::lang('common.pages-box-header');
    ?>
 </div>
<div class="p4 ui-widget-content ui-corner-bottom">
<?php 
    foreach ($pages as $page) {
        $this->data->getPageDetails($page);
        echo "<a class=\"multi0\" href=\"" . url::base(TRUE) . "page?page=" . $page . "\" title=\"" . $this->data->PAGE_DEF['page_name'] . "\">" . pnp::shorten($this->data->PAGE_DEF['page_name']) . "</a><br>\n";
    }
    ?>
</div>
</div>
<p>
<?php 
}
Пример #6
0
<div class="ui-widget">
 <div class="p2 ui-widget-header ui-corner-top">
<?php 
echo Kohana::lang('common.multisite-box-header');
?>
 </div>
 <div class="p4 ui-widget-content ui-corner-bottom">
<?php 
if (isset($host)) {
    echo "<strong>Host: </strong><a href=" . pnp::multisite_link($base_url, $site, $host) . ">" . html::specialchars(pnp::shorten($host)) . "</a><br>\n";
}
if (isset($service) && $service != "Host Perfdata") {
    echo "<strong>Service: </strong><a href=" . pnp::multisite_link($base_url, $site, $host, $service) . ">" . html::specialchars(pnp::shorten($service)) . "</a>\n";
}
?>
 </div>
</div>
<p>

Пример #7
0
    echo Kohana::lang('common.service-box-header');
    ?>
 
 </div>

<?php 
    $filter = $this->session->get('sfilter');
    ?>

<div class="p4 ui-widget-content">
	<?php 
    echo "<input type=\"text\" name=\"service-filter\" id=\"service-filter\" value=\"" . $filter . "\" class=\"textbox\" />";
    ?>
</div>

<div class="p4 ui-widget-content ui-corner-bottom" id="services">
<?php 
    foreach ($services as $service) {
        echo "<span id=\"service-" . $service['servicedesc'] . "\">\n";
        $path = pnp::addToUri(array('host' => $host, 'srv' => $service['name']));
        echo pnp::add_to_basket_icon($host, $service['name']);
        echo "<a href=\"" . $path . "\" class=\"multi" . $service['is_multi'] . " " . $service['state'] . "\" title=\"" . $service['servicedesc'] . "\">";
        echo pnp::shorten($service['servicedesc']) . "</a><br>\n";
        echo "</span>\n";
    }
    ?>
</div>
</div>
<p>
<?php 
}
Пример #8
0
 public function basket($action = FALSE)
 {
     // Disable auto-rendering
     $this->auto_render = FALSE;
     $host = false;
     $service = false;
     $basket = array();
     if ($action == "list") {
         $basket = $this->session->get("basket");
         if (is_array($basket) && sizeof($basket) > 0) {
             foreach ($basket as $item) {
                 printf("<li class=\"ui-state-default %s\" id=\"%s\"><a title=\"%s\" id=\"%s\"><img width=12px height=12px src=\"%smedia/images/remove.png\"></a>%s</li>\n", "basket_action_remove", $item, $item, Kohana::lang('common.basket-remove', $item), url::base(), pnp::shorten($item));
             }
         }
     } elseif ($action == "add") {
         $item = $_POST['item'];
         $basket = $this->session->get("basket");
         if (!is_array($basket)) {
             $basket[] = "{$item}";
         } else {
             if (!in_array($item, $basket)) {
                 $basket[] = $item;
             }
         }
         $this->session->set("basket", $basket);
         foreach ($basket as $item) {
             printf("<li class=\"ui-state-default %s\" id=\"%s\"><a title=\"%s\" id=\"%s\"><img width=12px height=12px src=\"%smedia/images/remove.png\"></a>%s</li>\n", "basket_action_remove", $item, $item, Kohana::lang('common.basket-remove', $item), url::base(), pnp::shorten($item));
         }
     } elseif ($action == "sort") {
         $items = $_POST['items'];
         $basket = explode(',', $items);
         array_pop($basket);
         $this->session->set("basket", $basket);
         foreach ($basket as $item) {
             printf("<li class=\"ui-state-default %s\" id=\"%s\"><a title=\"%s\" id=\"%s\"><img width=12px height=12px src=\"%smedia/images/remove.png\"></a>%s</li>\n", "basket_action_remove", $item, $item, Kohana::lang('common.basket-remove', $item), url::base(), pnp::shorten($item));
         }
     } elseif ($action == "remove") {
         $basket = $this->session->get("basket");
         $item_to_remove = $_POST['item'];
         $new_basket = array();
         foreach ($basket as $item) {
             if ($item == $item_to_remove) {
                 continue;
             }
             $new_basket[] = $item;
         }
         $basket = $new_basket;
         $this->session->set("basket", $basket);
         foreach ($basket as $item) {
             printf("<li class=\"ui-state-default %s\" id=\"%s\"><a title=\"%s\" id=\"%s\"><img width=12px height=12px src=\"%smedia/images/remove.png\"></a>%s</li>\n", "basket_action_remove", $item, $item, Kohana::lang('common.basket-remove', $item), url::base(), pnp::shorten($item));
         }
     } elseif ($action == "clear") {
         $this->session->delete("basket");
     } else {
         echo "Action {$action} not known";
     }
     $basket = $this->session->get("basket");
     if (is_array($basket) && sizeof($basket) == 0) {
         echo Kohana::lang('common.basket-empty');
     } else {
         echo "<div align=\"center\" class=\"p2\">\n";
         echo "<button id=\"show\">" . Kohana::lang('common.basket-show') . "</button>\n";
         echo "<button id=\"clear\">" . Kohana::lang('common.basket-clear') . "</button>\n";
         echo "</div>\n";
     }
 }
Пример #9
0
<?php

$basket = $this->session->get('basket');
echo "<div class=\"ui-widget\">\n";
echo "<div class=\"p2 ui-widget-header ui-corner-top\">\n";
echo Kohana::lang('common.basket-box-header') . "</div>\n";
echo "<div class=\"p4 ui-widget-content ui-corner-bottom\">\n";
echo "<div id=\"basket_items\">\n";
if (is_array($basket) && sizeof($basket) > 0) {
    foreach ($basket as $key => $item) {
        echo "<li class=\"ui-state-default basket_action_remove\" id=\"" . $item . "\"><a title=\"" . Kohana::lang('common.basket-remove', $item) . "\"" . "id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</li>\n";
    }
}
if (is_array($basket) && sizeof($basket) > 0) {
    echo "<div align=\"center\" class=\"p2\">\n";
    echo "<button id=\"basket-show\">" . Kohana::lang('common.basket-show') . "</button>\n";
    echo "<button id=\"basket-clear\">" . Kohana::lang('common.basket-clear') . "</button>\n";
    echo "</div>\n";
    #echo "<div><a class=\"multi0\" href=\"".url::base(TRUE)."page/basket\">".Kohana::lang('common.basket-show')."</a></div>\n";
} else {
    echo "<div>" . Kohana::lang('common.basket-empty') . "</div>\n";
}
echo "</div>\n";
echo "</div>\n";
echo "</div><br>\n";
?>
<div id="basket_box"></div>
Пример #10
0
<?php

$basket = $this->session->get('basket');
echo "<div class=\"ui-widget\">\n";
echo "<div class=\"p2 ui-widget-header ui-corner-top\">\n";
echo Kohana::lang('common.basket-box-header') . "</div>\n";
echo "<div class=\"p4 ui-widget-content ui-corner-bottom\">\n";
echo '<div id="basket_items">';
if (is_array($basket) && sizeof($basket) > 0) {
    foreach ($basket as $key => $item) {
        echo "<span id=\"basket_action_remove\"><a title=\"Remove " . $item . "\" id=\"" . $item . "\"><img width=12px height=12px src=\"" . url::base() . "media/images/remove.png\"></a>" . pnp::shorten($item) . "</span><br>\n";
    }
}
if (is_array($basket) && sizeof($basket) > 0) {
    echo "<div><a class=\"multi0\" href=\"" . url::base(TRUE) . "page/basket\">show basket</a></div>\n";
} else {
    echo "<div>Basket is empty</div>\n";
}
echo "</div>\n";
echo "</div>\n";
echo "</div><br>\n";
?>
<div id="basket_box"></div>
Пример #11
0
<?php

if (!empty($services) && $this->isAuthorizedFor('service_links')) {
    ?>
<div class="ui-widget">
 <div class="p2 ui-widget-header ui-corner-top">
 <?php 
    echo Kohana::lang('common.service-box-header');
    ?>
 
 </div>
<div class="p4 ui-widget-content ui-corner-bottom">
<?php 
    foreach ($services as $service) {
        $path = pnp::addToUri(array('host' => $host, 'srv' => $service['name']));
        echo "<a href=\"" . $path . "\" class=\"multi" . $service['is_multi'] . " " . $service['state'] . "\" title=\"" . $service['servicedesc'] . "\">" . pnp::shorten($service['servicedesc']) . "</a><br>\n";
    }
    ?>
</div>
</div>
<p>
<?php 
}