Returns the domain objects event collection, optionally registering any passed
events
@return Events
167045
public function events($events=array())
    {
        if (!isset($this->_events)) {
            $this->_events = new Events(array(), self::schema()->events());
            $this->_registerDefaultEventHandlers();
        }

        if(count($events))
            foreach($events as $event=>$callback)
                $this->_events->register($event, $callback);

        return $this->_events;
    }
270721
protected function getEvent()
    {
        if (null === $this->event) {
            $this->event = $event = new EntityEvent;

            $event->setTarget($this);
        }

        return $this->event;
    }
1282272
public function retrieveCalendarEvents(){
        
        $select = $this->tableGateway->getSql()->select();
        // preparing columns for calendar ui
        // as defined column name for calendar ui
        $select->columns(
            array(
                new \Zend\Db\Sql\Expression('cal_id AS id'),
                new \Zend\Db\Sql\Expression('CONCAT(cal_id," : ",cal_event_title) AS title'),
                new \Zend\Db\Sql\Expression('cal_date_start AS start'),
                new \Zend\Db\Sql\Expression('cal_date_end AS end'),
            ));
        $dataCalendar = $this->tableGateway->selectWith($select);
        
        return $dataCalendar;
    }
1065971
public function getDomains()
    {
        if (0 === count($this->domains)) {
            return null;
        }

        return $this->domains->map(function(Domain $domain) {
            return $domain->getUrl();
        });
    }
1234283
public function findEventTypes()
    {
        $xmlQuery = $this->metaApiService->getEventTypes();

        $types = new Types();

        $mapper = new \RGU\Dvoconnector\Mapper\EventTypes($xmlQuery);
        $mapper->mapToAbstractEntity($types);

        return $types;
    }
1183071
protected function getRegistrations() {
        if (!$this->_registrations) {
            $this->_registrations = new AuthTypeRegistrationsList(
                $this->version,
                $this->solution['accountSid'],
                $this->solution['domainSid']
            );
        }

        return $this->_registrations;
    }
1336613
public function domainAction()
    {
        $request = $this->getRequest();
        $type    = $request->getParam( 'type' );
        $domain  = $request->getParam( 'domain' );

        if ( ! $request instanceof ConsoleRequest )
        {
            throw new \RuntimeException( sprintf(
                '%s can only be used from a console.',
                __METHOD__
            ) );
        }

        $siteInfo = $this->getServiceLocator()
                         ->get( 'SiteInfo' );

        if ( $domain != $siteInfo->getDomain() )
        {
            throw new \RuntimeException( sprintf(
                '%s: domain mismatch. Detected "%s", while enforced "%s".',
                __METHOD__,
                $siteInfo->getDomain(),
                $domain
            ) );
        }

        $locator    = $this->getServiceLocator();
        $config     = $locator->get( 'Configuration' );

        if ( empty( $config['modules']['Grid\Core']['cron'] ) )
        {
            return '';
        }

        $result     = '';
        $keys       = array( 'site' );
        $cronConfig = $config['modules']['Grid\Core']['cron'];
        $modules    = $locator->get( 'Zend\ModuleManager\ModuleManagerInterface' )
                              ->getModules();

        if ( ! in_array( 'Grid\MultisitePlatform', $modules ) ||
               in_array( 'Grid\MultisiteCentral',  $modules ) )
        {
            $keys[] = 'once';
        }

        foreach ( $keys as $key )
        {
            if ( ! empty( $cronConfig[$key][$type] ) )
            {
                foreach ( $cronConfig[$key][$type] as $service )
                {
                    if ( is_scalar( $service ) )
                    {
                        $service = array(
                            'service' => $service,
                        );
                    }

                    if ( ! empty( $service['service'] ) )
                    {
                        $return = call_user_func_array(
                            array(
                                $this->getServiceLocator()
                                     ->get( $service['service'] ),
                                empty( $service['method'] )
                                    ? '__invoke'
                                    : (string) $service['method']
                            ),
                            empty( $service['arguments'] )
                                ? array()
                                : (array) $service['arguments']
                        );

                        $result .= sprintf(
                            'Service "%s" / %s / %s ',
                            $service['service'],
                            $key,
                            $type
                        );

                        if ( ! empty( $service['method'] ) )
                        {
                            $result .= sprintf( 'called "%s" ', $service['method'] );
                        }

                        if ( ! empty( $service['arguments'] ) )
                        {
                            $result .= Debug::dump(
                                $service['arguments'],
                                'with',
                                false
                            );
                        }

                        $result .= Debug::dump( $return, 'returned', false );
                    }
                }
            }
        }

        return $result;
    }
