|
Revision 18, 1.4 kB
(checked in by fabien, 7 years ago)
|
day 7 modifications
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
require_once 'model/om/BaseQuestionPeer.php'; |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
include_once 'model/Question.php'; |
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
class QuestionPeer extends BaseQuestionPeer |
|---|
| 22 |
{ |
|---|
| 23 |
public static function getQuestionFromTitle($title) |
|---|
| 24 |
{ |
|---|
| 25 |
$c = new Criteria(); |
|---|
| 26 |
$c->add(self::STRIPPED_TITLE, $title); |
|---|
| 27 |
|
|---|
| 28 |
$questions = self::doSelectJoinUser($c); |
|---|
| 29 |
|
|---|
| 30 |
return $questions ? $questions[0] : null; |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
public static function getHomepagePager($page) |
|---|
| 34 |
{ |
|---|
| 35 |
$pager = new sfPager('Question', APP_PAGER_HOMEPAGE_MAX); |
|---|
| 36 |
$c = new Criteria(); |
|---|
| 37 |
$c->addDescendingOrderByColumn(self::INTERESTED_USERS); |
|---|
| 38 |
$pager->setCriteria($c); |
|---|
| 39 |
$pager->setPage($page); |
|---|
| 40 |
$pager->setPeerMethod('doSelectJoinUser'); |
|---|
| 41 |
$pager->init(); |
|---|
| 42 |
|
|---|
| 43 |
return $pager; |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
public static function getRecentPager($page) |
|---|
| 47 |
{ |
|---|
| 48 |
$pager = new sfPager('Question', APP_PAGER_HOMEPAGE_MAX); |
|---|
| 49 |
$c = new Criteria(); |
|---|
| 50 |
$c->addDescendingOrderByColumn(self::CREATED_AT); |
|---|
| 51 |
$pager->setCriteria($c); |
|---|
| 52 |
$pager->setPage($page); |
|---|
| 53 |
$pager->setPeerMethod('doSelectJoinUser'); |
|---|
| 54 |
$pager->init(); |
|---|
| 55 |
|
|---|
| 56 |
return $pager; |
|---|
| 57 |
} |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
?> |
|---|