function display_content()
    {
        $updates = get_updates(array('filters' => array('status' => 0), 'hide_installed_update' => true))[data];
        $update_count = count($updates);
        if ($updates === FALSE) {
            // Update error occured
            printf('<center style="color:red;font-weight:bold">%s</center>', _T('An error occured while fetching updates'));
        } else {
            $view_updates_text = _T('View updates', 'update');
            print '<center>';
            if ($update_count == 0) {
                printf('<p><strong>%s</strong></p>', _T('No updates available.', 'update'));
            } else {
                printf('<p><strong>%d %s</strong></p>', $update_count, _T('updates available.', 'update'));
                print <<<EOS
                <a title="View updates" class="btnSecondary"
                    href="main.php?module=update&amp;submod=update&amp;action=index"
                    >{$view_updates_text}</a><br/><br/>
EOS;
            }
        }
        $machine_update_status = get_machines_update_status();
        $statut_count = array_count_values($machine_update_status);
        $state_name = array("up-to-date" => _T("Up-to-date"), "update_planned" => _T("Updates planned"), "update_available" => _T("Updates availables"), "os_update_disabled" => _T("OS Update disabled"), "not_registered" => _T("Not registered"), "not_supported" => _T("Not Supported"));
        $state_color = array("up-to-date" => '000-#73d216-#42780D', "update_planned" => '000-#64780D-#CEDD11', "update_available" => '000-#ef2929-#A31A1A', "os_update_disabled" => '000-#838383-#CCCCCC', "not_registered" => '000-#003399-#0251ED', "not_supported" => '000-#000000-#666665');
        $urlRedirect = urlStrRedirect("base/computers/createUpdateStaticGroup");
        foreach ($statut_count as $status => $count) {
            $data[] = $count;
            $label[] = $state_name[$status] . ' (' . $count . ')';
            $colors[] = $state_color[$status];
            $links[] = $urlRedirect . "&status=" . $status;
            $counts[] = $count;
        }
        array_multisort($counts, $data, $label, $colors, $links);
        $data = json_encode($data);
        $label = json_encode($label);
        $colors = json_encode($colors);
        $links = json_encode($links);
        $createGroupText = json_encode(_T("Create a group", "update"));
        print <<<CHART
        <div id="update_status"></div>
        <script type="text/javascript">
        var r = Raphael("update_status"),
                radius = 70,
                margin = 40,
                x = 100,
                y = 75;
        var data = {$data},
            colors = {$colors},
            legend = {$label},
            href = {$links},
            title = 'Update Status';
        percentdata = getPercentageData(data);
        pie = r.piechart(x, y + 5, radius, percentdata,
                       {colors: colors})
         .hover(function () {
            this.sector.stop();
            this.sector.animate({ transform: 's1.1 1.1 ' + this.cx + ' ' + this.cy }, 800, "elastic");

            if (this.label) {
                this.label[0].stop();
                this.label[0].attr({ r: 7.5 });
                this.label[1].attr({ "font-weight": 800 });
            }
         }, function () {
            this.sector.animate({ transform: 's1 1 ' + this.cx + ' ' + this.cy }, 800, "elastic");

            if (this.label) {
                this.label[0].animate({ r: 5 }, 500, "bounce");
                this.label[1].attr({ "font-weight": 400 });
            }
         });

        y += (radius * 2) + margin + 5;

        r.setSize(200, (radius * 1 + margin) + 50);
        // Legend
        jQuery('#update_status').append('<ul></ul>');
        for (var i = 0; i < legend.length; i++) {
            jQuery('#update_status ul').append(
                '<li style="color: ' + colors[i].split('-')[1]  + ';"><span style="color: #000">' + legend[i]
                + '<a href="' + href[i] + '"><img title="' + {$createGroupText} +
                '" style="height: 10px; padding-left: 3px;" src="img/machines/icn_machinesList.gif" /></a></span></li>'
            );
        }
        </script>
        <style type="text/css">
            #update_status ul {
                margin: 0px;
                padding-left: 28px;
            }
            #update_status li {
                list-style: none;
                font-size: 13px;
            }
            #update_status li:before {
                content: "•";
                font-size: 20px;
                vertical-align: bottom;
                line-height: 16px;
                margin-right: 3px;
            }
        </style>
CHART;
    }
Example #2
0
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
$params = array('min' => $start, 'max' => $start + $maxperpage, 'filters' => array());
if (isset($_GET["status"])) {
    $params['filters']['status'] = $_GET["status"];
}
if (isset($_GET["os_class_id"])) {
    $params['filters']['os_class_id'] = $_GET["os_class_id"];
}
if (isset($_GET["filter"]) && $_GET["filter"]) {
    $params['like_filters']['title'] = $_GET["filter"];
}
extract(get_updates($params));
if (!$count) {
    print _T('No entry found', 'update');
    return;
}
//  Listinfo params
$listinfoParams = array();
$checkboxes = array();
foreach ($data as $row) {
    $listinfoParams[] = array('id' => $row['id']);
    $checkboxes[] = '<input type="checkbox" name="selected_updates[]" value="' . $row['id'] . '">';
}
$check_all = '<input type="checkbox" id="check_all" />';
$cols = listInfoFriendly($data);
// Update types strings
$cols['type_str'] = array_map('getUpdateTypeLabel', $cols['type_id']);
Example #3
0
    } elseif (isset($_POST['action']) && $_POST['action'] == 'photo') {
        handle_upload($_GET['id']);
    } else {
        update_record($_GET['id'], $_POST);
    }
}
if (!isset($_GET['id'])) {
    header('Location: /');
    exit;
}
$person = load_record($_GET['id']);
if (empty($person)) {
    header('Location: /');
    exit;
}
$updates = get_updates($_GET['id']);
$comments = get_comments($_GET['id']);
$photos = get_photos($_GET['id']);
$searcher = get_searcher($_GET['id']);
$title = $person['fullname'];
//$title = msg('People');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php 
include 'header.php';
?>
	<?php 
include_once "sidebar.php";