当前位置: 首页>>代码示例>>PHP>>正文


PHP TagPeer::doSelectRS方法代码示例

本文整理汇总了PHP中TagPeer::doSelectRS方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::doSelectRS方法的具体用法?PHP TagPeer::doSelectRS怎么用?PHP TagPeer::doSelectRS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TagPeer的用法示例。


在下文中一共展示了TagPeer::doSelectRS方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeSioccupadi

 public function executeSioccupadi()
 {
     $options = array('limit' => 20, 'sort_by_relevance' => true);
     // estrazione tag, tipo firma, tipo atto
     // questo dovrebbe andare in TagPeer, ma romperebbe la neutralità del plugin
     $c = new Criteria();
     $c->addJoin(OppCaricaHasAttoPeer::ATTO_ID, OppAttoPeer::ID);
     $c->addJoin(TaggingPeer::TAGGABLE_ID, OppAttoPeer::ID);
     $c->addJoin(TagPeer::ID, TaggingPeer::TAG_ID);
     $c->add(OppCaricaHasAttoPeer::CARICA_ID, $this->carica->getId());
     $c->add(TaggingPeer::TAGGABLE_MODEL, 'OppAtto');
     $c->clearSelectColumns();
     $c->addSelectColumn(TagPeer::TRIPLE_VALUE);
     $c->addSelectColumn(OppCaricaHasAttoPeer::TIPO);
     $c->addSelectColumn(OppAttoPeer::TIPO_ATTO_ID);
     // costruzione array associativo dei tag
     $tags = array();
     $rs = TagPeer::doSelectRS($c);
     while ($rs->next()) {
         $value = $rs->getString(1);
         $tipo = $rs->getString(2);
         $tipo_atto_id = $rs->getInt(3);
         if (!array_key_exists($value, $tags)) {
             $tags[$value] = 0;
         }
         $tags[$value] += OppCaricaHasAttoPeer::get_fattore_firma($tipo) * OppAttoPeer::get_fattore_tipo_atto($tipo_atto_id);
     }
     // ordinamento per rilevanza, prima dello slice
     arsort($tags);
     // slice dell'array, se specificata l'opzione limit
     if (isset($options['limit']) && count($tags) > $options['limit']) {
         $this->n_remaining_tags = count($tags) - $options['limit'];
         $tags = array_slice($tags, 0, $options['limit'], true);
     }
     // ordinamento per triple_value, in caso sort_by_relevance non sia specificato
     if (!isset($options['sort_by_relevance']) || true !== $options['sort_by_relevance']) {
         krsort($tags);
     }
     $this->tags = $tags;
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:40,代码来源:components.class.php

示例2: countTagsUnderTermMonitoredByUser

 /**
  * conta il numero di tag sotto il term, monitorati da un utente (o da tutti gli utenti)
  *
  * @param string $term_id 
  * @param string $user_id - se null, torna il num. di tag monitorati da tutti gli utenti
  * @return void
  * @author Guglielmo Celata
  */
 public static function countTagsUnderTermMonitoredByUser($term_id, $user_id = null)
 {
     // fetch degli id dei tag sotto il term
     $c = new Criteria();
     $c->add(OppTagHasTtPeer::TESEOTT_ID, $term_id);
     $c->addJoin(OppTagHasTtPeer::TAG_ID, TagPeer::ID);
     $c->clearSelectColumns();
     $c->addSelectColumn(TagPeer::ID);
     $tags = array();
     $rs = TagPeer::doSelectRS($c);
     while ($rs->next()) {
         $tags[] = $rs->getInt(1);
     }
     // conteggio dei tag
     $c = new Criteria();
     if (!is_null($user_id)) {
         $c->add(MonitoringPeer::USER_ID, $user_id);
     }
     $c->add(MonitoringPeer::MONITORABLE_MODEL, 'Tag');
     $c->add(MonitoringPeer::MONITORABLE_ID, $tags, Criteria::IN);
     return MonitoringPeer::doCount($c);
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:30,代码来源:OppTeseottPeer.php

示例3: postSave

 /**
  * Tags saving logic, runned after the object himself has been saved
  *
  * @param      BaseObject  $object
  */
 public function postSave(BaseObject $object)
 {
     $tags = self::get_tags($object);
     $removed_tags = self::get_removed_tags($object);
     // save new tags
     foreach ($tags as $tagname) {
         $tag = TagPeer::retrieveOrCreateByTagName($tagname);
         $tag->save();
         $tagging = new Tagging();
         $tagging->setTagId($tag->getId());
         $tagging->setTaggableId($object->getPrimaryKey());
         $tagging->setTaggableModel(get_class($object));
         $tagging->save();
     }
     // remove removed tags
     $c = new Criteria();
     $c->add(TagPeer::NAME, $removed_tags, Criteria::IN);
     $rs = TagPeer::doSelectRS($c);
     $removed_tag_ids = array();
     while ($rs->next()) {
         $removed_tag_ids[] = $rs->getInt(1);
     }
     $c = new Criteria();
     $c->add(TaggingPeer::TAG_ID, $removed_tag_ids, Criteria::IN);
     $c->add(TaggingPeer::TAGGABLE_ID, $object->getPrimaryKey());
     $c->add(TaggingPeer::TAGGABLE_MODEL, get_class($object));
     TaggingPeer::doDelete($c);
     $tags = array_merge(self::get_tags($object), $this->getSavedTags($object));
     self::set_saved_tags($object, $tags);
     self::clear_tags($object);
     self::clear_removed_tags($object);
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:37,代码来源:sfPropelActAsTaggableBehavior.class.php

示例4: doSelect

 public static function doSelect(Criteria $criteria, $con = null)
 {
     return TagPeer::populateObjects(TagPeer::doSelectRS($criteria, $con));
 }
开发者ID:kotow,项目名称:work,代码行数:4,代码来源:BaseTagPeer.php

示例5: postSave

 /**
  * Tags saving logic, runned after the object himself has been saved
  *
  * @param      BaseObject  $object
  */
 public function postSave(BaseObject $object)
 {
     $tags = self::get_tags($object);
     $removed_tags = self::get_removed_tags($object);
     // read some config parameters and defaults
     $anonymous_tagging = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_anonymous_tagging', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_anonymous_tagging', true));
     $allows_tagging_removal = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_allows_tagging_removal', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_allows_tagging_removal', 'all'));
     $tagging_removal_credentials = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_tagging_removal_credentials', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_tagging_removal_credentials', array()));
     $use_unique_triple_values = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_use_unique_triple_values', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_use_unique_triple_values', false));
     $user = @sfContext::getInstance()->getUser();
     // save new tags
     foreach ($tags as $tagname) {
         if ($use_unique_triple_values) {
             $tag = TagPeer::retrieveOrCreateByTripleValue($tagname);
         } else {
             $tag = TagPeer::retrieveOrCreateByTagName($tagname);
         }
         $tag->save();
         $tagging = TaggingPeer::retrieveOrCreateByTagAndTaggable($tag->getId(), $object->getPrimaryKey(), get_class($object));
         $user_id = deppPropelActAsTaggableToolkit::getUserId();
         if (!$anonymous_tagging && $user->isAuthenticated() && !is_null($user_id) && $user_id != '') {
             if ($tagging->isNew()) {
                 $tagging->setUserId($user_id);
             }
         }
         $tagging->save();
     }
     // remove removed tags
     $removed_tag_ids = array();
     $c = new Criteria();
     $c->add(TagPeer::NAME, $removed_tags, Criteria::IN);
     if (Propel::VERSION >= '1.3') {
         $rs = TagPeer::doSelectStmt($c);
         while ($row = $rs->fetch(PDO::FETCH_ASSOC)) {
             $removed_tag_ids[] = intval($row['ID']);
         }
     } else {
         $rs = TagPeer::doSelectRS($c);
         while ($rs->next()) {
             $removed_tag_ids[] = $rs->getInt(1);
         }
     }
     $c = new Criteria();
     $c->add(TaggingPeer::TAG_ID, $removed_tag_ids, Criteria::IN);
     $c->add(TaggingPeer::TAGGABLE_ID, $object->getPrimaryKey());
     $c->add(TaggingPeer::TAGGABLE_MODEL, get_class($object));
     $user_id = deppPropelActAsTaggableToolkit::getUserId();
     // for authenticated users that do not have tagging_removal_credentials
     // if the only tags they're allowed to remove are their own
     // then, remove only those tags
     // this only works, if anonymnous_tagging is set to false
     if (!$anonymous_tagging && $user->isAuthenticated() && !is_null($user_id) && $user_id != '' && $allows_tagging_removal == 'self' && !$user->hasCredential($tagging_removal_credentials, false)) {
         $c->add(TaggingPeer::USER_ID, $user_id);
     }
     // delete e non doDelete, in modo che anche sul tagging si possano attivare i behavior (per le news)
     // TaggingPeer::doDelete($c);
     $tags_to_delete = TaggingPeer::doSelect($c);
     foreach ($tags_to_delete as $tag_to_delete) {
         $tag_to_delete->delete();
     }
     $tags = array_merge(self::get_tags($object), $this->getSavedTags($object));
     self::set_saved_tags($object, $tags);
     self::clear_tags($object);
     self::clear_removed_tags($object);
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:70,代码来源:deppPropelActAsTaggableBehavior.class.php

