当前位置: 首页>>代码示例>>PHP>>正文


PHP Summit::get_active方法代码示例

本文整理汇总了PHP中Summit::get_active方法的典型用法代码示例。如果您正苦于以下问题:PHP Summit::get_active方法的具体用法?PHP Summit::get_active怎么用?PHP Summit::get_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Summit的用法示例。


在下文中一共展示了Summit::get_active方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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');
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:29,代码来源:PresentationAPI.php

示例3: 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);
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:36,代码来源:SummitEventSetAvgRate.php

示例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;
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:34,代码来源:SpeakerSelectionAnnouncementEmailSenderFactory.php

示例5: 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();
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:36,代码来源:PresentationPage.php

示例6: send

 /**
  * @param IEntity $subject
  * @throws InvalidArgumentException
  * @return void
  */
 public function send(IEntity $subject)
 {
     if (!$subject instanceof IPresentationSpeaker) {
         return;
     }
     $subject->registerAnnouncementEmailTypeSent(IPresentationSpeaker::AnnouncementEmailAlternate);
     $email = EmailFactory::getInstance()->buildEmail('speakersupport@openstack.org', $subject->getEmail());
     $email->setUserTemplate('presentation-speaker-alternate-only')->populateTemplate(array('Speaker' => $subject, 'ConfirmationLink' => $subject->getSpeakerConfirmationLink(), 'ScheduleMainPageLink' => Summit::get_active()->SchedUrl, 'PromoCode' => $subject->getSummitPromoCode()->getCode()))->send();
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:14,代码来源:PresentationSpeakerAlternateAnnouncementEmailSender.php

示例7: getPresentationFields

 protected function getPresentationFields()
 {
     $categorySource = Summit::get_active()->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()->tinyMCEEditor('Description', 'Abstract')->configure()->setRows(20)->end()->literal('ShortDescriptionHelp', '<hr/><p>YouTube and other services limit the length of your presentation\'s description. Please provide a shorter, YouTube-friendly summary below.</p>')->literal('ShortDescriptionWordCount', '<p id="word-count"></p>')->tinyMCEEditor('ShortDescription', 'Short Description (450 Word Max)')->configure()->setRows(7)->setWordCount(450)->end()->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()->literal('TagHelp', '<p>You can optionally add tags help attendees find presentations that interest them. Examples: <i>nova, ubuntu, ldap.</i></p>')->bootstrapTag('Tags', 'Presentation Tags (Optional)')->configure()->setLabelField('Tag')->setSource(Tag::get())->setPrefetch(Tag::get()->leftJoin('Presentation_Tags', 'TagID = Tag.ID')->sort('COUNT(Tag.ID)', 'DESC')->limit(10)->alterDataQuery(function ($query) {
         $query->groupby('Tag.ID');
     }))->setFreeInput(true)->end();
     return $fields;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:9,代码来源:PresentationForm.php

示例8: 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>";
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:57,代码来源:SummitPromoRegistrationCodesLoaderTask.php

示例9: 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

示例10: send

 /**
  * @param mixed $subject
  * @throws InvalidArgumentException
  * @return void
  */
 public function send($subject)
 {
     if (!$subject instanceof IPresentationSpeaker) {
         return;
     }
     $summit = Summit::get_active();
     $subject->registerAnnouncementEmailTypeSent(IPresentationSpeaker::AnnouncementEmailRejected, $summit->ID);
     $email = EmailFactory::getInstance()->buildEmail('summit@openstack.org', $subject->getEmail());
     $email->setUserTemplate('presentation-speaker-rejected-only')->populateTemplate(array('Speaker' => $subject))->send();
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:15,代码来源:PresentationSpeakerRejectedAnnouncementEmailSender.php

示例11: trackChairCheck

 function trackChairCheck()
 {
     $member = Member::currentUser();
     $chair = new SummitTrackChair();
     if ($member) {
         $chair = SummitTrackChair::get()->filter(array('MemberID' => $member->ID, 'SummitID' => Summit::get_active()->ID));
     }
     if ($chair->exists() || Permission::check('ADMIN')) {
         return true;
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:11,代码来源:TrackChairsPage.php

示例12: send

 /**
  * @param $subject
  * @throws InvalidArgumentException
  * @return void
  */
 public function send($subject)
 {
     if (!$subject instanceof ISummitAttendee) {
         return;
     }
     $email_template = PermamailTemplate::get_by_identifier(SUMMIT_ATTENDEE_CREATED_EMAIL_TEMPLATE);
     if (is_null($email_template)) {
         return;
     }
     $email = EmailFactory::getInstance()->buildEmail(null, $subject->getMember()->getEmail());
     $email->setUserTemplate('summit-attendee-created')->populateTemplate(array('Attendee' => $subject, 'Summit' => Summit::get_active()))->send();
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:17,代码来源:SummitAttendeeCreatedAnnouncementEmailSender.php

示例13: __construct

 function __construct($controller, $name, $speakerHash)
 {
     $activeSummit = Summit::get_active();
     $PhoneField = new TextField('OnSitePhoneNumber', 'Your Onsite Phone Number for ' . $activeSummit->Title . ':');
     $RegisteredField = new CheckboxField('RegisteredForSummit', 'I have registered for the summit using the confirmation code sent in the email.');
     // Speaker Hash Field
     $SpeakerHashField = new HiddenField('speakerHash', "speakerHash", $speakerHash);
     $fields = new FieldList($PhoneField, $RegisteredField, $SpeakerHashField);
     $submitButton = new FormAction('doSavePhoneNumber', 'Save');
     $actions = new FieldList($submitButton);
     $validator = new RequiredFields('OnSitePhoneNumber');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:13,代码来源:OnsitePhoneForm.php

示例14: run

 /**
  *
  */
 public function run()
 {
     SapphireTransactionManager::getInstance()->transaction(function () {
         $unprocessedVideos = PresentationVideo::get()->filter(['Processed' => false])->limit(50);
         if (!$unprocessedVideos->exists()) {
             return;
         }
         $summit = Summit::get_active();
         $dateUTC = $summit->convertDateFromTimeZone2UTC(SS_DateTime::now()->Rfc2822());
         $dateUTCTimestamp = strtotime($dateUTC);
         $maxAge = SummitVideoApp::config()->abandon_unprocessed_videos_after;
         $ids = [];
         foreach ($unprocessedVideos as $video) {
             $age = $dateUTCTimestamp - strtotime($video->DateUploaded);
             if ($age > $maxAge) {
                 SS_Log::log("Video {$video->Title} has been unprocessed for a long time. ({$age} seconds). It should be deleted.", SS_Log::WARN);
                 continue;
             }
             $ids[] = $video->YouTubeID;
         }
         try {
             $response = $this->api->getVideoStatusById($ids);
         } catch (\Exception $e) {
             SS_Log::log("YouTube check for status failed" . $e->getMessage(), SS_Log::ERR);
             return;
         }
         $body = $response->getBody()->getContents();
         $data = Convert::json2array($body);
         $items = $data['items'];
         if (empty($items)) {
             echo "No videos are marked as processing. Exiting.\n";
             return;
         }
         foreach ($items as $item) {
             $currentStatus = $item['status']['uploadStatus'];
             if ($currentStatus == 'processed') {
                 $video = PresentationVideo::get()->filter(['YouTubeID' => $item['id']])->first();
                 if (!$video) {
                     SS_Log::log("Tried to update processing status for " . $item['id'] . " but no PresentationVideo with that YouTubeID was found.", SS_Log::WARN);
                     continue;
                 }
                 $video->Processed = true;
                 $video->write();
                 $this->videosUpdated++;
             }
         }
         echo "{$this->videosUpdated} videos updated.\n";
     });
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:52,代码来源:SummitVideoProcessingTask.php

示例15: getCMSFields

 public function getCMSFields()
 {
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', new HiddenField('OwnerID', 'OwnerID'));
     $f->addFieldsToTab('Root.Main', new TextField('ExternalOrderId', '#Order'));
     $f->addFieldsToTab('Root.Main', new TextField('ExternalAttendeeId', '#Attendee'));
     $f->addFieldsToTab('Root.Main', $date = new DatetimeField('TicketBoughtDate', 'Bought Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $f->addFieldsToTab('Root.Main', $date = new DatetimeField('TicketChangedDate', 'Changed Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $summit_id = $_REQUEST['SummitID'];
     if (empty($summit_id)) {
         $summit_id = $this->Owner()->exists() ? $this->Owner()->SummitID : Summit::get_active()->ID;
     }
     $f->addFieldsToTab('Root.Main', $ddl = new DropdownField('TicketTypeID', 'Ticket Type', SummitTicketType::get()->filter('SummitID', $summit_id)->map("ID", "Name")));
     return $f;
 }
开发者ID:hogepodge,项目名称:openstack-org,代码行数:17,代码来源:SummitAttendeeTicket.php


注:本文中的Summit::get_active方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。