本文整理汇总了PHP中ActionResponse::setReference方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionResponse::setReference方法的具体用法?PHP ActionResponse::setReference怎么用?PHP ActionResponse::setReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionResponse
的用法示例。
在下文中一共展示了ActionResponse::setReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// get filter to select manufacturers of active products only
$rootCat = Category::getRootNode();
$f = new ARSelectFilter();
$productFilter = new ProductFilter($rootCat, $f);
$ids = $counts = array();
foreach (ActiveRecordModel::getDataBySQL('SELECT DISTINCT(manufacturerID), COUNT(*) AS cnt FROM Product ' . $f->createString() . ' GROUP BY manufacturerID') as $row) {
$ids[] = $row['manufacturerID'];
$counts[$row['manufacturerID']] = $row['cnt'];
}
$f = new ARSelectFilter(new InCond(new ARFieldHandle('Manufacturer', 'ID'), $ids));
$f->mergeCondition(new NotEqualsCond(new ARFieldHandle('Manufacturer', 'name'), ''));
$f->setOrder(new ARFieldHandle('Manufacturer', 'name'));
$manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', $f);
foreach ($manufacturers as &$manufacturer) {
$manufacturer['url'] = $this->getManufacturerFilterUrl($manufacturer);
}
$this->addBreadCrumb($this->translate('_manufacturers'), '');
$response = new ActionResponse();
$response->setReference('manufacturers', $manufacturers);
$response->set('counts', $counts);
$response->set('rootCat', $rootCat->toArray());
return $response;
}
示例2: index
public function index()
{
/*
MANUFACTURER_PAGE_LIST_STYLE
MANPAGE_STYLE_ALL_IN_ONE_PAGE
MANPAGE_STYLE_GROUP_BY_FIRST_LETTER
MANUFACTURER_PAGE_NUMBER_OF_COLUMNS
MANUFACTURER_PAGE_PER_PAGE
*/
$config = $this->getApplication()->getConfig();
$request = $this->getRequest();
$listStyle = $config->get('MANUFACTURER_PAGE_LIST_STYLE');
$currentLetter = $listStyle == 'MANPAGE_STYLE_GROUP_BY_FIRST_LETTER' ? $request->get('letter') : null;
$letters = Manufacturer::getActiveProductManufacturerFirstLetters();
if (!$currentLetter) {
$currentLetter = reset($letters);
}
// pagination
$page = $request->get('page', 1);
extract(Manufacturer::getActiveProductManufacturers(array('currentPage' => $page, 'startingWith' => $currentLetter)));
// creates $manufacturers, $count, $counts
foreach ($manufacturers as &$manufacturer) {
$manufacturer['url'] = $this->getManufacturerFilterUrl($manufacturer);
}
$this->addBreadCrumb($this->translate('_manufacturers'), '');
$response = new ActionResponse();
$response->setReference('manufacturers', $manufacturers);
$response->set('counts', $counts);
// product count
$response->set('count', $count);
// manufacturers count
$response->set('rootCat', Category::getRootNode()->toArray());
$response->set('currentPage', $page);
$response->set('perPage', $config->get('MANUFACTURER_PAGE_PER_PAGE'));
$paginateUrlParams = array('controller' => 'manufacturers', 'action' => 'index', 'query' => array('page' => '_000_'));
if ($listStyle == 'MANPAGE_STYLE_GROUP_BY_FIRST_LETTER') {
$paginateUrlParams['query']['letter'] = $currentLetter;
}
$response->set('url', $this->router->createURL($paginateUrlParams, true));
if ($listStyle == 'MANPAGE_STYLE_GROUP_BY_FIRST_LETTER') {
$response->set('currentLetter', $currentLetter);
$response->set('letters', $letters);
}
return $response;
}