Beispiel #1
0
 function get_content()
 {
     include_once "classes/Contact.php";
     include_once "classes/Device.php";
     include_once "classes/Service.php";
     $clients = new Contact();
     $allClients = $clients->get_groups();
     $numClients = count($allClients);
     $devices = Device::get_devices();
     $numDevices = count($devices);
     $services = Service::get_services(0);
     $numLay2 = 0;
     $numOran = 0;
     $numComm = 0;
     $numCU = 0;
     $numIx = 0;
     foreach ($services as $id => $value) {
         $curService = new Service($id);
         switch ($curService->get_service_type()) {
             case 0:
                 $numComm++;
                 break;
             case 1:
                 $numOran++;
                 break;
             case 2:
                 $numIx++;
                 break;
             case 4:
                 $numLay2++;
                 break;
             case 7:
                 $numCU++;
                 break;
         }
     }
     $content = "<ul>";
     $content .= "<li>" . $numClients . " clients</li>" . "<li>" . $numDevices . " devices</li>" . "<li>" . $numCU . " customer logical router (CU_ALL) Service</li>" . "<li>" . $numComm . " internet IP Transit (commodity) Service</li>" . "<li>" . $numLay2 . " layer 2 vlan service (l2_vlan) Service</li>" . "<li>" . $numOran . " oran IP service (oran) Service</li>" . "<li>" . $numIx . " transit Exchange Peering (ix) Service</li>";
     $content .= "</ul>";
     return $content;
 }
Beispiel #2
0
function displayAllArchived($groupTypes)
{
    //global the tool and make a tool bar for adding a contact
    global $tool, $contactForm;
    if ($_SESSION['access'] >= 50) {
        $toolNames = array("Add New Contacts", "Contacts", "Contact Types", "Person Types");
        $toolIcons = array("add", "contact", "contact", "contact");
        $toolHandlers = array("handleEvent('contacts.php?action=addGroup')", "handleEvent('contacts.php')", "handleEvent('contacts.php?action=showGroupTypes')", "handleEvent('contacts.php?action=showArchivedGroup')");
    } else {
        $toolNames = array("Contacts", "Contact Types", "Person Types");
        $toolIcons = array("contact", "contact", "contact");
        $toolHandlers = array("handleEvent('contacts.php')", "handleEvent('contacts.php?action=showGroupTypes')", "handleEvent('contacts.php?action=showArchivedGroup')");
    }
    echo $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
    echo $tool->createNewFilters();
    //get all the contact and display them all in the 2 sections: "Contact Name" and "Contact ID".
    //$allGroupTypes = $groupTypes->get_group_types(1);
    $allGroups = Contact::get_groups(1);
    $keyHandlers = array();
    $keyTitle = array();
    $keyData = array();
    if (isset($allGroups)) {
        foreach ($allGroups as $id => $value) {
            $curGroup = new Contact($id);
            array_push($keyHandlers, "handleEvent('contacts.php?action=showGroup&groupID={$id}')");
            array_push($keyTitle, $curGroup->get_name());
            array_push($keyData, $curGroup->get_group_type_name());
            //$curGroupType = new GroupType($id);
            //array_push($keyData, $curGroupType->get_desc());
        }
    } else {
        $contactForm->warning("There are NO group types available");
    }
    $headings = array("Contacts", "Contact Type");
    $contactForm->setTableWidth("1024px");
    $contactForm->setTitles($keyTitle);
    $contactForm->setData($keyData);
    $contactForm->setEventHandler($keyHandlers);
    $contactForm->setHeadings($headings);
    $contactForm->setSortable(true);
    echo $contactForm->showAll();
}
Beispiel #3
0
function addLocationForm()
{
    //global all variables
    global $locationForm, $tool;
    $locationInfoKey = array("name", "desc", "country", "province", "city", "address1", "address2", "zip", "group", "notes", "type");
    $fieldType = array(8 => "drop_down", 9 => "text_area", 10 => "drop_down");
    $locationHeader = array("Location Information");
    $locationTitle = array("Name", "Description", "Country", "Province", "City", "Address 1", "Address 2", "Zip Code", "Contact", "Notes", "Location Type");
    $allLocationType = LocationType::get_location_types();
    $allGroups = Contact::get_groups();
    $locationForm->setHeadings($locationHeader);
    $locationForm->setTitles($locationTitle);
    $locationForm->setData($locationInfo);
    $locationForm->setSortable(false);
    $locationForm->setDatabase($locationInfoKey);
    $locationForm->setAddValue("addLocation");
    $locationForm->setType($allGroups);
    $locationForm->setType($allLocationType);
    $locationForm->setFieldType($fieldType);
    echo $locationForm->newLocationForm();
}
Beispiel #4
0
 It's created so we can automatically create the outage email  list
