Example #1
0
 function render_show_accounting_profile()
 {
     if (isset($_GET['pid']) && is_numeric($_GET['pid'])) {
         $pid = $_GET['pid'];
     } else {
         return "<b>Sorry invalid profile id " . $_GET['pid'] . "</b>";
     }
     $content = "";
     $profile_name = $this->get_accounting_profile_name($pid);
     // Menu bar
     $content .= "<div style='font-size:10px; font-weight:100px;'>\n\t\t\t<a href='{$this->url}'>Accounting</a> >> {$profile_name}</div><br>";
     /*
      Get all SCU-DCU sources for this profile
     */
     $query = "SELECT accounting_source from accounting_profiles_files\n\t\t\tWHERE profile_id = '{$pid}'";
     $result = mysql_query($query);
     $sources = '';
     while ($obj = mysql_fetch_object($result)) {
         $sources .= "graph_profile_id[]=" . $obj->accounting_source . "&";
     }
     // Remove last &
     $sources = substr($sources, 0, -1);
     /*
      End Get all SCU-DCU sources for this profile
     */
     // Tools menu
     $tool = new EdittingTools();
     if ($_SESSION['access'] >= 50) {
         $toolNames = array("Edit", "Delete", "Saved Reports", "New Report", "Quick Report");
         $toolIcons = array("edit", "delete", "stat", "line", "graph");
         $toolHandlers = array("window.location.href='{$this->url}&action=edit_accounting_profile&pid={$pid}'", "window.location.href='{$this->url}&action=del_accounting_profile&pid={$pid}'", "window.location.href='{$this->url}&pid={$pid}&action=show_reports'", "window.location.href='{$this->url}&action=create_report&pid={$pid}'", "window.location.href='{$this->url}&action=graph_profiles&{$sources}&pid={$pid}'");
         $content .= $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
     }
     $content .= "<p>";
     $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);
     $contact = new Contact($obj->client_id);
     $contact_name = $contact->get_name();
     if ($contact_name == '') {
         $contact_name = "n/a";
     }
     $values = array($obj->title, $contact_name, $this->int_to_si($obj->traffic_cap), $obj->notes);
     $form = new Form("auto", 2);
     $heading = array("Edit Accounting Profile");
     $titles = array("Name", "Client", "Traffic Cap.tip.Configured cap or Contracted rate.", "Notes");
     $form->setSortable(false);
     $form->setHeadings($heading);
     $form->setTitles($titles);
     $form->setDatabase($titles);
     $form->setData($values);
     //set the table size
     $form->setTableWidth("1024px");
     $form->setTitleWidth("20%");
     $content .= $form->ShowForm(1);
     $content .= "<div style=\"clear:both;\"></div> </p>";
     $content .= "</p><p><h2>RRD files</h2>";
     $tool2 = new EdittingTools();
     if ($_SESSION['access'] >= 50) {
         $toolNames = array("Add RRD file");
         $toolIcons = array("add");
         #$formType = array("newDialog");
         #$tool2->createNewModal($toolNames, $toolIcons, $formType);
         $toolHandlers = array("window.location.href='{$this->url}&action=show_add_rrd_to_profile&pid={$pid}'");
         $content .= $tool2->createNewTools($toolNames, $toolIcons, $toolHandlers);
     }
     $form = new Form("auto", 3);
     $heading = array("Delete", "Device", "SCU-DCU source");
     $data = array();
     $title = array();
     $handler = array();
     #$content .=  "<table><tr><th>Delete</th><th>Device</th><th>SCU-DCU sources</th>";
     $query = "SELECT accounting_profiles_files.accounting_source,\n\t\t\t\taccounting_sources.title, accounting_sources.device_id,\n\t\t\t\tDevices.name as device_name\n\t\t\tFROM accounting_profiles_files, accounting_sources, Devices\n\t\t\tWHERE profile_id = '{$pid}'\n\t\t\tAND accounting_sources.device_id = Devices.device_id\n\t\t\tAND accounting_profiles_files.accounting_source = accounting_sources.id";
     $result = mysql_query($query);
     if (!$result) {
         $content .= "<b>No Files found</b>";
     }
     while ($obj = mysql_fetch_object($result)) {
         #$content .=  "<tr><td><a href = '$this->url&action=del_accounting_source_from_profile&pid=$pid&asrc=$obj->accounting_source'><img src='icons/Delete.png' height=20></a></td> <td>$obj->device_name</td><td>$obj->title</td></tr>";
         array_push($title, "<a href='{$this->url}&action=del_accounting_source_from_profile&pid={$pid}&asrc={$obj->accounting_source}'><img src='icons/Delete.png' height=20></a>");
         array_push($data, $obj->device_name, $obj->title);
     }
     #$content .=  "</table>";
     $form->setSortable(true);
     // or false for not sortable
     $form->setHeadings($heading);
     $form->setTitles($title);
     $form->setTitleWidth("50px");
     $form->setData($data);
     $form->setTableWidth("500px");
     $content .= $form->showForm();
     // This is to add normal Interface RRD files
     // AT, remove this link as it's not fully implemented
     //$content .= "<a href='$this->url&action=add_device_interface_to_profile&pid=$pid'>Add interface to accounting profile</a>";
     // Done
     return $content;
 }
