本文整理匯總了PHP中Partner::getAllPartners方法的典型用法代碼示例。如果您正苦於以下問題:PHP Partner::getAllPartners方法的具體用法?PHP Partner::getAllPartners怎麽用?PHP Partner::getAllPartners使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Partner
的用法示例。
在下文中一共展示了Partner::getAllPartners方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPartner
public static function getPartner($id)
{
foreach (Partner::getAllPartners() as $partner) {
if ($partner->getID() === $id) {
return $partner;
}
}
throw new Exception($id . " is not a known partner ID");
}
示例2: AsideComponent
<?php
$rightCol = new AsideComponent();
$rightCol->setId("colRight");
$logo = new HeaderComponent();
// content set by the style
$logo->setClass("logo");
$rightCol->addComponent($logo);
$partners = array_filter(Partner::getAllPartners(), function (Partner $partner) {
return !$partner->isOver();
});
usort($partners, function ($a, $b) {
return strnatcasecmp($a->getName(), $b->getName());
});
$partnerMenu = new Menu("Partenaires");
$crushMenu = new Menu("Coups de cœur");
foreach ($partners as $partner) {
$link = new PartnerLink($partner);
$link->setUseImage(true);
if ($partner->isOfficial()) {
$partnerMenu->addEntry($link);
} else {
$crushMenu->addEntry($link);
}
}
$becomePartnerLink = new Link("?page=partenariat", "Devenir partenaires");
$becomePartnerLink->setClass('become-partner');
$partnerMenu->addEntry($becomePartnerLink);
$rightCol->addComponent(new MenuComponent($partnerMenu));
$rightCol->addComponent(new MenuComponent($crushMenu));
$rightCol->writeNow();