本文整理汇总了PHP中Summit::get_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Summit::get_by_id方法的具体用法?PHP Summit::get_by_id怎么用?PHP Summit::get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Summit
的用法示例。
在下文中一共展示了Summit::get_by_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRegistrationCodeByTerm
public function getRegistrationCodeByTerm(SS_HTTPRequest $request)
{
try {
$term = Convert::raw2sql($request->param('REG_CODE'));
$summit_id = intval($request->param('SUMMIT_ID'));
$summit = Summit::get_by_id('Summit', $summit_id);
if (is_null($summit)) {
throw new NotFoundEntityException('Summit', sprintf(' id %s', $summit_id));
}
$codes = SpeakerSummitRegistrationPromoCode::get()->filter(array('SummitID' => $summit_id, 'OwnerID' => 0, 'SpeakerID' => 0))->where(" Code LIKE '{$term}%' ")->limit(25, 0);
$data = array();
foreach ($codes as $code) {
$data[] = array('code' => trim($code->Code), 'name' => sprintf('%s (%s)', $code->Code, $code->Type));
}
return $this->ok($data, false);
} catch (NotFoundEntityException $ex2) {
SS_Log::log($ex2->getMessage(), SS_Log::WARN);
return $this->notFound($ex2->getMessage());
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
return $this->serverError();
}
}
示例2: getMembers
public function getMembers(SS_HTTPRequest $request)
{
try {
$query_string = $request->getVars();
$query = Convert::raw2sql($query_string['query']);
$summit_id = intval($request->param('SUMMIT_ID'));
$summit = Summit::get_by_id('Summit', $summit_id);
if (is_null($summit)) {
throw new NotFoundEntityException('Summit', sprintf(' id %s', $summit_id));
}
$members = DB::query("SELECT M.ID AS id, CONCAT(M.FirstName,' ',M.Surname,' (',M.Email,')') AS name FROM Member AS M\n\n WHERE\n (\n M.FirstName LIKE '%{$query}%' OR\n M.Surname LIKE '%{$query}%' OR\n M.Email LIKE '%{$query}%' OR\n CONCAT(M.FirstName,' ',M.Surname) LIKE '%{$query}%'\n )\n AND\n EXISTS\n (\n SELECT 1 FROM Group_Members AS GM\n INNER JOIN `Group` AS G ON G.ID = GM.GroupID\n WHERE\n GM.MemberID = M.ID\n AND\n (\n G.Code = '" . IFoundationMember::CommunityMemberGroupSlug . "'\n OR\n G.Code = '" . IFoundationMember::FoundationMemberGroupSlug . "'\n )\n )\n ORDER BY M.FirstName, M.Surname LIMIT 25;");
$data = array();
foreach ($members as $member) {
$data[] = $member;
}
return $this->ok($data);
} catch (NotFoundEntityException $ex2) {
SS_Log::log($ex2->getMessage(), SS_Log::WARN);
return $this->notFound($ex2->getMessage());
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
return $this->serverError();
}
}
示例3: getSchedule
public function getSchedule(SS_HTTPRequest $request)
{
try {
$summit_id = intval($request->param('SUMMIT_ID'));
$summit = Summit::get_by_id('Summit', $summit_id);
if (is_null($summit)) {
throw new NotFoundEntityException('Summit', sprintf(' id %s', $summit_id));
}
$attendee_id = intval($request->param('ATTENDEE_ID'));
$attendee = SummitAttendee::get_by_id('SummitAttendee', $attendee_id);
if (is_null($attendee)) {
throw new NotFoundEntityException('SummitAttendee', sprintf(' id %s', $attendee_id));
}
$events_array = array();
$events = $attendee->Schedule()->sort('StartDate');
foreach ($events as $event) {
$event_start_unix = strtotime($event->getStartDateUTC());
$event_end_unix = strtotime($event->getEndDateUTC());
$current_event = time() > $event_start_unix && time() < $event_end_unix;
$events_array[] = array('title' => $event->Title, 'location' => $event->getLocationNameNice(), 'time' => $event->getDateNice(), 'current_event' => $current_event);
}
return $this->ok($events_array);
} catch (NotFoundEntityException $ex2) {
SS_Log::log($ex2->getMessage(), SS_Log::WARN);
return $this->notFound($ex2->getMessage());
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
return $this->serverError();
}
}
示例4: getSpeakerByID
public function getSpeakerByID(SS_HTTPRequest $request)
{
try {
$speaker_id = intval($request->param('SPEAKER_ID'));
$summit_id = intval($request->param('SUMMIT_ID'));
$summit = Summit::get_by_id('Summit', $summit_id);
if (is_null($summit)) {
throw new NotFoundEntityException('Summit', sprintf(' id %s', $summit_id));
}
$speaker = PresentationSpeaker::get_by_id('PresentationSpeaker', $speaker_id);
$speaker_array = array('Title' => $speaker->Title, 'FirstName' => $speaker->FirstName, 'LastName' => $speaker->LastName, 'Email' => $speaker->RegistrationRequest()->Email, 'Member' => $speaker->Member()->Exists() ? $speaker->Member()->toMap() : null, 'Twitter' => $speaker->TwitterName, 'IRC' => $speaker->IRCHandle, 'Bio' => $speaker->Bio, 'PicUrl' => $speaker->ProfilePhoto(50), 'Expertise' => $speaker->AreasOfExpertise()->toNestedArray(), 'Presentations' => $speaker->Presentations()->toNestedArray(), 'OtherPresentations' => $speaker->OtherPresentationLinks()->toNestedArray(), 'TravelPreferences' => $speaker->TravelPreferences()->toNestedArray(), 'Languages' => $speaker->Languages()->toNestedArray(), 'Promocodes' => $speaker->PromoCodes()->toNestedArray(), 'Assistances' => $speaker->SummitAssistances()->toNestedArray(), 'OrganizationalRoles' => $speaker->OrganizationalRoles()->toNestedArray(), 'ActiveInvolvements' => $speaker->ActiveInvolvements()->toNestedArray());
return $this->ok($speaker_array, false);
} catch (NotFoundEntityException $ex2) {
SS_Log::log($ex2->getMessage(), SS_Log::WARN);
return $this->notFound($ex2->getMessage());
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
return $ex->getMessage();
}
}