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


PHP CategoryPeer::retrieveByPk方法代码示例

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


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

示例1: executeView

 public function executeView(sfWebRequest $request)
 {
     $category = CategoryPeer::retrieveByName($request->getParameter('category_name'));
     $this->forward404Unless($category);
     if ($category->getParentId() != 0) {
         $this->parentCategory = CategoryPeer::retrieveByPk($category->getParentId());
     } else {
         $this->subCategorys = CategoryPeer::getAllSub($category->getId());
     }
     $c = new Criteria();
     if (isset($this->subCategorys)) {
         $subCategoryIds = array();
         foreach ($this->subCategorys[$category->getId()] as $sub) {
             $subCategoryIds[] = $sub->getId();
         }
         $subCategoryIds[] = $category->getId();
         $c->add(ElementPeer::CATEGORY_ID, $subCategoryIds, Criteria::IN);
     } else {
         $c->add(ElementPeer::CATEGORY_ID, $category->getId());
     }
     $this->pager = new sfPropelPager('Element', 10);
     $this->pager->setPeerMethod('doSelectJoinAll');
     $this->pager->setCriteria($c);
     $this->pager->setPage($this->getRequestParameter('page'), 1);
     $this->pager->init();
     $this->elements = $this->pager->getResults();
     $this->category = $category;
 }
开发者ID:Chipusy,项目名称:lkbroker,代码行数:28,代码来源:actions.class.php

示例2: getParent

 public function getParent()
 {
     if ($this->getParentId() != 0) {
         return CategoryPeer::retrieveByPk($this->getParentId());
     }
     return false;
 }
开发者ID:Chipusy,项目名称:lkbroker,代码行数:7,代码来源:Category.php

示例3: executeCategory

 public function executeCategory($request)
 {
     $category = CategoryPeer::retrieveByPk($request->getParameter('category[id]'));
     $this->form = new CategoryForm($category);
     if ($request->getParameter('global')) {
         $this->form->getValidatorSchema()->getPostValidator()->setOption('throw_global_error', true);
     }
     if ($request->isMethod(sfRequest::POST)) {
         $this->form->bind($request->getParameter('category'));
         if ($this->form->isValid()) {
             $this->form->save();
             $this->redirect('unique/ok');
         }
     }
 }
开发者ID:laiello,项目名称:tesiscdfeg12,代码行数:15,代码来源:actions.class.php

示例4: 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) {
         $this->aCategory = CategoryPeer::retrieveByPk($this->category_id);
         /* 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->addArticles($this);
         		 */
     }
     return $this->aCategory;
 }
开发者ID:omarcl,项目名称:training-spot,代码行数:21,代码来源:BaseArticle.php

示例5: execute

 public function execute($request)
 {
     $connection = RaykuCommon::getDatabaseConnection();
     if (@$_SESSION['modelPopupOpen']) {
         if (@$_SESSION['popup_session']) {
             $_now = time();
             $_remain_time = $_now - $_SESSION['popup_session'];
             if ($_remain_time < 20) {
                 return $this->renderText('redirect');
             }
         } else {
             return $this->renderText('redirect');
         }
     }
     /* @var $currentUser User */
     $currentUser = $this->getUser()->getRaykuUser();
     $userId = $currentUser->getId();
     $time = time() - 300;
     $query = mysql_query($s = "select * from user_expert where checked_id = " . $userId . " and exe_order = 1 and time >= " . $time . "", $connection) or die(mysql_error());
     if (mysql_num_rows($query) > 0) {
         $row = mysql_fetch_assoc($query);
         if ($row['category_id']) {
             $category = CategoryPeer::retrieveByPk($row['category_id']);
             $subject = $category->getName();
         }
         //School Selection
         $usr_school_query = mysql_query("select * from user_expert where user_id = " . $row['user_id'] . "", $connection);
         $usr_school = mysql_fetch_array($usr_school_query);
         $school = $usr_school['school'];
         $length = strlen(trim($row['question']));
         if ($length <= 200) {
             $question = $row['question'];
         } else {
             $question = substr(trim($row['question']), 0, 200);
         }
         $x = new Criteria();
         $x->add(UserPeer::ID, $row['checked_id']);
         $newloginId = UserPeer::doSelectOne($x);
         $raykuCharge = $currentUser->getRate();
         mysql_query("update user_expert set status = 0 where id = " . $row['id'] . " ", $connection) or die(mysql_error());
         //User Course Info
         $usr_course_query = mysql_query("select * from user_expert as u join courses as c on u.course_id = c.id where u.user_id = " . $row['user_id'] . "", $connection);
         $usr_course = mysql_fetch_array($usr_course_query);
         if (!empty($usr_course['year']) && !empty($usr_course['course_code'])) {
             $course_info = $usr_course['course_name'] . ' | ' . $usr_course['year'] . ' | ' . $usr_course['course_code'];
         } else {
             $course_info = $usr_course['course_name'];
         }
         $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
         $browser = "others";
         if (eregi("(Chrome/)", $HTTP_USER_AGENT) == true) {
             $browser = "chrome";
         }
         if (eregi("(Safari/)", $HTTP_USER_AGENT) == true) {
             $browser = "safari";
         }
         $_SESSION["_modelbox"] = @$_SESSION["_modelbox"] + 1;
         $criteria = new Criteria();
         $criteria->add(StudentQuestionPeer::USER_ID, $row['user_id']);
         $criteria->add(StudentQuestionPeer::CHECKED_ID, $row['checked_id']);
         $criteria->add(StudentQuestionPeer::TIME, $time, '>=');
         $studentQuestion = StudentQuestionPeer::doSelectOne($criteria);
         if (!$studentQuestion) {
             exit;
         }
         $studentQuestion->setStatus(0);
         $studentQuestion->save();
         @setcookie('_popupclose', 1, time() + 300, '/', sfConfig::get('app_cookies_domain'));
         echo join('-', array($studentQuestion->getTutor()->getId(), $studentQuestion->getStudent()->getId(), base64_encode($studentQuestion->getQuestion()), $school, $subject, $course_info, $row['id'], $newloginId->getName(), "expert", $raykuCharge, $row['close'], $browser, $_SESSION["_modelbox"], $studentQuestion->getId()));
     }
     exit(0);
 }
开发者ID:rayku,项目名称:rayku,代码行数:72,代码来源:mapuserAction.class.php


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