Changeset 6
- Timestamp:
- 12/03/05 12:36:03 (3 years ago)
- Files:
-
- trunk/batch/load_data.php (added)
- trunk/data/fixtures (added)
- trunk/data/fixtures/test_data.yml (added)
- trunk/frontend/config/routing.yml (modified) (1 diff)
- trunk/frontend/modules/question/actions/actions.class.php (modified) (3 diffs)
- trunk/frontend/modules/question/templates/editSuccess.php (deleted)
- trunk/frontend/modules/question/templates/listSuccess.php (modified) (1 diff)
- trunk/frontend/templates/layout.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/frontend/config/routing.yml
r2 r6 2 2 homepage: 3 3 url: / 4 param: { module: default, action: index}4 param: { module: question, action: list } 5 5 6 6 default_symfony: trunk/frontend/modules/question/actions/actions.class.php
r4 r6 1 <?php2 // auto-generated by sfPropelCrud3 // date: 11/30/2005 15:17:534 ?>5 1 <?php 6 2 … … 8 4 * question actions. 9 5 * 10 * @package ##PROJECT_NAME##6 * @package askeet 11 7 * @subpackage question 12 * @author Your name here8 * @author Fabien Potencier 13 9 * @version SVN: $Id$ 14 10 */ 15 11 class questionActions extends sfActions 16 12 { 17 public function executeIndex ()18 {19 return $this->forward('question', 'list');20 }21 22 13 public function executeList () 23 14 { … … 31 22 $this->forward404Unless($this->question instanceof Question); 32 23 } 33 34 public function executeEdit ()35 {36 $this->question = $this->getQuestionOrCreate();37 }38 39 public function executeUpdate ()40 {41 $question = $this->getQuestionOrCreate();42 43 $question->setId($this->getRequestParameter('id'));44 $question->setUserId($this->getRequestParameter('user_id'));45 $question->setTitle($this->getRequestParameter('title'));46 $question->setBody($this->getRequestParameter('body'));47 48 $question->save();49 50 return $this->redirect('question/edit?id='.$question->getId());51 }52 53 public function executeDelete ()54 {55 $question = QuestionPeer::retrieveByPk($this->getRequestParameter('id'));56 57 $this->forward404Unless($question instanceof Question);58 59 $question->delete();60 61 return $this->redirect('question/list');62 }63 64 private function getQuestionOrCreate ($id = 'id')65 {66 if (!$this->getRequestParameter($id, 0))67 {68 $question = new Question();69 }70 else71 {72 $question = QuestionPeer::retrieveByPk($this->getRequestParameter($id));73 74 $this->forward404Unless($question instanceof Question);75 }76 77 return $question;78 }79 80 24 } 81 25 trunk/frontend/modules/question/templates/listSuccess.php
r4 r6 1 <?php 2 // auto-generated by sfPropelCrud 3 // date: 11/30/2005 15:17:53 4 ?> 5 <h1>question</h1> 1 <?php use_helper('Text') ?> 6 2 7 <table> 8 <thead> 9 <tr> 10 <th>Id</th> 11 <th>User id</th> 12 <th>Title</th> 13 <th>Body</th> 14 <th>Created at</th> 15 <th>Updated at</th> 16 </tr> 17 </thead> 18 <tbody> 19 <?php foreach ($questions as $question): ?> 20 <tr> 21 <td><?php echo link_to($question->getId(), 'question/show?id='.$question->getId()) ?></td> 22 <td><?php echo $question->getUserId() ?></td> 23 <td><?php echo $question->getTitle() ?></td> 24 <td><?php echo $question->getBody() ?></td> 25 <td><?php echo $question->getCreatedAt() ?></td> 26 <td><?php echo $question->getUpdatedAt() ?></td> 27 </tr> 3 <?php foreach($questions as $question): ?> 4 <div class="interested_block"> 5 <div class="interested_mark" id="interested_in_<?php echo $question->getId() ?>"> 6 <?php echo count($question->getInterests()) ?> 7 </div> 8 </div> 9 10 <h2><?php echo link_to($question->getTitle(), 'question/show?id='.$question->getId()) ?></h2> 11 12 <div class="question_body"> 13 <?php echo truncate_text($question->getBody(), 200) ?> 14 </div> 28 15 <?php endforeach ?> 29 </tbody>30 </table>31 32 <?php echo link_to ('create', 'question/edit') ?>trunk/frontend/templates/layout.php
r2 r6 16 16 <body> 17 17 18 <?php echo $content ?> 18 <div id="header"> 19 <ul> 20 <li><?php echo link_to('about', '@homepage') ?></li> 21 </ul> 22 <h1><?php echo link_to(image_tag('askeet_logo.gif', 'alt=askeet'), '@homepage') ?></h1> 23 </div> 24 25 <div id="content"> 26 <div id="content_main"> 27 <?php echo $content ?> 28 <div class="verticalalign"></div> 29 </div> 30 31 <div id="content_bar"> 32 <!-- Nothing for the moment --> 33 <div class="verticalalign"></div> 34 </div> 35 </div> 19 36 20 37 </body>