505386
public function actionEvents() {

		$user = Yii::$app->user->GetIdentity();

		$startDate	= Yii::$app->request->post( 'startDate' );
		$endDate	= Yii::$app->request->post( 'endDate' );

		$events = $this->modelService->getByRangeUserId( $startDate, $endDate, $user->id );
		$data	= [];

		foreach( $events as $event ) {

			$data[] = [ 'id' => $event->id, 'title' => "$event->name - $event->description", 'start' => $event->scheduledAt ];
		}

		// Trigger Ajax Success
		return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ), $data );
	}
141996
public function getLoggableEvents() {
		$list = [
			EVENT_CORE_USER_REGISTER,
			EVENT_CORE_BO_LOGIN_OK,
			EVENT_CORE_BO_LOGIN_FAIL,
			EVENT_CORE_LOG_CLEAR,
			//EVENT_CORE_DIR_CREATE,
			//EVENT_CORE_DIR_EDIT,
			//EVENT_CORE_DIR_DELETE,
			//EVENT_CORE_MATH_CREATE,
			//EVENT_CORE_MATH_EDIT,
			//EVENT_CORE_MATH_DELETE,
			//EVENT_CORE_MATH_PUB,
			//EVENT_CORE_MATH_UNPUB,
			//EVENT_CORE_USER_PROP,
		];
		
		return  array_diff(
			array_merge ( $list, (array)$this->configGet('events_log_enabled') ),
			(array)$this->configGet('events_log_disabled')
		);
	}
588297
protected static function eventsToBeRecorded(): Collection
    {
        if (isset(static::$recordEvents)) {
            return collect(static::$recordEvents);
        }

        $events = collect([
            'created',
            'updated',
            'deleted',
        ]);

        if (collect(class_uses_recursive(static::class))->contains(SoftDeletes::class)) {
            $events->push('restored');
        }

        return $events;
    }
244587
final public function getEventListForAjax() {

		$app		= Application::getInstance();
		$router		= Router::getInstance();
		
		if (!$this->isEnabled() or !$router->sendLog()) {
			return NULL;
		}
		
		$log = '';

		// shows the log
		if (Options::get('show_log') and $app->currentUser->admin) {
		
			$showQueries = isset($_COOKIE['LogShowQueries']) ? $_COOKIE['LogShowQueries'] : 0;
			
			foreach ($this->events as $e) {
			
				// if it's query, verifies cookie val
				$class = $e->type . (('query'==$e->type and !$showQueries) ? ' hidden' : '');
				
				$log .=
					'<div class="' . $class . '"><span class="time">' .
					$this->formatChrono($e->chrono) . '</span> ' . htmlspecialchars($e->description) .
					($e->subtext ? ' <span>| ' . htmlspecialchars($e->subtext) . '</span>' : '') . '</div>';
				
			}
			
		}
		
		return $log;
		
	}
276566
public function events(array $events = null)
    {
        if (null !== $events) {
            return $this->events = $events;
        }

        return $this->events;
    }
1165177
protected function getEvents()
    {
        $events = [];

        foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) {
            $providerEvents = array_merge($provider->discoverEvents(), $provider->listens());

            $events = array_merge_recursive($events, $providerEvents);
        }

        if ($this->filteringByEvent()) {
            $events = $this->filterEvents($events);
        }

        return collect($events)->map(function ($listeners, $event) {
            return ['Event' => $event, 'Listeners' => implode(PHP_EOL, $listeners)];
        })->sortBy('Event')->values()->toArray();
    }
