Count the existing competency frameworks.

@param string $filters Filters to use.
@return boolean
185352
public static function count_competencies($filters) {
        $params = self::validate_parameters(self::count_competencies_parameters(), array(
            'filters' => $filters
        ));

        $safefilters = array();
        $validcolumns = array('id', 'shortname', 'description', 'sortorder', 'idnumber', 'parentid', 'competencyframeworkid');
        foreach ($params['filters'] as $filter) {
            if (!in_array($filter['column'], $validcolumns)) {
                throw new invalid_parameter_exception('Filter column was invalid');
            }
            $safefilters[$filter['column']] = $filter['value'];
        }

        $context = null;
        if (isset($safefilters['competencyframeworkid'])) {
            $framework = api::read_framework($safefilters['competencyframeworkid']);
            $context = $framework->get_context();
        } else {
            $context = context_system::instance();
        }

        self::validate_context($context);

        return api::count_competencies($safefilters);
    }
213734
public function whereSearch($filters)
    {
        $data = $this->request->get();

        foreach ($filters as $k => $v) {
            preg_match('#^(\w+)(.*)$#', is_string($k) ? $k : $v, $match);
            $field = $match[1];

            if (is_int($k)) {
                if (!isset($data[$field])) {
                    continue;
                }
                $value = $data[$field];
                if (is_string($value)) {
                    $value = trim($value);
                    if ($value === '') {
                        continue;
                    }
                }
                $this->where($v, $value);
            } else {
                $this->where($k, $v);
            }
        }

        return $this;
    }
1082873
static public function count($filter=array())
    {
        $config = Conf::f('storage-mongodb-object', array());
        $db = isset($config['databases']) ? $config['databases'] : 'default';
        $db = DB::get($db);
        $collection = $db->selectCollection(static::getCollectionName());

        return $collection->count($filter);
    }
1358115
protected static function doFindFilters(array $filters, array $enabledFilters, $all)
    {
        $reactivateFilters = [];

        foreach ($enabledFilters as $name => $filter) {
            if (\in_array($name, $filters, true) || $all) {
                $reactivateFilters[] = $name;
            }
        }

        return $reactivateFilters;
    }
944472
public function addFiltersWithOrToAlias(iterable $filters): self
    {
        $addWith = $this->expr()->orX();
        $this->applyFilters($addWith, $this->getAlias(), $filters);
        $addWith->count() <= 0 ?: $this->andWhere($addWith);

        return $this;
    }
858227
private static function combineFilters($filters)
    {
        return function ($value) use ($filters) {
            foreach ($filters as $filter) {
                if (!$filter($value)) {
                    return false;
                }
            }
            return true;
        };
    }
462318
public static function getCustomersCount($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCount('/customers/count' . $filter->toQuery());
    }
1174454
public function setFilters($filters)
    {
        if (!$this->hasFilterer()) {
            $this->setFilterer(configurator()->build('form.filterer.class'));
        }

        $this->getFilterer()->setFilters($filters);
        return $this;
    }
732004
public function addFilters(array $filters)
    {
        foreach ($filters as $key => $filter) {
            $this->addFilter($filter);

            /** Name the expression if $key is a non-numeric string. */
            if (is_string($key) && !is_numeric($key)) {
                $filter = end($this->filters);
                $filter->setName($key);
            }
        }

        return $this;
    }
90799
public function addWhereAny($filters)
    {
        // Parse and split predicates along with any parameters
        $filters = $this->normalisePredicates(func_get_args());
        $this->splitQueryParameters($filters, $predicates, $parameters);

        $clause = "(" . implode(") OR (", $predicates) . ")";
        return $this->addWhere(array($clause => $parameters));
    }
497941
public function filter(array $filters = array())
    {
        foreach ($filters as $k => $v) {
            if (is_bool($v)) {
                $filters[$k] = $v ? 'true' : 'false';
            }
        }
        return $this->mergeAttributes('filters', $filters);
    }
747931
protected function filterArguments($filters = [])
    {
        $arguments = $this->arguments;

        foreach ($filters as $filter) {
            $arguments = array_filter($arguments, [$this, $filter]);
        }

        if (in_array('hasPrefix', $filters)) {
            usort($arguments, [$this, 'compareByPrefix']);
        }

        return array_values($arguments);
    }
63636
public function all($filters = array())
	{
		$keys = eaccelerator_list_keys();

		$data = array();

		if (is_array($keys))
		{
			foreach ($keys as $key)
			{
				// Trim leading ":" to work around list_keys namespace bug in eAcc.
				// This will still work when bug is fixed.
				$key['name'] = ltrim($key['name'], ':');

				if (strpos($key['name'], $this->prefix) === 0)
				{
					continue;
				}

				$session = new Object;
				$session->session_id = $file->getName();
				$session->data       = (string) eaccelerator_get($key['name']);

				$data[] = $session;
			}
		}

		return $data;
	}
854533
public function openingHoursFilter(array $filters)
    {
        foreach ($this->openingHours as $timeRange) {
            foreach ($filters as $filter) {
                if ($result = $filter($timeRange)) {
                    reset($timeRange);

                    return $result;
                }
            }
        }

        return false;
    }
1041358
public function setFilters(array $filters = [])
    {
        foreach ($filters as $filterName => $filterValue) {
            $this->addFilter($filterName, $filterValue);
        }

        return $this;
    }
494578
private function _countObjectsInCollectionByFilter(Filter $filterQuery)
    {
        $records = [];
        $props = [];
        $filters = [];
        foreach ($filterQuery->getComparisons() as $comparison) {
            $props[] = $comparison->prop;
            if ($comparison->expression && $comparison->comparison && $comparison->prop) {
                $expression = ($comparison->expression !== 'WHERE') ? $comparison->expression . ' ' : '';
                $prop = is_int($comparison->val) ? 'CAST(' . $comparison->prop . ' AS INT)' : $comparison->prop;
                $compare = $comparison->comparison;
                $value = (!isset($comparison->val) || is_null($comparison->val)) ? 'NULL' : $comparison->val;
                $filters[] = $expression . $prop . ' ' . $compare . ' \'' . $value . '\'';
            }
        }

        $props = array_unique($props);
        $joins = [];
        foreach ($props as $prop)
        {
            $standardFields = [
                '__id',
                '__type',
                '__collection',
                '__origin'
            ];
            if (!in_array($prop, $standardFields)) {
                $asTbl = $this->_generateAlphaToken();
                $joins[] =
                    'JOIN(' .
                        'SELECT id, val AS ' . $prop . ' ' .
                        'FROM ' . $this->_name . '__index ' .
                        'WHERE prop = \'' . $prop . '\'' .
                    ') AS ' . $asTbl . ' ' .
                    'ON A.id = ' . $asTbl . '.id';
            }
        }

        $select = Statement::get(
            'GET_OBJECTS_COUNT_BY_FILTER',
            [
                '@collection' => $this->_name,
                '@columns' => (count($props) > 0) ? ', ' . implode($props, ', ') : '',
                '@joinColumns' => (count($joins) > 0) ? implode($joins, ' ') . ' ' : '',
                '@type' => $this->_connector->quote($filterQuery->getIndexType()),
                '@filters' => ($filters) ? 'AND (' . implode($filters, ' ') . ') ' : ''
            ]
        );

        $count = $this->_connector->query($select)->fetch();
        if ($count) {
            return (int) $count[0];
        } else {
            return 0;
        }
    }
284714
public function setFilters($filters) {
		if ($filters instanceof Collection) {
			$filters = $filters->toArray();
		}
		
		$this->filters = $filters;

		return $this;
	}