Returns all policies that have versions with possible acceptances (excl. drafts and guest-only versions)

@return array|null
435139
public function get_avaliable_policies() {
        if ($this->policies === null) {
            $this->policies = [];
            foreach (\tool_policy\api::list_policies() as $policy) {
                // Make a list of all versions that are not draft and are not guest-only.
                $policy->versions = [];
                if ($policy->currentversion && $policy->currentversion->audience != policy_version::AUDIENCE_GUESTS) {
                    $policy->versions[$policy->currentversion->id] = $policy->currentversion;
                } else {
                    $policy->currentversion = null;
                }
                foreach ($policy->archivedversions as $version) {
                    if ($version->audience != policy_version::AUDIENCE_GUESTS) {
                        $policy->versions[$version->id] = $version;
                    }
                }
                if ($policy->versions) {
                    $this->policies[$policy->id] = $policy;
                }
            }
        }
        return $this->policies;
    }
678533
protected function getPersistent()
    {
        $values = [];
        if ($this->getSessionStorage()->has('filter')) {
            $values = $this->getSessionStorage()->get('filter');
        }

        if (\array_key_exists($this->getEnvironment()->getDataDefinition()->getName(), $values)) {
            $values = $values[$this->getEnvironment()->getDataDefinition()->getName()];

            if (\array_key_exists($this->getPropertyName(), $values)) {
                return $values[$this->getPropertyName()];
            }
        }

        return null;
    }
128882
public function getVersions()
    {
        $this->createIfNotExists();
        $sql = 'SELECT version FROM schema_migration ORDER BY version DESC';
        $versions = array();
        foreach ($this->connection->query($sql) as $row) {
            $versions[] = $row['version'];
        }

        return $versions;
    }
1008934
public static function accept() {
        global $USER, $DB;

        if (!isloggedin()) {
            return false;
        }

        if ($USER->policyagreed) {
            return false;
        }

        if (isguestuser()) {
            // For guests, agreement is stored in the session only.
            $USER->policyagreed = 1;
            return true;
        }

        // Find all compulsory policies and mark them as accepted.
        $compulsory = [];
        foreach (api::list_current_versions(policy_version::AUDIENCE_LOGGEDIN) as $policyversion) {
            if ($policyversion->optional == policy_version::AGREEMENT_COMPULSORY) {
                $compulsory[] = $policyversion->id;
            }
        }

        if ($compulsory) {
            api::accept_policies($compulsory);
        }

        // Mark policies as agreed.
        $DB->set_field('user', 'policyagreed', 1, array('id' => $USER->id));
        $USER->policyagreed = 1;

        return true;
    }
190438
public function getAllVersions($con = null)
    {
        $criteria = new Criteria();
        $criteria->addAscendingOrderByColumn(DealerFolderVersionTableMap::VERSION);

        return $this->getDealerFolderVersions($criteria, $con);
    }
11264
public function getDealerShedulesVersions()
    {
        if (null === $this->dealer_shedules_versions_unserialized) {
            $this->dealer_shedules_versions_unserialized = array();
        }
        if (!$this->dealer_shedules_versions_unserialized && null !== $this->dealer_shedules_versions) {
            $dealer_shedules_versions_unserialized = substr($this->dealer_shedules_versions, 2, -2);
            $this->dealer_shedules_versions_unserialized = $dealer_shedules_versions_unserialized ? explode(' | ', $dealer_shedules_versions_unserialized) : array();
        }

        return $this->dealer_shedules_versions_unserialized;
    }
1068505
public function getAll()
    {
        if (!$this->loadRepositories()) {
            return Repository::STATUS_NO_REPOSITORIES;
        }

        $modules = $this->getModulesFromRepository();

        // Is a higher version of an already installed package available?
        foreach ($modules as $key => $module) {
            $version = $this->packageService->getVersion($module->name);

            if (!$version) {
                // Not installed at all.
                unset($modules[$key]);
            } elseif (version_compare($version, $module->version, '<')) {
                // Older version installed.
                $modules[$key]->hasUpdate = true;
                $modules[$key]->versionInstalled = $version;
            } else {
                $modules[$key]->hasUpdate = false;
                $modules[$key]->versionInstalled = $version;
            }
        }

        return $modules;
    }
