Beispiel #1
0
 public function removeTag($question, $tag)
 {
     $c = new Criteria();
     $c->add(QuestionTagPeer::QUESTION_ID, $question->getId());
     $c->add(QuestionTagPeer::USER_ID, $this->getId());
     $c->add(QuestionTagPeer::NORMALIZED_TAG, Tag::normalize($tag));
     QuestionTagPeer::doDelete($c);
 }
Beispiel #2
0
 public function executePopular()
 {
     $this->tags = QuestionTagPeer::getPopularTags(40);
     $this->getResponse()->setTitle('askeet! » popular tags');
 }
 public static function retrieveByPK($question_id, $user_id, $normalized_tag, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(QuestionTagPeer::QUESTION_ID, $question_id);
     $criteria->add(QuestionTagPeer::USER_ID, $user_id);
     $criteria->add(QuestionTagPeer::NORMALIZED_TAG, $normalized_tag);
     $v = QuestionTagPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
 public function executeDeleteTag()
 {
     QuestionTagPeer::deleteSpam($this->getUser()->getSubscriber(), $this->getRequestParameter('tag'));
     $this->redirect($this->getRequest()->getReferer());
 }
Beispiel #5
0
 public function getQuestionTagsJoinQuestion($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseQuestionTagPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collQuestionTags === null) {
         if ($this->isNew()) {
             $this->collQuestionTags = array();
         } else {
             $criteria->add(QuestionTagPeer::USER_ID, $this->getId());
             $this->collQuestionTags = QuestionTagPeer::doSelectJoinQuestion($criteria, $con);
         }
     } else {
         $criteria->add(QuestionTagPeer::USER_ID, $this->getId());
         if (!isset($this->lastQuestionTagCriteria) || !$this->lastQuestionTagCriteria->equals($criteria)) {
             $this->collQuestionTags = QuestionTagPeer::doSelectJoinQuestion($criteria, $con);
         }
     }
     $this->lastQuestionTagCriteria = $criteria;
     return $this->collQuestionTags;
 }
Beispiel #6
0
use_helper('Global');
?>

<div id="add_question">
  <?php 
echo link_to_login(__('ask a new question'), '@add_question');
?>
</div>

<h2><?php 
echo __('popular tags');
?>
</h2>
<?php 
echo include_partial('tag/tag_cloud', array('tags' => QuestionTagPeer::getPopularTags(20)));
?>
<div class="right" style="padding-top: 5px"><?php 
echo link_to(__('more popular tags') . ' &raquo;', '@popular_tags');
?>
</div>

<h2><?php 
echo __('find it');
?>
</h2>
<?php 
echo include_partial('question/search');
?>

<h2><?php 
Beispiel #7
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = QuestionTagPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setQuestionId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setUserId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCreatedAt($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTag($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setNormalizedTag($arr[$keys[4]]);
     }
 }
Beispiel #8
0
 public function hasTag($tag)
 {
     $c = new Criteria();
     $c->add(QuestionTagPeer::QUESTION_ID, $this->getId());
     $c->add(QuestionTagPeer::NORMALIZED_TAG, Tag::normalize($tag));
     return QuestionTagPeer::doSelectOne($c) ? true : false;
 }