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


PHP Contest::getId方法代码示例

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


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

示例1: getFormFields

 /**
  * Gets the field definitions for the form.
  *
  * @since 0.1
  *
  * @param Contest $contest
  * @param integer|false $challengeId
  * @return array
  */
 protected function getFormFields(Contest $contest, $challengeId)
 {
     $fields = array();
     $user = $this->getUser();
     $fields['contest-id'] = array('type' => 'hidden', 'default' => $contest->getId(), 'id' => 'contest-id');
     $fields['contestant-realname'] = array('type' => 'text', 'default' => $user->getRealName(), 'label-message' => 'contest-signup-realname', 'required' => true, 'validation-callback' => array(__CLASS__, 'validateNameField'));
     $fields['contestant-email'] = array('type' => 'text', 'default' => $user->getEmail(), 'label-message' => 'contest-signup-email', 'required' => true, 'validation-callback' => array(__CLASS__, 'validateEmailField'));
     $fields['contestant-country'] = array('type' => 'select', 'label-message' => 'contest-signup-country', 'required' => true, 'options' => ContestContestant::getCountriesForInput(true), 'validation-callback' => array(__CLASS__, 'validateCountryField'));
     $fields['contestant-challengeid'] = array('type' => 'radio', 'label-message' => 'contest-signup-challenge', 'options' => $this->getChallengesList($contest), 'required' => true, 'validation-callback' => array(__CLASS__, 'validateChallengeField'));
     if ($challengeId !== false) {
         $fields['contestant-challengeid']['default'] = $challengeId;
     }
     $fields['contestant-volunteer'] = array('type' => 'check', 'default' => '0', 'label-message' => 'contest-signup-volunteer');
     $fields['contestant-wmf'] = array('type' => 'check', 'default' => '0', 'label-message' => 'contest-signup-wmf');
     $fields['contestant-readrules'] = array('type' => 'check', 'default' => '0', 'label-message' => array('contest-signup-readrules', $contest->getField('rules_page')), 'validation-callback' => array(__CLASS__, 'validateRulesField'), 'id' => 'contest-rules', 'data-foo' => 'bar');
     return $fields;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:26,代码来源:SpecialContestSignup.php

示例2: testMultiColJoin

 /**
  * Testing foreign keys with multiple referrer columns.
  * @link       http://propel.phpdb.org/trac/ticket/606
  */
 public function testMultiColJoin()
 {
     BookstoreContestPeer::doDeleteAll();
     BookstoreContestEntryPeer::doDeleteAll();
     $bs = new Bookstore();
     $bs->setStoreName("Test1");
     $bs->setPopulationServed(5);
     $bs->save();
     $bs1Id = $bs->getId();
     $bs2 = new Bookstore();
     $bs2->setStoreName("Test2");
     $bs2->setPopulationServed(5);
     $bs2->save();
     $bs2Id = $bs2->getId();
     $ct1 = new Contest();
     $ct1->setName("Contest1!");
     $ct1->save();
     $ct1Id = $ct1->getId();
     $ct2 = new Contest();
     $ct2->setName("Contest2!");
     $ct2->save();
     $ct2Id = $ct2->getId();
     $cmr = new Customer();
     $cmr->setName("Customer1");
     $cmr->save();
     $cmr1Id = $cmr->getId();
     $cmr2 = new Customer();
     $cmr2->setName("Customer2");
     $cmr2->save();
     $cmr2Id = $cmr2->getId();
     $contest = new BookstoreContest();
     $contest->setBookstoreId($bs1Id);
     $contest->setContestId($ct1Id);
     $contest->save();
     $contest = new BookstoreContest();
     $contest->setBookstoreId($bs2Id);
     $contest->setContestId($ct1Id);
     $contest->save();
     $entry = new BookstoreContestEntry();
     $entry->setBookstoreId($bs1Id);
     $entry->setContestId($ct1Id);
     $entry->setCustomerId($cmr1Id);
     $entry->save();
     $entry = new BookstoreContestEntry();
     $entry->setBookstoreId($bs1Id);
     $entry->setContestId($ct1Id);
     $entry->setCustomerId($cmr2Id);
     $entry->save();
     // Note: this test isn't really working very well.  We setup fkeys that
     // require that the BookstoreContest rows exist and then try to violate
     // the rules ... :-/  This may work in some lenient databases, but an error
     // is expected here.
     /*
      * Commented out for now ... though without it, this test may not really be testing anything
     $entry = new BookstoreContestEntry();
     $entry->setBookstoreId($bs1Id);
     $entry->setContestId($ct2Id);
     $entry->setCustomerId($cmr2Id);
     $entry->save();
     */
     $c = new Criteria();
     $c->addJoin(array(BookstoreContestEntryPeer::BOOKSTORE_ID, BookstoreContestEntryPeer::CONTEST_ID), array(BookstoreContestPeer::BOOKSTORE_ID, BookstoreContestPeer::CONTEST_ID));
     $results = BookstoreContestEntryPeer::doSelect($c);
     $this->assertEquals(2, count($results));
     foreach ($results as $result) {
         $this->assertEquals($bs1Id, $result->getBookstoreId());
         $this->assertEquals($ct1Id, $result->getContestId());
     }
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:73,代码来源:GeneratedPeerDoSelectTest.php

示例3: showContestants

 /**
  * Show a paged list of the contestants foe this contest.
  *
  * @since 0.1
  *
  * @param Contest $contest
  * @param string|false $challengeTitle
  */
 protected function showContestants(Contest $contest, $challengeTitle)
 {
     $out = $this->getOutput();
     $out->addWikiMsg('contest-contest-contestants-text');
     $conds = array('contestant_contest_id' => $contest->getId());
     $this->addRequestConditions($conds);
     $pager = new ContestantPager($this, $conds);
     if ($pager->getNumRows()) {
         $out->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar());
     } else {
         $out->addWikiMsg('contest-contest-no-results');
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:21,代码来源:SpecialContest.php

示例4: handleEnabledPage

 /**
  * Handle page request when the contest is enabled.
  *
  * @since 0.1
  *
  * @param Contest $contest
  */
 protected function handleEnabledPage(Contest $contest)
 {
     // Check if the user is already a contestant in this contest.
     // If he is, redirect to submission page, else show signup form.
     $contestant = ContestContestant::s()->selectRow(null, array('contest_id' => $contest->getId(), 'user_id' => $this->getUser()->getId()));
     if ($contestant === false) {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('ContestSignup', $contest->getField('name'))->getLocalURL());
     } else {
         $contestant->setContest($contest);
         $this->showSubmissionPage($contestant);
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:19,代码来源:SpecialMyContests.php

示例5: showEnabledPage

 protected function showEnabledPage(Contest $contest)
 {
     $out = $this->getOutput();
     $alreadySignedup = $this->getUser()->isLoggedIn();
     if ($alreadySignedup) {
         // Check if the user is already a contestant in this contest.
         // If he is, reirect to submission page, else show signup form.
         $alreadySignedup = ContestContestant::s()->selectRow('id', array('contest_id' => $contest->getId(), 'user_id' => $this->getUser()->getId())) !== false;
     }
     if ($alreadySignedup) {
         $out->redirect(SpecialPage::getTitleFor('MyContests', $contest->getField('name'))->getLocalURL());
     } else {
         $out->setPageTitle($contest->getField('name'));
         $this->showIntro($contest);
         $this->showChallenges($contest);
         $this->showOpportunities($contest);
         $this->showRules($contest);
         $out->addModules('contest.special.welcome');
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:20,代码来源:SpecialContestWelcome.php


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