コード例 #1
0
 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
0
 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
0
 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
0
 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();
     }
 }