Ejemplo n.º 1
0
<?php

/* $Id: host_view.php 1831 2008-09-26 12:18:54Z carenas $ */
$tpl = new TemplatePower(template("host_view.tpl"));
$tpl->assignInclude("extra", template("host_extra.tpl"));
$tpl->prepare();
$tpl->assign("cluster", $clustername);
$tpl->assign("host", $hostname);
$tpl->assign("node_image", node_image($metrics));
$tpl->assign("sort", $sort);
$tpl->assign("range", $range);
if ($hosts_up) {
    $tpl->assign("node_msg", "This host is up and running.");
} else {
    $tpl->assign("node_msg", "This host is down.");
}
$cluster_url = rawurlencode($clustername);
$tpl->assign("cluster_url", $cluster_url);
$tpl->assign("graphargs", "h={$hostname}&amp;{$get_metric_string}&amp;st={$cluster['LOCALTIME']}");
# For the node view link.
$tpl->assign("node_view", "./?p=2&amp;c={$cluster_url}&amp;h={$hostname}");
# No reason to go on if this node is down.
if ($hosts_down) {
    $tpl->printToScreen();
    return;
}
$tpl->assign("ip", $hosts_up['IP']);
$tpl->newBlock('columns_dropdown');
$tpl->assign("metric_cols_menu", $metric_cols_menu);
$g_metrics_group = array();
foreach ($metrics as $name => $v) {
<?php

/* $Id: cluster_view.php 1710 2008-08-21 16:44:54Z bernardli $ */
$tpl = new TemplatePower(template("cluster_view.tpl"));
$tpl->assignInclude("extra", template("cluster_extra.tpl"));
$tpl->prepare();
$tpl->assign("images", "./templates/{$template_name}/images");
$cpu_num = !$showhosts ? $metrics["cpu_num"]['SUM'] : cluster_sum("cpu_num", $metrics);
$load_one_sum = !$showhosts ? $metrics["load_one"]['SUM'] : cluster_sum("load_one", $metrics);
$load_five_sum = !$showhosts ? $metrics["load_five"]['SUM'] : cluster_sum("load_five", $metrics);
$load_fifteen_sum = !$showhosts ? $metrics["load_fifteen"]['SUM'] : cluster_sum("load_fifteen", $metrics);
$roxies_up = !$showhosts ? $metrics["roxie_instances"]['SUM'] : cluster_sum("roxie_instances", $metrics);
#
# Correct handling of *_report metrics
#
if (!$showhosts) {
    if (array_key_exists($metricname, $metrics)) {
        $units = $metrics[$metricname]['UNITS'];
    }
} else {
    if (array_key_exists($metricname, $metrics[key($metrics)])) {
        $units = $metrics[key($metrics)][$metricname]['UNITS'];
    }
}
if (isset($cluster['HOSTS_UP'])) {
    $tpl->assign("num_nodes", intval($cluster['HOSTS_UP']));
} else {
    $tpl->assign("num_nodes", 0);
}
if (isset($cluster['HOSTS_DOWN'])) {
    $tpl->assign("num_dead_nodes", intval($cluster['HOSTS_DOWN']));
Ejemplo n.º 3
0
    $tpl->assignGlobal('error_message', 'You are not not enrolled in any courses.');
    $tpl->prepare();
    // the user is good to go
} else {
    $tpl = new TemplatePower('template/students.html');
    // see if a form was submitted
    if (isset($_POST['action'])) {
        $action = $_POST['action'];
        // check to see what the user wanted to do
        switch ($action) {
            // uploading a file
            case 'upload':
                $assignment = $_POST['assignment'];
                $user = $_SESSION['userID'];
                $path = $_CONF['upload_path'];
                $tpl->assignInclude('upload', 'template/upload.html');
                $tpl->assignGlobal('assignment', $assignment);
                // check to see if a file has been uploaded
                if (isset($_FILES['file'])) {
                    $target_file = $path . $assignment . '-' . $_FILES['file']['name'];
                    // save the file to the uploads directory
                    if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) {
                        $tpl->assignGlobal('upload_error', 'The file ' . basename($_FILES['file']['name']) . ' has been uploaded as ' . $target_file);
                        // check to see if the grade already exists.
                        $_DB->sql_query("SELECT * FROM grades WHERE gradeAssignment='{$assignment}' AND gradeUser='******' LIMIT 1;");
                        if ($_DB->sql_numrows() > 0) {
                            // use the existing grade
                            $gradeID = $_DB->sql_fetchrow();
                            $gradeID = $gradeID['gradeID'];
                        } else {
                            // create a new grade for the user
Ejemplo n.º 4
0
<?php

require_once 'lib/TemplatePower.class.php';
//session_destroy();
$tpl = new TemplatePower('template/master.html');
$tpl->assignInclude('content', 'template/error.html');
$tpl->prepare();
$tpl->showUnAssigned(false);
$tpl->printToScreen();