Exemple #1
0
     print "<div class = 'box'>Host Per Net = <span id='sub'>" . $netblock->get_hostPerNet();
 } else {
     if ($_GET['action'] == 'desc') {
         $name = "NO OWNER";
         if ($ip_db->get_owner_name() != "") {
             $name = $ip_db->get_owner_name();
         }
         $assigned = "NO ASSIGNED TO";
         if ($ip_db->get_assigned_to_name() != "") {
             $assigned = $ip_db->get_assigned_to_name();
         }
         $location = "NO LOCATION";
         if ($ip_db->get_location_name() != "") {
             $location = $ip_db->get_location_name();
         }
         print "<span id='head' style='color:" . $color . ";'>" . $netblock->get_IP() . "</span> - " . $ip_db->get_title() . "<br / > ";
         print "<div id='left'>";
         print "<img src='icons/location.png' /> " . $location . "<br /> \n\t\t\t\t\t<img src='icons/Person.png' /> " . $name . " <br />\n\t\t\t\t\t<img src='icons/People.png' /> " . $assigned . "<br />";
         print "</div>";
         print "<div id='right'>";
         print "<div class = 'desc'>Comment: <span id='sub'>" . nl2br($ip_db->get_description()) . "</span></div>";
         print "<div class = 'desc'>Tags: <span id='sub'>";
         foreach ($ip_db->get_tags() as $t_id => $t_name) {
             $tag_str .= $t_name . ", ";
         }
         $tag_str = rtrim($tag_str, " ");
         print rtrim($tag_str, ",");
         print "</span></div>";
         print "</div>";
     }
 }
