Returns an event object when provided with an event id.

This function makes use of MUST_EXIST, if the event id passed in is invalid
it will result in an exception being thrown.

@param int|object $param event object or event id
@return calendar_event
546754
public static function load($param) {
        global $DB;
        if (is_object($param)) {
            $event = new calendar_event($param);
        } else {
            $event = $DB->get_record('event', array('id' => (int)$param), '*', MUST_EXIST);
            $event = new calendar_event($event);
        }
        return $event;
    }
458349
function event()
    {
        if (! $this->events ) {
            $events = new EventHeapOfSapi;
            $events->setMeeter( new MeeterIoc );

            $this->events = $events;
        }


        $this->events->collector()->setSapi($this); // also failure events need sapi
        return $this->events;
    }
1226826
public static function get_calendar_event_by_id($eventid) {
        global $PAGE, $USER;

        $params = self::validate_parameters(self::get_calendar_event_by_id_parameters(), ['eventid' => $eventid]);
        $context = \context_user::instance($USER->id);

        self::validate_context($context);
        $warnings = array();

        $legacyevent = calendar_event::load($eventid);
        // Must check we can see this event.
        if (!calendar_view_event_allowed($legacyevent)) {
            // We can't return a warning in this case because the event is not optional.
            // We don't know the context for the event and it's not worth loading it.
            $syscontext = context_system::instance();
            throw new \required_capability_exception($syscontext, 'moodle/course:view', 'nopermission', '');
        }

        $legacyevent->count_repeats();

        $eventmapper = event_container::get_event_mapper();
        $event = $eventmapper->from_legacy_event_to_event($legacyevent);

        $cache = new events_related_objects_cache([$event]);
        $relatedobjects = [
            'context' => $cache->get_context($event),
            'course' => $cache->get_course($event),
        ];

        $exporter = new event_exporter($event, $relatedobjects);
        $renderer = $PAGE->get_renderer('core_calendar');

        return array('event' => $exporter->export($renderer), 'warnings' => $warnings);
    }
572891
public function getResponseParam($param) {
    if (isset($this->notifyParams[$param])) {
      return $this->notifyParams[$param];
    }
    return NULL;
  }
1310538
public function get($param = '') {
        $this->validate();

        if ($param) {
            if (array_key_exists($param, $this->config)) {
                return $this->config[$param];
            }
            else {
                throw new ArgumentConfigException('argument param not valid: ' . $param);
            }
        }

        return $this->config;
    }
1215289
public function deleteEvent($eventId)
    {
        if (is_null($eventId) || $eventId == '') {
            throw new Exception('The eventId is required to delete an event.');
        }

        $params = array(
            'method' => 'sp.event.delete',
            'event_id' => $eventId
        );

        return $this->_makeApiRequest($params);
    }
427841
protected function parseParam($param)
    {
        $method = 'parse'.ucfirst($param);

        if (method_exists($this, $method)) {
            if ($params = $this->input($param)) {
                return $this->$method($params);
            }
        }
    }
1252947
public function get($id, $invalid_behavior = sfContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
    {
        $service = null;
        try {
            $service = parent::get($id, $invalid_behavior);
        } catch (RuntimeException $e) {
            if (false === $this->hasDefinition($id)) {
                throw $e;
            }

            if (false === $this->getDefinition($id)->isSynthetic()) {
                throw $e;
            }
        }

        if (
            true === ($service instanceof DispatchTagEventInterface)
            && true === $service->needDispatchEvent()
            && true === $this->hasDefinition($id)
            && true === $this->has('event.dispatcher')
        ) {
            foreach ($this->getDefinition($id)->getTags() as $tag => $datas) {
                if (false === isset($datas[0]['dispatch_event']) || true === $datas[0]['dispatch_event']) {
                    $this->services['event.dispatcher']->dispatch(
                        'service.tagged.'.$tag,
                        new Event($service, array('id' => $id))
                    );
                }
            }
        }

        return $service;
    }
149367
public function getEventAttribute ($param, $default = null)
    {
        return array_key_exists($param, $this->params) ? $this->params[$param] : $default;
    }
1112340
public function createEvent($eventName, array $params = array())
    {
        $class = $this->eventClass;
        return new $class($this->sender, $this->prefix . $eventName, $params);
    }
116183
public function getEventManager(): EventManagerInterface
    {
        if (null === $this->events) {
            $this->setEventManager(new EventManager());
        }
        return $this->events;
    }
644652
public function getParam(string $param)
    {
        $result = $this->getConfig()->get($param);
        return $result ?? null;
    }
221895
public static function load($param)
    {
        if (!($node = self::loadById($param))) {
            $node = self::loadByPath($param);
        }

        return $node;
    }
787473
public function fireEvent($name, $params = null)
    {
        $handleList = Utility::get($this->events, $name, null);
        $result = true;
        if ($handleList) {
            foreach ($handleList as $methodName) {
                if (gettype($methodName) == "string") {
                    $return = $this->$methodName($params);
                } else {
                    $return = $methodName($params);
                }
                $result &= ($return !== null) ? $return : true;
            }
        }
        //Allow to write event handle in the report
        if (method_exists($this, $name)) {
            $return = $this->$name($params);
            $result &= ($return !== null) ? $return : true;
        }
        return $result;
    }
939323
public function requestPdo($request, $param = null)
    {
        $this->result = $this->tableGateway->requestPdo($request, $param);

        return $this->result;
    }
1363062
public function getEvent(string $event)
    {
        $class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event);

        if (class_exists($class)) {
            return new $class($this);
        }

        return null;
    }