示例6: getAllWithCount

 /**
  * Returns all tags, sorted by name, with their number of occurencies.
  * The first optionnal parameter permits to add some restrictions on the
  * objects the selected tags are related to.
  * The second optionnal parameter permits to restrict the tag selection with
  * different criterias
  *
  * @param      Criteria    $c
  * @param      array       $options
  * @return     array
  */
 public static function getAllWithCount(Criteria $c = null, $options = array())
 {
     $tags = array();
     if (null === $c) {
         $c = new Criteria();
     }
     if (isset($options['limit'])) {
         $c->setLimit($options['limit']);
     }
     if (isset($options['model'])) {
         $c->add(TaggingPeer::TAGGABLE_MODEL, $options['model']);
     }
     if (isset($options['like'])) {
         $c->add(TagPeer::NAME, $options['like'], Criteria::LIKE);
     }
     if (isset($options['triple'])) {
         $c->add(TagPeer::IS_TRIPLE, $options['triple']);
     }
     if (isset($options['namespace'])) {
         $c->add(TagPeer::TRIPLE_NAMESPACE, $options['namespace']);
     }
     if (isset($options['key'])) {
         $c->add(TagPeer::TRIPLE_KEY, $options['key']);
     }
     if (isset($options['value'])) {
         $c->add(TagPeer::TRIPLE_VALUE, $options['value']);
     }
     $c->addSelectColumn(TagPeer::NAME);
     $c->addSelectColumn('COUNT(' . TagPeer::NAME . ') as counter');
     $c->addJoin(TagPeer::ID, TaggingPeer::TAG_ID);
     $c->addGroupByColumn(TaggingPeer::TAG_ID);
     $c->addDescendingOrderByColumn('counter');
     $c->addAscendingOrderByColumn(TagPeer::NAME);
     if (Propel::VERSION >= '1.3') {
         $rs = TagPeer::doSelectStmt($c);
         while ($row = $rs->fetch(PDO::FETCH_NUM)) {
             $tags[$row[0]] = $row[1];
         }
     } else {
         $rs = TagPeer::doSelectRS($c);
         while ($rs->next()) {
             $tags[$rs->getString(1)] = $rs->getInt(2);
         }
     }
     if (!isset($options['sort_by_popularity']) || true !== $options['sort_by_popularity']) {
         ksort($tags);
     }
     return $tags;
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:60,代码来源:TagPeer.php

示例7: getAllWithCount

 /**
  * Returns all tags, sorted by name, with their number of occurencies.
  * The first optionnal parameter permits to add some restrictions on the
  * objects the selected tags are related to.
  * The second optionnal parameter permits to restrict the tag selection with
  * different criterias
  *
  * @param      Criteria    $c
  * @param      array       $options
  * @return     array
  */
 public static function getAllWithCount(Criteria $c = null, $options = array())
 {
     $tags = array();
     if ($c == null) {
         $c = new Criteria();
     }
     if (isset($options['limit'])) {
         $c->setLimit($options['limit']);
     }
     if (isset($options['model'])) {
         $c->add(TaggingPeer::TAGGABLE_MODEL, $options['model']);
     }
     if (isset($options['like'])) {
         $c->add(TagPeer::NAME, $options['like'], Criteria::LIKE);
     }
     if (isset($options['triple'])) {
         $c->add(TagPeer::IS_TRIPLE, $options['triple']);
     }
     if (isset($options['namespace'])) {
         $c->add(TagPeer::TRIPLE_NAMESPACE, $options['namespace']);
     }
     if (isset($options['key'])) {
         $c->add(TagPeer::TRIPLE_KEY, $options['key']);
     }
     if (isset($options['value'])) {
         $c->add(TagPeer::TRIPLE_VALUE, $options['value']);
     }
     $c->addSelectColumn(TagPeer::NAME);
     $c->addSelectColumn(TaggingPeer::COUNT);
     $c->addJoin(TagPeer::ID, TaggingPeer::TAG_ID);
     $c->addGroupByColumn(TaggingPeer::TAG_ID);
     $c->addDescendingOrderByColumn(TaggingPeer::COUNT);
     $c->addAscendingOrderByColumn(TagPeer::NAME);
     $rs = TagPeer::doSelectRS($c);
     while ($rs->next()) {
         $tags[$rs->getString(1)] = $rs->getInt(2);
     }
     ksort($tags);
     return $tags;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:51,代码来源:TagPeer.php

示例8: getAllWithCount

 /**
  * Returns all tags, sorted by name, with their number of occurencies.
  * The first optionnal parameter permits to add some restrictions on the
  * objects the selected tags are related to.
  * The second optionnal parameter permits to restrict the tag selection with
  * different criterias
  *
  * @param      Criteria    $c
  * @param      array       $options
  * @return     array
  */
 public static function getAllWithCount(Criteria $c = null, $options = array())
 {
     $tags = array();
     if (null === $c) {
         $c = new Criteria();
     }
     if (isset($options['limit'])) {
         $c->setLimit($options['limit']);
     }
     if (isset($options['model'])) {
         $c->add(TaggingPeer::TAGGABLE_MODEL, $options['model']);
     }
     if (isset($options['like'])) {
         $c->add(TagPeer::NAME, $options['like'], Criteria::LIKE);
     }
     if (isset($options['triple'])) {
         $c->add(TagPeer::IS_TRIPLE, $options['triple']);
     }
     if (isset($options['namespace'])) {
         $c->add(TagPeer::TRIPLE_NAMESPACE, $options['namespace']);
     }
     if (isset($options['key'])) {
         $c->add(TagPeer::TRIPLE_KEY, $options['key']);
     }
     if (isset($options['value'])) {
         $c->add(TagPeer::TRIPLE_VALUE, $options['value']);
     }
     $c->addSelectColumn(TagPeer::NAME);
     $c->addSelectColumn('COUNT(' . TagPeer::NAME . ') as counter');
     $c->addJoin(TagPeer::ID, TaggingPeer::TAG_ID, Criteria::RIGHT_JOIN);
     $c->addGroupByColumn(TaggingPeer::TAG_ID);
     if (isset($options['sort_by_popularity'])) {
         $c->addDescendingOrderByColumn('counter');
     } else {
         $c->addAscendingOrderByColumn(TagPeer::TRIPLE_VALUE);
     }
     if (Propel::VERSION >= '1.3') {
         $rs = TagPeer::doSelectStmt($c);
         while ($row = $rs->fetch(PDO::FETCH_NUM)) {
             $tags[$row[0]] = $row[1];
         }
     } else {
         $rs = TagPeer::doSelectRS($c);
         while ($rs->next()) {
             $tags[$rs->getString(1)] = $rs->getInt(2);
         }
     }
     /* 
      * questo ordinava per la chiave (NAME) e quindi in modo errato
      * ora il comportamento di default è di ordinare per NAME
      * mentre se si vuole l'ordinamento per popolarità va specificato nelle options
      * come prima
     if (!isset($options['sort_by_popularity']) || (true !== $options['sort_by_popularity']))
     {
       ksort($tags);
     }
     */
     return $tags;
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:70,代码来源:TagPeer.php


注:本文中的TagPeer::doSelectRS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。