本文整理汇总了PHP中oledrion_utils::getUsersFromIds方法的典型用法代码示例。如果您正苦于以下问题:PHP oledrion_utils::getUsersFromIds方法的具体用法?PHP oledrion_utils::getUsersFromIds怎么用?PHP oledrion_utils::getUsersFromIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oledrion_utils
的用法示例。
在下文中一共展示了oledrion_utils::getUsersFromIds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUsersFromLists
/**
* Retourne une liste d'utilisateurs Xoops en fonction d'une liste de listes
*
* @param array $oledrion_lists
* @return array [clé] = id utilisateur
*/
public function getUsersFromLists($oledrion_lists)
{
$usersList = array();
foreach ($oledrion_lists as $list) {
$usersList[] = $list->list_uid;
}
if (count($usersList) > 0) {
return oledrion_utils::getUsersFromIds($usersList);
} else {
return array();
}
}
示例2: getProducts
/**
* Retourne une liste de produits selon certains critères
*
* @param oledrion_shelf_parameters $parameters Les paramètres de filtrage
* @return array Tableau prêt à être utilisé dans les templates
*/
function getProducts(oledrion_shelf_parameters $parameters)
{
global $vatArray;
$parametersValues = $parameters->getParameters();
$productType = $parametersValues['productsType'];
$start = $parametersValues['start'];
$limit = $parametersValues['limit'];
$category = $parametersValues['category'];
$sort = $parametersValues['sort'];
$order = $parametersValues['order'];
$excluded = $parametersValues['excluded'];
$withXoopsUser = $parametersValues['withXoopsUser'];
$withRelatedProducts = $parametersValues['withRelatedProducts'];
$withQuantity = $parametersValues['withQuantity'];
$thisMonthOnly = $parametersValues['thisMonthOnly'];
$ret = $xoopsUsersIDs = $users = $relatedProducts = $productsManufacturers = $manufacturersPerProduct = $products = $productsIds = $categoriesIds = $vendorsIds = $manufacturersIds = $manufacturers = $categories = $vendors = array();
// On commence par récupérer la liste des produits
switch (strtolower($productType)) {
case 'recent':
$products = $this->handlers->h_oledrion_products->getRecentProducts(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'category' => $category, 'sort' => $sort, 'order' => $order, 'excluded' => $excluded, 'thisMonthOnly' => $thisMonthOnly)));
break;
case 'mostsold':
$tempProductsIds = array();
$tempProductsIds = $this->handlers->h_oledrion_caddy->getMostSoldProducts($start, $limit, $category, $withQuantity);
if (count($tempProductsIds) > 0) {
$products = $this->handlers->h_oledrion_products->getProductsFromIDs(array_keys($tempProductsIds));
}
break;
case 'recentlysold':
$tempProductsIds = array();
$tempProductsIds = $this->handlers->h_oledrion_caddy->getRecentlySoldProducts($start, $limit);
if (count($tempProductsIds) > 0) {
$tempProductsIds = array_unique($tempProductsIds);
}
if (count($tempProductsIds) > 0) {
$products = $this->handlers->h_oledrion_products->getProductsFromIDs(array_keys($tempProductsIds));
}
break;
case 'mostviewed':
$products = $this->handlers->h_oledrion_products->getMostViewedProducts(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'category' => $category, 'sort' => $sort, 'order' => $order)));
break;
case 'bestrated':
$products = $this->handlers->h_oledrion_products->getBestRatedProducts(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'category' => $category, 'sort' => $sort, 'order' => $order)));
break;
case 'recommended':
$products = $this->handlers->h_oledrion_products->getRecentRecommended(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'category' => $category, 'sort' => $sort, 'order' => $order)));
break;
case 'promotional':
$products = $this->handlers->h_oledrion_products->getPromotionalProducts(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'category' => $category, 'sort' => $sort, 'order' => $order)));
break;
case 'random':
$products = $this->handlers->h_oledrion_products->getRandomProducts(new oledrion_parameters(array('start' => $start, 'limit' => $limit, 'category' => $category, 'sort' => $sort, 'order' => $order, 'thisMonthOnly' => $thisMonthOnly)));
}
if (count($products) > 0) {
$productsIds = array_keys($products);
} else {
return $ret;
}
// Recherche des Id des catégories et des vendeurs
foreach ($products as $product) {
$categoriesIds[] = $product->getVar('product_cid');
$vendorsIds[] = $product->getVar('product_vendor_id');
if ($withXoopsUser) {
$xoopsUsersIDs[] = $product->getVar('product_submitter');
}
}
$productsManufacturers = $this->handlers->h_oledrion_productsmanu->getFromProductsIds($productsIds);
// Regroupement des fabricants par produit
foreach ($productsManufacturers as $item) {
$manufacturersIds[] = $item->getVar('pm_manu_id');
$manufacturersPerProduct[$item->getVar('pm_product_id')][] = $item;
}
// On récupère la liste des personnes qui ont soumis les produits
if ($withXoopsUser) {
$users = oledrion_utils::getUsersFromIds($xoopsUsersIDs);
}
// Il faut récupérer la liste des produits relatifs
if ($withRelatedProducts) {
$relatedProducts = $this->getRelatedProductsFromProductsIds($productsIds);
}
$categoriesIds = array_unique($categoriesIds);
sort($categoriesIds);
$vendorsIds = array_unique($vendorsIds);
sort($vendorsIds);
$manufacturersIds = array_unique($manufacturersIds);
sort($manufacturersIds);
// Récupération des fabricants, des vendeurs et des catégories
if (count($manufacturersIds) > 0) {
$manufacturers = $this->handlers->h_oledrion_manufacturer->getManufacturersFromIds($manufacturersIds);
}
if (count($categoriesIds) > 0) {
$categories = $this->handlers->h_oledrion_cat->getCategoriesFromIds($categoriesIds);
}
if (count($vendorsIds) > 0) {
//.........这里部分代码省略.........