本文整理汇总了PHP中Aimeos\MW\View\Iface::param方法的典型用法代码示例。如果您正苦于以下问题:PHP Iface::param方法的具体用法?PHP Iface::param怎么用?PHP Iface::param使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aimeos\MW\View\Iface
的用法示例。
在下文中一共展示了Iface::param方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDomains
/**
* Returns the list of domains that are available as resources
*
* @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
* @return array List of domain names
*/
protected function getDomains(\Aimeos\MW\View\Iface $view)
{
if (($domains = $view->param('resource')) == '') {
/** admin/jsonadm/domains
* A list of domain names whose clients are available for the JSON API
*
* The HTTP OPTIONS method returns a list of resources known by the
* JSON API including their URLs. The list of available resources
* can be exteded dynamically be implementing a new Jsonadm client
* class handling request for this new domain.
*
* To add the new domain client to the list of resources returned
* by the HTTP OPTIONS method, you have to add its name in lower case
* to the existing configuration.
*
* @param array List of domain names
* @since 2016.01
* @category Developer
*/
$default = array('attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order', 'plugin', 'price', 'product', 'service', 'supplier', 'tag', 'text');
$domains = $this->getContext()->getConfig()->get('admin/jsonadm/domains', $default);
}
return (array) $domains;
}
示例2: updateItems
/**
* Updates existing product image references or creates new ones
*
* @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
*/
protected function updateItems(\Aimeos\MW\View\Iface $view)
{
$id = $view->item->getId();
$context = $this->getContext();
$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
$mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media');
$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
$cntl = \Aimeos\Controller\Common\Media\Factory::createController($context);
$listIds = (array) $view->param('image/product.lists.id', array());
$listItems = $manager->getItem($id, array('media'))->getListItems('media', 'default');
$mediaItem = $this->createItem();
$listItem = $this->createListItem($id);
$files = $view->value($view->request()->getUploadedFiles(), 'image/files', array());
$num = 0;
foreach ($listIds as $idx => $listid) {
if (!isset($listItems[$listid])) {
$litem = $listItem;
$litem->setId(null);
if (($file = $view->value($files, $num)) !== null) {
$item = $mediaItem;
$item->setId(null);
$cntl->add($item, $file);
$num++;
} else {
throw new \Aimeos\Admin\JQAdm\Exception(sprintf('No file uploaded for %1$d. new image', $num + 1));
}
} else {
$litem = $listItems[$listid];
$item = $litem->getRefItem();
}
$item->setLabel($view->param('image/media.label/' . $idx));
$item->setLanguageId($view->param('image/media.languageid/' . $idx));
$mediaManager->saveItem($item);
$litem->setPosition($idx);
$litem->setRefId($item->getId());
$listManager->saveItem($litem, false);
}
$this->cleanupItems($listItems, $listIds);
}
示例3: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$context = $this->getContext();
$prodid = $view->param('d_prodid');
$domains = array('media', 'price', 'text', 'attribute', 'product');
$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
$productItem = $this->getProductItem($prodid, $domains);
$this->addMetaItems($productItem, $this->expire, $this->tags);
$productManager = $controller->createManager('product');
$productIds = array_keys($productItem->getRefItems('product'));
$products = $this->getDomainItems($productManager, 'product.id', $productIds, $domains);
$attrIds = array_keys($productItem->getRefItems('attribute'));
$mediaIds = array_keys($productItem->getRefItems('media'));
foreach ($products as $product) {
$attrIds = array_merge($attrIds, array_keys($product->getRefItems('attribute')));
$mediaIds = array_merge($mediaIds, array_keys($product->getRefItems('media')));
}
$attributeManager = $controller->createManager('attribute');
$attributeItems = $this->getDomainItems($attributeManager, 'attribute.id', $attrIds, $domains);
$this->addMetaItems($attributeItems, $this->expire, $this->tags);
$mediaManager = $controller->createManager('media');
$mediaItems = $this->getDomainItems($mediaManager, 'media.id', $mediaIds, $domains);
$this->addMetaItems($mediaItems, $this->expire, $this->tags);
$propertyManager = $controller->createManager('product/property');
$propertyItems = $this->getDomainItems($propertyManager, 'product.property.parentid', $productIds, $domains);
$view->detailProductItem = $productItem;
$view->detailProductItems = $products;
$view->detailPropertyItems = $propertyItems;
$view->detailAttributeItems = $attributeItems;
$view->detailMediaItems = $mediaItems;
$view->detailUserId = $context->getUserId();
$view->detailParams = $this->getClientParams($view->param());
$this->cache = $view;
}
$expire = $this->expires($this->expire, $expire);
$tags = array_merge($tags, $this->tags);
return $this->cache;
}
示例4: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$expire = null;
$tags = $items = array();
$context = $this->getContext();
$config = $context->getConfig();
$session = $context->getSession();
$default = array('media', 'price', 'text');
$domains = $config->get('client/html/catalog/domains', $default);
/** client/html/catalog/session/pinned/domains
* A list of domain names whose items should be available in the pinned view template for the product
*
* The templates rendering product details usually add the images,
* prices and texts, etc. associated to the product
* item. If you want to display additional or less content, you can
* configure your own list of domains (attribute, media, price, product,
* text, etc. are domains) whose items are fetched from the storage.
* Please keep in mind that the more domains you add to the configuration,
* the more time is required for fetching the content!
*
* From 2014.09 to 2015.03, this setting was available as
* client/html/catalog/detail/pinned/domains
*
* @param array List of domain names
* @since 2015.04
* @category Developer
* @see client/html/catalog/domains
* @see client/html/catalog/lists/domains
* @see client/html/catalog/detail/domains
*/
$domains = $config->get('client/html/catalog/session/pinned/domains', $domains);
$pinned = $session->get('aimeos/catalog/session/pinned/list', array());
$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
$result = $controller->getProductItems($pinned, $domains);
foreach (array_reverse($pinned) as $id) {
if (isset($result[$id])) {
$items[$id] = $result[$id];
}
}
$view->pinnedProductItems = $items;
$view->pinnedParams = $this->getClientParams($view->param());
$this->cache = $view;
}
return $this->cache;
}
示例5: updateItems
/**
* Updates existing property items or creates new ones
*
* @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
*/
protected function updateItems(\Aimeos\MW\View\Iface $view)
{
$context = $this->getContext();
$manager = \Aimeos\MShop\Factory::createManager($context, 'product/property');
$typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/property/type');
$ids = array();
$items = $this->getItems($view->item->getId());
foreach ((array) $view->param('physical', array()) as $type => $value) {
$value = trim($value);
if ($value == '') {
if (isset($items[$type])) {
$ids[] = $items[$type]->getId();
}
continue;
}
if (!isset($items[$type])) {
$items[$type] = $manager->createItem();
$items[$type]->setParentId($view->item->getId());
$items[$type]->setTypeId($typeManager->findItem($type, array(), 'product/property')->getId());
}
$items[$type]->setValue($value);
$manager->saveItem($items[$type]);
}
$manager->deleteItems($ids);
}
示例6: getItemConfig
/**
* Maps the item configuration from parameters to a list of key/value pairs
*
* @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
* @return array Associative list of key/value pairs
*/
protected function getItemConfig(\Aimeos\MW\View\Iface $view)
{
$config = array();
foreach ($view->param('item/config/key') as $idx => $key) {
if (trim($key) !== '') {
$config[$key] = $view->param('item/config/val/' . $idx);
}
}
return $config;
}
示例7: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
if (($orderId = $view->param('his_id', null)) !== null) {
$context = $this->getContext();
$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
$search = $manager->createSearch(true);
$expr = array($search->getConditions(), $search->compare('==', 'order.id', $orderId), $search->compare('==', 'order.base.customerid', $context->getUserId()));
$search->setConditions($search->combine('&&', $expr));
$orderItems = $manager->searchItems($search);
if (($orderItem = reset($orderItems)) === false) {
$msg = $view->translate('client', 'Order with ID "%1$s" not found');
throw new \Aimeos\Client\Html\Exception(sprintf($msg, $orderId));
}
if ($orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus()) {
$view->summaryShowDownloadAttributes = true;
}
$view->summaryBasket = $baseManager->load($orderItem->getBaseId());
$view->summaryTaxRates = $this->getTaxRates($view->summaryBasket);
$view->orderItem = $orderItem;
}
$this->cache = $view;
}
return $this->cache;
}
示例8: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$context = $this->getContext();
$siteConfig = $context->getLocale()->getSite()->getConfig();
/** client/html/catalog/stock/sort
* Sortation key if stock levels for different warehouses exist
*
* Products can be shipped from several warehouses with a different
* stock level for each one. The stock levels for each warehouse will
* be shown in the product detail page. To get a consistent sortation
* of this list, the configured key of the product warehouse manager
* will be used.
*
* @param string Key for sorting
* @since 2014.03
* @category Developer
* @see client/html/catalog/stock/level/low
*/
$sortkey = $context->getConfig()->get('client/html/catalog/stock/sort', 'product.stock.warehouseid');
$productIds = $view->param('s_prodid');
if (!is_array($productIds)) {
$productIds = explode(' ', $productIds);
}
$stockManager = \Aimeos\MShop\Factory::createManager($context, 'product/stock');
$search = $stockManager->createSearch(true);
$expr = array($search->compare('==', 'product.stock.parentid', $productIds));
if (isset($siteConfig['warehouse'])) {
$expr[] = $search->compare('==', 'product.stock.warehouse.code', $siteConfig['warehouse']);
}
$expr[] = $search->getConditions();
$sortations = array($search->sort('+', 'product.stock.parentid'), $search->sort('+', $sortkey));
$search->setConditions($search->combine('&&', $expr));
$search->setSortations($sortations);
$search->setSlice(0, 0x7fffffff);
$stockItems = $stockManager->searchItems($search);
if (!empty($stockItems)) {
$warehouseIds = $stockItemsByProducts = array();
foreach ($stockItems as $item) {
$warehouseIds[$item->getWarehouseId()] = null;
$stockItemsByProducts[$item->getParentId()][] = $item;
}
$warehouseIds = array_keys($warehouseIds);
$warehouseManager = \Aimeos\MShop\Factory::createManager($context, 'product/stock/warehouse');
$search = $warehouseManager->createSearch();
$search->setConditions($search->compare('==', 'product.stock.warehouse.id', $warehouseIds));
$search->setSlice(0, count($warehouseIds));
$view->stockWarehouseItems = $warehouseManager->searchItems($search);
$view->stockItemsByProducts = $stockItemsByProducts;
}
$view->stockProductIds = $productIds;
$this->cache = $view;
}
return $this->cache;
}
示例9: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$context = $this->getContext();
$basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
$view->standardBasket = $basketCntl->get();
/** client/html/checkout/standard/url/step-active
* Name of the checkout process step to jump to if no previous step requires attention
*
* The checkout process consists of several steps which are usually
* displayed one by another to the customer. If the data of a step
* is already available, then that step is skipped. The active step
* is the one that is displayed if all other steps are skipped.
*
* If one of the previous steps misses some data the customer has
* to enter, then this step is displayed first. After providing
* the missing data, the whole series of steps are tested again
* and if no other step requests attention, the configured active
* step will be displayed.
*
* The order of the steps is determined by the order of sub-parts
* that are configured for the checkout client.
*
* @param string Name of the confirm standard HTML client
* @since 2014.07
* @category Developer
* @category User
* @see client/html/checkout/standard/standard/subparts
*/
$default = $view->config('client/html/checkout/standard/url/step-active', 'summary');
/** client/html/checkout/standard/onepage
* Shows all named checkout subparts at once for a one page checkout
*
* Normally, the checkout process is divided into several steps for entering
* addresses, select delivery and payment options as well as showing the
* summary page. This enables dependencies between two steps like showing
* delivery options based on the address entered by the customer. Furthermore,
* this is good way to limit the amount of information displayed which is
* preferred by mobile users.
*
* Contrary to that, a one page checkout displays all information on only
* one page and customers get an immediate overview of which information
* they have to enter and what options they can select from. This is an
* advantage if only a very limited amount of information must be entered
* or if there are almost no options to choose from and no dependencies
* between exist.
*
* Using this config options, shop developers are able to define which
* checkout subparts are combined to a one page view. Simply add the names
* of all checkout subparts to the list. Available checkout subparts for
* a one page checkout are:
* * address
* * delivery
* * payment
* * summary
*
* @param array List of checkout subparts name
* @since 2015.05
* @category Developer
*/
$onepage = $view->config('client/html/checkout/standard/onepage', array());
$onestep = !empty($onepage) ? array_shift($onepage) : $default;
// keep the first one page step
$steps = (array) $context->getConfig()->get($this->subPartPath, $this->subPartNames);
$steps = array_diff($steps, $onepage);
// remove all remaining steps in $onepage
// use first step if default step isn't available
$default = !in_array($default, $steps) ? reset($steps) : $default;
$current = $view->param('c_step', $default);
// use $onestep if the current step isn't available due to one page layout
if (!in_array($current, $steps)) {
$current = $onestep;
}
// use $onestep if the active step isn't available due to one page layout
if (isset($view->standardStepActive) && in_array($view->standardStepActive, $onepage)) {
$view->standardStepActive = $onestep;
}
$cpos = array_search($current, $steps);
if (!isset($view->standardStepActive) || ($apos = array_search($view->standardStepActive, $steps)) !== false && $cpos !== false && $cpos < $apos) {
$view->standardStepActive = $current;
}
$view->standardSteps = $steps;
$this->cache = $this->addNavigationUrls($view, $steps, $view->standardStepActive);
}
return $this->cache;
}
示例10: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->view)) {
if (($pos = $view->param('l_pos')) !== null && ($pid = $view->param('d_prodid')) !== null) {
if ($pos < 1) {
$start = 0;
$size = 2;
} else {
$start = $pos - 1;
$size = 3;
}
$context = $this->getContext();
$site = $context->getLocale()->getSite()->getCode();
$params = $context->getSession()->get('aimeos/catalog/lists/params/last/' . $site, array());
$filter = $this->getProductListFilterByParam($params);
$filter->setSlice($start, $size);
$total = null;
$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
$products = $controller->getIndexItems($filter, array('text'), $total);
if (($count = count($products)) > 1) {
$enc = $view->encoder();
$listPos = array_search($pid, array_keys($products));
$target = $view->config('client/html/catalog/detail/url/target');
$controller = $view->config('client/html/catalog/detail/url/controller', 'catalog');
$action = $view->config('client/html/catalog/detail/url/action', 'detail');
$config = $view->config('client/html/catalog/detail/url/config', array());
if ($listPos > 0 && ($product = reset($products)) !== false) {
$param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url ')), 'l_pos' => $pos - 1);
$view->navigationPrev = $view->url($target, $controller, $action, $param, array(), $config);
}
if ($listPos < $count - 1 && ($product = end($products)) !== false) {
$param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url')), 'l_pos' => $pos + 1);
$view->navigationNext = $view->url($target, $controller, $action, $param, array(), $config);
}
}
}
$this->view = $view;
}
return $this->view;
}
示例11: updateItems
/**
* Updates existing product stock items or creates new ones
*
* @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
*/
protected function updateItems(\Aimeos\MW\View\Iface $view)
{
$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock');
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'product.stock.parentid', $view->item->getId()));
$items = $manager->searchitems($search);
$list = (array) $view->param('stock/product.stock.id', array());
foreach ($list as $idx => $id) {
if (!isset($items[$id])) {
$item = $manager->createItem();
} else {
$item = $items[$id];
}
$item->setParentId($view->item->getId());
$item->setWarehouseId($view->param('stock/product.stock.warehouseid/' . $idx));
$item->setStocklevel($view->param('stock/product.stock.stocklevel/' . $idx));
$item->setDateBack($view->param('stock/product.stock.dateback/' . $idx));
$manager->saveItem($item, false);
}
$manager->deleteItems(array_diff(array_keys($items), $list));
}
示例12: setData
/**
* Returns the mapped input parameter or the existing items as expected by the template
*
* @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
*/
protected function setData(\Aimeos\MW\View\Iface $view)
{
$view->characteristicData = (array) $view->param('characteristic', array());
}
示例13: getDataParams
/**
* Maps the input parameter to an associative array as expected by the template
*
* @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
* @return array Multi-dimensional associative array
*/
protected function getDataParams(\Aimeos\MW\View\Iface $view)
{
$data = array();
foreach ((array) $view->param('selection/product.code', array()) as $pos => $code) {
if (!empty($code)) {
$data[$code]['product.lists.id'] = $view->param('selection/product.lists.id/' . $pos);
$data[$code]['product.id'] = $view->param('selection/product.id/' . $pos);
$data[$code]['product.label'] = $view->param('selection/product.label/' . $pos);
}
}
foreach ((array) $view->param('selection/attr/ref', array()) as $pos => $code) {
if (!empty($code)) {
$id = $view->param('selection/attr/id/' . $pos);
$data[$code]['attr'][$id]['ref'] = $code;
$data[$code]['attr'][$id]['label'] = $view->param('selection/attr/label/' . $pos);
}
}
return $data;
}
示例14: getProductListSize
/**
* Returns the sanitized page size from the parameters for the product list.
*
* @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
* @return integer Page size
*/
protected function getProductListSize(\Aimeos\MW\View\Iface $view)
{
/** client/html/account/favorite/size
* The number of products shown in a list page for favorite products
*
* Limits the number of products that is shown in the list pages to the
* given value. If more products are available, the products are split
* into bunches which will be shown on their own list page. The user is
* able to move to the next page (or previous one if it's not the first)
* to display the next (or previous) products.
*
* The value must be an integer number from 1 to 100. Negative values as
* well as values above 100 are not allowed. The value can be overwritten
* per request if the "l_size" parameter is part of the URL.
*
* @param integer Number of products
* @since 2014.09
* @category User
* @category Developer
* @see client/html/catalog/lists/size
*/
$defaultSize = $this->getContext()->getConfig()->get('client/html/account/favorite/size', 48);
$size = (int) $view->param('fav-size', $defaultSize);
return $size < 1 || $size > 100 ? $defaultSize : $size;
}
示例15: getItems
/**
* Retrieves the item or items and adds the data to the view
*
* @param \Aimeos\MW\View\Iface $view View instance
* @return \Aimeos\MW\View\Iface View instance with additional data assigned
*/
protected function getItems(\Aimeos\MW\View\Iface $view)
{
$include = ($include = $view->param('include')) !== null ? explode(',', $include) : array();
$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog');
$search = $this->initCriteria($manager->createSearch(), $view->param());
$total = 1;
if (($id = $view->param('id')) == null) {
$view->data = $manager->searchItems($search, array(), $total);
$view->listItems = $this->getListItems($view->data, $include);
$view->childItems = $this->getChildItems($view->data, $include);
} else {
$view->data = $manager->getTree($id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search);
$view->listItems = $this->getListItems(array($id => $view->data), $include);
$view->childItems = $this->getChildItems(array($view->data), $include);
}
$view->refItems = $this->getRefItems($view->listItems);
$view->total = $total;
return $view;
}