Lookup method

Return the list of attendees allowed for the event

@return void
763795
public function lookup(): void
    {
        $this->request->allowMethod(['post', 'put', 'patch']);
        $result = [];
        $data = $this->request->getData();
        $searchTerm = empty($data['term']) ? '' : $data['term'];

        $query = $this->CalendarAttendees->find()
            ->where([
                'OR' => [
                    'display_name LIKE' => "%$searchTerm%",
                    'contact_details LIKE' => "%$searchTerm%"
                ]
            ]);
        $attendees = $query->toArray();

        foreach ($attendees as $k => $att) {
            $result[] = [
                'id' => $att->id,
                'text' => "{$att->display_name} - {$att->contact_details}",
            ];
        }

        $this->set(compact('result'));
        $this->set('_serialize', 'result');
    }
1086891
protected function syncAttendees(): void
    {
        //sync all the attendees from users.
        $users = $this->usersTable->find()->all();
        $result = [];

        /** @var \Cake\Shell\Helper\ProgressHelper $progress */
        $progress = $this->helper('Progress');
        $progress->init();
        $this->out(null);
        $this->info('Syncing attendees...');

        $count = 1;
        /** @var \Cake\Datasource\EntityInterface $user */
        foreach ($users as $k => $user) {
            if (empty($user->email)) {
                continue;
            }

            $existing = $this->attendeesTable->exists(['contact_details' => $user->email]);

            if (!$existing) {
                $entity = $this->attendeesTable->newEntity();

                $entity->set('display_name', $user->get('name'));
                $entity->set('contact_details', $user->get('email'));

                $saved = $this->attendeesTable->save($entity);
                if ($saved) {
                    array_push($result, $saved);
                }
            }

            $progress->increment(100 / ++$count);
            $progress->draw();
        }

        $this->out(null);

        if (!empty($result)) {
            $this->out('<success> [' . count($result) . ']Attendees synchronized!</success>');
        }

        $this->out(null);
    }
437660
public function getEvents()
    {
        $events = [];

        $statement = $this->connection->prepare('SELECT * FROM ' . $this->table);

        $result = $statement->execute();

        if (0 < count($result)) {
            foreach ($result as $row) {
                var_dump($row);
                $events[] = (new Event())
                    ->setId($row['id']);
            }
        }

        return $events;
    }
176470
public function AttendeeForm() {
		$form = new EventAttendeeForm($this, "AttendeeForm");
		$this->extend("updateAttendeeForm", $form, $this->registration);
		if ($this->BackURL) {
			$form->addCancelLink($this->BackURL);
		}
		return $form;
	}
885124
public function get_user_list() {
        global $CFG, $SITE;

        $courseid = $SITE->id;
        if (!empty($this->course)) {
            $courseid = $this->course->id;
        }
        $context = context_course::instance($courseid);
        $limitfrom = empty($this->showusers) ? 0 : '';
        $limitnum  = empty($this->showusers) ? COURSE_MAX_USERS_PER_DROPDOWN + 1 : '';
        $courseusers = get_enrolled_users($context, '', $this->groupid, 'u.id, ' . get_all_user_name_fields(true, 'u'),
                null, $limitfrom, $limitnum);

        if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$this->showusers) {
            $this->showusers = 1;
        }

        $users = array();
        if ($this->showusers) {
            if ($courseusers) {
                foreach ($courseusers as $courseuser) {
                     $users[$courseuser->id] = fullname($courseuser, has_capability('moodle/site:viewfullnames', $context));
                }
            }
            $users[$CFG->siteguest] = get_string('guestuser');
        }
        return $users;
    }
875067
public function listEventsAction()
    {
        $this->checkStaticTemplateIsIncluded();
        $this->checkSettings();

        $this->slotExtendedAssignMultiple([
            self::VIEW_VARIABLE_ASSOCIATION_ID => $this->settings[self::SETTINGS_ASSOCIATION_ID],
            self::VIEW_VARIABLE_FILTER => $this->getEventsFilter()
        ], __CLASS__, __FUNCTION__);

        return $this->view->render();
    }
