Changeset 23

Show
Ignore:
Timestamp:
12/08/05 10:47:03 (3 years ago)
Author:
fabien
Message:

day 9 modifications

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/config/schema.xml

    r20 r23  
    1010     <column name="stripped_title" type="longvarchar" /> 
    1111     <column name="body" type="longvarchar" /> 
     12     <column name="html_body" type="longvarchar" /> 
    1213     <column name="interested_users" type="integer" default="0" /> 
    1314     <column name="created_at" type="timestamp" /> 
     
    2627     </foreign-key> 
    2728     <column name="body" type="longvarchar" /> 
     29     <column name="html_body" type="longvarchar" /> 
    2830     <column name="relevancy_up" type="integer" default="0" /> 
    2931     <column name="relevancy_down" type="integer" default="0" /> 
  • trunk/data/fixtures/test_data.yml

    r16 r23  
    2424    user_id: fabien 
    2525    body:  | 
    26       We shall meet in front of the __Dunkin'Doghnuts__ before dinner,  
     26      We shall meet in front of the __Dunkin'Donuts__ before dinner,  
    2727      and I haven't the slightest idea of what I can do with her.  
    28       She's not interested in programming, space opera movies nor insects
    29       She's kinda cute, so I really need to find something  
     28      She's not interested in _programming_, _space opera movies_ nor _insects_
     29      She's kinda cute, so I __really__ need to find something  
    3030      that will keep her to my side for another evening. 
    3131 
     
    3535    body:  | 
    3636      My stepmother has everything a stepmother is usually offered 
    37       (watch, vacuum cleaner, earrings, del.icio.us account).  
     37      (watch, vacuum cleaner, earrings, [del.icio.us](http://del.icio.us) account).  
    3838      Her birthday comes next week, I am broke, and I know that  
    39       if I don't offer her something sweet, my girlfriend  
     39      if I don't offer her something *sweet*, my girlfriend  
    4040      won't look at me in the eyes for another month. 
    4141 
  • trunk/data/sql/schema.sql

    r20 r23  
    1414    `stripped_title` TEXT ,  
    1515    `body` TEXT ,  
     16    `html_body` TEXT ,  
    1617    `interested_users` INTEGER default 0 ,  
    1718    `created_at` DATETIME ,  
     
    3435    `user_id` INTEGER ,  
    3536    `body` TEXT ,  
     37    `html_body` TEXT ,  
    3638    `relevancy_up` INTEGER default 0 ,  
    3739    `relevancy_down` INTEGER default 0 ,  
  • trunk/frontend/config/app.yml

    r14 r23  
    44    homepage_max: 2 
    55    answers_max:  1 
     6    users_max:    10 
     7 
  • trunk/frontend/config/routing.yml

    r18 r23  
    1212  param: { module: question, action: recent } 
    1313 
     14add_question: 
     15  url:   /add_question 
     16  param: { module: question, action: add } 
     17 
    1418# answers 
     19recent_answers: 
     20  url:   /recent/answers 
     21  param: { module: answer, action: recent } 
     22 
     23add_answer: 
     24  url:   /add_anwser 
     25  param: { module: answer, action: add } 
     26 
    1527answers: 
    1628  url:   /question/:stripped_title/page/:page 
    1729  param: { module: question, action: show, page: 1 } 
     30 
     31# user 
     32user_interests: 
     33  url:   /question/:stripped_title/interests/:page 
     34  param: { module: user, action: listInterestedBy } 
     35 
     36user_profile: 
     37  url:   /user/:nickname 
     38  param: { module: user, action: show } 
     39 
     40current_user_profile: 
     41  url:   /user 
     42  param: { module: user, action: show } 
     43 
     44add_account: 
     45  url:   /add_user 
     46  param: { module: user, action: new } 
    1847 
    1948# login 
     
    2150  url:   /login 
    2251  param: { module: user, action: login } 
     52 
     53logout: 
     54  url:   /logout 
     55  param: { module: user, action: logout } 
    2356 
    2457# default rules 
  • trunk/frontend/lib/helper/AnswerHelper.php

    r20 r23  
    33function answer_pager_link($name, $question, $page) 
    44{ 
    5   return link_to($name, 'question/show?stripped_title='.$question->getStrippedTitle().'&page='.$page); 
     5  return link_to($name, '@question?stripped_title='.$question->getStrippedTitle().'&page='.$page); 
    66} 
    77 
  • trunk/frontend/lib/helper/QuestionHelper.php

    r14 r23  
    11<?php 
    22 
    3 function question_pager_link($name, $page) 
    4 { 
    5   return link_to($name, 'question/list?page='.$page); 
    6 } 
    7  
    83?> 
  • trunk/frontend/modules/answer/templates/_list.php

    r20 r23  
    1010    on <?php echo format_date($answer->getCreatedAt(), 'p') ?> 
    1111    <div> 
    12       <?php echo $answer->getBody() ?> 
     12      <?php echo $answer->getHtmlBody() ?> 
    1313    </div> 
    1414  </div> 
  • trunk/frontend/modules/answer/templates/recentSuccess.php

    r18 r23  
    88  <div id="answers_pager"> 
    99 
    10   <?php echo link_to('&laquo;', 'answer/recent?page=1') ?> 
    11   <?php echo link_to('&lt;', 'answer/recent?page='.$answer_pager->getPreviousPage()) ?> 
     10  <?php echo link_to('&laquo;', '@recent_answers?page=1') ?> 
     11  <?php echo link_to('&lt;', '@recent_answers?page='.$answer_pager->getPreviousPage()) ?> 
    1212 
    1313  <?php foreach ($answer_pager->getLinks() as $page): ?> 
    14     <?php echo ($page == $answer_pager->getPage()) ? $page : link_to($page, 'answer/recent?page='.$page) ?> 
     14    <?php echo ($page == $answer_pager->getPage()) ? $page : link_to($page, '@recent_answers?page='.$page) ?> 
    1515    <?php echo ($page != $answer_pager->getCurrentMaxLink()) ? '-' : '' ?> 
    1616  <?php endforeach ?> 
    1717 
    18   <?php echo link_to('&gt;', 'answer/recent?page='.$answer_pager->getNextPage()) ?> 
    19   <?php echo link_to('&raquo;', 'answer/recent?page='.$answer_pager->getLastPage()) ?> 
     18  <?php echo link_to('&gt;', '@recent_answers?page='.$answer_pager->getNextPage()) ?> 
     19  <?php echo link_to('&raquo;', '@recent_answers?page='.$answer_pager->getLastPage()) ?> 
    2020 
    2121  </div> 
  • trunk/frontend/modules/question/templates/_question_list.php

    r20 r23  
    1 <?php use_helpers('Text', 'Question') ?> 
     1<?php use_helpers('Text', 'Global') ?> 
    22 
    33<?php foreach($question_pager->getResults() as $question): ?> 
     
    66  </div> 
    77 
    8   <h2><?php echo link_to($question->getTitle(), 'question/show?stripped_title='.$question->getStrippedTitle()) ?></h2> 
     8  <h2><?php echo link_to($question->getTitle(), '@question?stripped_title='.$question->getStrippedTitle()) ?></h2> 
    99 
    1010  <div class="question_body"> 
    11     <?php echo truncate_text($question->getBody(), 200) ?> 
     11    <?php echo truncate_text(strip_tags($question->getHtmlBody()), 200) ?> 
    1212  </div> 
    1313<?php endforeach ?> 
    1414 
    1515<div id="question_pager"> 
    16 <?php if ($question_pager->haveToPaginate()): ?> 
    17   <?php echo question_pager_link('&laquo;', 1) ?> 
    18   <?php echo question_pager_link('&lt;', $question_pager->getPreviousPage()) ?> 
    19  
    20   <?php foreach ($question_pager->getLinks() as $page): ?> 
    21     <?php echo link_to_unless($page == $question_pager->getPage(), $page, 'question/list?page='.$page) ?> 
    22     <?php echo ($page != $question_pager->getCurrentMaxLink()) ? '-' : '' ?> 
    23   <?php endforeach ?> 
    24  
    25   <?php echo question_pager_link('&gt;', $question_pager->getNextPage()) ?> 
    26   <?php echo question_pager_link('&raquo;', $question_pager->getLastPage()) ?> 
    27 <?php endif ?> 
     16<?php echo pager_navigation($question_pager, '@popular_questions') ?> 
    2817</div> 
  • trunk/frontend/modules/question/templates/showSuccess.php

    r18 r23  
    88     
    99<div class="question_body"> 
    10   <?php echo $question->getBody() ?> 
     10  <?php echo $question->getHtmlBody() ?> 
    1111</div> 
    1212 
  • trunk/frontend/modules/sidebar/templates/defaultSuccess.php

    r18 r23  
    1 <?php echo link_to('ask a new question', 'question/new') ?> 
     1<?php echo link_to('ask a new question', '@add_question') ?> 
    22  
    33<ul> 
    4   <li><?php echo link_to('popular questions', 'question/list') ?> 
    5   <li><?php echo link_to('latest questions', 'question/recent') ?></li> 
    6   <li><?php echo link_to('latest answers', 'answer/recent') ?></li> 
     4  <li><?php echo link_to('popular questions', '@homepage') ?> 
     5  <li><?php echo link_to('latest questions', '@recent_questions') ?></li> 
     6  <li><?php echo link_to('latest answers', '@recent_answers') ?></li> 
    77</ul> 
  • trunk/frontend/modules/user/actions/actions.class.php

    r20 r23  
    1313  public function executeListInterestedBy() 
    1414  { 
    15     $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); 
     15    $this->question = QuestionPeer::getQuestionFromTitle($this->getRequestParameter('stripped_title')); 
    1616    $this->forward404Unless($this->question instanceof Question); 
    1717 
    18     $this->interested_users = $this->question->getAllInterestedUsers(); 
     18    $page = $this->getRequestParameter('page', 1); 
     19 
     20    $this->interested_users_pager = $this->question->getInterestedUsersPager($page); 
    1921  } 
    2022 
     
    4850  public function executeShow() 
    4951  { 
    50     $this->subscriber = UserPeer::retrieveByPk($this->getRequestParameter('id', $this->getUser()->getSubscriberId())); 
     52    if ($this->hasRequestParameter('nickname')) 
     53    { 
     54      $this->subscriber = UserPeer::getUserFromNickname($this->getRequestParameter('nickname')); 
     55    } 
     56    else 
     57    { 
     58      $this->subscriber = UserPeer::retrieveByPk($this->getUser()->getSubscriberId()); 
     59    } 
    5160    $this->forward404Unless($this->subscriber); 
    5261 
  • trunk/frontend/modules/user/templates/listInterestedBySuccess.php

    r18 r23  
    1 <?php use_helper('Date') ?> 
     1<?php use_helpers('Date', 'Global') ?> 
    22 
    3 <h1><?php echo $question->getTitle() ?></h1
     3<h2><?php echo $question->getTitle() ?></h2
    44<p>asked by <strong><?php echo $question->getUser() ?></strong> <?php echo time_ago_in_words($question->getCreatedAt('U')) ?> ago</p> 
    5  
    6 <?php echo count($interested_users) ?> askeet users are interested by this question 
     5  
     6<?php echo $interested_users_pager->getNbResults() ?> askeet users are interested by this question 
    77<ul> 
    8   <?php foreach ($interested_users as $interested_user): ?> 
    9   <li><?php echo link_to($interested_user->__toString(), 'user/show?id='.$interested_user->getId()) ?></li> 
     8  <?php foreach ($interested_users_pager->getResults() as $interested_user): ?> 
     9  <li><?php echo link_to($interested_user->__toString(), '@user_profile?nickname='.$interested_user->getNickname()) ?></li> 
    1010  <?php endforeach ?> 
    1111</ul> 
     12 
     13<div id="users_pager"> 
     14  <?php echo pager_navigation($interested_users_pager, '@user_interests?stripped_title='.$request->getParameter('stripped_title 
     15')) ?> 
     16</div> 
  • trunk/frontend/templates/layout.php

    r21 r23  
    2323    <ul> 
    2424      <?php if ($user->hasAttribute('nickname', 'subscriber')): ?> 
    25         <li><?php echo link_to('sign out', 'user/logout') ?></li> 
    26         <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', 'user/profile') ?></li> 
     25        <li><?php echo link_to('sign out', '@logout') ?></li> 
     26        <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', '@current_user_profile') ?></li> 
    2727      <?php else: ?> 
    28         <li><?php echo link_to('sign in/register', 'user/login') ?></li> 
     28        <li><?php echo link_to('sign in/register', '@login') ?></li> 
    2929      <?php endif ?> 
    3030      <li><?php echo link_to('about', 'question/list') ?></li> 
    3131    </ul> 
    32     <h1><?php echo link_to(image_tag('askeet_logo.gif', 'alt=askeet'), 'question/list') ?></h1> 
     32    <h1><?php echo link_to(image_tag('askeet_logo.gif', 'alt=askeet'), '@homepage') ?></h1> 
    3333  </div> 
    34  
    35   <?php echo link_to_function('cancel', visual_effect('blind_up', 'login', array('duration' => 0.5))) ?> 
    3634 
    3735  <div id="login" style="display: none"> 
     
    4038    <?php echo link_to_function('cancel', visual_effect('blind_up', 'login', array('duration' => 0.5))) ?> 
    4139     
    42     <?php echo form_tag('user/login', 'id=loginform') ?> 
     40    <?php echo form_tag('@login', 'id=loginform') ?> 
    4341      nickname: <?php echo input_tag('nickname') ?><br /> 
    4442      password: <?php echo input_password_tag('password') ?><br /> 
  • trunk/lib/model/Answer.php

    r20 r23  
    3030    return $total ? sprintf('%.0f', $this->getRelevancyDown() * 100 / $total) : 0; 
    3131  } 
     32 
     33  public function setBody($v) 
     34  { 
     35    parent::setBody($v); 
     36 
     37    require_once('markdown.php'); 
     38 
     39    $this->setHtmlBody(markdown($v)); 
     40  } 
    3241} 
    3342 
  • trunk/lib/model/Question.php

    r18 r23  
    2424  } 
    2525 
     26  public function setBody($v) 
     27  { 
     28    parent::setBody($v); 
     29 
     30    require_once('markdown.php'); 
     31 
     32    $this->setHtmlBody(markdown($v)); 
     33  } 
     34 
    2635  public function getAllInterestedUsers() 
    27   {    
     36  { 
    2837    $c = new Criteria(); 
    2938    $c->addJoin(UserPeer::ID, InterestPeer::USER_ID, Criteria::LEFT_JOIN); 
     
    3241    return UserPeer::doSelect($c); 
    3342  } 
     43 
     44  public function getInterestedUsersPager($page) 
     45  {    
     46    $c = new Criteria(); 
     47    $c->addJoin(UserPeer::ID, InterestPeer::USER_ID, Criteria::LEFT_JOIN); 
     48    $c->add(InterestPeer::QUESTION_ID, $this->getId()); 
     49 
     50    $pager = new sfPager('User', APP_PAGER_USERS_MAX); 
     51    $pager->setCriteria($c); 
     52    $pager->setPage($page); 
     53    $pager->init(); 
     54 
     55    return $pager; 
     56  } 
    3457} 
    3558 
  • trunk/lib/model/UserPeer.php

    r4 r23  
    1919 * @package model 
    2020 */  
    21 class UserPeer extends BaseUserPeer { 
     21class UserPeer extends BaseUserPeer 
     22
     23  public static function getUserFromNickname($nickname) 
     24  { 
     25    $c = new Criteria(); 
     26    $c->add(self::NICKNAME, $nickname); 
    2227 
    23 } // UserPeer 
     28    return self::doSelectOne($c); 
     29  } 
     30
     31 
     32?> 
  • trunk/lib/model/map/AnswerMapBuilder.php

    r12 r23  
    7373        $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 
    7474 
     75        $tMap->addColumn('HTML_BODY', 'HtmlBody', 'string', CreoleTypes::LONGVARCHAR, false); 
     76 
    7577        $tMap->addColumn('RELEVANCY_UP', 'RelevancyUp', 'int', CreoleTypes::INTEGER, false); 
    7678 
  • trunk/lib/model/map/QuestionMapBuilder.php

    r12 r23  
    7575        $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 
    7676 
     77        $tMap->addColumn('HTML_BODY', 'HtmlBody', 'string', CreoleTypes::LONGVARCHAR, false); 
     78 
    7779        $tMap->addColumn('INTERESTED_USERS', 'InterestedUsers', 'int', CreoleTypes::INTEGER, false); 
    7880 
  • trunk/lib/model/om/BaseAnswer.php

    r16 r23  
    5858 
    5959    /** 
     60     * The value for the html_body field. 
     61     * @var string 
     62     */ 
     63    protected $html_body; 
     64 
     65 
     66    /** 
    6067     * The value for the relevancy_up field. 
    6168     * @var int 
     
    155162 
    156163        return $this->body; 
     164    } 
     165 
     166    /** 
     167     * Get the [html_body] column value. 
     168     *  
     169     * @return string 
     170     */ 
     171    public function getHtmlBody() 
     172    { 
     173 
     174        return $this->html_body; 
    157175    } 
    158176 
     
    283301 
    284302    /** 
     303     * Set the value of [html_body] column. 
     304     *  
     305     * @param string $v new value 
     306     * @return void 
     307     */ 
     308    public function setHtmlBody($v) 
     309    { 
     310 
     311        if ($this->html_body !== $v) { 
     312            $this->html_body = $v; 
     313            $this->modifiedColumns[] = AnswerPeer::HTML_BODY; 
     314        } 
     315 
     316    } // setHtmlBody() 
     317 
     318    /** 
    285319     * Set the value of [relevancy_up] column. 
    286320     *  
     
    363397            $this->body = $rs->getString($startcol + 3); 
    364398 
    365             $this->relevancy_up = $rs->getInt($startcol + 4); 
    366  
    367             $this->relevancy_down = $rs->getInt($startcol + 5); 
    368  
    369             $this->created_at = $rs->getTimestamp($startcol + 6, null); 
     399            $this->html_body = $rs->getString($startcol + 4); 
     400 
     401            $this->relevancy_up = $rs->getInt($startcol + 5); 
     402 
     403            $this->relevancy_down = $rs->getInt($startcol + 6); 
     404 
     405            $this->created_at = $rs->getTimestamp($startcol + 7, null); 
    370406 
    371407            $this->resetModified(); 
     
    374410 
    375411            // FIXME - using NUM_COLUMNS may be clearer. 
    376             return $startcol + 7; // 7 = AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS). 
     412            return $startcol + 8; // 8 = AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS). 
    377413 
    378414        } catch (Exception $e) { 
     
    630666                break; 
    631667            case 4: 
     668                return $this->getHtmlBody(); 
     669                break; 
     670            case 5: 
    632671                return $this->getRelevancyUp(); 
    633672                break; 
    634             case 5
     673            case 6
    635674                return $this->getRelevancyDown(); 
    636675                break; 
    637             case 6
     676            case 7
    638677                return $this->getCreatedAt(); 
    639678                break; 
     
    662701            $keys[2] => $this->getUserId(), 
    663702            $keys[3] => $this->getBody(), 
    664             $keys[4] => $this->getRelevancyUp(), 
    665             $keys[5] => $this->getRelevancyDown(), 
    666             $keys[6] => $this->getCreatedAt(), 
     703            $keys[4] => $this->getHtmlBody(), 
     704            $keys[5] => $this->getRelevancyUp(), 
     705            $keys[6] => $this->getRelevancyDown(), 
     706            $keys[7] => $this->getCreatedAt(), 
    667707        ); 
    668708        return $result; 
     
    710750                break; 
    711751            case 4: 
     752                $this->setHtmlBody($value); 
     753                break; 
     754            case 5: 
    712755                $this->setRelevancyUp($value); 
    713756                break; 
    714             case 5
     757            case 6
    715758                $this->setRelevancyDown($value); 
    716759                break; 
    717             case 6
     760            case 7
    718761                $this->setCreatedAt($value); 
    719762                break; 
     
    745788        if (array_key_exists($keys[2], $arr)) $this->setUserId($arr[$keys[2]]); 
    746789        if (array_key_exists($keys[3], $arr)) $this->setBody($arr[$keys[3]]); 
    747         if (array_key_exists($keys[4], $arr)) $this->setRelevancyUp($arr[$keys[4]]); 
    748         if (array_key_exists($keys[5], $arr)) $this->setRelevancyDown($arr[$keys[5]]); 
    749         if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); 
     790        if (array_key_exists($keys[4], $arr)) $this->setHtmlBody($arr[$keys[4]]); 
     791        if (array_key_exists($keys[5], $arr)) $this->setRelevancyUp($arr[$keys[5]]); 
     792        if (array_key_exists($keys[6], $arr)) $this->setRelevancyDown($arr[$keys[6]]); 
     793        if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); 
    750794    } 
    751795 
     
    763807        if ($this->isColumnModified(AnswerPeer::USER_ID)) $criteria->add(AnswerPeer::USER_ID, $this->user_id); 
    764808        if ($this->isColumnModified(AnswerPeer::BODY)) $criteria->add(AnswerPeer::BODY, $this->body); 
     809        if ($this->isColumnModified(AnswerPeer::HTML_BODY)) $criteria->add(AnswerPeer::HTML_BODY, $this->html_body); 
    765810        if ($this->isColumnModified(AnswerPeer::RELEVANCY_UP)) $criteria->add(AnswerPeer::RELEVANCY_UP, $this->relevancy_up); 
    766811        if ($this->isColumnModified(AnswerPeer::RELEVANCY_DOWN)) $criteria->add(AnswerPeer::RELEVANCY_DOWN, $this->relevancy_down); 
     
    825870 
    826871        $copyObj->setBody($this->body); 
     872 
     873        $copyObj->setHtmlBody($this->html_body); 
    827874 
    828875        $copyObj->setRelevancyUp($this->relevancy_up); 
  • trunk/lib/model/om/BaseAnswerPeer.php

    r16 r23  
    2525 
    2626    /** The total number of columns. */ 
    27     const NUM_COLUMNS = 7
     27    const NUM_COLUMNS = 8
    2828 
    2929    /** The number of lazy-loaded columns. */ 
     
    4343    const BODY = 'ask_answer.BODY'; 
    4444 
     45    /** the column name for the HTML_BODY field */ 
     46    const HTML_BODY = 'ask_answer.HTML_BODY'; 
     47 
    4548    /** the column name for the RELEVANCY_UP field */ 
    4649    const RELEVANCY_UP = 'ask_answer.RELEVANCY_UP'; 
     
    6366     */ 
    6467    private static $fieldNames = array ( 
    65         BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', 'RelevancyUp', 'RelevancyDown', 'CreatedAt', ), 
    66         BasePeer::TYPE_COLNAME => array (AnswerPeer::ID, AnswerPeer::QUESTION_ID, AnswerPeer::USER_ID, AnswerPeer::BODY, AnswerPeer::RELEVANCY_UP, AnswerPeer::RELEVANCY_DOWN, AnswerPeer::CREATED_AT, ), 
    67         BasePeer::TYPE_FIELDNAME => array ('id', 'question_id', 'user_id', 'body', 'relevancy_up', 'relevancy_down', 'created_at', ), 
    68         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6,
     68        BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', 'HtmlBody', 'RelevancyUp', 'RelevancyDown', 'CreatedAt', ), 
     69        BasePeer::TYPE_COLNAME => array (AnswerPeer::ID, AnswerPeer::QUESTION_ID, AnswerPeer::USER_ID, AnswerPeer::BODY, AnswerPeer::HTML_BODY, AnswerPeer::RELEVANCY_UP, AnswerPeer::RELEVANCY_DOWN, AnswerPeer::CREATED_AT, ), 
     70        BasePeer::TYPE_FIELDNAME => array ('id', 'question_id', 'user_id', 'body', 'html_body', 'relevancy_up', 'relevancy_down', 'created_at', ), 
     71        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,
    6972    ); 
    7073 
     
    7679     */ 
    7780    private static $fieldKeys = array ( 
    78         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, 'RelevancyUp' => 4, 'RelevancyDown' => 5, 'CreatedAt' => 6, ), 
    79         BasePeer::TYPE_COLNAME => array (AnswerPeer::ID => 0, AnswerPeer::QUESTION_ID => 1, AnswerPeer::USER_ID => 2, AnswerPeer::BODY => 3, AnswerPeer::RELEVANCY_UP => 4, AnswerPeer::RELEVANCY_DOWN => 5, AnswerPeer::CREATED_AT => 6, ), 
    80         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'question_id' => 1, 'user_id' => 2, 'body' => 3, 'relevancy_up' => 4, 'relevancy_down' => 5, 'created_at' => 6, ), 
    81         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6,
     81        BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, 'HtmlBody' => 4, 'RelevancyUp' => 5, 'RelevancyDown' => 6, 'CreatedAt' => 7, ), 
     82        BasePeer::TYPE_COLNAME => array (AnswerPeer::ID => 0, AnswerPeer::QUESTION_ID => 1, AnswerPeer::USER_ID => 2, AnswerPeer::BODY => 3, AnswerPeer::HTML_BODY => 4, AnswerPeer::RELEVANCY_UP => 5, AnswerPeer::RELEVANCY_DOWN => 6, AnswerPeer::CREATED_AT => 7, ), 
     83        BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'question_id' => 1, 'user_id' => 2, 'body' => 3, 'html_body' => 4, 'relevancy_up' => 5, 'relevancy_down' => 6, 'created_at' => 7, ), 
     84        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,
    8285    ); 
    8386 
     
    187190 
    188191        $criteria->addSelectColumn(AnswerPeer::BODY); 
     192 
     193        $criteria->addSelectColumn(AnswerPeer::HTML_BODY); 
    189194 
    190195        $criteria->addSelectColumn(AnswerPeer::RELEVANCY_UP); 
  • trunk/lib/model/om/BaseQuestion.php

    r16 r23  
    6565 
    6666    /** 
     67     * The value for the html_body field. 
     68     * @var string 
     69     */ 
     70    protected $html_body; 
     71 
     72 
     73    /** 
    6774     * The value for the interested_users field. 
    6875     * @var int 
     
    180187 
    181188        return $this->body; 
     189    } 
     190 
     191    /** 
     192     * Get the [html_body] column value. 
     193     *  
     194     * @return string 
     195     */ 
     196    public function getHtmlBody() 
     197    { 
     198 
     199        return $this->html_body; 
    182200    } 
    183201 
     
    340358 
    341359    /** 
     360     * Set the value of [html_body] column. 
     361     *  
     362     * @param string $v new value 
     363     * @return void 
     364     */ 
     365    public function setHtmlBody($v) 
     366    { 
     367 
     368        if ($this->html_body !== $v) { 
     369            $this->html_body = $v; 
     370            $this->modifiedColumns[] = QuestionPeer::HTML_BODY; 
     371        } 
     372 
     373    } // setHtmlBody() 
     374 
     375    /** 
    342376     * Set the value of [interested_users] column. 
    343377     *  
     
    430464            $this->body = $rs->getString($startcol + 4); 
    431465 
    432             $this->interested_users = $rs->getInt($startcol + 5); 
    433  
    434             $this->created_at = $rs->getTimestamp($startcol + 6, null); 
    435  
    436             $this->updated_at = $rs->getTimestamp($startcol + 7, null); 
     466            $this->html_body = $rs->getString($startcol + 5); 
     467 
     468            $this->interested_users = $rs->getInt($startcol + 6); 
     469 
     470            $this->created_at = $rs->getTimestamp($startcol + 7, null); 
     471 
     472            $this->updated_at = $rs->getTimestamp($startcol + 8, null); 
    437473 
    438474            $this->resetModified(); 
     
    441477 
    442478            // FIXME - using NUM_COLUMNS may be clearer. 
    443             return $startcol + 8; // 8 = QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS). 
     479            return $startcol + 9; // 9 = QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS). 
    444480 
    445481        } catch (Exception $e) { 
     
    704740                break; 
    705741            case 5: 
     742                return $this->getHtmlBody(); 
     743                break; 
     744            case 6: 
    706745                return $this->getInterestedUsers(); 
    707746                break; 
    708             case 6
     747            case 7
    709748                return $this->getCreatedAt(); 
    710749                break; 
    711             case 7
     750            case 8
    712751                return $this->getUpdatedAt(); 
    713752                break; 
     
    737776            $keys[3] => $this->getStrippedTitle(), 
    738777            $keys[4] => $this->getBody(), 
    739             $keys[5] => $this->getInterestedUsers(), 
    740             $keys[6] => $this->getCreatedAt(), 
    741             $keys[7] => $this->getUpdatedAt(), 
     778            $keys[5] => $this->getHtmlBody(), 
     779            $keys[6] => $this->getInterestedUsers(), 
     780            $keys[7] => $this->getCreatedAt(), 
     781            $keys[8] => $this->getUpdatedAt(), 
    742782        ); 
    743783        return $result; 
     
    788828                break; 
    789829            case 5: 
     830                $this->setHtmlBody($value); 
     831                break; 
     832            case 6: 
    790833                $this->setInterestedUsers($value); 
    791834                break; 
    792             case 6
     835            case 7
    793836                $this->setCreatedAt($value); 
    794837                break; 
    795             case 7
     838            case 8
    796839                $this->setUpdatedAt($value); 
    797840                break; 
     
    824867        if (array_key_exists($keys[3], $arr)) $this->setStrippedTitle($arr[$keys[3]]); 
    825868        if (array_key_exists($keys[4], $arr)) $this->setBody($arr[$keys[4]]); 
    826         if (array_key_exists($keys[5], $arr)) $this->setInterestedUsers($arr[$keys[5]]); 
    827         if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); 
    828         if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); 
     869        if (array_key_exists($keys[5], $arr)) $this->setHtmlBody($arr[$keys[5]]); 
     870        if (array_key_exists($keys[6], $arr)) $this->setInterestedUsers($arr[$keys[6]]); 
     871        if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); 
     872        if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); 
    829873    } 
    830874 
     
    843887        if ($this->isColumnModified(QuestionPeer::STRIPPED_TITLE)) $criteria->add(QuestionPeer::STRIPPED_TITLE, $this->stripped_title); 
    844888        if ($this->isColumnModified(QuestionPeer::BODY)) $criteria->add(QuestionPeer::BODY, $this->body); 
     889        if ($this->isColumnModified(QuestionPeer::HTML_BODY)) $criteria->add(QuestionPeer::HTML_BODY, $this->html_body); 
    845890        if ($this->isColumnModified(QuestionPeer::INTERESTED_USERS)) $criteria->add(QuestionPeer::INTERESTED_USERS, $this->interested_users); 
    846891        if ($this->isColumnModified(QuestionPeer::CREATED_AT)) $criteria->add(QuestionPeer::CREATED_AT, $this->created_at); 
     
    907952 
    908953        $copyObj->setBody($this->body); 
     954 
     955        $copyObj->setHtmlBody($this->html_body); 
    909956 
    910957        $copyObj->setInterestedUsers($this->interested_users); 
  • trunk/lib/model/om/BaseQuestionPeer.php

    r16 r23  
    2525 
    2626    /** The total number of columns. */ 
    27     const NUM_COLUMNS = 8
     27    const NUM_COLUMNS = 9
    2828 
    2929    /** The number of lazy-loaded columns. */ 
     
    4646    const BODY = 'ask_question.BODY'; 
    4747 
     48    /** the column name for the HTML_BODY field */ 
     49    const HTML_BODY = 'ask_question.HTML_BODY'; 
     50 
    4851    /** the column name for the INTERESTED_USERS field */ 
    4952    const INTERESTED_USERS = 'ask_question.INTERESTED_USERS'; 
     
    6669     */ 
    6770    private static $fieldNames = array ( 
    68         BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'StrippedTitle', 'Body', 'InterestedUsers', 'CreatedAt', 'UpdatedAt', ), 
    69         BasePeer::TYPE_COLNAME => array (QuestionPeer::ID, QuestionPeer::USER_ID, QuestionPeer::TITLE, QuestionPeer::STRIPPED_TITLE, QuestionPeer::BODY, QuestionPeer::INTERESTED_USERS, QuestionPeer::CREATED_AT, QuestionPeer::UPDATED_AT, ), 
    70         BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'title', 'stripped_title', 'body', 'interested_users', 'created_at', 'updated_at', ), 
    71         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,
     71        BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'StrippedTitle', 'Body', 'HtmlBody', 'InterestedUsers', 'CreatedAt', 'UpdatedAt', ), 
     72        BasePeer::TYPE_COLNAME => array (QuestionPeer::ID, QuestionPeer::USER_ID, QuestionPeer::TITLE, QuestionPeer::STRIPPED_TITLE, QuestionPeer::BODY, QuestionPeer::HTML_BODY, QuestionPeer::INTERESTED_USERS, QuestionPeer::CREATED_AT, QuestionPeer::UPDATED_AT, ), 
     73        BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'title', 'stripped_title', 'body', 'html_body', 'interested_users', 'created_at', 'updated_at', ), 
     74        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8,
    7275    ); 
    7376 
     
    7982     */ 
    8083    private static $fieldKeys = array ( 
    81         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'StrippedTitle' => 3, 'Body' => 4, 'InterestedUsers' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), 
    82         BasePeer::TYPE_COLNAME => array (QuestionPeer::ID => 0, QuestionPeer::USER_ID => 1, QuestionPeer::TITLE => 2, QuestionPeer::STRIPPED_TITLE => 3, QuestionPeer::BODY => 4, QuestionPeer::INTERESTED_USERS => 5, QuestionPeer::CREATED_AT => 6, QuestionPeer::UPDATED_AT => 7, ), 
    83         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'title' => 2, 'stripped_title' => 3, 'body' => 4, 'interested_users' => 5, 'created_at' => 6, 'updated_at' => 7, ), 
    84         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,
     84        BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'StrippedTitle' => 3, 'Body' => 4, 'HtmlBody' => 5, 'InterestedUsers' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), 
     85        BasePeer::TYPE_COLNAME => array (QuestionPeer::ID => 0, QuestionPeer::USER_ID => 1, QuestionPeer::TITLE => 2, QuestionPeer::STRIPPED_TITLE => 3, QuestionPeer::BODY => 4, QuestionPeer::HTML_BODY => 5, QuestionPeer::INTERESTED_USERS => 6, QuestionPeer::CREATED_AT => 7, QuestionPeer::UPDATED_AT => 8, ), 
     86        BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'title' => 2, 'stripped_title' => 3, 'body' => 4, 'html_body' => 5, 'interested_users' => 6, 'created_at' => 7, 'updated_at' => 8, ), 
     87        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8,
    8588    ); 
    8689 
     
    192195 
    193196        $criteria->addSelectColumn(QuestionPeer::BODY); 
     197 
     198        $criteria->addSelectColumn(QuestionPeer::HTML_BODY); 
    194199 
    195200        $criteria->addSelectColumn(QuestionPeer::INTERESTED_USERS);