*/
header("Content-Type: text/plain");
header("Pragma: no-cache");
header("Expires: 0");
$ini_array = parse_ini_file("../../config/cmdb.conf");
$dbhost = $ini_array['db_host'];
$dbport = $ini_array['db_port'];
$dbuser = $ini_array['db_user'];
$dbpass = $ini_array['db_pass'];
$dbname = $ini_array['db_name'];
$conn = mysql_connect("{$dbhost}:{$dbport}", $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname);
include_once '../../classes/Contact.php';
print "#\"Contact Name\",\"BCNET member Id\",\"Contact Type ID\",\"Contact Type\",\"Person Name\",\"Person Email\",\"Person Type ID\",\"Person Type\"\n";
$groups = Contact::get_groups();
foreach ($groups as $g_id => $value) {
    $g = null;
    $g = new Contact($g_id);
    //print_r($g);
    $group_type_name = $g->get_group_type_name();
    $group_type_id = $g->get_group_type();
    $bcnet_client_id = $g->get_custom_client_id();
    $contacts = $g->get_contacts();
    //print_r($contacts);
    foreach ($contacts as $c_id => $c_array) {
        $p = null;
        $p = new Person($c_array['contact_id']);
        if ($p->get_error) {
            continue;
        }
Beispiel #5
0
function editReportProfile()
{
    //global the tool and make a tool bar for adding a device and display all the archived device, and displaying the IP Report
    global $tool, $form, $report_types;
    include_once 'classes/Contact.php';
    $toolNames = array("Edit Profile", "Delete Profile", "Create Report");
    $toolIcons = array("edit", "delete", "report");
    $toolHandlers = array("handleEvent('" . $_SERVER['PHP_SELF'] . "?action=editReportProfile&profileid=" . $_GET[profileid] . "')", "handleEvent('" . $_SERVER['PHP_SELF'] . "?action=deleteReportProfile&profileid=" . $_GET[profileid] . "')", "handleEvent('" . $_SERVER['PHP_SELF'] . "?action=renderReportProfileReport&profileid=" . $_GET[profileid] . "')");
    echo $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
    if (is_numeric($_GET[profileid])) {
        $profile = new CheckReportProfile($_GET[profileid]);
    } else {
        $form->warning("Invalid Profile id id");
        return;
    }
    $allGroups[""] = "";
    foreach (Contact::get_groups() as $id => $name) {
        $allGroups[$id] = $name;
    }
    $form->setType($allGroups);
    // Drop down
    $form->setType($report_types);
    // Drop down
    $headings = array("Edit Report Profile Details");
    $postKeys = array("profile_name", "profile_client", "profile_report_type", "profile_notes");
    $keyTitle = array("Name.tip.descriptive name for this profile", "Client.tip.Optionally specify the contact client", "Report Type", "Notes");
    $keyHandlers = array();
    $keyData = array();
    if ($profile->get_contact_id()) {
        $contact = new Contact($profile->get_contact_id());
        $contact_name = $contact->get_name();
    } else {
        $contact_name = "";
    }
    $keyData = array($profile->get_name(), $contact_name, $report_types[$profile->get_report_type()], $profile->get_notes());
    $postKeys = array("profile_name", "profile_client", "profile_report_type", "profile_notes");
    $fieldType[1] = "drop_down";
    $fieldType[2] = "drop_down";
    $fieldType[3] = "text_area";
    $form->setFieldType($fieldType);
    $form->setCols(2);
    $form->setTableWidth("450px");
    $form->setData($keyData);
    $form->setTitles($keyTitle);
    $form->setDatabase($postKeys);
    $form->setHeadings($headings);
    $form->setSortable(false);
    $form->setUpdateValue("updateReportProfile");
    echo $form->editForm();
}
Beispiel #6
0
function display_search_box($sb_name = "search", $header = "Search")
{
    echo "<form method='get'>";
    echo "<font class='header2'>" . $header . "</font><hr />";
    echo "<font class='header'>Name</font><input type='text' name='title' style='width:100%; margin-bottom:10px;' maxchar='100'/>";
    //tab=devices.php&pluginID=4&className=IPmanager
    echo "<input type='hidden' name='tab' value='" . $_GET['tab'] . "' />";
    echo "<input type='hidden' name='pluginID' value='" . $_GET['pluginID'] . "' />";
    echo "<input type='hidden' name='className' value='" . $_GET['className'] . "' />";
    echo "Location: <select name='location'>";
    echo "<option value=''></option>";
    foreach (Location::get_locations() as $lid => $lname) {
        echo "<option value='" . $lid . "'>" . $lname . "</option>";
    }
    echo "</select> ";
    echo "Owner: <select name='owner'>";
    echo "<option value=''></option>";
    foreach (Contact::get_groups() as $g_id => $g_name) {
        echo "<option value='" . $g_id . "'>" . $g_name . "</option>";
    }
    echo "</select> ";
    echo "Assigned To: <select name='assigned'>";
    echo "<option value=''></option>";
    foreach (Contact::get_groups() as $g_id => $g_name) {
        echo "<option value='" . $g_id . "'>" . $g_name . "</option>";
    }
    echo "</select> ";
    echo "Status: <select name='status'>";
    $all_status = array("FREE", "RESERVED", "ASSIGNED");
    echo "<option value=''></option>";
    foreach ($all_status as $s_id => $s_name) {
        echo "<option value='" . $s_name . "'>" . $s_name . "</option>";
    }
    echo "</select> ";
    echo "<br /><font class='header'>Tags</font><input type='text'  class='tags_input' name='tags' style='width:100%; margin-bottom:10px;' />";
    echo " <input type='submit' name='" . $sb_name . "' value='SEARCH' />";
    echo "</form>";
}
Beispiel #7
0
function addServiceForm($services)
{
    //global all variables and make the tool bar
    global $tool, $serviceForm, $headings, $titles, $serviceKey, $serviceTypes, $location, $status_array;
    //create the tools if this is not in Ajax mode
    /*Taken out for usability issues
    	if (!isset($_GET['mode']))
    	{
    		$toolNames = array("All Services", "All Archived Services");
    		$toolIcons = array("services", "services");
    		$toolHandlers = array("handleEvent('services.php')", "handleEvent('services.php?action=showArchived')");
    		echo $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
    	}*/
    $serviceForm->setCols(2);
    $serviceType;
    $value = $_GET['mode'];
    /*switch ($value)
    	{
    		case 0: $serviceType = 'commodity'; break;
    		case 1: $serviceType = 'oran'; break;
    		case 2: $serviceType = 'ix'; break;
    		case 3: $serviceType = 'undefined'; break;
    		case 4: $serviceType = 'l2_vlan'; break;
    		case 5: $serviceType = 'l2_transparant_p2p'; break;
    		case 6: $serviceType = 'l2_tranparant_multipoint'; break;
    		case 7: $serviceType = 'CU_ALL'; break;
    	}*/
    //gives the headings titles and service keyes to the corresponding layer
    if ($_GET['layer'] == 3) {
        $headings = array("Service Information", "*<break>*", "Port Specific Information", "*<break>*", "Routing Specific Information", "*<break>*", "IPv4 Information", "*<break>*", "IPv6 Information");
        $titles = array("Customer name", "Service type", "Include statistics in portal?.tip.If YES is selected the user will be able to see the statistics for this particular service in the wiki portal. If this is not selected, traffic stats for this service will not be available in the wiki portal", "Service description (name).tip.A useful description for this service", "Notes.tip.Here you can add generic notes for this service, for example: This is a tempory backup connection.", "Status.tip.Specify the production status of this Service", "In production date", "Out of production date", "*<break>*", "Device for Service", "Interface.tip.Name of the physical interface, for example ge-2/0/1<br>Do not use subinterface format no ge-2/0/1.10", "Interface MTU Size.tip.Default for ORAN and CU_ALL is 9000 bytes, the commodity and IX instance use 1500", "Interface tagged", "Vlan number.tip.Please enter a vlan number. If this is an untagged routed port and has no vlan, than please use 0. This means no vlan configuration", "*<break>*", "Logical router", "Routing type", "AS number", "Traffic Policing", "*<break>*", "IPv4 unicast", "IPv4 multicast", "BCNET router address.tip.IPv4 address of the BCNET side of this link. Please include masklenght. Format: x.x.x.x/30", "Customer router address.tip.IPv4 address of the Customer side of this link. Please include masklenght. Format: x.x.x.x/30", "IPv4 prefix", "*<break>*", "IPv6 unicast", "IPv6 multicast", "BCNET router address", "Customer router address", "IPv6 prefix");
        $serviceKey = array("cusName", "serviceType", "stats", "description", "notes", "status", "in_production", "out_production", "device", "interface", "interfaceMTU", "tagged", "vlanNum", "logiRout", "routType", "ASNum", "trafPolice", "ipv4Uni", "ipv4Multi", "pRoutAd4", "cRoutAd4", "prefix4", "ipv6Uni", "ipv6Multi", "pRoutAd6", "cRoutAd6", "prefix6");
        $layer3Service = new Layer3_service($services->get_service_id());
        $fieldType = array("drop_down", "drop_down", "radio", "", "text_area", "drop_down", "date_picker", "date_picker", "drop_down", "", "drop_down", "radio", "", "", "drop_down", "", "", "radio", "radio", "custom", "custom", "text_area.width:150px.height:100px", "radio", "radio", "custom", "custom", "text_area.width:200px.height:100px");
        $customKeys = array("pRoutAd4", "cRoutAd4", "pRoutAd6", "cRoutAd6");
        $custom = array();
        foreach ($customKeys as $id => $value) {
            $custom[$id] = "<input name=\"" . $customKeys[$id] . "\" id=\"" . $customKeys[$id] . "\" value=\"\" type=\"text\" maxChar=\"250\" style='width: 30%;'> / <input name=\"" . $customKeys[$id] . "-length\" id=\"" . $customKeys[$id] . "-length\" value=\"\" type=\"text\" maxChar=\"2\" style='width: 2%;'>";
        }
        //store the values in the info
        $fieldInfo = array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", $custom[0], $custom[1], "", "", "", $custom[2], $custom[3], "");
        $contact = new Contact();
        $customers = $contact->get_groups();
        $MTU = array(1500 => '1500', 9000 => '9000');
        $routingType = array('BGP' => 'BGP', 'Static' => 'Static');
        $allServiceTypes = ServiceType::get_service_types();
        $lay3Types = array();
        foreach ($allServiceTypes as $id => $value) {
            $curServiceType = new ServiceType($id);
            if ($curServiceType->get_service_layer() == 3) {
                $lay3Types[$id] = $curServiceType->get_name();
            }
        }
        $types = array($customers, $lay3Types, $status_array, Device::get_devices(), $MTU, $routingType);
        $serviceForm->setData($fieldInfo);
        $serviceForm->setFieldType($fieldType);
        //WEIRD BUG THAT I DUN GET BCNET ROUTER ADDRESS NOT WORKING
        //store all the contact information values into an array
        echo $serviceForm->newServiceForm($headings, $titles, $serviceKey, $types);
    } else {
        if ($_GET['layer'] == 2) {
            $serviceKey = array("cusName", "serviceType", "stats", "description", "notes", "status", "in_production", "out_production", "vlanNum");
            $headings = array("Service Information", "*<break>*", "Layer 2 Specific Information");
            $titles = array("Customer name", "Service type", "Include statistics in portal?.tip.If YES is selected the user will be able to see the statistics for this particular service in the wiki portal. If this is not selected, traffic stats for this service will not be available in the wiki portal", "Service description (name).tip.A useful description for this service", "Notes.tip.Here you can add generic notes for this service, for example: This is a tempory backup connection.", "Status.tip.Specify the production status of this Service", "In production date", "Out of production date", "*<break>*", "Vlan number.tip.Please enter a vlan number. If this is an untagged routed port and has no vlan, than please use 0. This means no vlan configuration");
            $types = "";
            $contact = new Contact();
            $allServiceTypes = ServiceType::get_service_types();
            $lay2Types = array();
            foreach ($allServiceTypes as $id => $value) {
                $curServiceType = new ServiceType($id);
                if ($curServiceType->get_service_layer() == 2) {
                    $lay2Types[$id] = $curServiceType->get_name();
                }
            }
            $customers = $contact->get_groups();
            $types = array($customers, $lay2Types, $status_array);
            $fieldType = array("drop_down", "drop_down", "radio", "", "text_area", "drop_down", "date_picker", "date_picker", "");
            //$fieldInfo = array("", $serviceType, "", "", "", "");
            $serviceForm->setFieldType($fieldType);
            //$serviceForm->setData($fieldInfo);
            //store all the service information values into an array
            echo $serviceForm->newServiceForm($headings, $titles, $serviceKey, $types);
        } else {
            $handler2 = "return LoadPage('services.php?action=add&layer=2&mode='+this.value, 'addLayerForm');";
            $handler3 = "return LoadPage('services.php?action=add&layer=3&mode='+this.value, 'addLayerForm');";
            // Change that... for some reason the above doesn't load the ajax scripts properly....
            // Specificaly the datepicker scripts.
            $handler2 = "window.location='services.php?action=add&layer=2';";
            $handler3 = "window.location='services.php?action=add&layer=3';";
            echo "\r\n\t\t<div style='margin-bottom:10px; clear:left;'>\r\n\t\t<form method='post'>\r\n\t\t<input type='radio' name='serviceType' value='2' onclick=\"{$handler2}\">Layer 2</input>\r\n\t\t<input type='radio' name='serviceType' value='3' onclick=\"{$handler3}\">Layer 3</input>\r\n\t\t</form></div>\r\n\t\t<div id='addLayerForm'></div>";
        }
    }
}
Beispiel #8
0
 function render_edit_accounting_profile()
 {
     // Include contact class
     if (isset($_GET['pid']) && is_numeric($_GET['pid'])) {
         $pid = $_GET['pid'];
     } else {
         return "<b>Sorry invalid profile id " . $_GET['pid'] . "</b>";
     }
     $allGroups = Contact::get_groups();
     $query = "Select title, client_id, notes, traffic_cap\n\t\t\tFROM accounting_profiles\n\t\t\tWHERE profile_id = '{$pid}'";
     $result = mysql_query($query);
     if (!$result) {
         return "<b>Sorry something went wrong</b>" . mysql_error() . $query;
     }
     $obj = mysql_fetch_object($result);
     $thisGroup = new Contact($obj->client_id);
     $groupName = $thisGroup->get_name();
     $values = array($obj->title, "{$groupName}", $this->int_to_si($obj->traffic_cap), $obj->notes);
     $content .= "<h1>Accounting Profiles</h1>";
     $form = new Form("auto", 2);
     $heading = array("Edit Accounting Profile");
     $titles = array("Name", "Client", "Traffic Cap.tip.Configured cap or Contracted rate.<br>Examples 100M, 2M, 1G, 155M, 800K", "Notes");
     $post_keys = array("Name", "Client", "TrafficCap", "Notes");
     $form->setType($allGroups);
     // Drop down
     $fieldType = array(1 => "drop_down", 3 => "text_area");
     $form->setFieldType($fieldType);
     $form->setSortable(false);
     $form->setHeadings($heading);
     $form->setTitles($titles);
     $form->setDatabase($post_keys);
     $form->setData($values);
     //set the table size
     $form->setTableWidth("1024px");
     $form->setTitleWidth("20%");
     $content .= $form->EditForm(1);
     return $content;
 }