/**
  * Render an item in the backend (list/tree)
  *
  * @param InterfaceGeneralModel $objModelRow the model to be drawn
  *
  * @return void
  */
 protected function drawItem(InterfaceGeneralModel $objModelRow)
 {
     $objNativeItem = $objModelRow->getItem();
     $objMetaModel = $objNativeItem->getMetaModel();
     $objView = MetaModelRenderSettingsFactory::byId($objMetaModel, $this->intViewId);
     if ($objView) {
         $objTemplate = new MetaModelTemplate($objView->get('template'));
     } else {
         return 'No rendersetting defined.';
     }
     if ($objMetaModel->hasVariants() && !$objNativeItem->isVariantBase()) {
         // create a clone to have a seperate copy of the object as we are going to manipulate it here.
         $objView = clone $objView;
         // loop over all attributes and remove those from rendering that are not desired.
         foreach (array_keys($objMetaModel->getInVariantAttributes()) as $strAttrName) {
             $objView->setSetting($strAttrName, NULL);
         }
     }
     $this->prepareTemplate($objTemplate, $objNativeItem, $objView);
     return $objTemplate->parse('html5', true);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getView($intViewId = 0)
 {
     return MetaModelRenderSettingsFactory::byId($this, $intViewId);
 }
 /**
  * Get the jumpTo for a chosen value.
  * 
  * @param string|int $mixMetaModel       ID or name of MetaModels.
  *
  * @param int        $mixDataId          ID of the data row.
  *
  * @param int        $intIdRenderSetting ID of render setting.
  *
  * @param string     $strParam           Name of parameter - Default:url|label|page|params.[attrname].
  * 
  * @return boolean|string Return false when nothing was found for the requested value.
  */
 protected function jumpTo($mixMetaModel, $mixDataId, $intIdRenderSetting, $strParam = 'url')
 {
     // Set the param to url if empty.
     if (empty($strParam)) {
         $strParam = 'url';
     }
     // Get the MetaModel. Return if we can not find one.
     $objMetaModel = $this->loadMM($mixMetaModel);
     if ($objMetaModel == null) {
         return false;
     }
     // Get the render setting.
     $objRenderSettings = MetaModelRenderSettingsFactory::byId($objMetaModel, $intIdRenderSetting);
     if ($objRenderSettings == null) {
         return false;
     }
     // Get the data row.
     $objItem = $objMetaModel->findById($mixDataId);
     if ($objItem == null) {
         return false;
     }
     // Render the item and check if we have a jump to.
     $arrRenderedItem = $objItem->parseValue('text', $objRenderSettings);
     if (!isset($arrRenderedItem['jumpTo'])) {
         return false;
     }
     // Check if someone want the sub params.
     if (stripos($strParam, 'params.') !== false) {
         $mixAttName = trimsplit('.', $strParam);
         $mixAttName = array_pop($mixAttName);
         if (isset($arrRenderedItem['jumpTo']['params'][$mixAttName])) {
             return $arrRenderedItem['jumpTo']['params'][$mixAttName];
         }
     } elseif (isset($arrRenderedItem['jumpTo'][$strParam])) {
         return $arrRenderedItem['jumpTo'][$strParam];
     }
     // Nothing hit the output. Return false.
     return false;
 }