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


PHP CategoryPeer::doSelectOne方法代码示例

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


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

示例1: getOneForExpertCategoryUserId

 static function getOneForExpertCategoryUserId($user_id)
 {
     $c = new Criteria();
     $c->add(ExpertCategoryPeer::USER_ID, $user_id);
     $c->addJoin(ExpertCategoryPeer::CATEGORY_ID, CategoryPeer::ID);
     return CategoryPeer::doSelectOne($c);
 }
开发者ID:rayku,项目名称:rayku,代码行数:7,代码来源:CategoryPeer.php

示例2: execute


//.........这里部分代码省略.........
     }
     $queryPoints = mysql_query("select * from user where id=" . $userId) or die("Error In rate" . mysql_error());
     if (mysql_num_rows($queryPoints) > 0) {
         $rowPoints = mysql_fetch_assoc($queryPoints);
         $_points = $rowPoints['points'];
     }
     $c = new Criteria();
     $c->addJoin(ExpertCategoryPeer::USER_ID, UserTutorPeer::USERID, Criteria::INNER_JOIN);
     if ($this->cat == 5) {
         $experts = ExpertCategoryPeer::doSelect($c);
     } else {
         $c->add(ExpertCategoryPeer::CATEGORY_ID, $this->cat);
         $experts = ExpertCategoryPeer::doSelect($c);
     }
     $newUser = array();
     $i = 0;
     $eachExpertOnlyOnce = array();
     foreach ($experts as $exp) {
         if (in_array($exp->getUserId(), $eachExpertOnlyOnce)) {
             continue;
         }
         $eachExpertOnlyOnce[] = $exp->getUserId();
         $_queryCourse = mysql_query("select * from expert_course where user_id =" . $exp->getUserId() . " and category_id = 1 and course_id = " . $this->course_id . " ") or die("Er-1-->" . mysql_error());
         if (mysql_num_rows($_queryCourse) > 0) {
             $query = mysql_query("select * from user_score where user_id=" . $exp->getUserId()) or die(mysql_error());
             $score = mysql_fetch_assoc($query);
             if ($score['score'] != 0) {
                 if (false) {
                     //$_points == '' || $_points == '0.00'     Temporary hack
                     $emptyRCquery = mysql_query("select * from user_rate where userid=" . $exp->getUserId() . " and (rate = 0.00 || rate = 0) ") or die("Error In rate" . mysql_error());
                     if (mysql_num_rows($emptyRCquery) > 0) {
                         $dv = new Criteria();
                         $dv->add(UserPeer::ID, $exp->getUserId());
                         $_thisUser = UserPeer::doSelectOne($dv);
                         $newUser[$i] = array("score" => $score['score'], "userid" => $exp->getUserId(), "category" => $this->cat, "createdat" => $_thisUser->getCreatedAt());
                         $i++;
                     }
                 } else {
                     $dv = new Criteria();
                     $dv->add(UserPeer::ID, $exp->getUserId());
                     $_thisUser = UserPeer::doSelectOne($dv);
                     $newUser[$i] = array("score" => $score['score'], "userid" => $exp->getUserId(), "category" => $this->cat, "createdat" => $_thisUser->getCreatedAt());
                     $i++;
                 }
             }
         }
     }
     asort($newUser);
     arsort($newUser);
     $this->rankCheckUsers = $newUser;
     ////if no online expert available redirecting to the board page
     $onlineusers = array();
     $offlineusers = array();
     $newOnlineUser = array();
     $newOfflineUser = array();
     $j = 0;
     $k = 0;
     $facebookResponse = BotServiceProvider::createFor(sfConfig::get('app_facebook_url') . "/tutor")->getContent();
     $facebookUsers = json_decode($facebookResponse, true);
     $botResponse = BotServiceProvider::createFor(sfConfig::get('app_notification_bot_url') . "/tutor")->getContent();
     $botUsers = json_decode($botResponse, true);
     foreach ($newUser as $new) {
         $a = new Criteria();
         $a->add(UserPeer::ID, $new['userid']);
         $users_online = UserPeer::doSelectOne($a);
         $onlinecheck = '';
开发者ID:rayku,项目名称:rayku,代码行数:67,代码来源:indexAction.class.php

示例3: getCategory

 public function getCategory(PropelPDO $con = null)
 {
     if ($this->aCategory === null && $this->category_id !== null) {
         $c = new Criteria(CategoryPeer::DATABASE_NAME);
         $c->add(CategoryPeer::ID, $this->category_id);
         $this->aCategory = CategoryPeer::doSelectOne($c, $con);
     }
     return $this->aCategory;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:9,代码来源:BaseArticle.php

示例4: sfTestFunctional

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
$app = 'frontend';
$fixtures = 'fixtures/fixtures.yml';
if (!(include dirname(__FILE__) . '/../bootstrap/functional.php')) {
    return;
}
$b = new sfTestFunctional(new sfBrowser(), null, array('propel' => 'sfTesterPropel'));
ArticlePeer::doDeleteAll();
$c = CategoryPeer::doSelectOne(new Criteria());
$hash = spl_object_hash($c);
$b->get('/pooling/addArticleButDontSave/category_id/' . $c->getId())->with('propel')->check('Article', null, 0)->get('/pooling/addArticleAndSave/category_id/' . $c->getId())->with('propel')->check('Article', null, 1);
开发者ID:kcornejo,项目名称:estadistica,代码行数:19,代码来源:poolingTest.php

示例5: execute

 public function execute($request)
 {
     $connection = RaykuCommon::getDatabaseConnection();
     $logedUserId = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id'];
     $currentUser = $this->getUser()->getRaykuUser();
     $userId = $currentUser->getId();
     $this->userId = $currentUser->getId();
     $time = time();
     if (empty($_SESSION["course_id"])) {
         $_SESSION["course_id"] = '1';
     }
     $this->cat = $this->getRequestParameter('category');
     $this->course_id = $this->getRequestParameter('course');
     if (empty($this->course_id)) {
         if (!empty($_SESSION['course_id'])) {
             $this->course_id = $_SESSION['course_id'];
         } else {
             $this->course_id = 1;
         }
     } else {
         $_SESSION['course_id'] = $this->course_id;
     }
     if (empty($this->cat)) {
         if (!empty($_SESSION['subject'])) {
             $this->cat = $_SESSION['subject'];
         } else {
             $this->cat = 1;
         }
     } else {
         $_SESSION['subject'] = $this->cat;
     }
     $logedUserId = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id'];
     $c = new Criteria();
     $c->addJoin(ExpertCategoryPeer::USER_ID, UserTutorPeer::USERID, Criteria::INNER_JOIN);
     if ($this->cat == 5) {
         $experts = ExpertCategoryPeer::doSelect($c);
     } else {
         $c->add(ExpertCategoryPeer::CATEGORY_ID, $this->cat);
         $experts = ExpertCategoryPeer::doSelect($c);
     }
     $queryPoints = mysql_query("select * from user where id = " . $userId, $connection) or die("Error In rate" . mysql_error());
     if (mysql_num_rows($queryPoints) > 0) {
         $rowPoints = mysql_fetch_assoc($queryPoints);
         $_points = $rowPoints['points'];
     }
     $newUser = array();
     $i = 0;
     $eachExpertOnlyOnce = array();
     foreach ($experts as $exp) {
         if ($userId != $exp->getUserId()) {
             if (in_array($exp->getUserId(), $eachExpertOnlyOnce)) {
                 continue;
             }
             $eachExpertOnlyOnce[] = $exp->getUserId();
             /* Testing - Student match with Tutors */
             $_queryCourse = '';
             $tutorsq = mysql_query("select * from tutor_profile where category = 1 and user_id = " . $exp->getUserId() . "", $connection) or die("Er-1-->" . mysql_error());
             $tutors = mysql_fetch_array($tutorsq);
             $tutor = '';
             $tutor = explode("-", $tutors['course_id']);
             if (in_array($_SESSION["course_id"], $tutor)) {
                 $_queryCourse = mysql_query("select * from tutor_profile where category = 1 and user_id = " . $exp->getUserId() . "", $connection) or die("Er-1-->" . mysql_error());
                 //echo "select * from tutor_profile where category = 1 and user_id = ".$exp->getUserId()."";
             }
             if (@mysql_num_rows($_queryCourse) > 0) {
                 $query = mysql_query("select * from user_score where user_id = " . $exp->getUserId(), $connection) or die(mysql_error());
                 $score = mysql_fetch_assoc($query);
                 if ($score['score'] != 0) {
                     if ($_points == '' || $_points == '0.00') {
                         $emptyRCquery = mysql_query("select * from user_rate where userid = " . $exp->getUserId() . " and (rate = 0.00 || rate = 0) ", $connection) or die("Error In rate" . mysql_error());
                         if (mysql_num_rows($emptyRCquery) > 0) {
                             $dv = new Criteria();
                             $dv->add(UserPeer::ID, $exp->getUserId());
                             $_thisUser = UserPeer::doSelectOne($dv);
                             $rankUsersFinal[$i] = array("score" => $score['score'], "userid" => $exp->getUserId(), "category" => $this->cat, "createdat" => $_thisUser->getCreatedAt());
                             $newUser[$i] = array("score" => $score['score'], "userid" => $exp->getUserId(), "category" => $this->cat, "createdat" => $_thisUser->getCreatedAt());
                             $i++;
                         }
                     } else {
                         $dv = new Criteria();
                         $dv->add(UserPeer::ID, $exp->getUserId());
                         $_thisUser = UserPeer::doSelectOne($dv);
                         $rankUsersFinal[$i] = array("score" => $score['score'], "userid" => $exp->getUserId(), "category" => $this->cat, "createdat" => $_thisUser->getCreatedAt());
                         $newUser[$i] = array("score" => $score['score'], "userid" => $exp->getUserId(), "category" => $this->cat, "createdat" => $_thisUser->getCreatedAt());
                         $i++;
                     }
                 }
             }
         }
     }
     asort($newUser);
     arsort($newUser);
     asort($rankUsersFinal);
     arsort($rankUsersFinal);
     $this->rankCheckUsers = $rankUsersFinal;
     ////if no online expert available redirecting to the board page
     // // ant-edit remove for now
     $onlineusers = array();
     $offlineusers = array();
     $newOnlineUser = array();
//.........这里部分代码省略.........
开发者ID:rayku,项目名称:rayku,代码行数:101,代码来源:appendAction.class.php

示例6: execute

 public function execute($request)
 {
     $connection = RaykuCommon::getDatabaseConnection();
     $logedUserId = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id'];
     $currentUser = $this->getUser()->getRaykuUser();
     $userId = $currentUser->getId();
     $this->userId = $currentUser->getId();
     $time = time();
     $this->cat = $this->getRequestParameter('category');
     $this->course_id = $this->getRequestParameter('course');
     if (empty($this->course_id)) {
         if (!empty($_SESSION['course_id'])) {
             $this->course_id = $_SESSION['course_id'];
         } else {
             $this->course_id = 1;
         }
     } else {
         $_SESSION['course_id'] = $this->course_id;
     }
     if (empty($this->cat)) {
         if (!empty($_SESSION['subject'])) {
             $this->cat = $_SESSION['subject'];
         } else {
             $this->cat = 1;
         }
     } else {
         $_SESSION['subject'] = $this->cat;
     }
     if (empty($_SESSION["course_id"])) {
         $_SESSION["course_id"] = '1';
     }
     /* Quick Registration Users - Listing Tutors */
     if ($this->studentFromQuickRegistrationAskingAQuestion()) {
         $_dash_question = '';
         $_dash_course_id = '';
         $_school = '';
         $_dash_education = '';
         $_dash_code_id = '';
         $_dash_year = '';
         $_SESSION['subject'] = 1;
         $_dash_education = $_SESSION['edu'];
         $_dash_course_id = $_SESSION['course_id'];
         if ($_dash_course_id) {
             $queryCname = mysql_query("select * from courses where id ='" . $_dash_course_id . "'", $connection) or die(mysql_error());
             $rowCoursename = mysql_fetch_array($queryCname);
             $_SESSION['course_name_sess'] = $rowCoursename['course_name'];
         }
         if (strtolower($_SESSION['year']) != "Choose year") {
             $_dash_year = trim($_SESSION['year']);
         } elseif (strtolower($_SESSION['grade']) != "Choose grade") {
             $_dash_year = trim($_SESSION['grade']);
         }
         $c = new Criteria();
         $c->add(UserQuestionTagPeer::CATEGORY_ID, 1);
         $c->add(UserQuestionTagPeer::USER_ID, $userId);
         $c->add(UserQuestionTagPeer::COURSE_ID, $_dash_course_id);
         $c->add(UserQuestionTagPeer::COURSE_CODE, $_dash_code_id);
         $c->add(UserQuestionTagPeer::EDUCATION, $_dash_education);
         $c->add(UserQuestionTagPeer::SCHOOL, $_school);
         $c->add(UserQuestionTagPeer::YEAR, $_dash_year);
         $userQuestionTag = UserQuestionTagPeer::doSelectOne($c);
         if ($userQuestionTag) {
             $userQuestionTag->delete();
         }
         $userQuestionTag = new UserQuestionTag();
         $userQuestionTag->setUserId($userId);
         $userQuestionTag->setCategoryId(1);
         $userQuestionTag->setCourseId($_dash_course_id);
         $userQuestionTag->setCourseCode($_dash_code_id);
         $userQuestionTag->setEducation($_dash_education);
         $userQuestionTag->setSchool($_school);
         $userQuestionTag->setYear($_dash_year);
         $userQuestionTag->setQuestion($_SESSION['question']);
         $userQuestionTag->save();
     } else {
         if ($this->loggedStudentAsksAQuestion()) {
             $_dash_question = '';
             $_dash_course_id = '';
             $_school = '';
             $_dash_education = '';
             $_dash_code_id = '';
             $_dash_year = '';
             $_dash_question = $_POST['question'];
             $_SESSION['question'] = $_dash_question;
             $_SESSION['subject'] = 1;
             if (!empty($_POST['course_category_hidden'])) {
                 $course_name = trim($_POST['course_category_hidden']);
                 $_SESSION['course_name_sess'] = $course_name;
                 $_queryCourse = mysql_query("select * from courses where course_name ='" . $course_name . "' ", $connection) or die(mysql_error());
                 $_rowCourse = mysql_fetch_assoc($_queryCourse);
                 $_dash_course_id = $_rowCourse['id'];
                 $_SESSION["course_id"] = $_dash_course_id;
             }
             $_dash_education = $_POST['edu'];
             /* Student Confirmation */
             $_SESSION['edu'] = $_dash_education;
             if (strtolower($_POST['year_hidden']) != "choose year") {
                 $_dash_year = trim($_POST['year_hidden']);
                 /* student confirmation */
                 $_SESSION['year'] = $_dash_year;
//.........这里部分代码省略.........
开发者ID:rayku,项目名称:rayku,代码行数:101,代码来源:listAction.class.php

示例7: link_to

    /*$c=new Criteria();
      $c->add(PostPeer::THREAD_ID,$latestqn->getId());
      $post=PostPeer::doSelectOne($c); */
    ?>
      <?php 
    echo link_to($latestqn->getTitle(), '@view_thread?thread_id=' . $latestqn->getId() . '&page=1', array('class' => 'question', 'style' => 'background-repeat:no-repeat'));
    ?>
      <?php 
    $co = new Criteria();
    $co->add(PostPeer::THREAD_ID, $latestqn->getId());
    $replycount = PostPeer::doCount($co);
    ?>
      <?php 
    $fo = new Criteria();
    $fo->add(CategoryPeer::ID, $latestqn->getCategoryId());
    $categorie = CategoryPeer::doSelectOne($fo);
    ?>
      <?php 
    $u = new Criteria();
    $u->add(UserPeer::ID, $latestqn->getPosterId());
    $user = UserPeer::doSelectOne($u);
    ?>
      <div class="det"> <span> <?php 
    echo $replycount - 1;
    ?>
 Responses </span><br />
        Question Asked by <?php 
    echo link_to($user->getName(), sfConfig::get('app_rayku_url') . '/expertmanager/portfolio/' . $user->getUsername());
    ?>
 </div>
      <?php 
开发者ID:rayku,项目名称:rayku,代码行数:31,代码来源:indexSuccess.php

示例8: getCategory

 /**
  * Get the associated Category object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Category The associated Category object.
  * @throws     PropelException
  */
 public function getCategory(PropelPDO $con = null)
 {
     if ($this->aCategory === null && $this->category_id !== null) {
         $c = new Criteria(CategoryPeer::DATABASE_NAME);
         $c->add(CategoryPeer::ID, $this->category_id);
         $this->aCategory = CategoryPeer::doSelectOne($c, $con);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aCategory->addUserQuestionTags($this);
         		 */
     }
     return $this->aCategory;
 }
开发者ID:rayku,项目名称:rayku,代码行数:23,代码来源:BaseUserQuestionTag.php


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