本文整理汇总了PHP中Summit类的典型用法代码示例。如果您正苦于以下问题:PHP Summit类的具体用法?PHP Summit怎么用?PHP Summit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Summit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSummit
/**
* @param array $data
* @return ISummit
*/
public function createSummit(array $data)
{
$this_var = $this;
$repository = $this->summit_repository;
$factory = $this->summit_factory;
return $this->tx_manager->transaction(function () use($this_var, $factory, $data, $repository) {
$summit = new Summit();
$summit->registerMainInfo($factory->buildMainInfo($data));
if ($repository->isDuplicated($summit)) {
throw new EntityAlreadyExistsException('Summit', sprintf('Name %s', $summit->getName()));
}
$repository->add($summit);
return $summit;
});
}
示例2: init
/**
* Check for auth tokens
* @return mixed
*/
public function init()
{
parent::init();
if (!Summit::get_active()->isInDB()) {
return $this->httpError(404, 'There is no active summit');
}
/**
* On the existing tokenauthentication system, this is a fairly trivialmatter, and I'm not so sure it's anything to navigate right now.
* Thiswas implemented to provide the video upload people a simple API foradding videos. It's a very specific use c
* ase, and general users shouldnot be using it. If they can and they are, then that needs to bechanged.
*/
$result = $this->checkAuthenticationToken();
if (!$result && !Member::currentUser()) {
//check if speaker registration token is present..
$speaker_registration_token = $this->request->getVar(SpeakerRegistrationRequest::ConfirmationTokenParamName);
if (!is_null($speaker_registration_token)) {
$request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token);
if (is_null($request) || $request->alreadyConfirmed()) {
return SummitSecurity::permission_failure($this);
}
// redirect to register member speaker
$url = Controller::join_links(Director::baseURL(), 'summit-login', 'registration');
return $this->redirect($url . '?BackURL=' . urlencode($this->request->getURL()) . '&' . SpeakerRegistrationRequest::ConfirmationTokenParamName . '=' . $speaker_registration_token);
}
return SummitSecurity::permission_failure($this);
}
$speaker = Member::currentUser()->getSpeakerProfile();
if (!$speaker) {
$speaker = PresentationSpeaker::create(array('MemberID' => Member::currentUserID(), 'FirstName' => Member::currentUser()->FirstName, 'LastName' => Member::currentUser()->Surname));
$speaker->write();
}
}
示例3: getCMSFields
public function getCMSFields()
{
$summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : Summit::ActiveSummitID();
Requirements::javascript('summit/javascript/SummitPushNotification.js');
$f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
$f->addFieldToTab('Root.Main', $txt = new TextareaField('Message', 'Message'));
$txt->setAttribute('required', 'true');
$f->addFieldToTab('Root.Main', $ddl_channel = new DropdownField('Channel', 'Channel', singleton('SummitPushNotification')->dbObject('Channel')->enumValues()));
$f->addFieldToTab('Root.Main', $ddl_events = new DropdownField('EventID', 'Event', SummitEvent::get()->filter(['Published' => 1, 'SummitID' => $summit_id])->sort('Title', 'ASC')->Map('ID', 'FormattedTitle')));
$f->addFieldToTab('Root.Main', $ddl_groups = new DropdownField('GroupID', 'Group', Group::get()->sort('Title', 'ASC')->Map('ID', 'Title')));
$f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
$ddl_channel->setEmptyString('--SELECT A CHANNEL--');
$ddl_channel->setAttribute('required', 'true');
$ddl_events->setEmptyString('--SELECT AN EVENT--');
$ddl_events->addExtraClass('hidden');
$ddl_groups->setEmptyString('--SELECT A GROUP--');
$ddl_groups->addExtraClass('hidden');
$config = GridFieldConfig_RelationEditor::create(50);
$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
$config->removeComponentsByType('GridFieldAddNewButton');
$config->addComponent($auto_completer = new CustomGridFieldAddExistingAutocompleter('buttons-before-right'));
$auto_completer->setResultsFormat('$Title ($Email)');
$recipients = new GridField('Recipients', 'Member Recipients', $this->Recipients(), $config);
$f->addFieldToTab('Root.Main', $recipients);
return $f;
}
示例4: build
/**
* @param IPresentationSpeaker $speaker
* @return PresentationSpeakerAcceptedAnnouncementEmailSender
* @throws Exception
*/
public function build(IPresentationSpeaker $speaker)
{
$summit = Summit::get_active();
$has_approved = $speaker->hasApprovedPresentations($summit->ID);
$has_rejected = $speaker->hasRejectedPresentations($summit->ID);
$has_alternate = $speaker->hasAlternatePresentations($summit->ID);
if ($has_approved && !$has_rejected && !$has_alternate) {
return new PresentationSpeakerAcceptedAnnouncementEmailSender();
}
if (!$has_approved && !$has_rejected && $has_alternate) {
return new PresentationSpeakerAlternateAnnouncementEmailSender();
}
if (!$has_approved && $has_rejected && !$has_alternate) {
return new PresentationSpeakerRejectedAnnouncementEmailSender();
}
if ($has_approved && !$has_rejected && $has_alternate) {
return new PresentationSpeakerAcceptedAlternateAnnouncementEmailSender();
}
if ($has_approved && $has_rejected && !$has_alternate) {
return new PresentationSpeakerAcceptedRejectedAnnouncementEmailSender();
}
if (!$has_approved && $has_rejected && $has_alternate) {
return new PresentationSpeakerAlternateRejectedAnnouncementEmailSender();
}
if ($has_approved && $has_rejected && $has_alternate) {
return new PresentationSpeakerAcceptedAlternateAnnouncementEmailSender();
}
return null;
}
示例5: presentations
/**
* @param SS_HTTPRequest $r
*/
public function presentations(SS_HTTPRequest $r)
{
$data = [];
$speaker = null;
$key = $r->getVar('key');
if ($key) {
$username = PresentationSpeaker::hash_to_username($key);
$speaker = PresentationSpeaker::get()->filter('Member.Email', $username)->first();
} elseif ($speakerID = Session::get('UploadMedia.SpeakerID')) {
$speaker = PresentationSpeaker::get()->byID($speakerID);
}
// Speaker not found
if (!$speaker) {
return $this->httpError(404, 'Sorry, that does not appear to be a valid token.');
}
Session::set('UploadMedia.SpeakerID', $speaker->ID);
$mostRecentSummit = Summit::get_most_recent();
$presentations = $speaker->PublishedPresentations($mostRecentSummit->ID);
// No presentations
if (!$presentations->exists()) {
return $this->httpError(404, 'Sorry, it does not appear that you have any presentations.');
}
// IF there's only one presentation with no media, go ahead and forward to it's page
if ($presentations->count() == 1) {
$slide = $presentations->first()->MaterialType('PresentationSlide');
if (!$slide) {
$presentationID = $presentations->first()->ID;
return $this->redirect(Controller::join_links($this->Link(), '/presentation/', $presentationID, 'upload'));
}
}
$data['Speaker'] = $speaker;
$data['Presentations'] = $presentations;
return $this->customise($data);
}
示例6: getNextAvailableByType
/**
* @param string $promo_code_type
* @param int $batch_size
* @return ISpeakerSummitRegistrationPromoCode
*/
public function getNextAvailableByType($promo_code_type, $batch_size = 10)
{
switch ($promo_code_type) {
case ISpeakerSummitRegistrationPromoCode::TypeAccepted:
if (count($this->promo_code_speaker_session_pool) === 0) {
$query = new QueryObject(new SpeakerSummitRegistrationPromoCode());
$query->addAndCondition(QueryCriteria::equal('Type', $promo_code_type));
$query->addAndCondition(QueryCriteria::equal('OwnerID', 0));
$query->addAndCondition(QueryCriteria::equal('SpeakerID', 0));
$query->addAndCondition(QueryCriteria::equal('SummitID', Summit::get_active()->ID));
$query->addOrder(QueryOrder::asc('ID'));
list($this->promo_code_speaker_session_pool, $count) = $this->getAll($query, 0, $batch_size);
}
return array_shift($this->promo_code_speaker_session_pool);
break;
case ISpeakerSummitRegistrationPromoCode::TypeAlternate:
if (count($this->promo_code_alternate_speaker_session_pool) === 0) {
$query = new QueryObject(new SpeakerSummitRegistrationPromoCode());
$query->addAndCondition(QueryCriteria::equal('Type', $promo_code_type));
$query->addAndCondition(QueryCriteria::equal('OwnerID', 0));
$query->addAndCondition(QueryCriteria::equal('SpeakerID', 0));
$query->addAndCondition(QueryCriteria::equal('SummitID', Summit::get_active()->ID));
$query->addOrder(QueryOrder::asc('ID'));
list($this->promo_code_alternate_speaker_session_pool, $count) = $this->getAll($query, 0, $batch_size);
}
return array_shift($this->promo_code_alternate_speaker_session_pool);
break;
}
return null;
}
开发者ID:Thingee,项目名称:openstack-org,代码行数:35,代码来源:SapphireSpeakerSummitRegistrationPromoCodeRepository.php
示例7: handleGetAllPresentations
public function handleGetAllPresentations(SS_HTTPRequest $r)
{
$limit = $r->getVar('limit') ?: 50;
if ($limit > 50) {
$limit = 50;
}
$start = $r->getVar('page') ?: 0;
$presentations = Member::currentUser() ? Member::currentUser()->getRandomisedPresentations() : Presentation::get()->filter(array('SummitEvent.SummitID' => Summit::get_active()->ID));
if ($r->getVar('category')) {
$presentations = $presentations->filter('CategoryID', (int) $r->getVar('category'));
}
if ($r->getVar('keyword')) {
$k = $r->getVar('keyword');
$presentations = $presentations->filterAny(array('Title:PartialMatch' => $k, 'Description:PartialMatch' => $k, 'Speakers.FirstName:PartialMatch' => $k, 'Speakers.LastName:PartialMatch' => $k));
}
if ($r->getVar('voted') == "true") {
$presentations = $presentations->leftJoin("PresentationVote", "PresentationVote.PresentationID = Presentation.ID")->where("IFNULL(PresentationVote.MemberID,0) = " . Member::currentUserID());
}
if ($r->getVar('voted') == "false") {
$presentations = $presentations->leftJoin("PresentationVote", "PresentationVote.PresentationID = Presentation.ID")->where("IFNULL(PresentationVote.MemberID,0) != " . Member::currentUserID());
}
$count = $presentations->count();
$presentations = $presentations->limit($limit, $start * $limit);
$data = array('results' => array(), 'has_more' => $count > $limit * ($start + 1), 'total' => $count, 'remaining' => $count - $limit * ($start + 1));
foreach ($presentations as $p) {
$data['results'][] = array('id' => $p->ID, 'title' => $p->Title, 'user_vote' => $p->getUserVote() ? $p->getUserVote()->Vote : null);
}
return (new SS_HTTPResponse(Convert::array2json($data), 200))->addHeader('Content-Type', 'application/json');
}
示例8: run
/**
* @return void
*/
public function run()
{
try {
$batch_size = 100;
$init_time = time();
$summit = null;
if (isset($_GET['batch_size'])) {
$batch_size = intval(trim(Convert::raw2sql($_GET['batch_size'])));
echo sprintf('batch_size set to %s', $batch_size) . PHP_EOL;
}
if (isset($_GET['summit_id'])) {
$summit = Summit::get()->byID(intval($_GET['summit_id']));
}
if (is_null($summit)) {
throw new Exception('summit_id is not valid!');
}
$manager = Injector::inst()->get('SpeakerSecondBreakoutAnnouncementSenderManager');
if (!$manager instanceof ISpeakerSecondBreakoutAnnouncementSenderManager) {
return;
}
$processed = $manager->send($summit, $batch_size);
$finish_time = time() - $init_time;
echo 'processed records ' . $processed . ' - time elapsed : ' . $finish_time . ' seconds.';
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
}
}
示例9: run
/**
* @return void
*/
public function run()
{
try {
$init_time = time();
$processed_events = 0;
$events = array();
$current_summit = Summit::get_active();
if ($current_summit) {
$events = $current_summit->getSchedule();
}
foreach ($events as $event) {
$processed_events++;
$rate_sum = 0;
$rate_count = 0;
foreach ($event->Feedback as $feedback) {
$rate_count++;
$rate_sum = $rate_sum + $feedback->Rate;
}
$rate_avg = $rate_count > 0 ? $rate_sum / $rate_count : 0;
try {
$event->setAvgRate(round($rate_avg, 2));
$event->write(true);
} catch (Exception $ex) {
SS_Log::log($ex, SS_Log::ERR);
echo $ex->getMessage();
}
}
$finish_time = time() - $init_time;
echo 'processed events ' . $processed_events . ' - time elapsed : ' . $finish_time . ' seconds.';
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
}
}
示例10: getPresentationFields
protected function getPresentationFields()
{
$categorySource = Summit::ActiveSummit()->Categories()->map('ID', 'FormattedTitleAndDescription')->toArray();
$categorySource['other'] = '<h4 class="category-label">Other topic...</h4>';
$fields = FieldList::create()->text('Title', 'Proposed Presentation Title')->configure()->setAttribute('autofocus', 'TRUE')->end()->dropdown('Level', 'Please select the level of your presentation content')->configure()->setEmptyString('-- Select one --')->setSource(Presentation::create()->dbObject('Level')->enumValues())->end()->literal('AbstractHelp', '<hr/><p>YouTube and other services limit the length of your presentation\'s description. We will take the first 100 characters of your abstract to display in the YouTube description.</p>')->tinyMCEEditor('ShortDescription', 'Abstract (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->tinyMCEEditor('ProblemAddressed', 'What is the problem or use case you’re addressing in this session? (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->tinyMCEEditor('AttendeesExpectedLearnt', 'What should attendees expect to learn? (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->tinyMCEEditor('SelectionMotive', 'Why should this session be selected? (1000 chars)')->configure()->setRows(20)->setColumns(8)->setMaxCharLimit(1000)->setRequired(true)->end()->literal('PresentationMaterialsTitle', '<h3>Please provide any relevant links to additional information, such as code repositories, case studies, papers, blog posts etc. (Up to 5 links)</h3>')->text('PresentationLink[1]', '#1')->text('PresentationLink[2]', '#2')->text('PresentationLink[3]', '#3')->text('PresentationLink[4]', '#4')->text('PresentationLink[5]', '#5')->literal('HR', '<hr/>')->optionset('CategoryID', 'What is the general topic of the presentation?')->configure()->setSource($categorySource)->end()->text('OtherTopic', 'Other topic (if one above does not match)')->configure()->displayIf('CategoryID')->isEqualTo('other')->end()->end()->hidden('ID', 'ID');
return $fields;
}
示例11: handleAddDefaultEventTypes
public function handleAddDefaultEventTypes($grid, $request, $data = null)
{
$summit_id = intval($request->param('ID'));
if ($summit_id > 0 && ($summit = Summit::get()->byID($summit_id))) {
Summit::seedBasicEventTypes($summit_id);
}
}
示例12: getUpcomingSummitAttendee
/**
* @return ISummitAttendee|null
*/
public function getUpcomingSummitAttendee()
{
$upcoming_summit = Summit::ActiveSummit();
if ($upcoming_summit) {
return $this->getSummitAttendee($upcoming_summit->ID);
}
return null;
}
示例13: CurrentSummit
public function CurrentSummit()
{
$current_summit = Summit::CurrentSummit();
if (is_null($current_summit)) {
$current_summit = $this->UpcomingSummit();
}
return $current_summit;
}
示例14: up
function up()
{
echo "Starting Migration Proc ...<BR>";
//check if migration already had ran ...
$migration = Migration::get()->filter('Name', $this->title)->first();
$promo_code_type = isset($_REQUEST['promo_code_type']) ? intval($_REQUEST['promo_code_type']) : null;
$promo_code_file = isset($_REQUEST['promo_code_file']) ? $_REQUEST['promo_code_file'] : null;
if (is_null($promo_code_type)) {
echo 'ERROR - promo_code_type param missing!';
exit;
}
if (is_null($promo_code_file)) {
echo 'ERROR - promo_code_file param missing!';
exit;
}
$base_path = ASSETS_PATH;
$file_path = $base_path . '/' . $promo_code_file;
$type = explode(".", $file_path);
if (!strtolower(end($type)) == 'csv') {
echo 'ERROR - file hast not a csv extension!';
exit;
}
if (!file_exists($file_path)) {
echo sprintf('ERROR - %s file does not exists!', $file_path);
exit;
}
$reader = new CSVReader($file_path);
$row = 0;
do {
$line = $reader->getLine();
if ($line) {
++$row;
if ($row === 1) {
continue;
}
// skip header ...
switch ($promo_code_type) {
case 1:
$type = 'ACCEPTED';
break;
case 2:
$type = 'ALTERNATE';
break;
}
$code = new SpeakerSummitRegistrationPromoCode();
$code->Code = $line[0];
$code->Type = $type;
$code->SummitID = Summit::get_active()->ID;
try {
$code->write();
} catch (Exception $ex) {
SS_Log::log($ex->getMessage(), SS_Log::ERR);
}
}
} while ($line);
echo "Ending Migration Proc ...<BR>";
}
示例15: send
/**
* @param $subject
* @throws InvalidArgumentException
* @return void
*/
public function send($subject)
{
$email_template = PermamailTemplate::get_by_identifier(SUMMIT_ATTENDEE_CREATE_MEMBERSHIP_INVITATION_EMAIL_TEMPLATE);
if (is_null($email_template)) {
return;
}
$email = EmailFactory::getInstance()->buildEmail(null, $subject);
$email->setUserTemplate('summit-attendee-create-membership-invitation')->populateTemplate(array('Email' => $subject, 'Summit' => Summit::get_active()))->send();
}
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:14,代码来源:SummitAttendeeCreateMembershipAnnouncementEmailSender.php