本文整理汇总了PHP中BFCHelper::CountFavourites方法的典型用法代码示例。如果您正苦于以下问题:PHP BFCHelper::CountFavourites方法的具体用法?PHP BFCHelper::CountFavourites怎么用?PHP BFCHelper::CountFavourites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFCHelper
的用法示例。
在下文中一共展示了BFCHelper::CountFavourites方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResourcesFromFavorites
public function getResourcesFromFavorites()
{
// with random order is not possible to order by another field
$resources = null;
if (BFCHelper::CountFavourites() > 0) {
// only if there are unit in favorites
$params = $this->getState('params');
$options = array('path' => $this->urlResources, 'data' => array('$format' => 'json'));
$this->applyDefaultFilter($options);
$filterFav = '';
$tmpFav = BFCHelper::GetFavourites();
foreach ($tmpFav as $key => $value) {
if (!empty($tmpFav[$key])) {
$this->helper->addFilter($filterFav, '(OnSellUnitId eq ' . $tmpFav[$key] . ')', 'or');
}
}
if ($filterFav != '') {
if ($options['data']['$filter'] != '') {
$options['data']['$filter'] .= " and (" . $filterFav . ")";
}
}
// get only enabled merchants because disabled are of no use
// // adding other ordering to allow grouping
// $options['data']['$orderby'] = 'Created desc';
// $options['data']['$orderby'] = "IsShowcase desc, IsForeground desc, Created desc";
// if (isset($ordering)) {
// $options['data']['$orderby'] .= ", " . $ordering . ' ' . strtolower($direction);
// }
$url = $this->helper->getQuery($options);
$r = $this->helper->executeQuery($url);
if (isset($r)) {
$res = json_decode($r);
$resources = $res->d->results ?: $res->d;
}
}
return $resources;
}