本文整理汇总了PHP中Registration::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Registration::get方法的具体用法?PHP Registration::get怎么用?PHP Registration::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registration
的用法示例。
在下文中一共展示了Registration::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentRegistration
public function getCurrentRegistration()
{
$member = Member::currentUser();
if (!$member) {
return false;
}
$reg = Registration::get()->filter(array('MemberID' => $member->ID, 'ParentID' => $this->getCurrentEvent()->ID));
if (!$reg) {
return false;
}
return $reg->First();
}
示例2: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Sort');
$siteConfig = SiteConfig::current_site_config();
$current = $siteConfig->getCurrentEventID();
if ($this->Event()->ID) {
$event = $this->Event();
} else {
if ($this->Parent()->ParentID > 0) {
$event = Event::get()->byID($this->Parent()->ParentID);
} else {
$event = Event::get()->byID($current);
}
}
if ($event) {
$prefNum = $event->PreferencesPerSession ? $event->PreferencesPerSession : 2;
} else {
$prefNum = 2;
}
$pref = array();
for ($i = 1; $i <= $prefNum; $i++) {
$pref[$i] = $i;
}
$preference = new DropdownField('Preference', 'Preference', $pref);
$preference->setEmptyString(' ');
$fields->insertAfter($preference, 'GameID');
$status = array(0 => "Pending/Declined", 1 => "Accepted");
$fields->insertAfter(new OptionsetField('Status', 'Status', $status), 'Preference');
$reg = Registration::get()->filter(array('ParentID' => $event->ID))->map('ID', "Title");
$player = new DropdownField('ParentID', 'Player', $reg);
$player->setEmptyString(' ');
$fields->insertAfter($player, 'Status');
$fields->insertAfter($fields->dataFieldByName('Favourite'), 'Status');
$fields->insertAfter($fields->dataFieldByName('ParentID'), 'GameID');
$event = HiddenField::create('EventID', 'Event', $event->ID);
$fields->insertAfter($event, 'GameID');
return $fields;
}
示例3: function
<?php
View::composer(array('home', 'registrations.register'), function ($view) {
$all = Registration::get()->sum('tickets');
$today = Registration::where(DB::raw('DATE(registrations.created_at)'), DB::raw('CURDATE()'))->get()->sum('tickets');
$expected = Booking::get()->sum('tickets');
$view->with('registration_count_total', $all)->with('registration_count_today', $today)->with('expected_count', $expected);
});
示例4: getRegistrations
function getRegistrations($callsign = null)
{
if (is_null($this->registrations)) {
$this->registrations = Registration::get()->each(function ($registration) {
$registration->prefix = str_replace('-', '', $registration->prefix);
if (!$registration->regex) {
$registration->prefix .= '.*';
}
});
}
if (!is_null($callsign)) {
return $this->registrations->first(function ($key, $registration) use($callsign) {
return preg_match('/^' . $registration->prefix . '$/', $callsign);
});
}
return $this->registrations;
}
示例5: getRegistration
public function getRegistration($memberID)
{
$siteConfig = SiteConfig::current_site_config();
return Registration::get()->filter(array("MemberID" => $memberID, 'ParentID' => $siteConfig->CurrentEventID))->First();
}
示例6: addPlayerGame
/**
* Attempts to save a game
*
* @return Game|null
*/
protected function addPlayerGame($data, $form)
{
$fields = $form->Fields();
$event = $this->getCurrentEvent();
$currentID = $event->ID;
$prefNum = $event->PreferencesPerSession;
$regID = $data['RegistrationID'];
$reg = Registration::get()->byID($regID);
if (!$reg) {
return false;
}
// @todo - handle a proper 'change game' case
if ($reg->PlayerGames()->Count() > 0) {
foreach ($reg->PlayerGames() as $playerGame) {
$reg->PlayerGames()->removeByID($playerGame->ID);
$playerGame->delete();
}
}
$favouriteID = $data["FavouriteID"];
for ($session = 1; $session <= $event->NumberOfSessions; $session++) {
$notPlay = $data["NotPlaying_" . $session];
$games = Game::get()->filter(array('Session' => $session, 'ParentID' => $currentID, 'Status' => true));
// Alter prefnumber so it stops when it encounters "not Playing"
if ($notPlay != 0 && $notPlay < $prefNum) {
$prefNum = $notPlay;
}
// if first choice is to not play, don't create any games
if ($notPlay === 1) {
continue;
}
foreach ($games as $game) {
$gamePref = $data["GameID_" . $game->ID];
// only store games with a preference higher than our threshold
if ($gamePref > $prefNum || !isset($gamePref)) {
continue;
}
$playerGame = PlayerGame::create();
$form->saveInto($playerGame);
$playerGame->GameID = $game->ID;
$playerGame->ParentID = $regID;
$playerGame->Preference = $gamePref;
if ($favouriteID == $game->ID) {
$playerGame->Favourite = true;
}
try {
$playerGame->write();
} catch (ValidationException $e) {
$form->sessionMessage($e->getResult()->message(), 'bad');
return;
}
}
}
return $playerGame;
}
示例7: prepareDatabase
protected function prepareDatabase()
{
// Get database records for all airlines, airports, registrations
$this->airlines = Airline::get();
$this->registrations = Registration::get()->each(function ($registration) {
$registration->prefix = str_replace('-', '', $registration->prefix);
if (!$registration->regex) {
$registration->prefix .= '.*';
}
});
}