Beispiel #1
0
 public function getSubnets()
 {
     $device = \Basic\Model_Device::find($this->id);
     $rack = $device->racks;
     $room = $rack->rooms;
     $floor = $room->floors;
     $building = $floor->buildings;
     $location = Model_Location_Extra::find()->where('building', $building->id)->get();
     $valid = array();
     foreach ($location as $sub) {
         //distinct rack
         if ($sub['rack'] == $rack->id) {
             array_push($valid, $sub);
         }
         //same room
         if ($sub['rack'] == 0 and $sub['room'] == $room->id) {
             array_push($valid, $sub);
         }
         //same floor
         if ($sub['rack'] == 0 and $sub['room'] == 0 and $sub['floor'] == $floor->id) {
             array_push($valid, $sub);
         }
         //same building
         if ($sub['rack'] == 0 and $sub['room'] == 0 and $sub['floor'] == 0 and $sub['building'] == $building->id) {
             array_push($valid, $sub);
         }
     }
     return $valid;
 }
Beispiel #2
0
 public function getData($nodeId)
 {
     $out = array();
     $node = '-';
     $ds = Model_Location_Extra::find()->where('node', $nodeId)->get();
     foreach ($ds as $d) {
         array_push($out, array('id' => $d->id, 'mn' => $d->subnet_name['subnet'], 'bu' => $d->building_name['name'], 'fl' => $d->floor_name['name'], 'ro' => $d->room_name['name'], 'ra' => $d->rack_name['name'], 'st' => $d['pos_from'], 'en' => $d['pos_to']));
     }
     return $out;
 }