function checkAllowed($user_id = NULL, $station_id = NULL, $type = 'PC') { if ($user_id == NULL or $user_id == '') { global $current_user; $user_id = $current_user->getId(); } Debug::text('User ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10); if ($station_id == NULL or $station_id == '') { global $current_station; if (is_object($current_station)) { $station_id = $current_station->getStation(); } elseif ($this->getId() != '') { $station_id = $this->getId(); } else { Debug::text('Unable to get Station Object! Station ID: ' . $station_id, __FILE__, __LINE__, __METHOD__, 10); return FALSE; } } $slf = new StationListFactory(); $slf->getByUserIdAndStatusAndType($user_id, 'ENABLED', $type); Debug::text('Station ID: ' . $station_id . ' Type: ' . $type . ' Found Stations: ' . $slf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10); foreach ($slf as $station) { Debug::text('Checking Station ID: ' . $station->getId(), __FILE__, __LINE__, __METHOD__, 10); if ($station->isAllowed($user_id, $station_id, $station->getId()) === TRUE) { Debug::text('Station IS allowed! ' . $station_id . ' - ID: ' . $station->getId(), __FILE__, __LINE__, __METHOD__, 10); return TRUE; } } return FALSE; }