- Timestamp:
- 12/06/05 12:05:10 (7 years ago)
- Files:
-
- trunk/frontend/config/routing.yml (modified) (1 diff)
- trunk/frontend/config/view.yml (modified) (2 diffs)
- trunk/frontend/modules/answer (added)
- trunk/frontend/modules/answer/actions (added)
- trunk/frontend/modules/answer/actions/actions.class.php (added)
- trunk/frontend/modules/answer/config (added)
- trunk/frontend/modules/answer/config/.sf (added)
- trunk/frontend/modules/answer/lib (added)
- trunk/frontend/modules/answer/lib/.sf (added)
- trunk/frontend/modules/answer/templates (added)
- trunk/frontend/modules/answer/templates/_list.php (added)
- trunk/frontend/modules/answer/templates/recentSuccess.php (added)
- trunk/frontend/modules/answer/validate (added)
- trunk/frontend/modules/answer/validate/.sf (added)
- trunk/frontend/modules/question/actions/actions.class.php (modified) (1 diff)
- trunk/frontend/modules/question/templates/recentSuccess.php (added)
- trunk/frontend/modules/question/templates/showSuccess.php (modified) (1 diff)
- trunk/frontend/modules/sidebar (added)
- trunk/frontend/modules/sidebar/actions (added)
- trunk/frontend/modules/sidebar/actions/actions.class.php (added)
- trunk/frontend/modules/sidebar/config (added)
- trunk/frontend/modules/sidebar/config/.sf (added)
- trunk/frontend/modules/sidebar/config/module.yml (added)
- trunk/frontend/modules/sidebar/lib (added)
- trunk/frontend/modules/sidebar/lib/.sf (added)
- trunk/frontend/modules/sidebar/templates (added)
- trunk/frontend/modules/sidebar/templates/defaultSuccess.php (added)
- trunk/frontend/modules/sidebar/validate (added)
- trunk/frontend/modules/sidebar/validate/.sf (added)
- trunk/frontend/modules/user/actions/actions.class.php (modified) (1 diff)
- trunk/frontend/modules/user/templates/listInterestedBySuccess.php (added)
- trunk/frontend/modules/user/templates/showSuccess.php (added)
- trunk/frontend/templates/layout.php (modified) (1 diff)
- trunk/lib/model/AnswerPeer.php (modified) (1 diff)
- trunk/lib/model/Question.php (modified) (1 diff)
- trunk/lib/model/QuestionPeer.php (modified) (1 diff)
- trunk/test/frontend/answerActionsTest.php (added)
- trunk/test/frontend/sidebarActionsTest.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/frontend/config/routing.yml
r14 r18 7 7 url: /index/:page 8 8 param: { module: question, action: list } 9 10 recent_questions: 11 url: /recent 12 param: { module: question, action: recent } 9 13 10 14 # answers trunk/frontend/config/view.yml
r8 r18 4 4 5 5 metas: 6 title: symfony project6 title: askeet! ask questions, find answers 7 7 robots: index, follow 8 description: symfony project9 keywords: symfony, project 8 description: askeet!, a symfony project built in 24 hours 9 keywords: symfony, project, askeet, php5, question, answer 10 10 language: en 11 11 … … 17 17 layout: layout 18 18 19 slots: {} 19 slots: 20 sidebar: [sidebar, default] trunk/frontend/modules/question/actions/actions.class.php
r14 r18 23 23 $this->answer_pager = AnswerPeer::getPager($this->question->getId(), $this->getRequestParameter('page', 1)); 24 24 } 25 26 public function executeRecent() 27 { 28 $this->question_pager = QuestionPeer::getRecentPager($this->getRequestParameter('page', 1)); 29 } 25 30 } 26 31 trunk/frontend/modules/question/templates/showSuccess.php
r14 r18 11 11 </div> 12 12 13 <div id="answers"> 14 <?php foreach ($answer_pager->getResults() as $answer): ?> 15 <div> 16 <?php echo $answer->getRelevancyUpPercent() ?>% UP <?php echo $answer->getRelevancyDownPercent() ?> % DOWN 17 posted by <?php echo $answer->getUser() ?> 18 on <?php echo format_date($answer->getCreatedAt(), 'p') ?> 19 <div> 20 <?php echo $answer->getBody() ?> 21 </div> 22 </div> 23 <?php endforeach ?> 24 </div> 13 <?php include_partial('answer/list', array('answer_pager' => $answer_pager)) ?> 25 14 26 15 <?php if ($answer_pager->haveToPaginate()): ?> trunk/frontend/modules/user/actions/actions.class.php
r16 r18 11 11 class userActions extends sfActions 12 12 { 13 /** 14 * Executes index action 15 * 16 */ 13 public function executeListInterestedBy() 14 { 15 $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); 16 $this->forward404Unless($this->question instanceof Question); 17 18 $this->interested_users = $this->question->getAllInterestedUsers(); 19 } 20 21 public function executeShow() 22 { 23 $this->subscriber = UserPeer::retrieveByPk($this->getRequestParameter('id', $this->getUser()->getSubscriberId())); 24 $this->forward404Unless($this->subscriber); 25 26 $this->interests = $this->subscriber->getInterestsJoinQuestion(); 27 $this->answers = $this->subscriber->getAnswersJoinQuestion(); 28 $this->questions = $this->subscriber->getQuestions(); 29 } 30 17 31 public function executeLogin() 18 32 { trunk/frontend/templates/layout.php
r14 r18 36 36 37 37 <div id="content_bar"> 38 < !-- Nothing for the moment -->38 <?php echo $sidebar ?> 39 39 <div class="verticalalign"></div> 40 40 </div> trunk/lib/model/AnswerPeer.php
r14 r18 34 34 return $pager; 35 35 } 36 37 public static function getRecentPager($page) 38 { 39 $pager = new sfPager('Answer', APP_PAGER_HOMEPAGE_MAX); 40 $c = new Criteria(); 41 $c->addDescendingOrderByColumn(self::CREATED_AT); 42 $pager->setCriteria($c); 43 $pager->setPage($page); 44 $pager->setPeerMethod('doSelectJoinUser'); 45 $pager->init(); 46 47 return $pager; 48 } 36 49 } 37 50 trunk/lib/model/Question.php
r12 r18 23 23 $this->setStrippedTitle(myTools::stripText($v)); 24 24 } 25 26 public function getAllInterestedUsers() 27 { 28 $c = new Criteria(); 29 $c->addJoin(UserPeer::ID, InterestPeer::USER_ID, Criteria::LEFT_JOIN); 30 $c->add(InterestPeer::QUESTION_ID, $this->getId()); 31 32 return UserPeer::doSelect($c); 33 } 25 34 } 26 35 trunk/lib/model/QuestionPeer.php
r14 r18 43 43 return $pager; 44 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 } 45 58 } 46 59