106773
protected function getPermissions()
    {
        try {
            return $this->cache->rememberForever('permissions.policies', function () {
                return Permission::with('roles')->get();
            });
        } catch (\Exception $exception) {
            $this->cache->forget('permissions.policies');

            return new Collection;
        }
    }
1001437
public function getAcceptedTypes()
    {
        return $this->getCachedProperty(
            'accept',
            function () {
                $result = [];
                /** @var \DOMNodeList $nodes */
                // No REQUIRED — no exception.
                $nodes = $this->query('app:accept');
                foreach ($nodes as $value) {
                    $result[] = trim($value->textContent);
                }

                return $result;
            }
        );
    }
1011541
public static function isNewestVersionAvailable()
    {
        $latestVersion = self::getLatestVersion();
        if (!empty($latestVersion)
            && version_compare(Version::VERSION, $latestVersion) == -1
        ) {
            return $latestVersion;
        }
        return false;
    }
1085082
public function getClauses()
    {
        return array(
            $this->getUpdate(),
            $this->getJoins(),
            $this->getSet(),
            $this->getWhere(),
            $this->getOrder(),
            $this->getLimit(),
        );
    }
1030505
public function getVersionSteps()
    {
        if ($this->_versionSteps === null) {
            $currentVersion = Yii::$app->session->get(self::SESSION_VERSION, 0);
            $versionSteps = [];
            foreach ($this->steps as $version => $steps) {
                if (Helper::compareVersions(explode('.', $currentVersion), explode('.', $version)) == '<') {
                    $versionSteps += $steps;
                }
            }
            $this->_versionSteps = $versionSteps;
        }
        return $this->_versionSteps;
    }
714015
public function getMigrationsNotApplied()
    {
        $migrationsNotApplied = [];
        $migrations = $this->getAllMigrations();

        foreach ($migrations as $migration) {
            if (!$migration->isApplied()) {
                $migrationsNotApplied[] = $migration;
            }
        }

        return $migrationsNotApplied;
    }
645925
public function getVersionsBehind()
    {
        $current = $this->getCurrentVersion();
        $versions = array_filter($this->getVersions(),
                function ($version) use ($current) {
                    return $version > $current;
                }
        );

        return count($versions);
    }
348116
public function getStaticVersions(): array
	{
		$result = false;
		try
		{
			// Fetch StaticData from JSON files
			$result = DataDragonAPI::getStaticVersions();
			if (!$result) throw new ServerException("StaticData failed to be loaded.");

			$this->result_data = $result;
		}
		catch (DataDragonExceptions\ArgumentException $ex)
		{
			throw new RequestException($ex->getMessage(), $ex->getCode());
		}
		finally
		{
			// Return data
			return $result;
		}
	}
1091608
private function getVersionList()
    {
        /* @var \Concrete\Core\Form\Service\Widget\DateTime $dt */
        $dt = $this->app->make('helper/form/date_time');

        $startDate = $dt->translate('startDate', null, true);
        $endDate = $dt->translate('endDate', null, true);

        $versionList = new GlobalVersionList();
        $versionList->sortByDateApprovedDesc();

        if ($startDate !== null) {
            $versionList->filterByApprovedAfter($startDate);
        }

        if ($endDate !== null) {
            $versionList->filterByApprovedBefore($endDate);
        }

        return $versionList;
    }
753293
public function getDealerAdminVersions()
    {
        if (null === $this->dealer_admin_versions_unserialized) {
            $this->dealer_admin_versions_unserialized = array();
        }
        if (!$this->dealer_admin_versions_unserialized && null !== $this->dealer_admin_versions) {
            $dealer_admin_versions_unserialized = substr($this->dealer_admin_versions, 2, -2);
            $this->dealer_admin_versions_unserialized = $dealer_admin_versions_unserialized ? explode(' | ', $dealer_admin_versions_unserialized) : array();
        }

        return $this->dealer_admin_versions_unserialized;
    }