当前位置: 首页>>代码示例>>PHP>>正文


PHP Item::getElement方法代码示例

本文整理汇总了PHP中Item::getElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getElement方法的具体用法?PHP Item::getElement怎么用?PHP Item::getElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item::getElement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 /**
  * Constructor
  * @param Element|String $element
  * @param Item           $item
  * @param array          $options
  */
 function __construct($element, Item $item = null, $options = array())
 {
     // get Zoo app
     $this->app = App::getInstance('zoo');
     // set inner vars
     if (isset($options['elementId'])) {
         $this->_identifier = $options['elementId'];
         $this->_item = $item;
         $this->_element = $this->_item->getElement($this->_identifier);
     } else {
         if (is_object($element)) {
             $this->_element = $element;
             $this->_item = $element->getItem();
             $this->_identifier = $element->identifier;
         } else {
             $this->_identifier = $element;
         }
     }
     // set repeatable flag
     if (is_object($this->_element) && is_subclass_of($this->_element, 'ElementRepeatable')) {
         $this->_isRepeatable = true;
     }
     // set Item object
     if (!$this->_item && $item) {
         $this->_item = $item;
     }
     // get current value for export)
     if ($this->_item && $this->_identifier && isset($this->_item->elements[$this->_identifier])) {
         $this->_value = $this->_item->elements[$this->_identifier];
     }
     $this->_config = JBModelConfig::model();
     $this->_exportParams = $this->_config->getGroup('export.items', array());
     $this->_importParams = $this->_config->getGroup('import.items', array());
     $this->_lastImportParams = $this->_config->getGroup('import.last.items', array());
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:41,代码来源:item.php

示例2: renderItemElement

 /**
  * Render item element
  * @param string $elementId
  * @param Item $item
  * @param array $params
  * @return string
  */
 public function renderItemElement($elementId, Item $item, $params = array())
 {
     $element = $item->getElement($elementId);
     if ($element && $item && $element->hasValue()) {
         return parent::render("element.default", array('params' => $params, 'element' => $element, 'item' => $item));
     }
     return null;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:15,代码来源:compare.php

示例3: renderImageFromItem

 /**
  * Render HTML image form item by elementId
  * @param Item $item
  * @param $elementId
  * @param bool $isLink
  * @return string|null
  */
 public function renderImageFromItem(Item $item, $elementId, $isLink = false)
 {
     if (!$elementId) {
         return null;
     }
     $element = $item->getElement($elementId);
     if (JString::strtolower(get_class($element)) == 'elementjbimage') {
         return $element->render(array('width' => 50, 'height' => 50, 'template' => 'itemlink', 'display' => 'first'));
     } else {
         if (JString::strtolower(get_class($element)) == 'elementimage') {
             return $element->render(array('width' => 50, 'height' => 50));
         }
     }
     return null;
 }
开发者ID:JBZoo,项目名称:JBZoo-CCK-Free,代码行数:22,代码来源:jbitem.php

示例4: callElement

 public function callElement()
 {
     // get request vars
     $element_identifier = YRequest::getString('elm_id', '');
     $item_id = YRequest::getInt('item_id', 0);
     $type = YRequest::getString('type', '');
     $this->method = YRequest::getCmd('method', '');
     $this->args = YRequest::getVar('args', array(), 'default', 'array');
     JArrayHelper::toString($this->args);
     // load element
     if ($item_id) {
         $item = YTable::getInstance('item')->get($item_id);
     } elseif (!empty($type)) {
         $item = new Item();
         $item->application_id = $this->application->id;
         $item->type = $type;
     }
     // execute callback method
     if ($element = $item->getElement($element_identifier)) {
         echo $element->callback($this->method, $this->args);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:22,代码来源:item.php

示例5: getSubscriptionElements

 /**
  * Get duration element from item, using mapping
  *
  * @param   Item    $item
  * @param   string  Subscription property name, that you wish to get (e.g. duration, etc.)
  * @return  mixed
  */
 public function getSubscriptionElements($item)
 {
     $duration = array();
     if (!empty($item)) {
         $config = array();
         $config[] = $item->getApplication()->application_group;
         $config[] = $item->type;
         $config[] = 'subscription';
         $renderer = $this->app->renderer->create('item')->addPath(array($this->app->path->path("zoocart:mapping")));
         $subs_config = $renderer->getConfig('item')->get(implode('.', $config));
         if (!empty($subs_config)) {
             foreach ($subs_config as $property => $elements) {
                 // Get first element from each position:
                 $element = @array_shift($elements);
                 if ($element) {
                     $duration[$property] = $item->getElement($element['element']);
                 }
             }
         }
     }
     return $duration;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:29,代码来源:subscription.php

示例6: _createOrderElement

 /**
  * @param Item $order
  * @return JBCartElementOrderMigration
  */
 protected function _createOrderElement(Item $order)
 {
     /** @var JBCartElementOrderMigration $orderElement */
     $orderElement = $this->app->jbcartelement->create('migration', JBCart::ELEMENT_TYPE_ORDER, array('name' => JText::_('JBZOO_MIGRATE_FIELDS_NAME'), 'identifier' => $this->app->utility->generateUUID()));
     $result = array();
     foreach ($this->_fields as $elemId => $elemParams) {
         if ($element = $order->getElement($elemId)) {
             $name = $element->config->name;
             if ($elemParams['_value_map']) {
                 $data = $this->app->data->create($element->data());
                 $content = $data->find($elemParams['_value_map']);
             } else {
                 $content = $element->getSearchData();
             }
             $result[$name] = $content;
         }
     }
     $orderElement->bindData(array('content' => $result));
     return $orderElement;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:24,代码来源:jbmigrateorder.php

示例7: _convertItem

 /**
  * @param Item $item
  * @return bool
  */
 public function _convertItem(Item $item)
 {
     $oldPrices = $item->getElementsByType('jbpriceadvance');
     $oldPrice = current($oldPrices);
     if (!$oldPrice) {
         return false;
     }
     $oldData = $this->app->data->create($oldPrice->data());
     $params = $this->app->data->create($this->_migrate->getParams()->find('elements.' . $oldPrice->identifier));
     $newPriceData = array('default_variant' => 0, 'variations' => array(array('_sku' => array('value' => $oldData->find('basic.sku')), '_balance' => array('value' => $oldData->find('basic.balance')), '_value' => array('value' => $oldData->find('basic.value') . ' ' . $oldData->find('basic.currency')), '_discount' => array('value' => $oldData->find('basic.discount') . ' ' . $oldData->find('basic.discount_currency')), '_description' => array('value' => $oldData->find('basic.description')))));
     $variations = (array) $oldData->find('variations', array());
     foreach ($variations as $vari) {
         /** @var AppData $vari */
         $vari = $this->app->data->create($vari);
         $newPriceData['variations'][] = array('_value' => array('value' => $vari->get('value') . ' ' . $vari->get('currency')), '_balance' => array('value' => $vari->get('balance')), '_sku' => array('value' => $vari->get('sku')), 'param1' => array('value' => $params->find('map.param1.options-map.' . $vari->get('param1'))), 'param2' => array('value' => $params->find('map.param2.options-map.' . $vari->get('param2'))), 'param3' => array('value' => $params->find('map.param3.options-map.' . $vari->get('param3'))), 'old-description' => array('value' => $vari->get('description')));
     }
     /** @var ElementJBPricePlain $newPrice */
     $newPriceId = $params->get('id');
     if ($newPriceId && ($newPrice = $item->getElement($newPriceId))) {
         $newPrice->bindData($newPriceData);
     }
     return true;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:27,代码来源:jbmigrateprice.php


注:本文中的Item::getElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。