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


PHP kshowPeer::doSelectJoinKuser方法代码示例

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


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

示例1: getRelatedShows

 /**
  * Will return an array of kshows that are 'related' to a given show
  *
  * @param string $kshow_id
  * @return array of
  */
 public static function getRelatedShows($kshow_id, $kuser_id, $amount)
 {
     $c = new Criteria();
     $c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
     $c->add(kshowPeer::ID, 10000, Criteria::GREATER_EQUAL);
     //$c->add( kshowPeer::PRODUCER_ID, $kuser_id );
     // our related algorithm is based on finding shows that have similar 'heavy' tags
     if ($kshow_id) {
         $kshow = kshowPeer::retrieveByPK($kshow_id);
         if ($kshow) {
             $tags_string = $kshow->getTags();
             if ($tags_string) {
                 $tagsweight = array();
                 foreach (ktagword::getTagsArray($tags_string) as $tag) {
                     $tagsweight[$tag] = ktagword::getWeight($tag);
                 }
                 arsort($tagsweight);
                 $counter = 0;
                 foreach ($tagsweight as $tag => $weight) {
                     if ($counter++ > 2) {
                         break;
                     } else {
                         //we'll be looking for shows that have similar top tags (3 in this case)
                         $c->addOr(kshowPeer::TAGS, '%' . $tag . '%', Criteria::LIKE);
                     }
                 }
             }
             // and of course, we don't want the show itself
             $c->addAnd(kshowPeer::ID, $kshow_id, Criteria::NOT_IN);
         }
     }
     // we want recent ones
     $c->addDescendingOrderByColumn(kshowPeer::UPDATED_AT);
     $c->setLimit($amount);
     $shows = kshowPeer::doSelectJoinKuser($c);
     //did we get enough?
     $amount_related = count($shows);
     if ($amount_related < $amount) {
         // let's get some more, which are not really related, but recent
         $c = new Criteria();
         $c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
         $c->addDescendingOrderByColumn(kshowPeer::UPDATED_AT);
         $c->setLimit($amount - $amount_related);
         $moreshows = kshowPeer::doSelectJoinKuser($c);
         return array_merge($shows, $moreshows);
     }
     return $shows;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:54,代码来源:myKshowUtils.class.php


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