Changeset 6

Show
Ignore:
Timestamp:
12/03/05 12:36:03 (7 years ago)
Author:
fabien
Message:

day 3 modifications

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/frontend/config/routing.yml

    r2 r6  
    22homepage: 
    33  url:   / 
    4   param: { module: default, action: index
     4  param: { module: question, action: list
    55 
    66default_symfony: 
  • trunk/frontend/modules/question/actions/actions.class.php

    r4 r6  
    1 <?php 
    2 // auto-generated by sfPropelCrud 
    3 // date: 11/30/2005 15:17:53 
    4 ?> 
    51<?php 
    62 
     
    84 * question actions. 
    95 * 
    10  * @package    ##PROJECT_NAME## 
     6 * @package    askeet 
    117 * @subpackage question 
    12  * @author     Your name here 
     8 * @author     Fabien Potencier 
    139 * @version    SVN: $Id$ 
    1410 */ 
    1511class questionActions extends sfActions 
    1612{ 
    17   public function executeIndex () 
    18   { 
    19     return $this->forward('question', 'list'); 
    20   } 
    21  
    2213  public function executeList () 
    2314  { 
     
    3122    $this->forward404Unless($this->question instanceof Question); 
    3223  } 
    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     else 
    71     { 
    72       $question = QuestionPeer::retrieveByPk($this->getRequestParameter($id)); 
    73  
    74       $this->forward404Unless($question instanceof Question); 
    75     } 
    76  
    77     return $question; 
    78   } 
    79  
    8024} 
    8125 
  • 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') ?> 
    62 
    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> 
    2815<?php endforeach ?> 
    29 </tbody> 
    30 </table> 
    31  
    32 <?php echo link_to ('create', 'question/edit') ?> 
  • trunk/frontend/templates/layout.php

    r2 r6  
    1616<body> 
    1717 
    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> 
    1936 
    2037</body>