Retrieves the correct stations file, can be filtered to only show stations that are flagges as active. Conditions
for this can be
@param bool $activeOnly
@return array
493940
public function getStations(AbstractHourlyService $controller, bool $activeOnly = false, bool $forceDownloadFile = false)
    {
        $downloadFile = false || $forceDownloadFile;
        $stationsFTPPath = DWDConfiguration::getHourlyConfiguration()->parameters;
        $stationsFTPPath = get_object_vars($stationsFTPPath)[$controller->getParameter()]->stations;

        $filePath = $controller->getStationFTPPath($stationsFTPPath);
        //Retrieve Stations
        if (file_exists($filePath)) {
            $lastModifiedStationFile = Carbon::createFromTimestamp(filemtime($filePath));
            $diffInHours = Carbon::now()->diffInHours(Carbon::createFromTimestamp(filemtime($filePath)));
            DWDUtil::log(self::class, "last modified? " . $lastModifiedStationFile
                . "; difference to today (h)? " . $diffInHours);
            $downloadFile = $diffInHours >= 12; //redownload every 12h.
        } else
            $downloadFile = true;
        //todo: determine if this works - had a problem where this did not trigger redownloading of the file, which lead to the no active stations exception.
        if ($downloadFile) {
            DWDUtil::log(self::class, "Downloading station file=" . $filePath);
            DWDStationsController::getStationFile($stationsFTPPath, $filePath);
        }

        $stations = DWDStationsController::parseStations($filePath);
        DWDUtil::log(self::class, "Got stations... " . count($stations));

        //todo 31.8.2017:  rewrite the "active" part in a way that checks if the queried date is inside the "active" period of stations
        if ($activeOnly && count($stations) > 0) {
            $stations = array_filter($stations,
                function (DWDStation $station) {
                    return $station->isActive();
                });
        }
        DWDUtil::log(self::class, "Got stations after filtering... " . count($stations));

        return $stations;
    }
1159907
public function getAllFlat($bOnlySelectable = false)
    {
        $aAvailable = $this->getAll($bOnlySelectable);
        $aOut       = [];

        foreach ($aAvailable as $oType) {
            $aOut[$oType->slug] = $oType->label;
        }

        return $aOut;
    }
685596
public function findActiveLayers(array $layers, RequestInterface $request, bool $checkMethod = true): array
    {
        $activeLayers = array_filter($layers, function(Layer $layer) use($checkMethod, $request) {
            return $this->isActiveLayer($layer, $request, $checkMethod);
        });

        return array_values($activeLayers);
    }
1012137
public function getAll($bOnlySelectable = false)
    {
        $aOut = [];

        foreach ($this->aAvailable as $oType) {
            $sClassName = $oType->slug;
            if (!$bOnlySelectable || $sClassName::IS_SELECTABLE) {
                $aOut[] = $oType;
            }
        }

        return $aOut;
    }
189572
public static function get_tool_proxies($orphanedonly) {
        global $PAGE;
        $params = self::validate_parameters(self::get_tool_proxies_parameters(),
                                            array(
                                                'orphanedonly' => $orphanedonly
                                            ));
        $orphanedonly = $params['orphanedonly'];

        $proxies = array();
        $context = context_system::instance();

        self::validate_context($context);
        require_capability('moodle/site:config', $context);

        $proxies = lti_get_tool_proxies($orphanedonly);

        return array_map('serialise_tool_proxy', $proxies);
    }
713271
public function getServiceList($fields = null, $only_active = false)
    {
        $allowed = ['id', 'name', 'label', 'description', 'is_active', 'type'];
        if (empty($fields)) {
            $fields = $allowed;
        } elseif (is_string($fields)) {
            $fields = array_map('trim', explode(',', trim($fields, ',')));
        }
        $includeGroup = in_array('group', $fields);
        $includeTypeLabel = in_array('type_label', $fields);
        if (($includeGroup || $includeTypeLabel) && !in_array('type', $fields)) {
            $fields[] = 'type';
        }
        $fields = array_intersect($fields, $allowed);
        if ($only_active) {
            $results = Service::whereIsActive(true)->get($fields)->toArray();
        } else {
            $results = Service::get($fields)->toArray();
        }
        if ($includeGroup || $includeTypeLabel) {
            $services = [];
            foreach ($results as $result) {
                if ($typeInfo = $this->getServiceType(array_get($result, 'type'))) {
                    if ($includeGroup) {
                        $result['group'] = $typeInfo->getGroup();
                    }
                    if ($includeTypeLabel) {
                        $result['type_label'] = $typeInfo->getLabel();
                    }
                    $services[] = $result;
                }
            }

            return $services;
        }

        return $results;
    }
388440
public function getFilterable(bool $assoc = false): array
	{
		if ($this->filterable === self::ALLOW_ALL) {
			return self::ALLOW_ALL;
		}

		return $assoc ? $this->filterable : array_keys($this->filterable);
	}
62747
public function GetActiveSettingAsArray()
    {
        $aData = array();
        if (is_array($this->aActiveFilterData) || !empty($this->aActiveFilterData)) {
            $aData = array(TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA => array($this->id => $this->aActiveFilterData));
        }

        return $aData;
    }
896567
public function getAddons($active = false) {
        if ($active) {
            return array_keys($this->enabled);
        }
        return array_keys($this->addons);
    }