Exemple #2
0
function display_search_results($s_results, $ip_manager)
{
    if (empty($s_results)) {
        echo Form::warning("NO IP!");
        return false;
    }
    echo "<style>";
    foreach ($s_results as $id => $name) {
        echo "#modalBox #dialog" . $id;
        echo "{\n\t\t\twidth:auto;\n\t\t\tmax-width: 80%;\n\t\t\tmin-width:40%;\n  \t\t\theight:auto;\n\t\t\tpadding:10px;\n\t\t\tpadding-top:10px;\n\t\t}\n\t\t";
        echo "#modalBox #dialog_calc" . $id;
        echo "{\n\t\t\twidth:auto;\n\t\t\tmax-width: 80%;\n\t\t\tmin-width:40%;\n  \t\t\theight:auto;\n\t\t\tpadding:10px;\n\t\t\tpadding-top:10px;\n\t\t}";
    }
    echo "</style>";
    //set the default column
    $form = new Form("auto", 6);
    //create the headings for these
    $heading = array("Netblock", "Name", "Location", "Owner", "Assigned To", "Status");
    $data = array();
    // Loop through all vlans and set the name and status
    foreach ($s_results as $id => $n_name) {
        $my_netblock = new IP_Database($id);
        $color = "black";
        $status = $my_netblock->get_status();
        switch ($status) {
            case "FREE":
                $color = "green";
                break;
            case "RESERVED":
                $color = "blue";
                break;
            case "ASSIGNED":
                $color = "red";
                break;
            case "PARENT":
                $color = "grey; font-style:italic;";
                break;
        }
        array_push($data, "<a name='modal' href='#dialog" . $id . "' style='cursor:default; color:" . $color . "' class='ipdesc' rel='" . $my_netblock->get_address_ip() . "@" . $id . "'>" . $my_netblock->get_address_ip() . " </a><a name='modal' href='#dialog_calc" . $id . "' style='cursor:default; color:" . $color . "' class='ipcalc' rel='" . $my_netblock->get_address_ip() . "@" . $id . "'><img src='icons/calculator.png' /></a><input type='hidden' name='id' value='" . $id . "' />");
        array_push($data, $my_netblock->get_title());
        array_push($data, $my_netblock->get_location_name());
        array_push($data, $my_netblock->get_owner_name());
        array_push($data, $my_netblock->get_assigned_to_name());
        array_push($data, $my_netblock->get_status());
        echo "<div id='modalBox'>\n\t\t\t<div id='dialog" . $id . "' class='window'>\n\t\t\t<div style='clear:both;'></div>\n\t\t\t<form method='post'>";
        echo "<a href='#'class='close' /><img src='icons/close.png'></a>";
        echo "<input type='hidden' name='id' value='" . $id . "' />";
        echo "<font class='header2'>" . $my_netblock->get_address_ip() . "</font><hr /><br/><font class='header'>Name</font>";
        echo "</select> ";
        echo "<input type='text' name='title' style='width:100%; margin-bottom:10px;' maxchar='100' value='" . $my_netblock->get_title() . "' />";
        echo "<font class='header'>Comment</font><textArea name='description' style='width:100%; margin-bottom:10px;' rows='5' >" . $my_netblock->get_description() . "</textArea>";
        echo "Location: <select name='location'>";
        if ($my_netblock->get_location_id() === NULL) {
            echo "<option selected value='NULL'>No Location</option>";
        } else {
            echo "<option value='NULL'>No Location</option>";
        }
        foreach (Location::get_locations() as $lid => $lname) {
            if ($lid == $my_netblock->get_location_id()) {
                echo "<option selected value='" . $lid . "'>" . $lname . "</option>";
            } else {
                echo "<option value='" . $lid . "'>" . $lname . "</option>";
            }
        }
        echo "</select> ";
        echo "Owner: <select name='owner'>";
        if ($my_netblock->get_owner_id() === NULL) {
            echo "<option selected value='NULL'>No Owner</option>";
        } else {
            echo "<option value='NULL'>No Owner</option>";
        }
        foreach (Contact::get_groups() as $g_id => $g_name) {
            if ($g_id == $my_netblock->get_owner_id()) {
                echo "<option selected value='" . $g_id . "'>" . $g_name . "</option>";
            } else {
                echo "<option value='" . $g_id . "'>" . $g_name . "</option>";
            }
        }
        echo "</select> ";
        echo "Assigned To: <select name='assigned'>";
        if ($my_netblock->get_owner_id() === NULL) {
            echo "<option selected value='NULL'>No Assigned To</option>";
        } else {
            echo "<option value='NULL'>No Assigned To</option>";
        }
        foreach (Contact::get_groups() as $g_id => $g_name) {
            if ($g_id == $my_netblock->get_assigned_to_id()) {
                echo "<option selected value='" . $g_id . "'>" . $g_name . "</option>";
            } else {
                echo "<option value='" . $g_id . "'>" . $g_name . "</option>";
            }
        }
        echo "</select> ";
        if (!IP_Database::is_parent($id)) {
            echo "Status: <select name='status'>";
            $all_status = array("FREE", "RESERVED", "ASSIGNED");
            foreach ($all_status as $s_id => $s_name) {
                if ($my_netblock->get_status() == $s_name) {
                    echo "<option selected value='" . $s_name . "'>" . $s_name . "</option>";
                } else {
                    echo "<option value='" . $s_name . "'>" . $s_name . "</option>";
                }
            }
            echo "</select> ";
        }
        if (!IP_Database::is_parent($id)) {
            echo "Stub: <select name='stub' id='stub" . $id . "'>";
            if ($my_netblock->is_stub() == 0) {
                echo "<option value='0' selected >not stub</option>\n\t\t\t\t\t<option value='1' >stub</option>";
            } else {
                echo "<option value='0' >not stub</option>\n\t\t\t\t\t<option  value='1' selected >stub</option>";
            }
            echo "</select>";
        }
        echo "<br /><font class='header'>Tags</font><input type='text' name='tags'  class='tags_input' style='width:100%; margin-bottom:10px;' value='";
        foreach ($my_netblock->get_tags() as $t_id => $t_name) {
            echo $t_name . ", ";
        }
        echo "' />";
        echo " <input type='submit' id='ip_update' name='ip_update' value='UPDATE' />\n\t\t\t<input type='submit' id='ip_delete' name='ip_delete' onclick='return confirmSubmit()' value='DELETE NETWORK' />\n\t\t\t</form>";
        echo "</div>\n\t\t\t\t<div id='mask'></div>\n\t\t\t\t</div>";
        $ip_manager->set_ip($my_netblock->get_address_ip());
        echo "<div id='modalBox'>\n\t\t\t<div id='dialog_calc" . $id . "' class='window'>\n\t\t\t<div style='clear:both;'></div>";
        echo "<a href='#'class='close' /><img src='icons/close.png'></a>";
        echo $ip_manager->print_all($my_netblock->get_title());
        echo "</div>\n\t\t\t\t<div id='mask'></div>\n\t\t\t\t</div>";
    }
    $form->setSortable(true);
    // or false for not sortable
    $form->setHeadings($heading);
    $form->setData($data);
    //set the table size
    $form->setTableWidth("1024px");
    echo "<div id='csv_block' style='clear:both; float:left; margin-bottom:5px; margin-top:10px;'><input type='button' onclick='csv_report(\"plugins/IP%20Manager/export_csv.php?report_name=ip_report&title=" . $_GET['title'] . "&location=" . $_GET['location'] . "&owner=" . $_GET['owner'] . "&assigned=" . $_GET['assigned'] . "&status=" . $_GET['status'] . "&tags=" . $_GET['tags'] . "\")' value='Export to CSV' /></div>";
    //$_GET['title'] $_GET['tags'] $_GET['location'] $_GET['owner'] $_GET['assigned'] $_GET['status'];
    //title=$_GET['title']&location=$_GET['location']&owner=$_GET['owner']&assigned=$_GET['assigned']&status=$_GET['status']&tags=$_GET['tags']
    echo $form->showForm();
}