21293
static function calendar( $params = false, $nodeID = 0 )
    {
        if ( !is_numeric( $nodeID ) and !is_array( $nodeID ) )
        {
            return array();
        }

        if ( $params === false )
        {
            $params = array( 'Depth'                    => false,
                             'Offset'                   => false,
                             'Limit'                    => false,
                             'AttributeFilter'          => false,
                             'ExtendedAttributeFilter'  => false,
                             'ClassFilterType'          => false,
                             'ClassFilterArray'         => false,
                             'GroupBy'                  => false );
        }

        $offset           = ( isset( $params['Offset'] ) && is_numeric( $params['Offset'] ) ) ? $params['Offset']             : false;
        $limit            = ( isset( $params['Limit']  ) && is_numeric( $params['Limit']  ) ) ? $params['Limit']              : false;
        $depth            = ( isset( $params['Depth']  ) && is_numeric( $params['Depth']  ) ) ? $params['Depth']              : false;
        $depthOperator    = ( isset( $params['DepthOperator']     ) )                         ? $params['DepthOperator']      : false;
        $groupBy          = ( isset( $params['GroupBy']           ) )                         ? $params['GroupBy']            : false;
        $mainNodeOnly     = ( isset( $params['MainNodeOnly']      ) )                         ? $params['MainNodeOnly']       : false;
        $ignoreVisibility = ( isset( $params['IgnoreVisibility']  ) )                         ? $params['IgnoreVisibility']   : false;
        if ( !isset( $params['ClassFilterType'] ) )
            $params['ClassFilterType'] = false;

        $classCondition          = eZContentObjectTreeNode::createClassFilteringSQLString( $params['ClassFilterType'], $params['ClassFilterArray'] );
        $attributeFilter         = eZContentObjectTreeNode::createAttributeFilterSQLStrings( $params['AttributeFilter'], $sortingInfo );
        $extendedAttributeFilter = eZContentObjectTreeNode::createExtendedAttributeFilterSQLStrings( $params['ExtendedAttributeFilter'] );
        $mainNodeOnlyCond        = eZContentObjectTreeNode::createMainNodeConditionSQLString( $mainNodeOnly );

        $pathStringCond     = '';
        $notEqParentString  = '';
        eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings( $pathStringCond, $notEqParentString, $nodeID, $depth, $depthOperator );

        $groupBySelectText  = '';
        $groupBySQL         = $extendedAttributeFilter['group_by'];
        if ( !$groupBySQL )
        {
            eZContentObjectTreeNode::createGroupBySQLStrings( $groupBySelectText, $groupBySQL, $groupBy );
        }
        else if ( $groupBy )
        {
            eZDebug::writeError( "Cannot use group_by parameter together with extended attribute filter which sets group_by!", __METHOD__ );
        }

        $limitation = ( isset( $params['Limitation']  ) && is_array( $params['Limitation']  ) ) ? $params['Limitation']: false;
        $limitationList = eZContentObjectTreeNode::getLimitationList( $limitation );
        $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL( $limitationList );

        // Determine whether we should show invisible nodes.
        $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString( !$ignoreVisibility );

        $query = "SELECT DISTINCT
                         ezcontentobject.published as published
                         $groupBySelectText
                   FROM
                      ezcontentobject_tree
                      INNER JOIN ezcontentobject ON (ezcontentobject.id = ezcontentobject_tree.contentobject_id)
                      INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)
                      INNER JOIN ezcontentobject_name ON (
                          ezcontentobject_name.contentobject_id = ezcontentobject_tree.contentobject_id AND
                          ezcontentobject_name.content_version = ezcontentobject_tree.contentobject_version
                      )

                      $attributeFilter[from]
                      $extendedAttributeFilter[tables]
                      $sqlPermissionChecking[from]
                   WHERE
                      $pathStringCond
                      $extendedAttributeFilter[joins]
                      $attributeFilter[where]
                      ezcontentclass.version = 0 AND
                      $notEqParentString
                      $mainNodeOnlyCond
                      $classCondition
                      " . eZContentLanguage::sqlFilter( 'ezcontentobject_name', 'ezcontentobject' ) . "
                      $showInvisibleNodesCond
                      $sqlPermissionChecking[where]
                $groupBySQL";


        $db = eZDB::instance();

        $server = count( $sqlPermissionChecking['temp_tables'] ) > 0 ? eZDBInterface::SERVER_SLAVE : false;

        if ( !$offset && !$limit )
        {
            $nodeListArray = $db->arrayQuery( $query, array(), $server );
        }
        else
        {
            $nodeListArray = $db->arrayQuery( $query, array( 'offset' => $offset,
                                                              'limit'  => $limit ),
                                                      $server );
        }

        // cleanup temp tables
        $db->dropTempTableList( $sqlPermissionChecking['temp_tables'] );

        return $nodeListArray;
    }