本文整理汇总了PHP中Aimeos\MW\View\Iface类的典型用法代码示例。如果您正苦于以下问题:PHP Iface类的具体用法?PHP Iface怎么用?PHP Iface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Iface类的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 text 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)
{
$id = $view->item->getId();
$context = $this->getContext();
$types = array('name', 'short', 'long', 'url', 'meta-keyword', 'meta-description');
$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
$textManager = \Aimeos\MShop\Factory::createManager($context, 'text');
$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
$listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
$listIds = array();
$langIds = (array) $view->param('text/langid', array());
$listItems = $manager->getItem($id, array('text'))->getListItems('text');
$listItem = $listManager->createItem();
$listItem->setTypeId($listTypeManager->findItem('default', array(), 'text')->getId());
$listItem->setDomain('text');
$listItem->setParentId($id);
$listItem->setStatus(1);
$textItem = $textManager->createItem();
$textItem->setDomain('product');
$textItem->setStatus(1);
foreach ($langIds as $idx => $langid) {
foreach ($types as $type) {
$content = trim($view->param('text/' . $type . '/content/' . $idx));
$listid = $view->param('text/' . $type . '/listid' . $idx);
$listIds[] = $listid;
if (!isset($listItems[$listid])) {
$litem = $listItem;
$litem->setId(null);
$item = $textItem;
$item->setId(null);
} else {
$litem = $listItems[$listid];
$item = $litem->getRefItem();
}
$item->setContent($content);
$item->setLabel(mb_strcut($item->getContent(), 0, 255));
$item->setTypeId($this->getTypeId($type));
$item->setLanguageId($langid);
$textManager->saveItem($item);
$litem->setPosition($idx);
$litem->setRefId($item->getId());
$listManager->saveItem($litem, false);
}
}
$rmIds = array();
$rmListIds = array_diff(array_keys($listItems), $listIds);
foreach ($rmListIds as $id) {
$rmIds[] = $listItems[$id]->getRefId();
}
$listManager->deleteItems($rmListIds);
$textManager->deleteItems($rmIds);
}
示例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)) {
$params = $this->getClientParams($view->param(), array('f', 'l'));
if (isset($params['f_catid']) && $params['f_catid'] != '') {
$context = $this->getContext();
$config = $context->getConfig();
$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
$default = array('attribute', 'media', 'text');
/** client/html/catalog/domains
* A list of domain names whose items should be available in the catalog view templates
*
* @see client/html/catalog/stage/domains
*/
$domains = $config->get('client/html/catalog/domains', $default);
/** client/html/catalog/stage/standard/domains
* A list of domain names whose items should be available in the catalog stage view template
*
* The templates rendering the catalog stage section use the texts and
* maybe images and attributes associated to the categories. 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!
*
* This configuration option overwrites the "client/html/catalog/domains"
* option that allows to configure the domain names of the items fetched
* for all catalog related data.
*
* @param array List of domain names
* @since 2014.03
* @category Developer
* @see client/html/catalog/domains
* @see client/html/catalog/detail/domains
* @see client/html/catalog/lists/domains
*/
$domains = $config->get('client/html/catalog/stage/standard/domains', $domains);
$stageCatPath = $controller->getCatalogPath($params['f_catid'], $domains);
if (($categoryItem = end($stageCatPath)) !== false) {
$view->stageCurrentCatItem = $categoryItem;
}
$this->addMetaItems($stageCatPath, $this->expire, $this->tags);
$view->stageCatPath = $stageCatPath;
}
$view->stageParams = $params;
$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: 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');
try {
$langid = $basketCntl->get()->getAddress('payment')->getLanguageId();
} catch (\Exception $e) {
$langid = $view->param('ca_billing/order.base.address.languageid', $context->getLocale()->getLanguageId());
}
$view->billingLanguage = $langid;
/** client/html/checkout/standard/address/billing/hidden
* List of billing address input fields that are optional and should be hidden
*
* You can configure the list of billing address fields that
* are hidden when a customer enters his new billing address.
* Available field keys are:
* * order.base.address.company
* * order.base.address.vatid
* * order.base.address.salutation
* * order.base.address.firstname
* * order.base.address.lastname
* * order.base.address.address1
* * order.base.address.address2
* * order.base.address.address3
* * order.base.address.postal
* * order.base.address.city
* * order.base.address.state
* * order.base.address.languageid
* * order.base.address.countryid
* * order.base.address.telephone
* * order.base.address.telefax
* * order.base.address.email
* * order.base.address.website
*
* Caution: Only hide fields that don't require any input
*
* Until 2015-02, the configuration option was available as
* "client/html/common/address/billing/hidden" starting from 2014-03.
*
* @param array List of field keys
* @since 2015.02
* @category User
* @category Developer
* @see client/html/checkout/standard/address/billing/disable-new
* @see client/html/checkout/standard/address/billing/salutations
* @see client/html/checkout/standard/address/billing/mandatory
* @see client/html/checkout/standard/address/billing/optional
* @see client/html/checkout/standard/address/countries
*/
$hidden = $view->config('client/html/checkout/standard/address/billing/hidden', array());
if (count($view->get('addressLanguages', array())) === 1) {
$hidden[] = 'order.base.address.languageid';
}
$salutations = array('company', 'mr', 'mrs');
/** client/html/checkout/standard/address/billing/salutations
* List of salutions the customer can select from for the billing address
*
* The following salutations are available:
* * empty string for "unknown"
* * company
* * mr
* * mrs
* * miss
*
* You can modify the list of salutation codes and remove the ones
* which shouldn't be used. Adding new salutations is a little bit
* more difficult because you have to adapt a few areas in the source
* code.
*
* Until 2015-02, the configuration option was available as
* "client/html/common/address/billing/salutations" starting from 2014-03.
*
* @param array List of available salutation codes
* @since 2015.02
* @category User
* @category Developer
* @see client/html/checkout/standard/address/billing/disable-new
* @see client/html/checkout/standard/address/billing/mandatory
* @see client/html/checkout/standard/address/billing/optional
* @see client/html/checkout/standard/address/billing/hidden
* @see client/html/checkout/standard/address/countries
*/
$view->billingSalutations = $view->config('client/html/checkout/standard/address/billing/salutations', $salutations);
$view->billingMandatory = $view->config('client/html/checkout/standard/address/billing/mandatory', $this->mandatory);
$view->billingOptional = $view->config('client/html/checkout/standard/address/billing/optional', $this->optional);
$view->billingHidden = $hidden;
$this->cache = $view;
}
return $this->cache;
}
示例6: 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)) {
$config = $this->getContext()->getConfig();
/** client/html/catalog/count/enable
* Enables or disables displaying product counts in the catalog filter
*
* This configuration option allows shop owners to display product
* counts in the catalog filter or to disable fetching product count
* information.
*
* The product count information is fetched via AJAX and inserted via
* Javascript. This allows to cache parts of the catalog filter by
* leaving out such highly dynamic content like product count which
* changes with used filter parameter.
*
* @param boolean Value of "1" to display product counts, "0" to disable them
* @since 2014.03
* @category User
* @category Developer
* @see client/html/catalog/count/url/target
* @see client/html/catalog/count/url/controller
* @see client/html/catalog/count/url/action
* @see client/html/catalog/count/url/config
*/
if ($config->get('client/html/catalog/count/enable', true) == true) {
/** client/html/catalog/count/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.03
* @category Developer
* @see client/html/catalog/count/url/controller
* @see client/html/catalog/count/url/action
* @see client/html/catalog/count/url/config
*/
$target = $config->get('client/html/catalog/count/url/target');
/** client/html/catalog/count/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.03
* @category Developer
* @see client/html/catalog/count/url/target
* @see client/html/catalog/count/url/action
* @see client/html/catalog/count/url/config
*/
$controller = $config->get('client/html/catalog/count/url/controller', 'catalog');
/** client/html/catalog/count/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.03
* @category Developer
* @see client/html/catalog/count/url/target
* @see client/html/catalog/count/url/controller
* @see client/html/catalog/count/url/config
*/
$action = $config->get('client/html/catalog/count/url/action', 'count');
/** client/html/catalog/count/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.03
* @category Developer
* @see client/html/catalog/count/url/target
* @see client/html/catalog/count/url/controller
* @see client/html/catalog/count/url/action
* @see client/html/url/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)) {
$mediaItems = array();
$catPath = $view->get('stageCatPath', array());
foreach (array_reverse($catPath) as $catItem) {
$mediaItems = $catItem->getRefItems('media', 'default', 'stage');
if (!empty($mediaItems)) {
break;
}
}
$view->imageItems = $mediaItems;
$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)) {
$map = array();
$context = $this->getContext();
$config = $context->getConfig();
$locale = $context->getLocale();
/** client/html/locale/select/language/param-name
* Name of the parameter that contains the language ID value
*
* Frameworks and applications normally use its own predefined parameter
* that contains the current language ID if they are multi-language
* capable. To adapt the Aimeos parameter name to the already used name,
* you are able to configure it by using this setting.
*
* @param string Parameter name for language ID
* @since 2015.06
* @see client/html/locale/select/currency/param-name
*/
$langname = $config->get('client/html/locale/select/language/param-name', 'loc_languageid');
/** client/html/locale/select/currency/param-name
* Name of the parameter that contains the currency ID value
*
* Frameworks and applications normally use its own predefined parameter
* that contains the current currency ID if they already support multiple
* currencies. To adapt the Aimeos parameter name to the already used name,
* you are able to configure it by using this setting.
*
* @param string Parameter name for currency ID
* @since 2015.06
* @see client/html/locale/select/language/param-name
*/
$curname = $config->get('client/html/locale/select/currency/param-name', 'loc_currencyid');
$manager = \Aimeos\MShop\Factory::createManager($context, 'locale');
$search = $manager->createSearch(true);
$search->setSortations(array($search->sort('+', 'locale.position')));
foreach ($manager->searchItems($search) as $item) {
$curId = $item->getCurrencyId();
$langId = $item->getLanguageId();
$map[$langId][$curId] = array($langname => $langId, $curname => $curId);
}
$params = $view->param();
$view->selectMap = $map;
$view->selectParams = $params;
$view->selectLanguageId = $locale->getLanguageId();
$view->selectCurrencyId = $locale->getCurrencyId();
$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)) {
$input = $view->param('f_search');
$controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
$filter = $controller->createTextFilter($input);
$items = $controller->getTextList($filter);
$suggestTextItems = array();
foreach ($items as $id => $name) {
$suggestTextItems[] = array("id" => $id, "name" => $name);
}
$view->suggestTextItems = $suggestTextItems;
$this->cache = $view;
}
return $this->cache;
}
示例10: getProductListSort
/**
* Returns the sanitized sortation from the parameters for the product list.
*
* @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
* @param string &$sortdir Value-result parameter where the sort direction will be stored
* @return string Sortation string (relevance, name, price)
*/
protected function getProductListSort(\Aimeos\MW\View\Iface $view, &$sortdir)
{
return $this->getProductListSortByParam($view->param(), $sortdir);
}
示例11: 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)) {
$view->actionsParams = $this->getClientParams($view->param());
$view->actionsUserId = $this->getContext()->getUserId();
$this->cache = $view;
}
return $this->cache;
}
示例12: 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;
}
示例13: updateItems
/**
* Updates existing product download 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');
$attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
$listItems = $manager->getItem($id, array('attribute'))->getListItems('attribute', 'hidden');
if (($listId = $view->param('download/product.lists.id')) !== null) {
if (!isset($listItems[$listId])) {
$litem = $this->createListItem($id);
$item = $this->createItem();
} else {
$litem = $listItems[$listId];
$item = $litem->getRefItem();
}
$item->setLabel($view->param('download/attribute.label'));
if (($file = $view->value($view->request()->getUploadedFiles(), 'download/file')) !== null) {
$item->setCode($this->storeFile($file));
}
$attrManager->saveItem($item);
$litem->setPosition(0);
$litem->setRefId($item->getId());
$listManager->saveItem($litem, false);
}
$this->cleanupItems($listItems, array($listId));
}
示例14: 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());
}
示例15: updateItems
/**
* Updates existing product bundle 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)
{
$context = $this->getContext();
$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
$typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
$item = $manager->createItem();
$item->setParentId($view->item->getId());
$item->setTypeId($typeManager->findItem('default', array(), 'product')->getId());
$item->setDomain('product');
$map = $this->getListItems($view->item->getId());
foreach ((array) $view->param('bundle/product.lists.id', array()) as $pos => $prodid) {
if (!isset($map[$prodid])) {
$item->setId(null);
$item->setRefId($prodid);
$item->setPosition($pos);
$manager->saveItem($item, false);
} else {
unset($map[$prodid]);
}
}
$manager->deleteItems($map);
}