Changeset 55
- Timestamp:
- 12/20/05 11:44:03 (6 years ago)
- Files:
-
- trunk/config/schema.xml (modified) (8 diffs)
- trunk/data/fixtures/test_data.yml (modified) (1 diff)
- trunk/data/sql/schema.sql (modified) (8 diffs)
- trunk/frontend/config/logging.yml (modified) (1 diff)
- trunk/frontend/config/routing.yml (modified) (1 diff)
- trunk/frontend/config/view.yml (modified) (1 diff)
- trunk/frontend/lib/helper/AnswerHelper.php (modified) (1 diff)
- trunk/frontend/lib/helper/QuestionHelper.php (modified) (1 diff)
- trunk/frontend/lib/myUser.class.php (modified) (1 diff)
- trunk/frontend/modules/administrator (added)
- trunk/frontend/modules/administrator/actions (added)
- trunk/frontend/modules/administrator/actions/actions.class.php (added)
- trunk/frontend/modules/administrator/config (added)
- trunk/frontend/modules/administrator/config/.sf (added)
- trunk/frontend/modules/administrator/config/security.yml (added)
- trunk/frontend/modules/administrator/config/view.yml (added)
- trunk/frontend/modules/administrator/lib (added)
- trunk/frontend/modules/administrator/lib/.sf (added)
- trunk/frontend/modules/administrator/templates (added)
- trunk/frontend/modules/administrator/templates/_user_options.php (added)
- trunk/frontend/modules/administrator/templates/usersSuccess.php (added)
- trunk/frontend/modules/administrator/validate (added)
- trunk/frontend/modules/administrator/validate/.sf (added)
- trunk/frontend/modules/answer/templates/_answer.php (modified) (1 diff)
- trunk/frontend/modules/moderator (added)
- trunk/frontend/modules/moderator/actions (added)
- trunk/frontend/modules/moderator/actions/actions.class.php (added)
- trunk/frontend/modules/moderator/config (added)
- trunk/frontend/modules/moderator/config/.sf (added)
- trunk/frontend/modules/moderator/config/security.yml (added)
- trunk/frontend/modules/moderator/lib (added)
- trunk/frontend/modules/moderator/lib/.sf (added)
- trunk/frontend/modules/moderator/templates (added)
- trunk/frontend/modules/moderator/templates/_answer_options.php (added)
- trunk/frontend/modules/moderator/templates/_question_options.php (added)
- trunk/frontend/modules/moderator/templates/reportedAnswersSuccess.php (added)
- trunk/frontend/modules/moderator/templates/reportedQuestionsSuccess.php (added)
- trunk/frontend/modules/moderator/templates/unpopularTagsSuccess.php (added)
- trunk/frontend/modules/moderator/validate (added)
- trunk/frontend/modules/moderator/validate/.sf (added)
- trunk/frontend/modules/question/templates/_question_list.php (modified) (2 diffs)
- trunk/frontend/modules/question/templates/showSuccess.php (modified) (2 diffs)
- trunk/frontend/modules/sidebar/templates/_administration.php (added)
- trunk/frontend/modules/sidebar/templates/_moderation.php (added)
- trunk/frontend/modules/sidebar/templates/defaultSuccess.php (modified) (1 diff)
- trunk/frontend/modules/sidebar/templates/questionSuccess.php (modified) (1 diff)
- trunk/frontend/modules/tag/actions/actions.class.php (modified) (2 diffs)
- trunk/frontend/modules/tag/templates/_question_tags.php (modified) (1 diff)
- trunk/frontend/modules/user/actions/actions.class.php (modified) (2 diffs)
- trunk/frontend/modules/user/config/security.yml (added)
- trunk/frontend/modules/user/config/view.yml (modified) (1 diff)
- trunk/frontend/modules/user/templates/reportAnswerSuccess.php (added)
- trunk/frontend/modules/user/templates/reportQuestionSuccess.php (added)
- trunk/frontend/modules/user/templates/showSuccess.php (modified) (3 diffs)
- trunk/frontend/templates/layout.php (modified) (1 diff)
- trunk/lib/model/Answer.php (modified) (1 diff)
- trunk/lib/model/AnswerPeer.php (modified) (2 diffs)
- trunk/lib/model/Question.php (modified) (1 diff)
- trunk/lib/model/QuestionPeer.php (modified) (1 diff)
- trunk/lib/model/QuestionTagPeer.php (modified) (1 diff)
- trunk/lib/model/ReportAnswer.php (added)
- trunk/lib/model/ReportAnswerPeer.php (added)
- trunk/lib/model/ReportQuestion.php (added)
- trunk/lib/model/ReportQuestionPeer.php (added)
- trunk/lib/model/UserPeer.php (modified) (1 diff)
- trunk/lib/model/map/AnswerMapBuilder.php (modified) (1 diff)
- trunk/lib/model/map/QuestionMapBuilder.php (modified) (1 diff)
- trunk/lib/model/map/QuestionTagMapBuilder.php (modified) (2 diffs)
- trunk/lib/model/map/ReportAnswerMapBuilder.php (added)
- trunk/lib/model/map/ReportQuestionMapBuilder.php (added)
- trunk/lib/model/map/UserMapBuilder.php (modified) (1 diff)
- trunk/lib/model/om/BaseAnswer.php (modified) (16 diffs)
- trunk/lib/model/om/BaseAnswerPeer.php (modified) (5 diffs)
- trunk/lib/model/om/BaseQuestion.php (modified) (16 diffs)
- trunk/lib/model/om/BaseQuestionPeer.php (modified) (5 diffs)
- trunk/lib/model/om/BaseQuestionTag.php (modified) (3 diffs)
- trunk/lib/model/om/BaseQuestionTagPeer.php (modified) (5 diffs)
- trunk/lib/model/om/BaseReportAnswer.php (added)
- trunk/lib/model/om/BaseReportAnswerPeer.php (added)
- trunk/lib/model/om/BaseReportQuestion.php (added)
- trunk/lib/model/om/BaseReportQuestionPeer.php (added)
- trunk/lib/model/om/BaseUser.php (modified) (16 diffs)
- trunk/lib/model/om/BaseUserPeer.php (modified) (5 diffs)
- trunk/web/css/main.css (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config/schema.xml
r44 r55 12 12 <column name="html_body" type="longvarchar" /> 13 13 <column name="interested_users" type="integer" default="0" /> 14 <column name="reports" type="integer" default="0" /> 14 15 <column name="created_at" type="timestamp" /> 15 16 <column name="updated_at" type="timestamp" /> … … 19 20 <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" /> 20 21 <column name="question_id" type="integer" /> 21 <foreign-key foreignTable="ask_question" >22 <foreign-key foreignTable="ask_question" onDelete="cascade"> 22 23 <reference local="question_id" foreign="id"/> 23 24 </foreign-key> … … 30 31 <column name="relevancy_up" type="integer" default="0" /> 31 32 <column name="relevancy_down" type="integer" default="0" /> 33 <column name="reports" type="integer" default="0" /> 32 34 <column name="created_at" type="timestamp" /> 33 35 </table> … … 42 44 <column name="salt" type="varchar" size="32" /> 43 45 <column name="has_paypal" type="boolean" default="0" /> 46 <column name="want_to_be_moderator" type="boolean" default="0" /> 47 <column name="is_moderator" type="boolean" default="0" /> 48 <column name="is_administrator" type="boolean" default="0" /> 49 <column name="deletions" type="integer" default="0" /> 44 50 <column name="created_at" type="timestamp" /> 45 51 </table> … … 47 53 <table name="ask_interest" phpName="Interest"> 48 54 <column name="question_id" type="integer" primaryKey="true" /> 49 <foreign-key foreignTable="ask_question" >55 <foreign-key foreignTable="ask_question" onDelete="cascade"> 50 56 <reference local="question_id" foreign="id"/> 51 57 </foreign-key> … … 59 65 <table name="ask_relevancy" phpName="Relevancy"> 60 66 <column name="answer_id" type="integer" primaryKey="true" /> 61 <foreign-key foreignTable="ask_answer" >67 <foreign-key foreignTable="ask_answer" onDelete="cascade"> 62 68 <reference local="answer_id" foreign="id"/> 63 69 </foreign-key> … … 71 77 72 78 <table name="ask_question_tag" phpName="QuestionTag"> 73 <column name="question_id" type="integer" />74 <foreign-key foreignTable="ask_question" >79 <column name="question_id" type="integer" primaryKey="true" /> 80 <foreign-key foreignTable="ask_question" onDelete="cascade"> 75 81 <reference local="question_id" foreign="id" /> 76 82 </foreign-key> 77 <column name="user_id" type="integer" />83 <column name="user_id" type="integer" primaryKey="true" /> 78 84 <foreign-key foreignTable="ask_user"> 79 85 <reference local="user_id" foreign="id" /> … … 81 87 <column name="created_at" type="timestamp" /> 82 88 <column name="tag" type="varchar" size="100" /> 83 <column name="normalized_tag" type="varchar" size="100" />89 <column name="normalized_tag" type="varchar" size="100" primaryKey="true" /> 84 90 <index name="normalized_tag_index"> 85 91 <index-column name="normalized_tag" /> 86 92 </index> 87 <unique name="pk"> 88 <unique-column name="question_id" /> 89 <unique-column name="user_id" /> 90 <unique-column name="normalized_tag" /> 91 </unique> 93 </table> 94 95 <table name="ask_report_question" phpName="ReportQuestion"> 96 <column name="question_id" type="integer" primaryKey="true" /> 97 <foreign-key foreignTable="ask_question" onDelete="cascade"> 98 <reference local="question_id" foreign="id" /> 99 </foreign-key> 100 <column name="user_id" type="integer" primaryKey="true" /> 101 <foreign-key foreignTable="ask_user"> 102 <reference local="user_id" foreign="id" /> 103 </foreign-key> 104 <column name="created_at" type="timestamp" /> 105 </table> 106 107 <table name="ask_report_answer" phpName="ReportAnswer"> 108 <column name="answer_id" type="integer" primaryKey="true" /> 109 <foreign-key foreignTable="ask_answer" onDelete="cascade"> 110 <reference local="answer_id" foreign="id" /> 111 </foreign-key> 112 <column name="user_id" type="integer" primaryKey="true" /> 113 <foreign-key foreignTable="ask_user"> 114 <reference local="user_id" foreign="id" /> 115 </foreign-key> 116 <column name="created_at" type="timestamp" /> 92 117 </table> 93 118 trunk/data/fixtures/test_data.yml
r38 r55 11 11 password: symfony 12 12 email: fp@example.com 13 is_administrator: on 13 14 14 15 francois: trunk/data/sql/schema.sql
r44 r55 16 16 `html_body` TEXT , 17 17 `interested_users` INTEGER default 0 , 18 `reports` INTEGER default 0 , 18 19 `created_at` DATETIME , 19 20 `updated_at` DATETIME , … … 38 39 `relevancy_up` INTEGER default 0 , 39 40 `relevancy_down` INTEGER default 0 , 41 `reports` INTEGER default 0 , 40 42 `created_at` DATETIME , 41 43 PRIMARY KEY(`id`), … … 44 46 FOREIGN KEY (`question_id`) 45 47 REFERENCES `ask_question` (`id`) 46 ,48 ON DELETE CASCADE, 47 49 INDEX `ask_answer_FI_2` (`user_id`), 48 50 CONSTRAINT `ask_answer_FK_2` … … 65 67 `salt` VARCHAR(32) , 66 68 `has_paypal` INTEGER default 0 , 69 `want_to_be_moderator` INTEGER default 0 , 70 `is_moderator` INTEGER default 0 , 71 `is_administrator` INTEGER default 0 , 72 `deletions` INTEGER default 0 , 67 73 `created_at` DATETIME , 68 74 PRIMARY KEY(`id`)) … … 81 87 FOREIGN KEY (`question_id`) 82 88 REFERENCES `ask_question` (`id`) 83 ,89 ON DELETE CASCADE, 84 90 INDEX `ask_interest_FI_2` (`user_id`), 85 91 CONSTRAINT `ask_interest_FK_2` … … 102 108 FOREIGN KEY (`answer_id`) 103 109 REFERENCES `ask_answer` (`id`) 104 ,110 ON DELETE CASCADE, 105 111 INDEX `ask_relevancy_FI_2` (`user_id`), 106 112 CONSTRAINT `ask_relevancy_FK_2` … … 115 121 116 122 CREATE TABLE `ask_question_tag`( 117 `question_id` INTEGER ,118 `user_id` INTEGER ,123 `question_id` INTEGER NOT NULL , 124 `user_id` INTEGER NOT NULL , 119 125 `created_at` DATETIME , 120 126 `tag` VARCHAR(100) , 121 `normalized_tag` VARCHAR(100) ,122 UNIQUE KEY `pk`(`question_id`,`user_id`,`normalized_tag`),127 `normalized_tag` VARCHAR(100) NOT NULL , 128 PRIMARY KEY(`question_id`,`user_id`,`normalized_tag`), 123 129 KEY `normalized_tag_index` (`normalized_tag`), 124 130 CONSTRAINT `ask_question_tag_FK_1` 125 131 FOREIGN KEY (`question_id`) 126 132 REFERENCES `ask_question` (`id`) 127 ,133 ON DELETE CASCADE, 128 134 INDEX `ask_question_tag_FI_2` (`user_id`), 129 135 CONSTRAINT `ask_question_tag_FK_2` … … 132 138 ) 133 139 Type=InnoDB; 140 # ----------------------------------------------------------------------- 141 # ask_report_question 142 # ----------------------------------------------------------------------- 143 DROP TABLE IF EXISTS `ask_report_question`; 144 145 CREATE TABLE `ask_report_question`( 146 `question_id` INTEGER NOT NULL , 147 `user_id` INTEGER NOT NULL , 148 `created_at` DATETIME , 149 PRIMARY KEY(`question_id`,`user_id`), 150 CONSTRAINT `ask_report_question_FK_1` 151 FOREIGN KEY (`question_id`) 152 REFERENCES `ask_question` (`id`) 153 ON DELETE CASCADE, 154 INDEX `ask_report_question_FI_2` (`user_id`), 155 CONSTRAINT `ask_report_question_FK_2` 156 FOREIGN KEY (`user_id`) 157 REFERENCES `ask_user` (`id`) 158 ) 159 Type=InnoDB; 160 # ----------------------------------------------------------------------- 161 # ask_report_answer 162 # ----------------------------------------------------------------------- 163 DROP TABLE IF EXISTS `ask_report_answer`; 164 165 CREATE TABLE `ask_report_answer`( 166 `answer_id` INTEGER NOT NULL , 167 `user_id` INTEGER NOT NULL , 168 `created_at` DATETIME , 169 PRIMARY KEY(`answer_id`,`user_id`), 170 CONSTRAINT `ask_report_answer_FK_1` 171 FOREIGN KEY (`answer_id`) 172 REFERENCES `ask_answer` (`id`) 173 ON DELETE CASCADE, 174 INDEX `ask_report_answer_FI_2` (`user_id`), 175 CONSTRAINT `ask_report_answer_FK_2` 176 FOREIGN KEY (`user_id`) 177 REFERENCES `ask_user` (`id`) 178 ) 179 Type=InnoDB; 180 181 134 182 135 183 trunk/frontend/config/logging.yml
r2 r55 1 1 prod: 2 level: err2 level: warning 3 3 4 4 dev: trunk/frontend/config/routing.yml
r44 r55 53 53 url: /password_request 54 54 param: { module: user, action: passwordRequest } 55 56 user_report_question: 57 url: /report_question/:id 58 param: { module: user, action: reportQuestion } 59 60 user_report_answer: 61 url: /report_answer/:id 62 param: { module: user, action: reportAnswer } 55 63 56 64 # login trunk/frontend/config/view.yml
r20 r55 19 19 slots: 20 20 sidebar: [sidebar, default] 21 22 use_default_slots: on 23 trunk/frontend/lib/helper/AnswerHelper.php
r39 r55 49 49 } 50 50 51 function link_to_report_answer($answer, $user) 52 { 53 use_helper('Javascript'); 54 55 $text = '[report to moderator]'; 56 if ($user->isAuthenticated()) 57 { 58 $has_already_reported_answer = ReportAnswerPeer::retrieveByPk($answer->getId(), $user->getSubscriberId()); 59 if ($has_already_reported_answer) 60 { 61 // already spam for this user 62 return '[reported as spam]'; 63 } 64 else 65 { 66 return link_to_remote($text, array( 67 'url' => '@user_report_answer?id='.$answer->getId(), 68 'update' => array('success' => 'report_answer_'.$answer->getId()), 69 'loading' => "Element.show('indicator')", 70 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'report_answer_'.$answer->getId()), 71 )); 72 } 73 } 74 else 75 { 76 return link_to_login($text); 77 } 78 } 79 51 80 ?> trunk/frontend/lib/helper/QuestionHelper.php
r38 r55 18 18 } 19 19 20 function link_to_report_question($question, $user) 21 { 22 use_helper('Javascript'); 23 24 $text = '[report to moderator]'; 25 if ($user->isAuthenticated()) 26 { 27 $has_already_reported_question = ReportQuestionPeer::retrieveByPk($question->getId(), $user->getSubscriberId()); 28 if ($has_already_reported_question) 29 { 30 // already spam for this user 31 return '[reported as spam]'; 32 } 33 else 34 { 35 return link_to_remote($text, array( 36 'url' => '@user_report_question?id='.$question->getId(), 37 'update' => array('success' => 'report_question_'.$question->getId()), 38 'loading' => "Element.show('indicator')", 39 'complete' => "Element.hide('indicator');".visual_effect('highlight', 'report_question_'.$question->getId()), 40 )); 41 } 42 } 43 else 44 { 45 return link_to_login($text); 46 } 47 } 48 20 49 ?> trunk/frontend/lib/myUser.class.php
r44 r55 9 9 10 10 $this->addCredential('subscriber'); 11 12 if ($user->getIsModerator()) 13 { 14 $this->addCredential('moderator'); 15 } 16 17 if ($user->getIsAdministrator()) 18 { 19 $this->addCredential('administrator'); 20 } 21 11 22 $this->setAttribute('nickname', $user->getNickname(), 'subscriber'); 12 23 } trunk/frontend/modules/answer/templates/_answer.php
r40 r55 8 8 <?php echo $answer->getHtmlBody() ?> 9 9 <div class="subtitle" style="margin-top: -8px">answered by <?php echo link_to_profile($answer->getUser()) ?> on <?php echo format_date($answer->getCreatedAt(), 'f') ?></div> 10 <div class="options" id="report_answer_<?php echo $answer->getId() ?>"> 11 <?php echo link_to_report_answer($answer, $user) ?> 12 <?php echo include_partial('moderator/answer_options', array('answer' => $answer)) ?> 13 </div> 10 14 </div> 11 15 trunk/frontend/modules/question/templates/_question_list.php
r38 r55 14 14 <?php echo truncate_text(strip_tags($question->getHtmlBody()), 200) ?> 15 15 16 <div class=" tags">16 <div class="options"> 17 17 18 18 <?php if ($question->getAnswers()): ?> … … 30 30 </div> 31 31 32 <div class="options" id="report_question_<?php echo $question->getId() ?>"> 33 <?php echo link_to_report_question($question, $user) ?> 34 <?php include_partial('moderator/question_options', array('question' => $question)) ?> 35 </div> 36 32 37 </div> 33 38 </div> trunk/frontend/modules/question/templates/showSuccess.php
r48 r55 1 <?php use_helpers('Date', 'Answer' ) ?>1 <?php use_helpers('Date', 'Answer', 'Question') ?> 2 2 3 3 <h1></h1> … … 14 14 <div class="question_body"> 15 15 <?php echo $question->getHtmlBody() ?> 16 <div class="options" id="report_question_<?php echo $question->getId() ?>"> 17 <?php echo link_to_report_question($question, $user) ?> 18 <?php include_partial('moderator/question_options', array('question' => $question)) ?> 19 </div> 16 20 </div> 17 21 </div> trunk/frontend/modules/sidebar/templates/defaultSuccess.php
r38 r55 11 11 <h2>browse askeet</h2> 12 12 <?php echo include_partial('rss_links') ?> 13 14 <?php echo include_partial('sidebar/moderation') ?> 15 16 <?php echo include_partial('sidebar/administration') ?> trunk/frontend/modules/sidebar/templates/questionSuccess.php
r38 r55 28 28 </div> 29 29 <?php endif ?> 30 31 <?php echo include_partial('sidebar/moderation') ?> 32 33 <?php echo include_partial('sidebar/administration') ?> trunk/frontend/modules/tag/actions/actions.class.php
r53 r55 41 41 42 42 // clear the question tag list fragment in cache 43 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 43 if (SF_CACHE) 44 { 45 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 46 } 44 47 } 45 48 … … 61 64 62 65 // clear the question tag list fragment in cache 63 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 66 if (SF_CACHE) 67 { 68 $this->getContext()->getViewCacheManager()->remove('@question?stripped_title='.$this->question->getStrippedTitle(), 'fragment_question_tags'); 69 } 64 70 } 65 71 trunk/frontend/modules/tag/templates/_question_tags.php
r53 r55 17 17 <?php echo link_to($tag, '@tag?tag='.$tag, 'rel=tag') ?> 18 18 <?php endif ?> 19 20 <?php if ($user->hasCredential('moderator')): ?> 21 <?php echo link_to('[remove tag]', 'moderator/deleteTagForQuestion?tag='.$tag.'&question_id='.$question->getId(), 'confirm=Are you sure you want to delete this tag for this question?') ?> 22 <?php endif ?> 19 23 </li> 20 24 <?php endforeach ?> trunk/frontend/modules/user/actions/actions.class.php
r48 r55 166 166 } 167 167 168 public function executeReportQuestion() 169 { 170 $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); 171 $this->forward404Unless($this->question); 172 173 $spam = new ReportQuestion(); 174 $spam->setQuestionId($this->question->getId()); 175 $spam->setUserId($this->getUser()->getSubscriberId()); 176 $spam->save(); 177 } 178 179 public function executeReportAnswer() 180 { 181 $this->answer = AnswerPeer::retrieveByPk($this->getRequestParameter('id')); 182 $this->forward404Unless($this->answer); 183 184 $spam = new ReportAnswer(); 185 $spam->setAnswerId($this->answer->getId()); 186 $spam->setUserId($this->getUser()->getSubscriberId()); 187 $spam->save(); 188 } 189 168 190 public function handleErrorLogin() 169 191 { … … 200 222 $this->subscriber->setEmail($this->getRequestParameter('email')); 201 223 $this->subscriber->setHasPaypal($this->getRequestParameter('has_paypal'), 0); 224 $this->subscriber->setWantToBeModerator($this->getRequestParameter('want_to_be_moderator')); 202 225 } 203 226 trunk/frontend/modules/user/config/view.yml
r20 r55 4 4 interestedSuccess: 5 5 has_layout: off 6 7 reportQuestionSuccess: 8 has_layout: off 9 10 reportAnswerSuccess: 11 has_layout: off trunk/frontend/modules/user/templates/showSuccess.php
r46 r55 1 1 <?php use_helpers('Date', 'Question', 'Text', 'Object') ?> 2 2 3 <h1><?php echo $subscriber ?>'s profile</h1> 3 <h1><?php echo $subscriber ?>'s profile 4 <?php if ($subscriber->getIsModerator()): ?> [moderator]<?php endif ?> 5 <?php if ($subscriber->getIsAdministrator()): ?> [administrator]<?php endif ?> 6 </h1> 7 8 <?php echo include_partial('administrator/user_options', array('subscriber' => $subscriber)) ?> 4 9 5 10 <?php if ($subscriber->getId() == $user->getSubscriberId()): ?> … … 26 31 <br class="clearleft" /> 27 32 28 <?php echo form_error('has_paypal') ?>29 33 <label for="has_paypal">paypal account?</label> 30 34 <?php echo object_checkbox_tag($subscriber, 'getHasPaypal') ?> … … 40 44 <?php echo input_password_tag('password_bis', '', 'size=30') ?> 41 45 <br class="clearleft" /> 46 47 <?php if (!$subscriber->getIsModerator()): ?> 48 <label for="want_to_be_moderator">do you want to be a moderator?</label> 49 <?php echo object_checkbox_tag($subscriber, 'getWantToBeModerator') ?> 50 <br class="clearleft" /> 51 <?php endif ?> 42 52 43 53 </fieldset> trunk/frontend/templates/layout.php
r40 r55 27 27 <ul> 28 28 <?php if ($user->isAuthenticated()): ?> 29 <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', '@current_user_profile') ?></li> 29 30 <li><?php echo link_to('sign out', '@logout') ?></li> 30 <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', '@current_user_profile') ?></li>31 31 <?php else: ?> 32 32 <li><?php echo link_to('sign in/register', '@login') ?></li> trunk/lib/model/Answer.php
r23 r55 39 39 $this->setHtmlBody(markdown($v)); 40 40 } 41 42 public function deleteReports() 43 { 44 $reports = $this->getReportQuestions(); 45 foreach ($reports as $report) 46 { 47 $report->delete(); 48 } 49 50 $this->setReports(0); 51 } 52 53 public function deleteSpam($moderator) 54 { 55 $con = Propel::getConnection(); 56 try 57 { 58 $con->begin(); 59 60 $user = $this->getUser(); 61 if ($user->getNickname() != 'anonymous') 62 { 63 $user->setDeletions($user->getDeletions() + 1); 64 $user->save(); 65 } 66 67 $this->delete(); 68 69 $con->commit(); 70 71 $log = 'moderator "%s" deleted answer "%s" for question "%s" (%s)'; 72 $log = sprintf($log, $moderator->getNickname(), $this->getId(), $this->getQuestion()->getTitle(), substr($this->getBody(), 0, 50)); 73 sfContext::getInstance()->getLogger()->warning($log); 74 } 75 catch (PropelException $e) 76 { 77 $con->rollback(); 78 throw $e; 79 } 80 } 41 81 } 42 82 trunk/lib/model/AnswerPeer.php
r40 r55 50 50 } 51 51 52 public function getRecent($max = 10)52 public static function getRecent($max = 10) 53 53 { 54 54 $c = new Criteria(); … … 58 58 59 59 return self::doSelectJoinUser($c); 60 } 61 62 public static function getReportedSpamPager($page) 63 { 64 $pager = new sfPager('Answer', APP_PAGER_HOMEPAGE_MAX); 65 $c = new Criteria(); 66 $c->add(self::REPORTS, 0, Criteria::GREATER_THAN); 67 $c->setLimit(20); 68 $c->addDescendingOrderByColumn(self::REPORTS); 69 $c->addAscendingOrderByColumn(self::CREATED_AT); 70 $c = self::addPermanentTagToCriteria($c); 71 $pager->setCriteria($c); 72 $pager->setPage($page); 73 $pager->setPeerMethod('doSelectJoinUser'); 74 $pager->init(); 75 76 return $pager; 77 } 78 79 public static function getReportCount() 80 { 81 $c = new Criteria(); 82 $c->add(self::REPORTS, 0, Criteria::GREATER_THAN); 83 $c = self::addPermanentTagToCriteria($c); 84 85 return self::doCount($c); 60 86 } 61 87 trunk/lib/model/Question.php
r42 r55 145 145 $c->addAsColumn('relevancy', AnswerPeer::RELEVANCY_UP.' / ('.AnswerPeer::RELEVANCY_UP.' + '.AnswerPeer::RELEVANCY_DOWN.')'); 146 146 $c->addDescendingOrderByColumn('relevancy'); 147 $c->addDescendingOrderByColumn(AnswerPeer::RELEVANCY_UP); 147 148 148 149 return AnswerPeer::doSelect($c); 150 } 151 152 public function deleteReports() 153 { 154 $reports = $this->getReportQuestions(); 155 foreach ($reports as $report) 156 { 157 $report->delete(); 158 } 159 160 $this->setReports(0); 161 } 162 163 public function deleteSpam($moderator) 164 { 165 $con = Propel::getConnection(); 166 try 167 { 168 $con->begin(); 169 170 $user = $this->getUser(); 171 $user->setDeletions($user->getDeletions() + 1); 172 $user->save(); 173 174 $this->delete(); 175 176 $con->commit(); 177 178 $log = 'moderator "%s" deleted question "%s"'; 179 $log = sprintf($log, $moderator->getNickname(), $this->getTitle()); 180 sfContext::getInstance()->getLogger()->warning($log); 181 } 182 catch (PropelException $e) 183 { 184 $con->rollback(); 185 throw $e; 186 } 149 187 } 150 188 } trunk/lib/model/QuestionPeer.php
r42 r55 103 103 } 104 104 105 public static function getReportedSpamPager($page) 106 { 107 $pager = new sfPager('Question', APP_PAGER_HOMEPAGE_MAX); 108 $c = new Criteria(); 109 $c->add(self::REPORTS, 0, Criteria::GREATER_THAN); 110 $c->setLimit(20); 111 $c->addDescendingOrderByColumn(self::REPORTS); 112 $c->addAscendingOrderByColumn(self::CREATED_AT); 113 $c = self::addPermanentTagToCriteria($c); 114 $pager->setCriteria($c); 115 $pager->setPage($page); 116 $pager->setPeerMethod('doSelectJoinUser'); 117 $pager->init(); 118 119 return $pager; 120 } 121 122 public static function getReportCount() 123 { 124 $c = new Criteria(); 125 $c->add(self::REPORTS, 0, Criteria::GREATER_THAN); 126 $c = self::addPermanentTagToCriteria($c); 127 128 return self::doCount($c); 129 } 130 105 131 private static function addPermanentTagToCriteria($criteria) 106 132 { trunk/lib/model/QuestionTagPeer.php
r40 r55 147 147 return $tags; 148 148 } 149 150 public static function getUnpopularTags() 151 { 152 $tags = array(); 153 154 $con = Propel::getConnection(); 155 $query = ' 156 SELECT t1.normalized_tag AS tag, 157 COUNT(t1.normalized_tag) AS count 158 FROM '.QuestionTagPeer::TABLE_NAME.' AS t1'; 159 160 if (defined('APP_PERMANENT_TAG')) 161 { 162 $query .= ' 163 INNER JOIN '.QuestionTagPeer::TABLE_NAME.' AS t2 ON t1.question_id = t2.question_id 164 WHERE t2.normalized_tag = ? AND t1.normalized_tag != ? 165 AND count < 5 166 '; 167 } 168 169 $query .= ' 170 GROUP BY t1.normalized_tag 171 ORDER BY count ASC 172 '; 173 174 $stmt = $con->prepareStatement($query); 175 if (defined('APP_PERMANENT_TAG')) 176 { 177 $stmt->setString(1, APP_PERMANENT_TAG); 178 $stmt->setString(2, APP_PERMANENT_TAG); 179 } 180 $rs = $stmt->executeQuery(); 181 while ($rs->next()) 182 { 183 $tags[$rs->getString('tag')] = $rs->getInt('count'); 184 } 185 186 return $tags; 187 } 188 189 public static function getByNormalizedTag($tag) 190 { 191 $c = new Criteria(); 192 $c->add(self::NORMALIZED_TAG, Tag::normalize($tag)); 193 194 return self::doSelect($c); 195 } 196 197 public static function deleteSpam($moderator, $tag, $question_id = null) 198 { 199 if ($question_id === null) 200 { 201 $tags = self::getByNormalizedTag($tag); 202 } 203 else 204 { 205 $c = new Criteria(); 206 $c->add(self::NORMALIZED_TAG, Tag::normalize($tag)); 207 $c->add(self::QUESTION_ID, $question_id); 208 209 $tags = self::doSelect($c); 210 } 211 212 $con = Propel::getConnection(); 213 try 214 { 215 $con->begin(); 216 217 foreach ($tags as $tag) 218 { 219 $user = $tag->getUser(); 220 $user->setDeletions($user->getDeletions() + 1); 221 $user->save(); 222 223 $tag->delete(); 224 } 225 226 $con->commit(); 227 228 $log = 'moderator "%s" deleted tag "%s"'; 229 $log = sprintf($log, $moderator->getNickname(), $tag->getNormalizedTag()); 230 sfContext::getInstance()->getLogger()->warning($log); 231 } 232 catch (PropelException $e) 233 { 234 $con->rollback(); 235 throw $e; 236 } 237 } 149 238 } 150 239 trunk/lib/model/UserPeer.php
r48 r55 45 45 return null; 46 46 } 47 48 public static function getModeratorCandidatesCount() 49 { 50 $c = new Criteria(); 51 $c->add(self::WANT_TO_BE_MODERATOR, true); 52 53 return self::doCount($c); 54 } 55 56 public static function getModeratorCandidates() 57 { 58 $c = new Criteria(); 59 $c->add(self::WANT_TO_BE_MODERATOR, true); 60 $c->addAscendingOrderByColumn(self::CREATED_AT); 61 62 return self::doSelect($c); 63 } 64 65 public static function getModerators() 66 { 67 $c = new Criteria(); 68 $c->add(self::IS_MODERATOR, true); 69 $c->addAscendingOrderByColumn(self::CREATED_AT); 70 71 return self::doSelect($c); 72 } 73 74 public static function getAdministrators() 75 { 76 $c = new Criteria(); 77 $c->add(self::IS_ADMINISTRATOR, true); 78 $c->addAscendingOrderByColumn(self::CREATED_AT); 79 80 return self::doSelect($c); 81 } 82 83 public static function getProblematicUsersCount() 84 { 85 $c = new Criteria(); 86 $c->add(self::DELETIONS, 0, Criteria::GREATER_THAN); 87 88 return self::doCount($c); 89 } 90 91 public static function getProblematicUsers() 92 { 93 $c = new Criteria(); 94 $c->add(self::DELETIONS, 0, Criteria::GREATER_THAN); 95 $c->addDescendingOrderByColumn(self::DELETIONS); 96 97 return self::doSelect($c); 98 } 47 99 } 48 100 trunk/lib/model/map/AnswerMapBuilder.php
r23 r55 79 79 $tMap->addColumn('RELEVANCY_DOWN', 'RelevancyDown', 'int', CreoleTypes::INTEGER, false); 80 80 81 $tMap->addColumn('REPORTS', 'Reports', 'int', CreoleTypes::INTEGER, false); 82 81 83 $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 82 84 trunk/lib/model/map/QuestionMapBuilder.php
r23 r55 79 79 $tMap->addColumn('INTERESTED_USERS', 'InterestedUsers', 'int', CreoleTypes::INTEGER, false); 80 80 81 $tMap->addColumn('REPORTS', 'Reports', 'int', CreoleTypes::INTEGER, false); 82 81 83 $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 82 84 trunk/lib/model/map/QuestionTagMapBuilder.php
r31 r55 65 65 $tMap->setUseIdGenerator(false); 66 66 67 $tMap->addForeign Key('QUESTION_ID', 'QuestionId', 'int', CreoleTypes::INTEGER, 'ask_question', 'ID', false, null);67 $tMap->addForeignPrimaryKey('QUESTION_ID', 'QuestionId', 'int' , CreoleTypes::INTEGER, 'ask_question', 'ID', true, null); 68 68 69 $tMap->addForeign Key('USER_ID', 'UserId', 'int', CreoleTypes::INTEGER, 'ask_user', 'ID', false, null);69 $tMap->addForeignPrimaryKey('USER_ID', 'UserId', 'int' , CreoleTypes::INTEGER, 'ask_user', 'ID', true, null); 70 70 71 71 $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); … … 73 73 $tMap->addColumn('TAG', 'Tag', 'string', CreoleTypes::VARCHAR, false); 74 74 75 $tMap->add Column('NORMALIZED_TAG', 'NormalizedTag', 'string', CreoleTypes::VARCHAR, false);75 $tMap->addPrimaryKey('NORMALIZED_TAG', 'NormalizedTag', 'string', CreoleTypes::VARCHAR, true, 100); 76 76 77 77 } // doBuild() trunk/lib/model/map/UserMapBuilder.php
r44 r55 81 81 $tMap->addColumn('HAS_PAYPAL', 'HasPaypal', 'boolean', CreoleTypes::BOOLEAN, false); 82 82 83 $tMap->addColumn('WANT_TO_BE_MODERATOR', 'WantToBeModerator', 'boolean', CreoleTypes::BOOLEAN, false); 84 85 $tMap->addColumn('IS_MODERATOR', 'IsModerator', 'boolean', CreoleTypes::BOOLEAN, false); 86 87 $tMap->addColumn('IS_ADMINISTRATOR', 'IsAdministrator', 'boolean', CreoleTypes::BOOLEAN, false); 88 89 $tMap->addColumn('DELETIONS', 'Deletions', 'int', CreoleTypes::INTEGER, false); 90 83 91 $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 84 92 trunk/lib/model/om/BaseAnswer.php
r23 r55 79 79 80 80 /** 81 * The value for the reports field. 82 * @var int 83 */ 84 protected $reports = 0; 85 86 87 /** 81 88 * The value for the created_at field. 82 89 * @var int … … 105 112 */ 106 113 private $lastRelevancyCriteria = null; 114 115 /** 116 * Collection to store aggregation of collReportAnswers. 117 * @var array 118 */ 119 protected $collReportAnswers; 120 121 /** 122 * The criteria used to select the current contents of collReportAnswers. 123 * @var Criteria 124 */ 125 private $lastReportAnswerCriteria = null; 107 126 108 127 /** … … 195 214 196 215 return $this->relevancy_down; 216 } 217 218 /** 219 * Get the [reports] column value. 220 * 221 * @return int 222 */ 223 public function getReports() 224 { 225 226 return $this->reports; 197 227 } 198 228 … … 349 379 350 380 /** 381 * Set the value of [reports] column. 382 * 383 * @param int $v new value 384 * @return void 385 */ 386 public function setReports($v) 387 { 388 389 if ($this->reports !== $v || $v === 0) { 390 $this->reports = $v; 391 $this->modifiedColumns[] = AnswerPeer::REPORTS; 392 } 393 394 } // setReports() 395 396 /** 351 397 * Set the value of [created_at] column. 352 398 * … … 403 449 $this->relevancy_down = $rs->getInt($startcol + 6); 404 450 405 $this->created_at = $rs->getTimestamp($startcol + 7, null); 451 $this->reports = $rs->getInt($startcol + 7); 452 453 $this->created_at = $rs->getTimestamp($startcol + 8, null); 406 454 407 455 $this->resetModified(); … … 410 458 411 459 // FIXME - using NUM_COLUMNS may be clearer. 412 return $startcol + 8; // 8= AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS).460 return $startcol + 9; // 9 = AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS). 413 461 414 462 } catch (Exception $e) { … … 546 594 } 547 595 596 if ($this->collReportAnswers !== null) { 597 foreach($this->collReportAnswers as $referrerFK) { 598 if (!$referrerFK->isDeleted()) { 599 $affectedRows += $referrerFK->save($con); 600 } 601 } 602 } 603 548 604 $this->alreadyInSave = false; 549 605 } … … 620 676 } 621 677 678 if ($this->collReportAnswers !== null) { 679 foreach($this->collReportAnswers as $referrerFK) { 680 if (($retval = $referrerFK->validate()) !== true) { 681 $failureMap = array_merge($failureMap, $retval); 682 } 683 } 684 } 685 622 686 623 687 $this->alreadyInValidation = false; … … 675 739 break; 676 740 case 7: 741 return $this->getReports(); 742 break; 743 case 8: 677 744 return $this->getCreatedAt(); 678 745 break; … … 704 771 $keys[5] => $this->getRelevancyUp(), 705 772 $keys[6] => $this->getRelevancyDown(), 706 $keys[7] => $this->getCreatedAt(), 773 $keys[7] => $this->getReports(), 774 $keys[8] => $this->getCreatedAt(), 707 775 ); 708 776 return $result; … … 759 827 break; 760 828 case 7: 829 $this->setReports($value); 830 break; 831 case 8: 761 832 $this->setCreatedAt($value); 762 833 break; … … 791 862 if (array_key_exists($keys[5], $arr)) $this->setRelevancyUp($arr[$keys[5]]); 792 863 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]]); 864 if (array_key_exists($keys[7], $arr)) $this->setReports($arr[$keys[7]]); 865 if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]); 794 866 } 795 867 … … 810 882 if ($this->isColumnModified(AnswerPeer::RELEVANCY_UP)) $criteria->add(AnswerPeer::RELEVANCY_UP, $this->relevancy_up); 811 883 if ($this->isColumnModified(AnswerPeer::RELEVANCY_DOWN)) $criteria->add(AnswerPeer::RELEVANCY_DOWN, $this->relevancy_down); 884 if ($this->isColumnModified(AnswerPeer::REPORTS)) $criteria->add(AnswerPeer::REPORTS, $this->reports); 812 885 if ($this->isColumnModified(AnswerPeer::CREATED_AT)) $criteria->add(AnswerPeer::CREATED_AT, $this->created_at); 813 886 … … 876 949 877 950 $copyObj->setRelevancyDown($this->relevancy_down); 951 952 $copyObj->setReports($this->reports); 878 953 879 954 $copyObj->setCreatedAt($this->created_at); … … 887 962 foreach($this->getRelevancys() as $relObj) { 888 963 $copyObj->addRelevancy($relObj->copy($deepCopy)); 964 } 965 966 foreach($this->getReportAnswers() as $relObj) { 967 $copyObj->addReportAnswer($relObj->copy($deepCopy)); 889 968 } 890 969 … … 1193 1272 } 1194 1273 1274 /** 1275 * Temporary storage of collReportAnswers to save a possible db hit in 1276 * the event objects are add to the collection, but the 1277 * complete collection is never requested. 1278 * @return void 1279 */ 1280 public function initReportAnswers() 1281 { 1282 if ($this->collReportAnswers === null) { 1283 $this->collReportAnswers = array(); 1284 } 1285 } 1286 1287 /** 1288 * If this collection has already been initialized with 1289 * an identical criteria, it returns the collection. 1290 * Otherwise if this Answer has previously 1291 * been saved, it will retrieve related ReportAnswers from storage. 1292 * If this Answer is new, it will return 1293 * an empty collection or the current collection, the criteria 1294 * is ignored on a new object. 1295 * 1296 * @param Connection $con 1297 * @param Criteria $criteria 1298 * @throws PropelException 1299 */ 1300 public function getReportAnswers($criteria = null, $con = null) 1301 { 1302 // include the Peer class 1303 include_once 'model/om/BaseReportAnswerPeer.php'; 1304 if ($criteria === null) { 1305 $criteria = new Criteria(); 1306 } 1307 elseif ($criteria instanceof Criteria) 1308 { 1309 $criteria = clone $criteria; 1310 } 1311 1312 if ($this->collReportAnswers === null) { 1313 if ($this->isNew()) { 1314 $this->collReportAnswers = array(); 1315 } else { 1316 1317 $criteria->add(ReportAnswerPeer::ANSWER_ID, $this->getId()); 1318 1319 ReportAnswerPeer::addSelectColumns($criteria); 1320 $this->collReportAnswers = ReportAnswerPeer::doSelect($criteria, $con); 1321 } 1322 } else { 1323 // criteria has no effect for a new object 1324 if (!$this->isNew()) { 1325 // the following code is to determine if a new query is 1326 // called for. If the criteria is the same as the last 1327 // one, just return the collection. 1328 1329 1330 $criteria->add(ReportAnswerPeer::ANSWER_ID, $this->getId()); 1331 1332 ReportAnswerPeer::addSelectColumns($criteria); 1333 if (!isset($this->lastReportAnswerCriteria) || !$this->lastReportAnswerCriteria->equals($criteria)) { 1334 $this->collReportAnswers = ReportAnswerPeer::doSelect($criteria, $con); 1335 } 1336 } 1337 } 1338 $this->lastReportAnswerCriteria = $criteria; 1339 return $this->collReportAnswers; 1340 } 1341 1342 /** 1343 * Returns the number of related ReportAnswers. 1344 * 1345 * @param Criteria $criteria 1346 * @param Connection $con 1347 * @throws PropelException 1348 */ 1349 public function countReportAnswers($criteria = null, $con = null) 1350 { 1351 // include the Peer class 1352 include_once 'model/om/BaseReportAnswerPeer.php'; 1353 if ($criteria === null) { 1354 $criteria = new Criteria(); 1355 } 1356 elseif ($criteria instanceof Criteria) 1357 { 1358 $criteria = clone $criteria; 1359 } 1360 1361 $criteria->add(ReportAnswerPeer::ANSWER_ID, $this->getId()); 1362 1363 return ReportAnswerPeer::doCount($criteria, $con); 1364 } 1365 1366 /** 1367 * Method called to associate a ReportAnswer object to this object 1368 * through the ReportAnswer foreign key attribute 1369 * 1370 * @param ReportAnswer $l ReportAnswer 1371 * @return void 1372 * @throws PropelException 1373 */ 1374 public function addReportAnswer(ReportAnswer $l) 1375 { 1376 $this->collReportAnswers[] = $l; 1377 $l->setAnswer($this); 1378 } 1379 1380 1381 /** 1382 * If this collection has already been initialized with 1383 * an identical criteria, it returns the collection. 1384 * Otherwise if this Answer is new, it will return 1385 * an empty collection; or if this Answer has previously 1386 * been saved, it will retrieve related ReportAnswers from storage. 1387 * 1388 * This method is protected by default in order to keep the public 1389 * api reasonable. You can provide public methods for those you 1390 * actually need in Answer. 1391 */ 1392 public function getReportAnswersJoinUser($criteria = null, $con = null) 1393 { 1394 // include the Peer class 1395 include_once 'model/om/BaseReportAnswerPeer.php'; 1396 if ($criteria === null) { 1397 $criteria = new Criteria(); 1398 } 1399 elseif ($criteria instanceof Criteria) 1400 { 1401 $criteria = clone $criteria; 1402 } 1403 1404 if ($this->collReportAnswers === null) { 1405 if ($this->isNew()) { 1406 $this->collReportAnswers = array(); 1407 } else { 1408 1409 $criteria->add(ReportAnswerPeer::ANSWER_ID, $this->getId()); 1410 1411 $this->collReportAnswers = ReportAnswerPeer::doSelectJoinUser($criteria, $con); 1412 } 1413 } else { 1414 // the following code is to determine if a new query is 1415 // called for. If the criteria is the same as the last 1416 // one, just return the collection. 1417 1418 $criteria->add(ReportAnswerPeer::ANSWER_ID, $this->getId()); 1419 1420 if (!isset($this->lastReportAnswerCriteria) || !$this->lastReportAnswerCriteria->equals($criteria)) { 1421 $this->collReportAnswers = ReportAnswerPeer::doSelectJoinUser($criteria, $con); 1422 } 1423 } 1424 $this->lastReportAnswerCriteria = $criteria; 1425 1426 return $this->collReportAnswers; 1427 } 1428 1195 1429 } // BaseAnswer trunk/lib/model/om/BaseAnswerPeer.php
r23 r55 25 25 26 26 /** The total number of columns. */ 27 const NUM_COLUMNS = 8;27 const NUM_COLUMNS = 9; 28 28 29 29 /** The number of lazy-loaded columns. */ … … 52 52 const RELEVANCY_DOWN = 'ask_answer.RELEVANCY_DOWN'; 53 53 54 /** the column name for the REPORTS field */ 55 const REPORTS = 'ask_answer.REPORTS'; 56 54 57 /** the column name for the CREATED_AT field */ 55 58 const CREATED_AT = 'ask_answer.CREATED_AT'; … … 66 69 */ 67 70 private static $fieldNames = array ( 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, )71 BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', 'HtmlBody', 'RelevancyUp', 'RelevancyDown', 'Reports', 'CreatedAt', ), 72 BasePeer::TYPE_COLNAME => array (AnswerPeer::ID, AnswerPeer::QUESTION_ID, AnswerPeer::USER_ID, AnswerPeer::BODY, AnswerPeer::HTML_BODY, AnswerPeer::RELEVANCY_UP, AnswerPeer::RELEVANCY_DOWN, AnswerPeer::REPORTS, AnswerPeer::CREATED_AT, ), 73 BasePeer::TYPE_FIELDNAME => array ('id', 'question_id', 'user_id', 'body', 'html_body', 'relevancy_up', 'relevancy_down', 'reports', 'created_at', ), 74 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) 72 75 ); 73 76 … … 79 82 */ 80 83 private static $fieldKeys = array ( 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, )84 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, 'HtmlBody' => 4, 'RelevancyUp' => 5, 'RelevancyDown' => 6, 'Reports' => 7, 'CreatedAt' => 8, ), 85 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::REPORTS => 7, AnswerPeer::CREATED_AT => 8, ), 86 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'question_id' => 1, 'user_id' => 2, 'body' => 3, 'html_body' => 4, 'relevancy_up' => 5, 'relevancy_down' => 6, 'reports' => 7, 'created_at' => 8, ), 87 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) 85 88 ); 86 89 … … 196 199 197 200 $criteria->addSelectColumn(AnswerPeer::RELEVANCY_DOWN); 201 202 $criteria->addSelectColumn(AnswerPeer::REPORTS); 198 203 199 204 $criteria->addSelectColumn(AnswerPeer::CREATED_AT); trunk/lib/model/om/BaseQuestion.php
r31 r55 79 79 80 80 /** 81 * The value for the reports field. 82 * @var int 83 */ 84 protected $reports = 0; 85 86 87 /** 81 88 * The value for the created_at field. 82 89 * @var int … … 131 138 */ 132 139 private $lastQuestionTagCriteria = null; 140 141 /** 142 * Collection to store aggregation of collReportQuestions. 143 * @var array 144 */ 145 protected $collReportQuestions; 146 147 /** 148 * The criteria used to select the current contents of collReportQuestions. 149 * @var Criteria 150 */ 151 private $lastReportQuestionCriteria = null; 133 152 134 153 /** … … 221 240 222 241 return $this->interested_users; 242 } 243 244 /** 245 * Get the [reports] column value. 246 * 247 * @return int 248 */ 249 public function getReports() 250 { 251 252 return $this->reports; 223 253 } 224 254 … … 402 432 403 433 /** 434 * Set the value of [reports] column. 435 * 436 * @param int $v new value 437 * @return void 438 */ 439 public function setReports($v) 440 { 441 442 if ($this->reports !== $v || $v === 0) { 443 $this->reports = $v; 444 $this->modifiedColumns[] = QuestionPeer::REPORTS; 445 } 446 447 } // setReports() 448 449 /** 404 450 * Set the value of [created_at] column. 405 451 * … … 480 526 $this->interested_users = $rs->getInt($startcol + 6); 481 527 482 $this->created_at = $rs->getTimestamp($startcol + 7, null); 483 484 $this->updated_at = $rs->getTimestamp($startcol + 8, null); 528 $this->reports = $rs->getInt($startcol + 7); 529 530 $this->created_at = $rs->getTimestamp($startcol + 8, null); 531 532 $this->updated_at = $rs->getTimestamp($startcol + 9, null); 485 533 486 534 $this->resetModified(); … … 489 537 490 538 // FIXME - using NUM_COLUMNS may be clearer. 491 return $startcol + 9; // 9= QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS).539 return $startcol + 10; // 10 = QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS). 492 540 493 541 } catch (Exception $e) { … … 635 683 } 636 684 685 if ($this->collReportQuestions !== null) { 686 foreach($this->collReportQuestions as $referrerFK) { 687 if (!$referrerFK->isDeleted()) { 688 $affectedRows += $referrerFK->save($con); 689 } 690 } 691 } 692 637 693 $this->alreadyInSave = false; 638 694 } … … 719 775 } 720 776 777 if ($this->collReportQuestions !== null) { 778 foreach($this->collReportQuestions as $referrerFK) { 779 if (($retval = $referrerFK->validate()) !== true) { 780 $failureMap = array_merge($failureMap, $retval); 781 } 782 } 783 } 784 721 785 722 786 $this->alreadyInValidation = false; … … 774 838 break; 775 839 case 7: 840 return $this->getReports(); 841 break; 842 case 8: 776 843 return $this->getCreatedAt(); 777 844 break; 778 case 8:845 case 9: 779 846 return $this->getUpdatedAt(); 780 847 break; … … 806 873 $keys[5] => $this->getHtmlBody(), 807 874 $keys[6] => $this->getInterestedUsers(), 808 $keys[7] => $this->getCreatedAt(), 809 $keys[8] => $this->getUpdatedAt(), 875 $keys[7] => $this->getReports(), 876 $keys[8] => $this->getCreatedAt(), 877 $keys[9] => $this->getUpdatedAt(), 810 878 ); 811 879 return $result; … … 862 930 break; 863 931 case 7: 932 $this->setReports($value); 933 break; 934 case 8: 864 935 $this->setCreatedAt($value); 865 936 break; 866 case 8:937 case 9: 867 938 $this->setUpdatedAt($value); 868 939 break; … … 897 968 if (array_key_exists($keys[5], $arr)) $this->setHtmlBody($arr[$keys[5]]); 898 969 if (array_key_exists($keys[6], $arr)) $this->setInterestedUsers($arr[$keys[6]]); 899 if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); 900 if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); 970 if (array_key_exists($keys[7], $arr)) $this->setReports($arr[$keys[7]]); 971 if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]); 972 if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]); 901 973 } 902 974 … … 917 989 if ($this->isColumnModified(QuestionPeer::HTML_BODY)) $criteria->add(QuestionPeer::HTML_BODY, $this->html_body); 918 990 if ($this->isColumnModified(QuestionPeer::INTERESTED_USERS)) $criteria->add(QuestionPeer::INTERESTED_USERS, $this->interested_users); 991 if ($this->isColumnModified(QuestionPeer::REPORTS)) $criteria->add(QuestionPeer::REPORTS, $this->reports); 919 992 if ($this->isColumnModified(QuestionPeer::CREATED_AT)) $criteria->add(QuestionPeer::CREATED_AT, $this->created_at); 920 993 if ($this->isColumnModified(QuestionPeer::UPDATED_AT)) $criteria->add(QuestionPeer::UPDATED_AT, $this->updated_at); … … 984 1057 985 1058 $copyObj->setInterestedUsers($this->interested_users); 1059 1060 $copyObj->setReports($this->reports); 986 1061 987 1062 $copyObj->setCreatedAt($this->created_at); … … 1005 1080 foreach($this->getQuestionTags() as $relObj) { 1006 1081 $copyObj->addQuestionTag($relObj->copy($deepCopy)); 1082 } 1083 1084 foreach($this->getReportQuestions() as $relObj) { 1085 $copyObj->addReportQuestion($relObj->copy($deepCopy)); 1007 1086 } 1008 1087 … … 1570 1649 } 1571 1650 1651 /** 1652 * Temporary storage of collReportQuestions to save a possible db hit in 1653 * the event objects are add to the collection, but the 1654 * complete collection is never requested. 1655 * @return void 1656 */ 1657 public function initReportQuestions() 1658 { 1659 if ($this->collReportQuestions === null) { 1660 $this->collReportQuestions = array(); 1661 } 1662 } 1663 1664 /** 1665 * If this collection has already been initialized with 1666 * an identical criteria, it returns the collection. 1667 * Otherwise if this Question has previously 1668 * been saved, it will retrieve related ReportQuestions from storage. 1669 * If this Question is new, it will return 1670 * an empty collection or the current collection, the criteria 1671 * is ignored on a new object. 1672 * 1673 * @param Connection $con 1674 * @param Criteria $criteria 1675 * @throws PropelException 1676 */ 1677 public function getReportQuestions($criteria = null, $con = null) 1678 { 1679 // include the Peer class 1680 include_once 'model/om/BaseReportQuestionPeer.php'; 1681 if ($criteria === null) { 1682 $criteria = new Criteria(); 1683 } 1684 elseif ($criteria instanceof Criteria) 1685 { 1686 $criteria = clone $criteria; 1687 } 1688 1689 if ($this->collReportQuestions === null) { 1690 if ($this->isNew()) { 1691 $this->collReportQuestions = array(); 1692 } else { 1693 1694 $criteria->add(ReportQuestionPeer::QUESTION_ID, $this->getId()); 1695 1696 ReportQuestionPeer::addSelectColumns($criteria); 1697 $this->collReportQuestions = ReportQuestionPeer::doSelect($criteria, $con); 1698 } 1699 } else { 1700 // criteria has no effect for a new object 1701 if (!$this->isNew()) { 1702 // the following code is to determine if a new query is 1703 // called for. If the criteria is the same as the last 1704 // one, just return the collection. 1705 1706 1707 $criteria->add(ReportQuestionPeer::QUESTION_ID, $this->getId()); 1708 1709 ReportQuestionPeer::addSelectColumns($criteria); 1710 if (!isset($this->lastReportQuestionCriteria) || !$this->lastReportQuestionCriteria->equals($criteria)) { 1711 $this->collReportQuestions = ReportQuestionPeer::doSelect($criteria, $con); 1712 } 1713 } 1714 } 1715 $this->lastReportQuestionCriteria = $criteria; 1716 return $this->collReportQuestions; 1717 } 1718 1719 /** 1720 * Returns the number of related ReportQuestions. 1721 * 1722 * @param Criteria $criteria 1723 * @param Connection $con 1724 * @throws PropelException 1725 */ 1726 public function countReportQuestions($criteria = null, $con = null) 1727 { 1728 // include the Peer class 1729 include_once 'model/om/BaseReportQuestionPeer.php'; 1730 if ($criteria === null) { 1731 $criteria = new Criteria(); 1732 } 1733 elseif ($criteria instanceof Criteria) 1734 { 1735 $criteria = clone $criteria; 1736 } 1737 1738 $criteria->add(ReportQuestionPeer::QUESTION_ID, $this->getId()); 1739 1740 return ReportQuestionPeer::doCount($criteria, $con); 1741 } 1742 1743 /** 1744 * Method called to associate a ReportQuestion object to this object 1745 * through the ReportQuestion foreign key attribute 1746 * 1747 * @param ReportQuestion $l ReportQuestion 1748 * @return void 1749 * @throws PropelException 1750 */ 1751 public function addReportQuestion(ReportQuestion $l) 1752 { 1753 $this->collReportQuestions[] = $l; 1754 $l->setQuestion($this); 1755 } 1756 1757 1758 /** 1759 * If this collection has already been initialized with 1760 * an identical criteria, it returns the collection. 1761 * Otherwise if this Question is new, it will return 1762 * an empty collection; or if this Question has previously 1763 * been saved, it will retrieve related ReportQuestions from storage. 1764 * 1765 * This method is protected by default in order to keep the public 1766 * api reasonable. You can provide public methods for those you 1767 * actually need in Question. 1768 */ 1769 public function getReportQuestionsJoinUser($criteria = null, $con = null) 1770 { 1771 // include the Peer class 1772 include_once 'model/om/BaseReportQuestionPeer.php'; 1773 if ($criteria === null) { 1774 $criteria = new Criteria(); 1775 } 1776 elseif ($criteria instanceof Criteria) 1777 { 1778 $criteria = clone $criteria; 1779 } 1780 1781 if ($this->collReportQuestions === null) { 1782 if ($this->isNew()) { 1783 $this->collReportQuestions = array(); 1784 } else { 1785 1786 $criteria->add(ReportQuestionPeer::QUESTION_ID, $this->getId()); 1787 1788 $this->collReportQuestions = ReportQuestionPeer::doSelectJoinUser($criteria, $con); 1789 } 1790 } else { 1791 // the following code is to determine if a new query is 1792 // called for. If the criteria is the same as the last 1793 // one, just return the collection. 1794 1795 $criteria->add(ReportQuestionPeer::QUESTION_ID, $this->getId()); 1796 1797 if (!isset($this->lastReportQuestionCriteria) || !$this->lastReportQuestionCriteria->equals($criteria)) { 1798 $this->collReportQuestions = ReportQuestionPeer::doSelectJoinUser($criteria, $con); 1799 } 1800 } 1801 $this->lastReportQuestionCriteria = $criteria; 1802 1803 return $this->collReportQuestions; 1804 } 1805 1572 1806 } // BaseQuestion trunk/lib/model/om/BaseQuestionPeer.php
r23 r55 25 25 26 26 /** The total number of columns. */ 27 const NUM_COLUMNS = 9;27 const NUM_COLUMNS = 10; 28 28 29 29 /** The number of lazy-loaded columns. */ … … 52 52 const INTERESTED_USERS = 'ask_question.INTERESTED_USERS'; 53 53 54 /** the column name for the REPORTS field */ 55 const REPORTS = 'ask_question.REPORTS'; 56 54 57 /** the column name for the CREATED_AT field */ 55 58 const CREATED_AT = 'ask_question.CREATED_AT'; … … 69 72 */ 70 73 private static $fieldNames = array ( 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, )74 BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'StrippedTitle', 'Body', 'HtmlBody', 'InterestedUsers', 'Reports', 'CreatedAt', 'UpdatedAt', ), 75 BasePeer::TYPE_COLNAME => array (QuestionPeer::ID, QuestionPeer::USER_ID, QuestionPeer::TITLE, QuestionPeer::STRIPPED_TITLE, QuestionPeer::BODY, QuestionPeer::HTML_BODY, QuestionPeer::INTERESTED_USERS, QuestionPeer::REPORTS, QuestionPeer::CREATED_AT, QuestionPeer::UPDATED_AT, ), 76 BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'title', 'stripped_title', 'body', 'html_body', 'interested_users', 'reports', 'created_at', 'updated_at', ), 77 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) 75 78 ); 76 79 … … 82 85 */ 83 86 private static $fieldKeys = array ( 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, )87 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'StrippedTitle' => 3, 'Body' => 4, 'HtmlBody' => 5, 'InterestedUsers' => 6, 'Reports' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ), 88 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::REPORTS => 7, QuestionPeer::CREATED_AT => 8, QuestionPeer::UPDATED_AT => 9, ), 89 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'title' => 2, 'stripped_title' => 3, 'body' => 4, 'html_body' => 5, 'interested_users' => 6, 'reports' => 7, 'created_at' => 8, 'updated_at' => 9, ), 90 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) 88 91 ); 89 92 … … 199 202 200 203 $criteria->addSelectColumn(QuestionPeer::INTERESTED_USERS); 204 205 $criteria->addSelectColumn(QuestionPeer::REPORTS); 201 206 202 207 $criteria->addSelectColumn(QuestionPeer::CREATED_AT); trunk/lib/model/om/BaseQuestionTag.php
r31 r55 662 662 $criteria = new Criteria(QuestionTagPeer::DATABASE_NAME); 663 663 664 $criteria->add(QuestionTagPeer::QUESTION_ID, $this->question_id); 665 $criteria->add(QuestionTagPeer::USER_ID, $this->user_id); 666 $criteria->add(QuestionTagPeer::NORMALIZED_TAG, $this->normalized_tag); 664 667 665 668 return $criteria; … … 667 670 668 671 /** 669 * Returns NULL since this table doesn't have a primary key.670 * Th is method exists only for BC and is deprecated!671 * @return null672 * Returns the composite primary key for this object. 673 * The array elements will be in same order as specified in XML. 674 * @return array 672 675 */ 673 676 public function getPrimaryKey() 674 677 { 675 return null; 676 } 677 678 /** 679 * Dummy primary key setter. 680 * 681 * This function only exists to preserve backwards compatibility. It is no longer 682 * needed or required by the Persistent interface. It will be removed in next BC-breaking 683 * release of Propel. 684 * 685 * @deprecated 686 */ 687 public function setPrimaryKey($pk) 688 { 689 // do nothing, because this object doesn't have any primary keys 690 } 678 $pks = array(); 679 680 $pks[0] = $this->getQuestionId(); 681 682 $pks[1] = $this->getUserId(); 683 684 $pks[2] = $this->getNormalizedTag(); 685 686 return $pks; 687 } 688 689 /** 690 * Set the [composite] primary key. 691 * 692 * @param array $keys The elements of the composite key (order must match the order in XML file). 693 * @return void 694 */ 695 public function setPrimaryKey($keys) 696 { 697 698 $this->setQuestionId($keys[0]); 699 700 $this->setUserId($keys[1]); 701 702 $this->setNormalizedTag($keys[2]); 703 704 } 691 705 692 706 /** … … 703 717 { 704 718 705 $copyObj->setQuestionId($this->question_id);706 707 $copyObj->setUserId($this->user_id);708 709 719 $copyObj->setCreatedAt($this->created_at); 710 720 711 721 $copyObj->setTag($this->tag); 712 722 713 $copyObj->setNormalizedTag($this->normalized_tag);714 715 723 716 724 $copyObj->setNew(true); 725 726 $copyObj->setQuestionId(NULL); // this is a pkey column, so set to default value 727 728 $copyObj->setUserId(NULL); // this is a pkey column, so set to default value 729 730 $copyObj->setNormalizedTag(NULL); // this is a pkey column, so set to default value 717 731 718 732 } trunk/lib/model/om/BaseQuestionTagPeer.php
r31 r55 186 186 } 187 187 188 const COUNT = 'COUNT( *)';189 const COUNT_DISTINCT = 'COUNT(DISTINCT *)';188 const COUNT = 'COUNT(ask_question_tag.QUESTION_ID)'; 189 const COUNT_DISTINCT = 'COUNT(DISTINCT ask_question_tag.QUESTION_ID)'; 190 190 191 191 /** … … 942 942 $criteria = clone $values; // rename for clarity 943 943 944 $comparison = $criteria->getComparison(QuestionTagPeer::QUESTION_ID); 945 $selectCriteria->add(QuestionTagPeer::QUESTION_ID, $criteria->remove(QuestionTagPeer::QUESTION_ID), $comparison); 946 947 $comparison = $criteria->getComparison(QuestionTagPeer::USER_ID); 948 $selectCriteria->add(QuestionTagPeer::USER_ID, $criteria->remove(QuestionTagPeer::USER_ID), $comparison); 949 950 $comparison = $criteria->getComparison(QuestionTagPeer::NORMALIZED_TAG); 951 $selectCriteria->add(QuestionTagPeer::NORMALIZED_TAG, $criteria->remove(QuestionTagPeer::NORMALIZED_TAG), $comparison); 952 944 953 } else { // $values is QuestionTag object 945 954 $criteria = $values->buildCriteria(); // gets full criteria … … 998 1007 } elseif ($values instanceof QuestionTag) { 999 1008 1000 $criteria = $values->build Criteria();1009 $criteria = $values->buildPkeyCriteria(); 1001 1010 } else { 1002 1011 // it must be the primary key … … 1014 1023 { 1015 1024 1016 } 1017 1025 $vals[0][] = $value[0]; 1026 $vals[1][] = $value[1]; 1027 $vals[2][] = $value[2]; 1028 } 1029 1030 $criteria->add(QuestionTagPeer::QUESTION_ID, $vals[0], Criteria::IN); 1031 $criteria->add(QuestionTagPeer::USER_ID, $vals[1], Criteria::IN); 1032 $criteria->add(QuestionTagPeer::NORMALIZED_TAG, $vals[2], Criteria::IN); 1018 1033 } 1019 1034 … … 1074 1089 } 1075 1090 1091 /** 1092 * Retrieve object using using composite pkey values. 1093 * @param int $question_id 1094 @param int $user_id 1095 @param string $normalized_tag 1096 1097 * @param Connection $con 1098 * @return QuestionTag 1099 */ 1100 public static function retrieveByPK( $question_id, $user_id, $normalized_tag, $con = null) { 1101 if ($con === null) { 1102 $con = Propel::getConnection(self::DATABASE_NAME); 1103 } 1104 $criteria = new Criteria(); 1105 $criteria->add(QuestionTagPeer::QUESTION_ID, $question_id); 1106 $criteria->add(QuestionTagPeer::USER_ID, $user_id); 1107 $criteria->add(QuestionTagPeer::NORMALIZED_TAG, $normalized_tag); 1108 $v = QuestionTagPeer::doSelect($criteria, $con); 1109 return !empty($v) ? $v[0] : null; 1110 } 1076 1111 } // BaseQuestionTagPeer 1077 1112 trunk/lib/model/om/BaseUser.php
r44 r55 86 86 87 87 /** 88 * The value for the want_to_be_moderator field. 89 * @var boolean 90 */ 91 protected $want_to_be_moderator = false; 92 93 94 /** 95 * The value for the is_moderator field. 96 * @var boolean 97 */ 98 protected $is_moderator = false; 99 100 101 /** 102 * The value for the is_administrator field. 103 * @var boolean 104 */ 105 protected $is_administrator = false; 106 107 108 /** 109 * The value for the deletions field. 110 * @var int 111 */ 112 protected $deletions = 0; 113 114 115 /** 88 116 * The value for the created_at field. 89 117 * @var int … … 150 178 */ 151 179 private $lastQuestionTagCriteria = null; 180 181 /** 182 * Collection to store aggregation of collReportQuestions. 183 * @var array 184 */ 185 protected $collReportQuestions; 186 187 /** 188 * The criteria used to select the current contents of collReportQuestions. 189 * @var Criteria 190 */ 191 private $lastReportQuestionCriteria = null; 192 193 /** 194 * Collection to store aggregation of collReportAnswers. 195 * @var array 196 */ 197 protected $collReportAnswers; 198 199 /** 200 * The criteria used to select the current contents of collReportAnswers. 201 * @var Criteria 202 */ 203 private $lastReportAnswerCriteria = null; 152 204 153 205 /** … … 251 303 252 304 return $this->has_paypal; 305 } 306 307 /** 308 * Get the [want_to_be_moderator] column value. 309 * 310 * @return boolean 311 */ 312 public function getWantToBeModerator() 313 { 314 315 return $this->want_to_be_moderator; 316 } 317 318 /** 319 * Get the [is_moderator] column value. 320 * 321 * @return boolean 322 */ 323 public function getIsModerator() 324 { 325 326 return $this->is_moderator; 327 } 328 329 /** 330 * Get the [is_administrator] column value. 331 * 332 * @return boolean 333 */ 334 public function getIsAdministrator() 335 { 336 337 return $this->is_administrator; 338 } 339 340 /** 341 * Get the [deletions] column value. 342 * 343 * @return int 344 */ 345 public function getDeletions() 346 { 347 348 return $this->deletions; 253 349 } 254 350 … … 413 509 414 510 /** 511 * Set the value of [want_to_be_moderator] column. 512 * 513 * @param boolean $v new value 514 * @return void 515 */ 516 public function setWantToBeModerator($v) 517 { 518 519 if ($this->want_to_be_moderator !== $v || $v === false) { 520 $this->want_to_be_moderator = $v; 521 $this->modifiedColumns[] = UserPeer::WANT_TO_BE_MODERATOR; 522 } 523 524 } // setWantToBeModerator() 525 526 /** 527 * Set the value of [is_moderator] column. 528 * 529 * @param boolean $v new value 530 * @return void 531 */ 532 public function setIsModerator($v) 533 { 534 535 if ($this->is_moderator !== $v || $v === false) { 536 $this->is_moderator = $v; 537 $this->modifiedColumns[] = UserPeer::IS_MODERATOR; 538 } 539 540 } // setIsModerator() 541 542 /** 543 * Set the value of [is_administrator] column. 544 * 545 * @param boolean $v new value 546 * @return void 547 */ 548 public function setIsAdministrator($v) 549 { 550 551 if ($this->is_administrator !== $v || $v === false) { 552 $this->is_administrator = $v; 553 $this->modifiedColumns[] = UserPeer::IS_ADMINISTRATOR; 554 } 555 556 } // setIsAdministrator() 557 558 /** 559 * Set the value of [deletions] column. 560 * 561 * @param int $v new value 562 * @return void 563 */ 564 public function setDeletions($v) 565 { 566 567 if ($this->deletions !== $v || $v === 0) { 568 $this->deletions = $v; 569 $this->modifiedColumns[] = UserPeer::DELETIONS; 570 } 571 572 } // setDeletions() 573 574 /** 415 575 * Set the value of [created_at] column. 416 576 * … … 469 629 $this->has_paypal = $rs->getBoolean($startcol + 7); 470 630 471 $this->created_at = $rs->getTimestamp($startcol + 8, null); 631 $this->want_to_be_moderator = $rs->getBoolean($startcol + 8); 632 633 $this->is_moderator = $rs->getBoolean($startcol + 9); 634 635 $this->is_administrator = $rs->getBoolean($startcol + 10); 636 637 $this->deletions = $rs->getInt($startcol + 11); 638 639 $this->created_at = $rs->getTimestamp($startcol + 12, null); 472 640 473 641 $this->resetModified(); … … 476 644 477 645 // FIXME - using NUM_COLUMNS may be clearer. 478 return $startcol + 9; // 9= UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS).646 return $startcol + 13; // 13 = UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS). 479 647 480 648 } catch (Exception $e) { … … 624 792 } 625 793 794 if ($this->collReportQuestions !== null) { 795 foreach($this->collReportQuestions as $referrerFK) { 796 if (!$referrerFK->isDeleted()) { 797 $affectedRows += $referrerFK->save($con); 798 } 799 } 800 } 801 802 if ($this->collReportAnswers !== null) { 803 foreach($this->collReportAnswers as $referrerFK) { 804 if (!$referrerFK->isDeleted()) { 805 $affectedRows += $referrerFK->save($con); 806 } 807 } 808 } 809 626 810 $this->alreadyInSave = false; 627 811 } … … 712 896 } 713 897 898 if ($this->collReportQuestions !== null) { 899 foreach($this->collReportQuestions as $referrerFK) { 900 if (($retval = $referrerFK->validate()) !== true) { 901 $failureMap = array_merge($failureMap, $retval); 902 } 903 } 904 } 905 906 if ($this->collReportAnswers !== null) { 907 foreach($this->collReportAnswers as $referrerFK) { 908 if (($retval = $referrerFK->validate()) !== true) { 909 $failureMap = array_merge($failureMap, $retval); 910 } 911 } 912 } 913 714 914 715 915 $this->alreadyInValidation = false; … … 770 970 break; 771 971 case 8: 972 return $this->getWantToBeModerator(); 973 break; 974 case 9: 975 return $this->getIsModerator(); 976 break; 977 case 10: 978 return $this->getIsAdministrator(); 979 break; 980 case 11: 981 return $this->getDeletions(); 982 break; 983 case 12: 772 984 return $this->getCreatedAt(); 773 985 break; … … 800 1012 $keys[6] => $this->getSalt(), 801 1013 $keys[7] => $this->getHasPaypal(), 802 $keys[8] => $this->getCreatedAt(), 1014 $keys[8] => $this->getWantToBeModerator(), 1015 $keys[9] => $this->getIsModerator(), 1016 $keys[10] => $this->getIsAdministrator(), 1017 $keys[11] => $this->getDeletions(), 1018 $keys[12] => $this->getCreatedAt(), 803 1019 ); 804 1020 return $result; … … 858 1074 break; 859 1075 case 8: 1076 $this->setWantToBeModerator($value); 1077 break; 1078 case 9: 1079 $this->setIsModerator($value); 1080 break; 1081 case 10: 1082 $this->setIsAdministrator($value); 1083 break; 1084 case 11: 1085 $this->setDeletions($value); 1086 break; 1087 case 12: 860 1088 $this->setCreatedAt($value); 861 1089 break; … … 891 1119 if (array_key_exists($keys[6], $arr)) $this->setSalt($arr[$keys[6]]); 892 1120 if (array_key_exists($keys[7], $arr)) $this->setHasPaypal($arr[$keys[7]]); 893 if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]); 1121 if (array_key_exists($keys[8], $arr)) $this->setWantToBeModerator($arr[$keys[8]]); 1122 if (array_key_exists($keys[9], $arr)) $this->setIsModerator($arr[$keys[9]]); 1123 if (array_key_exists($keys[10], $arr)) $this->setIsAdministrator($arr[$keys[10]]); 1124 if (array_key_exists($keys[11], $arr)) $this->setDeletions($arr[$keys[11]]); 1125 if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]); 894 1126 } 895 1127 … … 911 1143 if ($this->isColumnModified(UserPeer::SALT)) $criteria->add(UserPeer::SALT, $this->salt); 912 1144 if ($this->isColumnModified(UserPeer::HAS_PAYPAL)) $criteria->add(UserPeer::HAS_PAYPAL, $this->has_paypal); 1145 if ($this->isColumnModified(UserPeer::WANT_TO_BE_MODERATOR)) $criteria->add(UserPeer::WANT_TO_BE_MODERATOR, $this->want_to_be_moderator); 1146 if ($this->isColumnModified(UserPeer::IS_MODERATOR)) $criteria->add(UserPeer::IS_MODERATOR, $this->is_moderator); 1147 if ($this->isColumnModified(UserPeer::IS_ADMINISTRATOR)) $criteria->add(UserPeer::IS_ADMINISTRATOR, $this->is_administrator); 1148 if ($this->isColumnModified(UserPeer::DELETIONS)) $criteria->add(UserPeer::DELETIONS, $this->deletions); 913 1149 if ($this->isColumnModified(UserPeer::CREATED_AT)) $criteria->add(UserPeer::CREATED_AT, $this->created_at); 914 1150 … … 979 1215 980 1216 $copyObj->setHasPaypal($this->has_paypal); 1217 1218 $copyObj->setWantToBeModerator($this->want_to_be_moderator); 1219 1220 $copyObj->setIsModerator($this->is_moderator); 1221 1222 $copyObj->setIsAdministrator($this->is_administrator); 1223 1224 $copyObj->setDeletions($this->deletions); 981 1225 982 1226 $copyObj->setCreatedAt($this->created_at); … … 1006 1250 foreach($this->getQuestionTags() as $relObj) { 1007 1251 $copyObj->addQuestionTag($relObj->copy($deepCopy)); 1252 } 1253 1254 foreach($this->getReportQuestions() as $relObj) { 1255 $copyObj->addReportQuestion($relObj->copy($deepCopy)); 1256 } 1257 1258 foreach($this->getReportAnswers() as $relObj) { 1259 $copyObj->addReportAnswer($relObj->copy($deepCopy)); 1008 1260 } 1009 1261 … … 1781 2033 } 1782 2034 2035 /** 2036 * Temporary storage of collReportQuestions to save a possible db hit in 2037 * the event objects are add to the collection, but the 2038 * complete collection is never requested. 2039 * @return void 2040 */ 2041 public function initReportQuestions() 2042 { 2043 if ($this->collReportQuestions === null) { 2044 $this->collReportQuestions = array(); 2045 } 2046 } 2047 2048 /** 2049 * If this collection has already been initialized with 2050 * an identical criteria, it returns the collection. 2051 * Otherwise if this User has previously 2052 * been saved, it will retrieve related ReportQuestions from storage. 2053 * If this User is new, it will return 2054 * an empty collection or the current collection, the criteria 2055 * is ignored on a new object. 2056 * 2057 * @param Connection $con 2058 * @param Criteria $criteria 2059 * @throws PropelException 2060 */ 2061 public function getReportQuestions($criteria = null, $con = null) 2062 { 2063 // include the Peer class 2064 include_once 'model/om/BaseReportQuestionPeer.php'; 2065 if ($criteria === null) { 2066 $criteria = new Criteria(); 2067 } 2068 elseif ($criteria instanceof Criteria) 2069 { 2070 $criteria = clone $criteria; 2071 } 2072 2073 if ($this->collReportQuestions === null) { 2074 if ($this->isNew()) { 2075 $this->collReportQuestions = array(); 2076 } else { 2077 2078 $criteria->add(ReportQuestionPeer::USER_ID, $this->getId()); 2079 2080 ReportQuestionPeer::addSelectColumns($criteria); 2081 $this->collReportQuestions = ReportQuestionPeer::doSelect($criteria, $con); 2082 } 2083 } else { 2084 // criteria has no effect for a new object 2085 if (!$this->isNew()) { 2086 // the following code is to determine if a new query is 2087 // called for. If the criteria is the same as the last 2088 // one, just return the collection. 2089 2090 2091 $criteria->add(ReportQuestionPeer::USER_ID, $this->getId()); 2092 2093 ReportQuestionPeer::addSelectColumns($criteria); 2094 if (!isset($this->lastReportQuestionCriteria) || !$this->lastReportQuestionCriteria->equals($criteria)) { 2095 $this->collReportQuestions = ReportQuestionPeer::doSelect($criteria, $con); 2096 } 2097 } 2098 } 2099 $this->lastReportQuestionCriteria = $criteria; 2100 return $this->collReportQuestions; 2101 } 2102 2103 /** 2104 * Returns the number of related ReportQuestions. 2105 * 2106 * @param Criteria $criteria 2107 * @param Connection $con 2108 * @throws PropelException 2109 */ 2110 public function countReportQuestions($criteria = null, $con = null) 2111 { 2112 // include the Peer class 2113 include_once 'model/om/BaseReportQuestionPeer.php'; 2114 if ($criteria === null) { 2115 $criteria = new Criteria(); 2116 } 2117 elseif ($criteria instanceof Criteria) 2118 { 2119 $criteria = clone $criteria; 2120 } 2121 2122 $criteria->add(ReportQuestionPeer::USER_ID, $this->getId()); 2123 2124 return ReportQuestionPeer::doCount($criteria, $con); 2125 } 2126 2127 /** 2128 * Method called to associate a ReportQuestion object to this object 2129 * through the ReportQuestion foreign key attribute 2130 * 2131 * @param ReportQuestion $l ReportQuestion 2132 * @return void 2133 * @throws PropelException 2134 */ 2135 public function addReportQuestion(ReportQuestion $l) 2136 { 2137 $this->collReportQuestions[] = $l; 2138 $l->setUser($this); 2139 } 2140 2141 2142 /** 2143 * If this collection has already been initialized with 2144 * an identical criteria, it returns the collection. 2145 * Otherwise if this User is new, it will return 2146 * an empty collection; or if this User has previously 2147 * been saved, it will retrieve related ReportQuestions from storage. 2148 * 2149 * This method is protected by default in order to keep the public 2150 * api reasonable. You can provide public methods for those you 2151 * actually need in User. 2152 */ 2153 public function getReportQuestionsJoinQuestion($criteria = null, $con = null) 2154 { 2155 // include the Peer class 2156 include_once 'model/om/BaseReportQuestionPeer.php'; 2157 if ($criteria === null) { 2158 $criteria = new Criteria(); 2159 } 2160 elseif ($criteria instanceof Criteria) 2161 { 2162 $criteria = clone $criteria; 2163 } 2164 2165 if ($this->collReportQuestions === null) { 2166 if ($this->isNew()) { 2167 $this->collReportQuestions = array(); 2168 } else { 2169 2170 $criteria->add(ReportQuestionPeer::USER_ID, $this->getId()); 2171 2172 $this->collReportQuestions = ReportQuestionPeer::doSelectJoinQuestion($criteria, $con); 2173 } 2174 } else { 2175 // the following code is to determine if a new query is 2176 // called for. If the criteria is the same as the last 2177 // one, just return the collection. 2178 2179 $criteria->add(ReportQuestionPeer::USER_ID, $this->getId()); 2180 2181 if (!isset($this->lastReportQuestionCriteria) || !$this->lastReportQuestionCriteria->equals($criteria)) { 2182 $this->collReportQuestions = ReportQuestionPeer::doSelectJoinQuestion($criteria, $con); 2183 } 2184 } 2185 $this->lastReportQuestionCriteria = $criteria; 2186 2187 return $this->collReportQuestions; 2188 } 2189 2190 /** 2191 * Temporary storage of collReportAnswers to save a possible db hit in 2192 * the event objects are add to the collection, but the 2193 * complete collection is never requested. 2194 * @return void 2195 */ 2196 public function initReportAnswers() 2197 { 2198 if ($this->collReportAnswers === null) { 2199 $this->collReportAnswers = array(); 2200 } 2201 } 2202 2203 /** 2204 * If this collection has already been initialized with 2205 * an identical criteria, it returns the collection. 2206 * Otherwise if this User has previously 2207 * been saved, it will retrieve related ReportAnswers from storage. 2208 * If this User is new, it will return 2209 * an empty collection or the current collection, the criteria 2210 * is ignored on a new object. 2211 * 2212 * @param Connection $con 2213 * @param Criteria $criteria 2214 * @throws PropelException 2215 */ 2216 public function getReportAnswers($criteria = null, $con = null) 2217 { 2218 // include the Peer class 2219 include_once 'model/om/BaseReportAnswerPeer.php'; 2220 if ($criteria === null) { 2221 $criteria = new Criteria(); 2222 } 2223 elseif ($criteria instanceof Criteria) 2224 { 2225 $criteria = clone $criteria; 2226 } 2227 2228 if ($this->collReportAnswers === null) { 2229 if ($this->isNew()) { 2230 $this->collReportAnswers = array(); 2231 } else { 2232 2233 $criteria->add(ReportAnswerPeer::USER_ID, $this->getId()); 2234 2235 ReportAnswerPeer::addSelectColumns($criteria); 2236 $this->collReportAnswers = ReportAnswerPeer::doSelect($criteria, $con); 2237 } 2238 } else { 2239 // criteria has no effect for a new object 2240 if (!$this->isNew()) { 2241 // the following code is to determine if a new query is 2242 // called for. If the criteria is the same as the last 2243 // one, just return the collection. 2244 2245 2246 $criteria->add(ReportAnswerPeer::USER_ID, $this->getId()); 2247 2248 ReportAnswerPeer::addSelectColumns($criteria); 2249 if (!isset($this->lastReportAnswerCriteria) || !$this->lastReportAnswerCriteria->equals($criteria)) { 2250 $this->collReportAnswers = ReportAnswerPeer::doSelect($criteria, $con); 2251 } 2252 } 2253 } 2254 $this->lastReportAnswerCriteria = $criteria; 2255 return $this->collReportAnswers; 2256 } 2257 2258 /** 2259 * Returns the number of related ReportAnswers. 2260 * 2261 * @param Criteria $criteria 2262 * @param Connection $con 2263 * @throws PropelException 2264 */ 2265 public function countReportAnswers($criteria = null, $con = null) 2266 { 2267 // include the Peer class 2268 include_once 'model/om/BaseReportAnswerPeer.php'; 2269 if ($criteria === null) { 2270 $criteria = new Criteria(); 2271 } 2272 elseif ($criteria instanceof Criteria) 2273 { 2274 $criteria = clone $criteria; 2275 } 2276 2277 $criteria->add(ReportAnswerPeer::USER_ID, $this->getId()); 2278 2279 return ReportAnswerPeer::doCount($criteria, $con); 2280 } 2281 2282 /** 2283 * Method called to associate a ReportAnswer object to this object 2284 * through the ReportAnswer foreign key attribute 2285 * 2286 * @param ReportAnswer $l ReportAnswer 2287 * @return void 2288 * @throws PropelException 2289 */ 2290 public function addReportAnswer(ReportAnswer $l) 2291 { 2292 $this->collReportAnswers[] = $l; 2293 $l->setUser($this); 2294 } 2295 2296 2297 /** 2298 * If this collection has already been initialized with 2299 * an identical criteria, it returns the collection. 2300 * Otherwise if this User is new, it will return 2301 * an empty collection; or if this User has previously 2302 * been saved, it will retrieve related ReportAnswers from storage. 2303 * 2304 * This method is protected by default in order to keep the public 2305 * api reasonable. You can provide public methods for those you 2306 * actually need in User. 2307 */ 2308 public function getReportAnswersJoinAnswer($criteria = null, $con = null) 2309 { 2310 // include the Peer class 2311 include_once 'model/om/BaseReportAnswerPeer.php'; 2312 if ($criteria === null) { 2313 $criteria = new Criteria(); 2314 } 2315 elseif ($criteria instanceof Criteria) 2316 { 2317 $criteria = clone $criteria; 2318 } 2319 2320 if ($this->collReportAnswers === null) { 2321 if ($this->isNew()) { 2322 $this->collReportAnswers = array(); 2323 } else { 2324 2325 $criteria->add(ReportAnswerPeer::USER_ID, $this->getId()); 2326 2327 $this->collReportAnswers = ReportAnswerPeer::doSelectJoinAnswer($criteria, $con); 2328 } 2329 } else { 2330 // the following code is to determine if a new query is 2331 // called for. If the criteria is the same as the last 2332 // one, just return the collection. 2333 2334 $criteria->add(ReportAnswerPeer::USER_ID, $this->getId()); 2335 2336 if (!isset($this->lastReportAnswerCriteria) || !$this->lastReportAnswerCriteria->equals($criteria)) { 2337 $this->collReportAnswers = ReportAnswerPeer::doSelectJoinAnswer($criteria, $con); 2338 } 2339 } 2340 $this->lastReportAnswerCriteria = $criteria; 2341 2342 return $this->collReportAnswers; 2343 } 2344 1783 2345 } // BaseUser trunk/lib/model/om/BaseUserPeer.php
r44 r55 25 25 26 26 /** The total number of columns. */ 27 const NUM_COLUMNS = 9;27 const NUM_COLUMNS = 13; 28 28 29 29 /** The number of lazy-loaded columns. */ … … 55 55 const HAS_PAYPAL = 'ask_user.HAS_PAYPAL'; 56 56 57 /** the column name for the WANT_TO_BE_MODERATOR field */ 58 const WANT_TO_BE_MODERATOR = 'ask_user.WANT_TO_BE_MODERATOR'; 59 60 /** the column name for the IS_MODERATOR field */ 61 const IS_MODERATOR = 'ask_user.IS_MODERATOR'; 62 63 /** the column name for the IS_ADMINISTRATOR field */ 64 const IS_ADMINISTRATOR = 'ask_user.IS_ADMINISTRATOR'; 65 66 /** the column name for the DELETIONS field */ 67 const DELETIONS = 'ask_user.DELETIONS'; 68 57 69 /** the column name for the CREATED_AT field */ 58 70 const CREATED_AT = 'ask_user.CREATED_AT'; … … 69 81 */ 70 82 private static $fieldNames = array ( 71 BasePeer::TYPE_PHPNAME => array ('Id', 'Nickname', 'FirstName', 'LastName', 'Email', 'Sha1Password', 'Salt', 'HasPaypal', ' CreatedAt', ),72 BasePeer::TYPE_COLNAME => array (UserPeer::ID, UserPeer::NICKNAME, UserPeer::FIRST_NAME, UserPeer::LAST_NAME, UserPeer::EMAIL, UserPeer::SHA1_PASSWORD, UserPeer::SALT, UserPeer::HAS_PAYPAL, UserPeer:: CREATED_AT, ),73 BasePeer::TYPE_FIELDNAME => array ('id', 'nickname', 'first_name', 'last_name', 'email', 'sha1_password', 'salt', 'has_paypal', ' created_at', ),74 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )83 BasePeer::TYPE_PHPNAME => array ('Id', 'Nickname', 'FirstName', 'LastName', 'Email', 'Sha1Password', 'Salt', 'HasPaypal', 'WantToBeModerator', 'IsModerator', 'IsAdministrator', 'Deletions', 'CreatedAt', ), 84 BasePeer::TYPE_COLNAME => array (UserPeer::ID, UserPeer::NICKNAME, UserPeer::FIRST_NAME, UserPeer::LAST_NAME, UserPeer::EMAIL, UserPeer::SHA1_PASSWORD, UserPeer::SALT, UserPeer::HAS_PAYPAL, UserPeer::WANT_TO_BE_MODERATOR, UserPeer::IS_MODERATOR, UserPeer::IS_ADMINISTRATOR, UserPeer::DELETIONS, UserPeer::CREATED_AT, ), 85 BasePeer::TYPE_FIELDNAME => array ('id', 'nickname', 'first_name', 'last_name', 'email', 'sha1_password', 'salt', 'has_paypal', 'want_to_be_moderator', 'is_moderator', 'is_administrator', 'deletions', 'created_at', ), 86 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) 75 87 ); 76 88 … … 82 94 */ 83 95 private static $fieldKeys = array ( 84 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nickname' => 1, 'FirstName' => 2, 'LastName' => 3, 'Email' => 4, 'Sha1Password' => 5, 'Salt' => 6, 'HasPaypal' => 7, ' CreatedAt' => 8, ),85 BasePeer::TYPE_COLNAME => array (UserPeer::ID => 0, UserPeer::NICKNAME => 1, UserPeer::FIRST_NAME => 2, UserPeer::LAST_NAME => 3, UserPeer::EMAIL => 4, UserPeer::SHA1_PASSWORD => 5, UserPeer::SALT => 6, UserPeer::HAS_PAYPAL => 7, UserPeer:: CREATED_AT => 8, ),86 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'nickname' => 1, 'first_name' => 2, 'last_name' => 3, 'email' => 4, 'sha1_password' => 5, 'salt' => 6, 'has_paypal' => 7, ' created_at' => 8, ),87 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )96 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nickname' => 1, 'FirstName' => 2, 'LastName' => 3, 'Email' => 4, 'Sha1Password' => 5, 'Salt' => 6, 'HasPaypal' => 7, 'WantToBeModerator' => 8, 'IsModerator' => 9, 'IsAdministrator' => 10, 'Deletions' => 11, 'CreatedAt' => 12, ), 97 BasePeer::TYPE_COLNAME => array (UserPeer::ID => 0, UserPeer::NICKNAME => 1, UserPeer::FIRST_NAME => 2, UserPeer::LAST_NAME => 3, UserPeer::EMAIL => 4, UserPeer::SHA1_PASSWORD => 5, UserPeer::SALT => 6, UserPeer::HAS_PAYPAL => 7, UserPeer::WANT_TO_BE_MODERATOR => 8, UserPeer::IS_MODERATOR => 9, UserPeer::IS_ADMINISTRATOR => 10, UserPeer::DELETIONS => 11, UserPeer::CREATED_AT => 12, ), 98 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'nickname' => 1, 'first_name' => 2, 'last_name' => 3, 'email' => 4, 'sha1_password' => 5, 'salt' => 6, 'has_paypal' => 7, 'want_to_be_moderator' => 8, 'is_moderator' => 9, 'is_administrator' => 10, 'deletions' => 11, 'created_at' => 12, ), 99 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) 88 100 ); 89 101 … … 201 213 202 214 $criteria->addSelectColumn(UserPeer::HAS_PAYPAL); 215 216 $criteria->addSelectColumn(UserPeer::WANT_TO_BE_MODERATOR); 217 218 $criteria->addSelectColumn(UserPeer::IS_MODERATOR); 219 220 $criteria->addSelectColumn(UserPeer::IS_ADMINISTRATOR); 221 222 $criteria->addSelectColumn(UserPeer::DELETIONS); 203 223 204 224 $criteria->addSelectColumn(UserPeer::CREATED_AT); trunk/web/css/main.css
r42 r55 261 261 div#content_bar li 262 262 { 263 padding: 0 0 5px 5px; 263 264 list-style:none; 264 265 } … … 315 316 } 316 317 318 .clearright 319 { 320 clear: right; 321 } 322 317 323 .form input 318 324 { … … 392 398 } 393 399 394 #rss_links li395 {396 padding: 0 0 5px 5px;397 }398 399 400 #add_question 400 401 { … … 412 413 } 413 414 414 . tags415 .options, .options :link, .options :visited 415 416 { 416 417 color: #aaa; 417 418 } 418 419 419 .right420 {421 text-align: right;422 }423 424 420 .small 425 421 {
