Changeset 5066
- Timestamp:
- 09/13/07 13:40:22 (6 years ago)
- Files:
-
- plugins/sfSimpleForumPlugin/CHANGELOG (modified) (1 diff)
- plugins/sfSimpleForumPlugin/lib/model/sfSimpleForumPost.php (modified) (1 diff)
- plugins/sfSimpleForumPlugin/modules/sfSimpleForum/lib/BasesfSimpleForumActions.class.php (modified) (2 diffs)
- plugins/sfSimpleForumPlugin/modules/sfSimpleForum/templates/_post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfSimpleForumPlugin/CHANGELOG
r5064 r5066 1 1 == Trunk == 2 2 3 * francois: Fixed page displayed after adding a message doesn't use pagination 4 * francois: Added a new getMessage() action 3 5 * francois: Switched icon set to famfamfam as I couldn't find where the sticky one came from 4 6 * francois: Added locked topic feature plugins/sfSimpleForumPlugin/lib/model/sfSimpleForumPost.php
r5063 r5066 120 120 } 121 121 122 public function getPositionInTopic() 123 { 124 $c = new Criteria(); 125 $c->clearSelectColumns(); 126 $c->addSelectColumn(sfSimpleForumPostPeer::ID); 127 $c->add(sfSimpleForumPostPeer::PARENT_ID, $this->getParentId()); 128 $c->addAscendingOrderByColumn(sfSimpleForumPostPeer::CREATED_AT); 129 $rs = sfSimpleForumPostPeer::doSelectRS($c); 130 $messages = array(); 131 while($rs->next()) 132 { 133 $messages[] = $rs->getInt(1); 134 } 135 136 return array_search($this->getId(), $messages) + 1; 137 } 138 122 139 public function incrementViews() 123 140 { plugins/sfSimpleForumPlugin/modules/sfSimpleForum/lib/BasesfSimpleForumActions.class.php
r5064 r5066 224 224 } 225 225 226 public function executeMessage() 227 { 228 $post = sfSimpleForumPostPeer::retrieveByPk($this->getRequestParameter('id')); 229 $this->forward404Unless($post); 230 if($post->isTopic()) 231 { 232 $this->redirect('sfSimpleForum/topic?id='.$post->getId().'&stripped_title='.$post->getStrippedTitle()); 233 } 234 else 235 { 236 $position = $post->getPositionInTopic(); 237 $page = ceil(($position + 1) / sfConfig::get('app_sfSimpleForumPlugin_max_per_page', 10)); 238 $this->redirect('sfSimpleForum/topic?id='.$post->getParentId().'&stripped_title='.$post->getStrippedTitle().'&page='.$page.'#post'.$post->getId()); 239 } 240 } 226 241 // One user 227 242 … … 370 385 $post->save(); 371 386 372 $this->redirect('sfSimpleForum/topic?id='.$post->getParent()->getId().'&stripped_title='.$post->getParent()->getStrippedTitle()); 387 $position = $post->getPositionInTopic(); 388 $page = ceil(($position + 1) / sfConfig::get('app_sfSimpleForumPlugin_max_per_page', 10)); 389 $this->redirect('sfSimpleForum/topic?id='.$post->getParent()->getId().'&stripped_title='.$post->getParent()->getStrippedTitle().'&page='.$page.'#post'.$post->getId()); 373 390 } 374 391 plugins/sfSimpleForumPlugin/modules/sfSimpleForum/templates/_post.php
r5064 r5066 16 16 » 17 17 <?php endif ?> 18 < ?php echo $post->getTitle() ?>18 <a name="post<?php echo $post->getId() ?>"><?php echo $post->getTitle() ?></a> 19 19 </div> 20 20 <div class="post_content">