Returns a boolean value whether the current calendar has events or not

@param {array} $events    An array with events.
@param {array} $sortOrder Either SORT_ASC, SORT_DESC, SORT_REGULAR,
SORT_NUMERIC, SORT_STRING

@return {boolean}
344153
public function sortEventsWithOrder($events, $sortOrder = SORT_ASC)
    {
        $extendedEvents = [];

        // Loop through all events by adding two new elements
        foreach ($events as $anEvent) {
            if (!array_key_exists('UNIX_TIMESTAMP', $anEvent)) {
                $anEvent['UNIX_TIMESTAMP'] = $this->iCalDateToUnixTimestamp($anEvent['DTSTART']);
            }

            if (!array_key_exists('REAL_DATETIME', $anEvent)) {
                $anEvent['REAL_DATETIME'] = date('d.m.Y', $anEvent['UNIX_TIMESTAMP']);
            }

            $extendedEvents[] = $anEvent;
        }

        foreach ($extendedEvents as $key => $value) {
            $timestamp[$key] = $value['UNIX_TIMESTAMP'];
        }
        array_multisort($timestamp, $sortOrder, $extendedEvents);

        return $extendedEvents;
    }
27224
public function has($event)
    {
        list($event, $payload) = $this->parseEventAndPayload($event, []);

        return array_key_exists($event, $this->listeners);
    }
1156835
public static function get_all_eventlist($withoutcomponent = false) {
        if ($withoutcomponent) {
            $return = array_merge(self::get_core_eventlist(), self::get_non_core_eventlist($withoutcomponent));
            array_multisort($return, SORT_NATURAL);
        } else {
            $return = array_merge(array('core' => self::get_core_eventlist()),
                    self::get_non_core_eventlist($withoutcomponent = false));
        }
        return $return;
    }
739079
public function generateOrder($sortBy, $sortOrder, &$order)
    {
        if (! empty($sortBy)) {
            if (empty($sortOrder)) { // @codeCoverageIgnore
                $sortOrder = "ASC"; // @codeCoverageIgnore
            } // @codeCoverageIgnore

            $order = "$sortBy $sortOrder";
        }
    }
485622
public function set_sortorder($sortorder) {
        if ($this->sortorder == $sortorder) {
            return;
        }
        $this->sortorder = $sortorder;
        $this->update();
    }
182896
public static function getCalendars($container, $count = false) {
		if (!$container instanceof ElggEntity) {
			return false;
		}

		$options = array(
			'type' => 'object',
			'subtype' => 'calendar',
			'container_guid' => $container->guid,
			'limit' => false
		);

		if ($count) {
			$options['count'] = true;
			return elgg_get_entities($options);
		}

		return new ElggBatch('elgg_get_entities', $options);
	}
1182604
protected function listActiveEvent($reload = false)
    {
        if (!isset($this->dispatcher) || (isset($this->activeEvents) && !$reload)) {
            return $this;
        }

        $this->activeEvents = [];
        $eventList          = FlowEvent::getEventList();
        $sortedListeners    = $this->dispatcher->getListeners();
        foreach ($sortedListeners as $eventName => $listeners) {
            if (isset($eventList[$eventName]) && !empty($listeners)) {
                $this->activeEvents[$eventName] = 1;
            }
        }

        return $this;
    }
1186894
public function sortSubscribers($eventName)
    {
        $this->sorted[$eventName] = array();
        if (isset($this->eventList[$eventName])) {
            krsort($this->eventList[$eventName]);
            $this->sorted[$eventName] = call_user_func_array('array_merge', $this->eventList[$eventName]);
        }

        return $this->sorted[$eventName];
    }
51820
protected function sortOrderQuery(
        array $sortOrderCondition = [],
        string $sortOrderAttribute = 'sortOrder'
    ): ActiveQuery {
        return static::find()
            ->andWhere($sortOrderCondition)
            ->orderBy([
                $sortOrderAttribute => SORT_ASC,
                'dateUpdated' => SORT_DESC
            ]);
    }
1057379
protected function filterEvents(array $events)
    {
        if (! $eventName = $this->option('event')) {
            return $events;
        }

        return collect($events)->filter(function ($listeners, $event) use ($eventName) {
            return Str::contains($event, $eventName);
        })->toArray();
    }
441088
public static function get_tour_from_sortorder($sortorder) {
        global $DB;

        $tour = $DB->get_record('tool_usertours_tours', array('sortorder' => $sortorder));
        return tour::load_from_record($tour);
    }
1095624
public static function isSupportedEvent(string $event): bool
    {
        if ($ets = self::$allowedEvents) {
            return \in_array($event, $ets, true);
        }

        return true;
    }
751218
function sort(children, sortOrder) {
    if (typeof sortOrder === 'function') {
        return children.sort(sortOrder);
    }
    else {
        var isAsc = sortOrder === 'asc';
        return children.sort(function (a, b) {
            var diff = (a.getValue() - b.getValue()) * (isAsc ? 1 : -1);
            return diff === 0
                ? (a.dataIndex - b.dataIndex) * (isAsc ? -1 : 1)
                : diff;
        });
    }
}
780151
public function applySorting ($sortMapping, array $where = []) : bool
    {
        if (!\is_array($sortMapping) || empty($sortMapping))
        {
            // if value is not in correct format or an empty array.
            return false;
        }

        $all = $this->getAllEntities($where);

        // check sort values
        $possibleSortValues = \range(0, \count($all) - 1);

        if (!$this->arraysAreIdentical($possibleSortValues, \array_values($sortMapping)))
        {
            // the given sort values are wrong
            return false;
        }

        // check item ids
        $allIds = \array_map(function (SortableEntityInterface $entity) { return $entity->getId(); }, $all);

        if (!$this->arraysAreIdentical($allIds, \array_keys($sortMapping)))
        {
            // the given item ids are wrong
            return false;
        }

        foreach ($all as $entity)
        {
            $entity->setSortOrder($sortMapping[$entity->getId()]);
        }

        return true;
    }
366242
protected function ensureSortOrder(
        array $sortOrderCondition = [],
        string $sortOrderAttribute = 'sortOrder'
    ) {
        if ($this->getAttribute($sortOrderAttribute) === null) {
            $this->setAttribute(
                $sortOrderAttribute,
                $this->nextSortOrder(
                    $sortOrderCondition,
                    $sortOrderAttribute
                )
            );
        }
    }
777691
public static function hasListeners(string $event) : bool
    {
        if (! isset(Event::$listeners[$event]) || count(Event::$listeners[$event]) === 0) {
            return false;
        }

        return true;
    }
662851
public function hasCustomOrdering($orderColumn)
    {
        $methodName = camel_case('laratables_order_'.$orderColumn);

        if (method_exists($this->class, $methodName)) {
            return $methodName;
        }

        return false;
    }