Security->check_auth_page('user.php'); if($_SERVER['REQUEST_METHOD'] == 'POST'){ require_once '../includes/Validate.class.php'; $validate = new Validate($qls); if ($validate->returnData['active'] == 'inactive') { echo json_encode($validate->returnData); return; } $data = json_decode($_POST['data'], true); validate($data, $validate, $qls); if (!count($validate->returnData['error'])){ $cabinetView = $data['view']; $page = $data['page']; foreach($data['cabinetArray'] as $cabinetData) { $html = ''; //Retreive name of the cabinet or location $elementID = $cabinetData['id']; $elementFace = $cabinetData['face']; $elementType = $cabinetData['type']; if($elementType == 'cabinet') { $cabinetID = $elementID; $cabinetFace = $elementFace; } else { $object = $qls->App->objectArray[$elementID]; $cabinetID = $object['env_tree_id']; $cabinetFace = ($object['cabinet_front'] == $elementFace) ? 0 : 1; } $cabinetFace = $cabinetFace == 0 ? 'cabinet_front' : 'cabinet_back'; $cabinet = $qls->App->envTreeArray[$cabinetID]; $cabinetType = $cabinet['type']; $cabinetParentID = $cabinet['parent']; $ruOrientation = $cabinet['ru_orientation']; $cabinetName = $cabinet['name']; $cabinetSize = $cabinet['size']; // Retreive ancestor info $locationID = $cabinetParentID; $ancestorIDArray = array(); while($locationID != '#') { $location = $qls->App->envTreeArray[$locationID]; $locationName = $location['name']; $parentID = $location['parent']; $workingArray = array( 'id' => $locationID, 'parentID' => $parentID, 'name' => $locationName ); array_unshift($ancestorIDArray, $workingArray); $locationID = $parentID; } //Retreive cabinet object info $object = array(); $insert = array(); if(isset($qls->App->objectByCabinetArray[$cabinetID])) { foreach($qls->App->objectByCabinetArray[$cabinetID] as $objID) { $obj = $qls->App->objectArray[$objID]; if($obj[$cabinetFace] !== null) { $templateID = $obj['template_id']; $template = $qls->App->templateArray[$templateID]; if($template['templateType'] == 'Standard') { $RU = $obj['RU']; $object[$RU] = $obj; $object[$RU]['face'] = $obj[$cabinetFace]; } else { $parentID = $obj['parent_id']; $parentFace = $obj['parent_face']; $parentDepth = $obj['parent_depth']; $insertSlotX = $obj['insertSlotX']; $insertSlotY = $obj['insertSlotY']; $insert[$parentID][$parentFace][$parentDepth][$insertSlotX][$insertSlotY] = $obj; } } } } //Retreive rackable objects $objectTemplate = array(); $results = $qls->SQL->select('*', 'app_object_templates'); while ($row = $qls->SQL->fetch_assoc($results)){ $objectTemplate[$row['id']] = $row; $objectTemplate[$row['id']]['partitionData'] = json_decode($row['templatePartitionData'], true); $objectTemplate[$row['id']]['categoryName'] = $qls->App->categoryArray[$row['templateCategory_id']]['name']; unset($objectTemplate[$row['id']]['templatePartitionData']); } //Retreive patched ports $patchedPortTable = array(); $query = $qls->SQL->select('*', 'app_inventory'); while ($row = $qls->SQL->fetch_assoc($query)){ array_push($patchedPortTable, $row['a_object_id'].'-'.$row['a_object_face'].'-'.$row['a_object_depth'].'-'.$row['a_port_id']); array_push($patchedPortTable, $row['b_object_id'].'-'.$row['b_object_face'].'-'.$row['b_object_depth'].'-'.$row['b_port_id']); } //Retreive populated ports $populatedPortTable = array(); $query = $qls->SQL->select('*', 'app_populated_port'); while ($row = $qls->SQL->fetch_assoc($query)){ array_push($populatedPortTable, $row['object_id'].'-'.$row['object_face'].'-'.$row['object_depth'].'-'.$row['port_id']); } $cursorClass = ($page == 'explore' or $page == 'diagram') ? 'cursorPointer' : 'cursorGrab'; $html .= '
| '.$RUNumber.' | '; if (array_key_exists($cabLoop, $object)){ $objName = $object[$cabLoop]['name']; $face = $object[$cabLoop]['face']; $templateID = $object[$cabLoop]['template_id']; $template = $qls->App->templateArray[$templateID]; $partitionData = json_decode($template['templatePartitionData'], true); $function = $template['templateFunction']; $type = $template['templateType']; $mountConfig = $template['templateMountConfig']; $objectID = $object[$cabLoop]['id']; $RUSize = $template['templateRUSize']; $categoryID = $template['templateCategory_id']; $categoryName = $qls->App->categoryArray[$categoryID]['name']; $objClassArray = array( 'rackObj', $cursorClass, 'draggable', 'object', 'RU'.$RUSize ); $html .= '';
$isCombinedTemplate = false;
if($cabinetView == 'port') {
$html .= $qls->App->generateObjContainer($template, $face, $objClassArray, $isCombinedTemplate, $objectID);
//$rackObj = true;
$html .= $qls->App->buildStandard($partitionData[$face], $isCombinedTemplate, $objectID, $face);
$html .= '';
} else if($cabinetView == 'visual') {
$categoryData = false;
$html .= $qls->App->generateObjContainer($template, $face, $objClassArray, $$isCombinedTemplate, $objectID, $categoryData, $cabinetView);
//$rackObj = true;
$html .= $qls->App->buildStandard($partitionData[$face], $isCombinedTemplate, $objectID, $face, $cabinetView);
$html .= '';
} else if($cabinetView == 'name') {
$html .= ' '.$objName.' ';
}
$skipCounter = $RUSize-1;
} else {
if ($skipCounter == 0){
$html .= ' | '; } else { $html .= ' | '; $html .= ''; $html .= ' |