Example #2
0
 function render_show_change()
 {
     // First determine change id
     // If not a;ready defined. then check GET
     if (isset($_GET[cid]) && is_numeric($_GET[cid])) {
         $cid = mysql_real_escape_string($_GET[cid]);
     } else {
         return "<b>Sorry change not found<br></b>";
     }
     //$content = "<h1>Change Details (#$cid) </h1>";
     // Tools menu
     $tool = new EdittingTools();
     if ($_SESSION['access'] >= 50) {
         $toolNames = array("Edit", "Add Device", "Delete Change");
         $toolIcons = array("edit", "add", "delete");
         $toolHandlers = array("window.location.href='{$this->url}&action=edit_change&cid={$cid}'", "window.location.href='{$this->url}&action=edit_change&cid={$cid}&add_device#new_device'", "window.location.href='{$this->url}&action=delete_change&cid={$cid}&return=show_change'");
         $contentH .= $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
     }
     $contentH .= " <div style=\"clear:both;\"></div><br> ";
     /*
     	First Generic change info
     */
     $query = "SELECT change_id, title, notes, record_date, planned_change_date,change_date,\n\t\t\t\t\tchange_contact_1, change_contact_2, impact, status\n\t\t\t\t\tFROM plugin_ChangeManager_Changes\n\t\t\t\t\tWHERE change_id = '{$cid}'";
     $result = mysql_query($query);
     if (!$result) {
         return "<b>Oops something went wrong, unable to select changes </b>";
     }
     $values = array();
     while ($obj = mysql_fetch_object($result)) {
         $notes = nl2br($obj->notes);
         $user1 = new User($obj->change_contact_1);
         $contact_name1 = $user1->get_full_name();
         $user2 = new User($obj->change_contact_2);
         $contact_name2 = $user2->get_full_name();
         $impact_name = $this->impact_values[$obj->impact];
         $status_name = $this->status_values[$obj->status];
         if (is_null($obj->planned_change_date)) {
             $planned_change_date = 'Not Specified';
         } else {
             $planned_change_date = $obj->planned_change_date;
         }
         if (is_null($obj->change_date)) {
             $change_date = 'Not Specified';
         } else {
             $change_date = $obj->change_date;
         }
         array_push($values, $obj->title, $planned_change_date, $change_date, $contact_name1, $contact_name2, $impact_name, $status_name, $notes);
         $title = $obj->title;
     }
     $content = "<hr align=\"left\" style=\"width:94%;border:1px solid #C0C0C0;\">\n\t\t\t\t\t<h2>CHANGE (#{$cid}): {$title}</h2>\n\t\t\t\t\t<hr align=\"left\" style=\"width:94%;border:1px solid #C0C0C0;\">" . $contentH;
     $form = new Form("auto", 2);
     $heading = array("Change Details");
     $titles = array("Summary", "Planned Date", "Completion Date", "Primary Contact", "Secondary Contact", "Impact", "Status", "Change Description");
     #$fieldType = array(1=>"text_area");
     #$form->setFieldType($fieldType);
     $form->setSortable(false);
     $form->setHeadings($heading);
     $form->setTitles($titles);
     $form->setDatabase($titles);
     $form->setData($values);
     //set the table size
     $form->setTableWidth("94%");
     $form->setTitleWidth("20%");
     $content .= $form->ShowForm(1);
     /*
     	Device specific change info
     */
     $query2 = "SELECT device_id, impact, effects, chgby_id, change_date, description,\n\t\t\t\t\tback_out, status, id\n\t\t\t\t\tFROM plugin_ChangeManager_Components\n\t\t\t\t\tWHERE change_id = '{$cid}'";
     $result2 = mysql_query($query2);
     if (!$result2) {
         return "<b>Oops something went wrong, unable to select changes </b>";
     }
     $content .= "<table style='width:94%; clear:left;' id=\"sortDataTable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr></tr><td><h2>Device Changes</h2></td></tr></table>";
     while ($obj = mysql_fetch_object($result2)) {
         $dvalues = array();
         // Determine device name
         $device = new Device($obj->device_id);
         $device_name = $device->get_name();
         // Determine device name
         $user = new User($obj->chgby_id);
         $fullname = $user->get_full_name();
         $effects = stripslashes(nl2br($obj->effects));
         $description = stripslashes(nl2br(htmlentities($obj->description)));
         // For Juniper code we need to keep the indents in place. so replace white spaces as well
         $description = str_replace("  ", "&nbsp;&nbsp;", $description);
         $back_out = stripslashes(nl2br($obj->back_out));
         array_push($dvalues, $device_name, $fullname, $description, $effects, $back_out);
         $heading = array("Device Details: {$device_name} <div style='text-align: right;'> \n<a href='{$this->url}&action=delete_device_component&cid={$cid}&component_id={$obj->id}&return=show_change' style='color:#FFFFFF'>\nDelete <img src='icons/Delete.png' height=20></a></div>");
         $titles = array("Device", "Changed By", "Change Details", "Change Effects", "Backout Procedure");
         #$fieldType = array(4=>"text_area");
         #$fieldType = array(4=>"text_area.height:60px");
         $dform = new Form("auto", 2);
         $dform->setHeadings($heading);
         $dform->setFieldType($fieldType);
         $dform->setTitles($titles);
         $dform->setDatabase($titles);
         $dform->setData($dvalues);
         //set the table size
         $dform->setTableWidth("94%");
         $dform->setTitleWidth("20%");
         $content .= $dform->ShowForm(1);
     }
     return $content;
 }