385010
private function getRealPath($activeOnly)
	{
		$path = $this->getPathEntity()->getPath();
		$active = $this->getPathEntity()->isActive();

		// Method will return NullPath instance
		if (is_null($path)) {
			$path = NullPath::getInstance();
			$this->getPathEntity()->setPath($path);
		} elseif ($activeOnly && ! $active) {
			$path = NullPath::getInstance();
		}

		return $path;
	}
695951
private function filtersBooleanOverride(array $filters): array
    {
        foreach ($filters as $key => $filter) {
            $builderType = $filter['type'];

            switch ($builderType) {
                case 'boolean':
                    $filter['values'] = [
                        1 => 'Yes',
                        0 => 'No',
                    ];
                    $filter['input'] = 'radio';
                    $filter['colors'] = [
                        1 => 'success',
                        0 => 'danger',
                    ];

                    break;
            }

            $filters[$key] = $filter;
        }

        return $filters;
    }
995528
public function render( $bodyOnly = false )
    {
        $this->parseRequest();

        $result = $this->view->render( 'rowSet/layout', array(
            'rowSet' => $this,
        ) );

        if ( $bodyOnly )
        {
            return $result;
        }

        if ( $this->hasFlags( self::FLAG_LAYOUT_FILTERING ) )
        {
            $result = $this->view->render( 'rowSet/layout/filtering', array(
                'content'   => $result,
                'rowSet'    => $this,
            ) );
        }

        if ( $this->hasFlags( self::FLAG_LAYOUT_AJAX ) )
        {
            $result = $this->view->render( 'rowSet/layout/ajax', array(
                'content'   => $result,
                'rowSet'    => $this,
            ) );
        }
        else
        {
            $result = $this->view->render( 'rowSet/layout/basic', array(
                'content'   => $result,
                'rowSet'    => $this,
            ) );
        }

        return $result;
    }
558705
public static function get_active_metaplates( ) {

		global $post;

		if( empty( $post ) ){ return; } // no post - return

		// GET METAPLATEs
		$metaplates = self::get_registry();
		$meta_stack = array();
		if ( is_array( $metaplates ) ) {
			foreach ( $metaplates as $metaplate_try ) {
				$is_plate = self::get_metaplate( $metaplate_try['id'] );
				if ( ! empty( $is_plate['post_type'][ $post->post_type ] ) ) {
					switch ( $is_plate['page_type'] ) {
						case 'single':
							if ( is_single() || is_page() ) {
								$meta_stack[] = $is_plate;
							}
							break;
						case 'archive':
							if ( ( is_archive() || is_front_page() ) && ( ! is_page() || ! is_single() ) ) {
								$meta_stack[] = $is_plate;
							}
							break;
						default:
							$meta_stack[] = $is_plate;
							break;
					}
				}
			}
		}

		return $meta_stack;

	}
1323869
public function files($active = true)
    {
        $query = $this->morphToMany(File::class, 'uploadable')
        ->with('translations')
        ->withPivot('weight')
        ->orderBy('weight', 'ASC')
        ->withTimestamps();

        if ($active) {
            $query->where('is_active', '=', 1);
        }

        return $query;
    }
454091
public function getActiveElements(): array
    {
        if (empty($this->activeElements)) {
            return [];
        }

        if (Filter::MUST_ALL_WITH_LEVELS === $this->applicationType) {
            $value = [array_reduce(
                $this->activeElements,
                function ($carry, $counter) {
                    if (!$counter instanceof Counter) {
                        return $carry;
                    }

                    if (!$carry instanceof Counter) {
                        return $counter;
                    }

                    return $carry->getLevel() > $counter->getLevel()
                        ? $carry
                        : $counter;
                }, null)];

            return is_null($value)
                ? []
                : $value;
        }

        return $this->activeElements;
    }
216243
public function getActiveFilters()
    {
        $activeFilters = [];

        if (!$this->isInline()) {
            $requestParams    = array_keys($this->getRequest()->getParams());
            $displayedFilters = $this->getDisplayedFilters();
            $expandedFacets   = $this->_scopeConfig->getValue(self::DEFAULT_EXPANDED_FACETS_COUNT_CONFIG_XML_PATH);
            $activeFilters    = range(0, min(count($displayedFilters), $expandedFacets) - 1);

            foreach ($displayedFilters as $index => $filter) {
                if (in_array($filter->getRequestVar(), $requestParams)) {
                    $activeFilters[] = $index;
                }
            }
        }

        return json_encode($activeFilters);
    }
261165
public static function activeStatus($active, array $options = [], $withIcon = true)
    {
        // TODO: Refactor the options to a dedicated config file.
        $classes      = Arr::get($options, 'classes', [
            'enabled'  => 'label label-success',
            'disabled' => 'label label-default',
        ]);
        $translations = Arr::get($options, 'trans', [
            'enabled'  => 'core::statuses.enabled',
            'disabled' => 'core::statuses.disabled',
        ]);
        $icons = Arr::get($options, 'icons', [
            'enabled'  => 'fa fa-fw fa-check',
            'disabled' => 'fa fa-fw fa-ban',
        ]);

        $key        = $active ? 'enabled' : 'disabled';
        $attributes = ['class' => $classes[$key]];

        return $withIcon
            ? static::generateWithIcon(ucfirst(trans($translations[$key])), $icons[$key], $attributes)
            : static::generate(ucfirst(trans($translations[$key])), $attributes);
    }