barcode; break; case "cleansleft": $tmp_array[1] = $inSlot->availableCleanings; break; case "loglib": $tmp_array[1] = $inSlot->name; break; case "mediatype": $tmp_array[1] = $inSlot->mediaType; break; case "slottype": $tmp_array[1] = $inSlot->slotType; break; case "location": $tmp_array[1] = $inSlot->location; break; case "EA": $tmp_array[1] = $inSlot->logicalAddress; break; default: $tmp_array[1] = $inSlot->name; break; } $sorted_array[$i] = $tmp_array; $i++; } if ($i != 0) { usort($sorted_array, 'cmpStr'); $i = 0; foreach ($sorted_array as $out_array) { $old_index[$i] = $out_array[0]; $i++; } return $old_index; } } return 0; } //-------------------------------------------------------------------------- // calculateDivAttributes // // This function determines div parameters for the main table and decides // whether the table should be scrollable or not. // //-------------------------------------------------------------------------- function calculateDivAttributes($libraryView, $enclosureView, $inObjects, $numObjects, $maxRows, $maxSize) { $i = 0; $numDisplayed = 0; $divAtts['divClass'] = ""; $divAtts['thClass'] = ""; $divAtts['divHeight'] = ""; $divAtts['numDisplay'] = ""; while (($numDisplayed <= $maxRows) && ($i < $numObjects)) { $inObject = $inObjects[$i]; // store the first part of the enclosure (chassis) location value $chass = $inObject->location[0]; // if the enclosure (chassis) location is negative, append the numeric value to the // '-' to identify the enclosure if (!strcmp($chass, '-')) { $chass = $inObject->location[0].$inObject->location[1]; } error_log("DIV ATTRS $chass ".$libraryView." ".$enclosureView." ".$inObjects." ".$numObjects." ".$maxRows." ".$maxSize); if ((!strcmp($libraryView, "All Logical Libraries") && !strcmp($enclosureView, "All Enclosures")) || (!strcmp($libraryView, $inObject->name) && !strcmp($enclosureView, "All Enclosures")) || (!strcmp($libraryView, "All Logical Libraries") && !strcmp($enclosureView, $chass)) || (!strcmp($libraryView, $inObject->name) && !strcmp($enclosureView, $chass))) { $numDisplayed++; } $i++; } if ($numDisplayed > $maxRows) { $divAtts['divClass'] = "table-scroll"; $divAtts['thClass'] = "table-noscroll"; $divAtts['divHeight'] = $maxSize; } $divAtts['numDisplay'] = $numDisplayed; error_log($divAtts); return $divAtts; } //-------------------------------------------------------------------------- // sortDrives // // This function handles the sort for drive data. // //-------------------------------------------------------------------------- function sortDrives($inDrives, $sortBy) { $i = 0; if ($inDrives != "") { foreach ($inDrives as $inDrives) { $tmp_array[0] = $i; switch ($sortBy) { case "contents": $tmp_array[1] = $inDrives->barcode; break; case "loglib": $tmp_array[1] = $inDrives->name; break; case "mediatype": $tmp_array[1] = $inDrives->mediaType; break; case "slottype": $tmp_array[1] = $inDrives->slotType; break; case "location": $tmp_array[1] = $inDrives->location; break; case "status": $tmp_array[1] = $inDrives->status; break; case "lastclean": $tmp_array[1] = "unknown"; break; case "fwlevel": $tmp_array[1] = $inDrives->firmwareLevel; break; case "EA": $tmp_array[1] = $inDrives->logicalAddress; break; default: $tmp_array[1] = $inDrives->location; break; } $sorted_array[$i] = $tmp_array; $i++; } if ($i != 0) { usort($sorted_array, 'cmpStr'); $i = 0; foreach ($sorted_array as $out_array) { $old_index[$i] = $out_array[0]; $i++; } return $old_index; } } return 0; } //--------------------------------------------------------------------- // getBrowserType // // This function test the browser type. Returns "IE" if the if the application // is running in Microsoft Internet Explorer browser, or "Mozilla" if the application // is running in Mozilla Firefox browser. //--------------------------------------------------------------------- function getBrowserType(){ $browser = "Default"; if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { $browser="IE"; }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false){ $browser="Mozilla"; } return $browser; } ?>