예제 #1
0
<?php

$pagetitle[] = 'Services';
require_once '../includes/services.inc.php';
$services = service_get($device['device_id']);
require_once 'includes/modal/new_service.inc.php';
require_once 'includes/modal/delete_service.inc.php';
print_optionbar_start();
echo "<span style='font-weight: bold;'>Services</span> &#187; ";
$menu_options = array('basic' => 'Basic', 'details' => 'Details');
if (!$vars['view']) {
    $vars['view'] = 'basic';
}
$sep = '';
foreach ($menu_options as $option => $text) {
    if (empty($vars['view'])) {
        $vars['view'] = $option;
    }
    echo $sep;
    if ($vars['view'] == $option) {
        echo "<span class='pagemenu-selected'>";
    }
    echo generate_link($text, $vars, array('view' => $option));
    if ($vars['view'] == $option) {
        echo '</span>';
    }
    $sep = ' | ';
}
unset($sep);
echo '<div class="pull-right"><a data-toggle="modal" href="#create-service"><img src="images/16/add.png" border="0" align="absmiddle"> Add Service</a></div>';
print_optionbar_end();
예제 #2
0
<?php

/*
 * LibreNMS
 *
 * Copyright (c) 2016 Aaron Daniels <*****@*****.**>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
if (is_admin() === false) {
    die('ERROR: You need to be admin');
}
$service_id = $vars['service_id'];
if (is_numeric($service_id) && $service_id > 0) {
    $service = service_get(null, $service_id);
    $output = array('stype' => $service[0]['service_type'], 'ip' => $service[0]['service_ip'], 'desc' => $service[0]['service_desc'], 'param' => $service[0]['service_param']);
    header('Content-Type: application/json');
    echo _json_encode($output);
}
예제 #3
0
<?php

if ($services['total']) {
    // Build the string.
    foreach (service_get($device['device_id']) as $data) {
        if ($data['service_status'] == '0') {
            // Ok
            $status = 'green';
        } elseif ($data['service_status'] == '1') {
            // Warning
            $status = 'red';
        } elseif ($data['service_status'] == '2') {
            // Critical
            $status = 'red';
        } else {
            // Unknown
            $status = 'grey';
        }
        $string .= $break . '<a class=' . $status . '>' . strtolower($data['service_type']) . '</a>';
        $break = ', ';
    }
    ?>
    <div class="container-fluid">
        <div class="row col-md-12">
            <div class="panel panel-default panel-condensed">
                <div class="panel-heading">
                    <img src='images/16/cog.png'><strong> Services</strong>
                </div>
                <table class="table table-hover table-condensed table-striped">
                    <tr>
                        <td title="Total"><img src='images/16/cog.png'> <?php 
$data['customer_id'] = $customer_id;
$data['start'] = 0;
$data['limit'] = 40;
$data['api_key'] = 'test_admin_apikey';
$return = service_get($url, $data);
die_if_error($return);
echo "Customer ID: " . $customer_id . " orders count " . count($return) . "<br><br>\n";
$first_order_id = $return[0]['order_id'];
//get customer orders
echo "Testing order lookup ... <br>\n";
$data = array();
$data['rt'] = 'a/order/details';
$data['token'] = $token;
$data['order_id'] = $first_order_id;
$data['api_key'] = 'test_admin_apikey';
$return = service_get($url, $data);
die_if_error($return);
echo "Order ID: " . $first_order_id . " Total " . $return['total'] . "<br><br>\n";
echo "Test has completed!<br>\n";
?>
    
<?php 
function die_if_error($return_array = array())
{
    if (isset($return_array['error'])) {
        echo "Error: " . $return_array['error'] . "<br>\n";
        exit;
    }
}
/* curl connection functions */
function service_post($url, $data)