Retrieving Calendar item event data for updating

@return \Zend\View\Model\JsonModel
186383
public function getEventTitleAction(){
        $translator = $this->getServiceLocator()->get('translator');
        
        $request = $this->getRequest();
        // Default Values
        $status  = 0;
        // This can be override with success if result is success
        $textMessage = $translator->translate('tr_melistoolcalendar_unable_get_event');
        $errors  = array();
        $textTitle = '';
        $eventData = array();
        
         
        if($request->isPost()) {
             
            $postValues = get_object_vars($request->getPost());
             
            if (!empty($postValues)){
                 
                $calendarTable = $this->getServiceLocator()->get('MelisCalendarTable');
                 
                $resultEvent = $calendarTable->getEntryById($postValues['cal_id']);
                 
                if (!empty($resultEvent)){
                    $eventData = $resultEvent->current();
                     
                    if (!empty($eventData)){
                        $textMessage = $translator->translate('tr_melistoolcalendar_get_event_success');
                        $status  = 1;
                    }
                }
            }
        }
         
        $response = array(
            'success' => $status,
            'textTitle' => $translator->translate('tr_melistoolcalendar_form_title'),
            'textMessage' => $textMessage,
            'errors' => $errors,
            'eventData' => $eventData
        );
         
        return new JsonModel($response);
    }
511488
public function toJsonLd()
    {
        $jsonLd = [];

        $jsonLd['calendarType'] = $this->getType()->toNative();
        // All calendar types allow startDate (and endDate).
        // One timestamp - full day.
        // One timestamp - start hour.
        // One timestamp - start and end hour.
        empty($this->startDate) ?: $jsonLd['startDate'] = $this->getStartDate()->format(DateTime::ATOM);
        empty($this->endDate) ?: $jsonLd['endDate'] = $this->getEndDate()->format(DateTime::ATOM);


        $timestamps = $this->getTimestamps();
        if (!empty($timestamps)) {
            $jsonLd['subEvent'] = array();
            foreach ($timestamps as $timestamp) {
                $jsonLd['subEvent'][] = array(
                  '@type' => 'Event',
                  'startDate' => $timestamp->getStartDate()->format(DateTime::ATOM),
                  'endDate' => $timestamp->getEndDate()->format(DateTime::ATOM),
                );
            }
        }

        // Period.
        // Period with openingtimes.
        // Permanent - "altijd open".
        // Permanent - with openingtimes
        $openingHours = $this->getOpeningHours();
        if (!empty($openingHours)) {
            $jsonLd['openingHours'] = array();
            foreach ($openingHours as $openingHour) {
                $jsonLd['openingHours'][] = $openingHour->serialize();
            }
        }

        return $jsonLd;
    }
508917
protected function get_legacy_eventdata() {
        global $USER;

        $workshop = $this->get_record_snapshot('workshop', $this->objectid);
        $course   = $this->get_record_snapshot('course', $this->courseid);
        $cm       = $this->get_record_snapshot('course_modules', $this->contextinstanceid);
        $workshop = new \workshop($workshop, $cm, $course);
        return (object)array('workshop' => $workshop, 'user' => $USER);
    }
510799
private function getDataMapper()
    {
        if($this->dataMapper == null) {
            $this->dataMapper = new \Friday\Model\DataMapper(self::$app->config);
        }
        return $this->dataMapper;
    }
757968
public function index()
    {
        $this->request->allowMethod(['post', 'put', 'patch']);
        $calendarsTable = TableRegistry::get('Qobo/Calendar.Calendars');

        $events = [];
        $data = $this->request->getData();
        $data = is_array($data)? $data : [];
        if (!empty($data['calendar_id'])) {
            $calendar = $calendarsTable->get($data['calendar_id']);
            $events = $this->CalendarEvents->getEvents($calendar, $data);
        }

        $this->set(compact('events'));
        $this->set('_serialize', 'events');
    }
729203
public function onGetJSONData()
    {
        $iElementID = Input::get('element_id');
        $obElementItem = $this->makeItem($iElementID);

        return $obElementItem->toJSON();
    }
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;
    }
1016152
public function jsonSerialize()
    {
        $jsonData = [
            'identity'   => $this->identity,
            'public_key' => $this->publicKey,
            'version'    => $this->version,
            'created_at' => $this->createdAt,
        ];

        if ($this->previousCardId != null) {
            $jsonData['previous_card_id'] = $this->previousCardId;
        }

        return $jsonData;
    }
742220
public function getJsonValue()
    {
        $dts = $this->getDateTimes();
        $hasTime = $this->hasTime();
        $isFloating = $this->isFloating();

        $tz = $dts[0]->getTimeZone();
        $isUtc = $isFloating ? false : in_array($tz->getName(), ['UTC', 'GMT', 'Z']);

        return array_map(
            function (DateTimeInterface $dt) use ($hasTime, $isUtc) {
                if ($hasTime) {
                    return $dt->format('Y-m-d\\TH:i:s').($isUtc ? 'Z' : '');
                } else {
                    return $dt->format('Y-m-d');
                }
            },
            $dts
        );
    }
