Example #1
0
 static function getPortList($DeviceID)
 {
     global $dbh;
     $dev = new Device();
     $dev->DeviceID = $DeviceID;
     if (!$dev->GetDevice()) {
         return false;
         // This device doesn't exist
     }
     $sql = "SELECT * FROM fac_Ports WHERE DeviceID={$dev->DeviceID};";
     $portList = array();
     foreach ($dbh->query($sql) as $row) {
         $portList[$row['PortNumber']] = DevicePorts::RowToObject($row);
     }
     if (sizeof($portList) == 0 && $dev->DeviceType != "Physical Infrastructure") {
         // somehow this device doesn't have ports so make them now
         $portList = DevicePorts::createPorts($dev->DeviceID);
     }
     return $portList;
 }