171828
protected function getEventDefinitions()
    {
        $scanner = $this->laravel->make('annotations.event.scanner');

        $scanner->setClassesToScan($this->provider->eventScans());

        return '<?php '.PHP_EOL.PHP_EOL.$scanner->getEventDefinitions().PHP_EOL;
    }
151166
public function getEventsManager() {
		if ($this->_eventsManager === null) {
			if ($this instanceof LocatorAwareInterface && $this->hasLocator()) {
				$this->_eventsManager = $this->getLocator()->get($this->getEventsManagerServiceId());
				
				if (! $this->_eventsManager instanceof EventsManagerInterface) {
					throw new NoEventsManager('Event\'s manager must implement "EventsManagerInterface"');
				}
			} else {
				throw new NoEventsManager('No Events manager been supplied, also unable to obtain one through locator');
			}
		}
		
		return $this->_eventsManager;
	}
806255
public function implementedEvents()
    {
        $events = [];
        if ($this->getConfig('events') === false) {
            return $events;
        }
        foreach ((array)$this->getConfig('events') as $eventKey => $event) {
            if (is_numeric($eventKey)) {
                $eventKey = $event;
                $event = null;
            }
            if ($event === null || is_string($event)) {
                $event = ['callable' => $event];
            }
            if (!is_array($event)) {
                throw new \InvalidArgumentException('Event should be string or array');
            }
            $priority = $this->getConfig('priority');
            if (!array_key_exists('callable', $event) || $event['callable'] === null) {
                list(, $event['callable']) = pluginSplit($eventKey);
            }
            if ($priority && !array_key_exists('priority', $event)) {
                $event['priority'] = $priority;
            }
            $events[$eventKey] = $event;
        }

        return $events;
    }
1231004
public function Events()
    {
        $action = $this->request->param('Action');
        //Debug::dump($this->request->params());

        //Normal & Registerable events
        $s = CalendarConfig::subpackage_settings('pagetypes');
        $indexSetting = $s['calendarpage']['index'];
        if ($action == 'eventregistration'
            || $action == 'eventlist'
            || ($action == '' && $indexSetting == 'eventlist')

        ) {
            $events = CalendarHelper::events_for_month($this->CurrentMonth());

            if ($action == 'eventregistration') {
                $events = $events
                    ->filter('Registerable', 1);
            }

            return $events;
        }


        //Search
        if ($action == 'search') {
            $query = $this->SearchQuery();
            $query = strtolower(addslashes($query));
            //Debug::dump($query);
            $qarr = preg_split('/[ +]/', $query);

            $filter = '';
            $first = true;
            foreach ($qarr as $qitem) {
                if (!$first) {
                    $filter .= " AND ";
                }

                $filter .= " (
					Title LIKE '%$qitem%'
					OR Details LIKE '%$qitem%'
				)";
                $first = false;
            }

            //Debug::dump($filter);
            $events = CalendarHelper::all_events()
                ->where($filter);
            return $events;
        }




        //TODO below doesn't need to be that complicated...
//		$events = null;
//		if ($action == 'past') {
//			$events = CalendarHelper::past_events();
//		} else {
//			if ($this->CurrentCategoryID()) {
//				$events = PublicEventCategory::get()
//					->ByID($this->CurrentCategoryID())
//					->ComingEvents($this->CurrentDisplayDate());
//			} else {
//				$events = CalendarHelper::coming_events($this->CurrentDisplayDate());
//			}
//		}
//
//		if ($this->CurrentCalendarID()) {
//			$events = $events->filter(array(
//				'CalendarID' => $this->CurrentCalendarID()
//			));
//		}
//
//		$list = new PaginatedList($events, $this->request);
//		$list->setPageLength(10);
//
//		return $list;
    }