1283764
def _get_events(self):
        
        self.last_update = datetime.datetime.now()
        time_min = datetime.datetime.utcnow()
        time_max = time_min + datetime.timedelta(hours=self.events_within_hours)
        events = []

        try:
            eventsResult = (
                self.service.events()
                .list(
                    calendarId="primary",
                    timeMax=time_max.isoformat() + "Z",  # 'Z' indicates UTC time
                    timeMin=time_min.isoformat() + "Z",  # 'Z' indicates UTC time
                    singleEvents=True,
                    orderBy="startTime",
                )
                .execute(num_retries=5)
            )
        except Exception:
            return self.events or events
        else:
            for event in eventsResult.get("items", []):
                # filter out events that we did not accept (default)
                # unless we organized them with no attendees
                i_organized = event.get("organizer", {}).get("self", False)
                has_attendees = event.get("attendees", [])
                for attendee in event.get("attendees", []):
                    if attendee.get("self") is True:
                        if attendee["responseStatus"] in self.response:
                            break
                else:
                    # we did not organize the event or we did not accept it
                    if not i_organized or has_attendees:
                        continue

                # strip and lower case output if needed
                for key in ["description", "location", "summary"]:
                    event[key] = event.get(key, "").strip()
                    if self.force_lowercase is True:
                        event[key] = event[key].lower()

                # ignore all day events if configured
                if event["start"].get("date") is not None:
                    if self.ignore_all_day_events:
                        continue

                # filter out blacklisted event names
                if event["summary"] is not None:
                    if event["summary"].lower() in map(
                        lambda e: e.lower(), self.blacklist_events
                    ):
                        continue

                events.append(event)

        return events[: self.num_events]
1304201
public function getEventCounter()
    {
        // BC support for old formats
        foreach ($this->events as $type => $events) {
            if (!isset($this->totalEvents[$type])) {
                $this->totalEvents[$type] = count($events);
            }
        }

        $counter = [
            'total' => array_sum($this->totalEvents),
        ];

        if ($this->countOnly && $this->groupUnit) {
            $counter['byUnit'] = $this->totalEventsByUnit;
        }

        return $counter;
    }
336337
public function edit($request) {
		//get attendee from registration
		$attendee = $this->registration->Attendees()
			->byID($request->param('ID'));
		if(!$attendee) {
			return $this->httpError(404, "Attendee not found");
		}
		$form = $this->AttendeeForm();
		//add tickets dropdown, if there is no selected ticket
		$ticket = $attendee->Ticket();
		if(!$ticket->exists()){
			$form->setAllowedTickets(
				$this->registration->Event()->getAvailableTickets()
			);
		}
		if (!$form->hasSessionData()) {
			$form->loadDataFrom($attendee);
		}
		//add tickets dropdown, if there is no selected ticket
		$form->getValidator()->addRequiredField("ID");
		$this->extend("onEdit", $form, $attendee, $this->registration);
		return array(
			'Title' => $attendee->Ticket()->Title,
			'Form' => $form
		);
	}
215490
public function participants()
    {
        return User::join('posts', 'posts.user_id', '=', 'users.id')
            ->where('posts.discussion_id', $this->id)
            ->where('posts.is_private', false)
            ->where('posts.type', 'comment')
            ->select('users.*')
            ->distinct();
    }
322714
def get_event_attendee(self, id, attendee_id, **data):
        
        
        return self.get("/events/{0}/attendees/{0}/".format(id,attendee_id), data=data)
161227
public function getAvailableEventClasses()
    {
        /** @var \Railken\Amethyst\Repositories\ListenerRepository */
        $repository = $this->getRepository();

        return $repository->newQuery()->get()->map(function ($v) {
            return $v->event_class;
        })->toArray();
    }
1234631
public function index()
    {
        $this->set('groups', $this->paginate($this->Groups, [
            'contain' => [
                'Users' => function ($q) {
                    return $q->select(['Users.id', 'Users.username'])
                        ->order(['Users.username' => 'ASC']);
                }
            ],
            'maxLimit' => 500,
            'limit' => 500
        ]));
        $this->set('_serialize', ['groups']);
    }
845558
public function getEventAllowableValues()
    {
        return [
            self::EVENT_BOUNCES,
            self::EVENT_HARD_BOUNCES,
            self::EVENT_SOFT_BOUNCES,
            self::EVENT_DELIVERED,
            self::EVENT_SENT,
            self::EVENT_ACCEPTED,
            self::EVENT_UNSUBSCRIPTION,
            self::EVENT_REPLIES,
            self::EVENT_BLOCKED,
        ];
    }
98235
public function getCalendarEnabled()
    {
        if ($this->owner->isReadonly() || $this->owner->isDisabled()) {
            return 'false';
        }
        
        return ($this->calendarDisabled || $this->owner->config()->calendar_disabled) ? 'false' : 'true';
    }
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');
    }
523309
def attendees_attributes
      return {} unless @attendees

      attendees = @attendees.map do |attendee|
        attendee.select { |k,_v| ['displayName', 'email', 'responseStatus'].include?(k) }
      end

      { "attendees" => attendees }
    end