當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。