當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FeedItem::listByIds方法代碼示例

本文整理匯總了PHP中FeedItem::listByIds方法的典型用法代碼示例。如果您正苦於以下問題:PHP FeedItem::listByIds方法的具體用法?PHP FeedItem::listByIds怎麽用?PHP FeedItem::listByIds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FeedItem的用法示例。


在下文中一共展示了FeedItem::listByIds方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: listRelevantFeedItems

 private function listRelevantFeedItems($count = 100)
 {
     // Hämtar alla FeedItems som berör en medlem
     if (empty($this->relevantFeedItems)) {
         global $db;
         $sql = "\n\t\t\t\nSELECT \n\tid \nFROM \n\t" . self::RELATION_TABLE . " \nWHERE \n\tmedlem_id IN (\n\t\tSELECT id \n\t\tFROM " . self::MEDLEM_TABLE . " \n\t\tWHERE \n\t\t\n\t\t\tid IN \n\t\t\t\t( \n\t\t\t\t\tSELECT kontakt_id \n\t\t\t\t\tFROM " . Adressbok::RELATION_TABLE . "\n\t\t\t\t\tWHERE medlem_id = " . $this->getMedlem()->getId() . "\n\n\t\t\t\t) OR id IN (\n\t\t\t\t\tSELECT medlem_id \n\t\t\t\t\tFROM " . Foretag::KEY_TABLE . " \n\t\t\t\t\tWHERE lag_id in (\n\t\t\t\t\t\tSELECT lag_id \n\t\t\t\t\t\tFROM " . Foretag::KEY_TABLE . " \n\t\t\t\t\t\tWHERE medlem_id = " . $this->getMedlem()->getId() . "\n\t\t\t\t\t)\t\t\n\t\t\t\t)\n\t\t\n\t)\t\n\tOR\n\tgrupp_id IN (\n\t\n\t\tSELECT grupp_id \n\t\tFROM " . Grupp::RELATION_TABLE . " \n\t\tWHERE medlem_id = " . $this->getMedlem()->getId() . "\n\t\n\t)\n\n\t" . "\n\tOR\n\tid IN (\n\t\n\t\tSELECT\n\t\t\t" . self::RELATION_TABLE . ".id\n\t\tFROM\n\t\t\t" . self::RELATION_TABLE . " JOIN " . Grupp::RELATION_TABLE . "\n\t\t\tON " . self::RELATION_TABLE . ".medlem_id = " . Grupp::RELATION_TABLE . ".medlem_id\n\t\tWHERE \n\t\t\t" . self::RELATION_TABLE . ".medlem_id = " . $this->getMedlem()->getId() . " AND\n\t\t\t" . self::RELATION_TABLE . ".datum >= " . Grupp::RELATION_TABLE . ".datum\n\n\t)\n\tOR\n\t(typ = 'lagttilliadressbok' AND params = '" . $this->getMedlem()->getId() . "|" . $this->getMedlem()->getANamn() . "')\n\tOR\n\t(typ = 'valkommen' AND medlem_id = " . $this->getMedlem()->getId() . ")\n";
         $this->relevantFeedItems = FeedItem::listByIds($db->valuesAsArray($sql));
         /* Lag and Foretagsfeeds */
         global $USER;
         if (isset($USER)) {
             $foretag = $USER->getForetag();
             if (isset($foretag)) {
                 $foretagFeeds = array();
                 $foretagFeeds = FeedItem::getForetagItems($foretag);
                 $this->relevantFeedItems = array_merge($this->relevantFeedItems, $foretagFeeds);
             }
             $lag = $USER->getLag();
             if (isset($lag)) {
                 $lagFeeds = array();
                 $lagFeeds = FeedItem::getLagItems($lag);
                 $this->relevantFeedItems = array_merge($this->relevantFeedItems, $lagFeeds);
             }
             if (true || isset($lag) || isset($foretag)) {
                 /* no need to sort if no feeds are added, handled thru mobject-fetch */
                 $this->relevantFeedItems = self::sortFeeds($this->relevantFeedItems);
             }
         }
     }
     // print_r($this->relevantFeedItems);
     return $this->relevantFeedItems;
 }
開發者ID:krillo,項目名稱:motiomera,代碼行數:31,代碼來源:Feed.php


注:本文中的FeedItem::listByIds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。