468778
public function getTemplateDataByIdAction()
    {
        $request = $this->getRequest();
        $data    = array();

        if($request->isPost())
        {
            $templatesModel = $this->getServiceLocator()->get('MelisEngineTableTemplate');
            $templateId = $request->getPost('templateId');

            if(is_numeric($templateId))
                $data = $templatesModel->getEntryById($templateId);
        }

        return new JsonModel($data);
    }
938749
public function searchCalendarEventAction(){
        $translator = $this->getServiceLocator()->get('translator');
        $textMessage = '';
        $request = $this->getRequest();
        // Default Values
        $id = null;

        if($request->isPost()) {

            $postValues = get_object_vars($request->getPost());

            if (!empty($postValues)){

                $calendarService = $this->getServiceLocator()->get('MelisCalendarService');
                $id = $responseData = $calendarService->deleteCalendarEvent($postValues);
            }
        }

        $response = array(
            'success' => '0',
            'textTitle' => 'tr_melistoolcalendar_delete_event_title',
            'textMessage' => $textMessage,
            'errors' => $errors,
        );

        return new JsonModel($response);
    }
1271504
public function toArray()
    {
        $event = [
            'app' => $this->config->getAppData(),
            'device' => array_merge(['time' => $this->time], $this->config->getDeviceData()),
            'user' => $this->getUser(),
            'context' => $this->getContext(),
            'payloadVersion' => HttpClient::PAYLOAD_VERSION,
            'severity' => $this->getSeverity(),
            'exceptions' => $this->exceptionArray(),
            'breadcrumbs' => $this->breadcrumbs,
            'metaData' => $this->cleanupObj($this->getMetaData(), true),
            'unhandled' => $this->getUnhandled(),
            'severityReason' => $this->getSeverityReason(),
        ];

        if ($hash = $this->getGroupingHash()) {
            $event['groupingHash'] = $hash;
        }

        if (isset($this->session)) {
            $event['session'] = $this->session;
        }

        return $event;
    }
355044
public function getInternalLink()
    {
        //for now all event details will only have one link - that is the main calendar page
        //NOTE: this could be amended by calling that link via AJAX, and thus could be shown as an overlay
        //everywhere on the site
//		//if the event page is enabled, we provide for links to event pages
//		if (CalendarConfig::subpackage_setting('pagetypes','enable_eventpage')) {
//			$eventPage = $this->EventPage();
//			if ($eventPage->exists()) {
//				return $eventPage->Link();
//			} else {
//				$calendarPage = CalendarPage::get()->First();
//				return $calendarPage->Link() .  $detailStr;
//			}
//		} else {
        $calendarPage = CalendarPage::get()->First();
        return CalendarHelper::add_preview_params(Controller::join_links($calendarPage->Link('detail'),$this->ID),$this);
//		}
    }
824764
public function getJson() {
		$json = [
			'title' => $this->title,
			'author' => $this->author,
			'show_cover_pic' => $this->show_cover_pic,
			'digest' => $this->digest,
			'content_source_url' => $this->content_source_url,
		];
		if($this->manager) {
			$materialMedia = $this->thumbMaterialMedia;
			$json['thumb_media_id'] = $materialMedia->media_id;
			$json['thumb_material_media_id'] = $materialMedia->id;
			$json['content'] = $this->wechatContent;
		} else {
			$json['thumb_url'] = $this->thumbMaterial->url;
			$json['content'] = $this->content;
		}
		
		return $json;
	}
615171
public function getEventInfo(?string $id = null, ?EntityInterface $calendar = null)
    {
        $result = [];

        if (empty($id)) {
            return $result;
        }

        $options = $this->getRecurrenceEventId($id);

        /** @var \Cake\ORM\Query $query */
        $query = $this->find()
                ->where(['id' => $options['id']])
                ->contain(['CalendarAttendees']);
        $result = $query->first();

        if (!($result instanceof EntityInterface)) {
            return [];
        }

        //@NOTE: we're faking the start/end intervals for recurring events
        if (!empty($options['end'])) {
            $time = Time::parse($options['end']);
            $result->set('end_date', $time);
            $result->set('end', $time);
            unset($time);
        }

        if (!empty($options['start'])) {
            $time = Time::parse($options['start']);
            $result->set('start_date', $time);
            $result->set('start', $time);
            unset($time);
        }

        if ($calendar) {
            if (empty($result->calendar_id)) {
                $result->set('calendar_id', $calendar->id);
            }
        }

        $result->set('color', $this->Calendars->getColor($calendar));

        return $result;
    }
638243
public function jsonSerialize()
    {
        $feedbacks = [];

        foreach ($this->feedbacks as $feedback) {
            $feedbacks[] = $feedback->serialize($this->controllerContext);
        }

        return [
            'timestamp' => new \DateTime(),
            'feedbacks' => $feedbacks
        ];
    }
213999
public function retrieveProspectDataByIdAction()
    {
        $prospectTable = $this->getServiceLocator()->get('MelisProspects');
        $id = $this->params()->fromRoute('id', $this->params()->fromQuery('id', ''));
        
        return new JsonModel($prospectTable->getEntryById($id));
    }