Beispiel #1
0
 private function renderOptioned(umiObjectProperty &$property, $template, $showNull = false)
 {
     $name = $property->getName();
     $title = $property->getTitle();
     $value = $property->getValue();
     list($tpl_block, $tpl_block_empty, $tpl_item) = self::loadTemplates("data/" . $template, "optioned_block", "optioned_block_empty", "optioned_item");
     if (empty($value) && !$showNull) {
         return $tpl_block_empty;
     }
     $items_arr = array();
     foreach ($value as $info) {
         $objectId = getArrayKey($info, 'rel');
         $elementId = getArrayKey($info, 'symlink');
         $item_arr = array('int' => getArrayKey($info, 'int'), 'float' => getArrayKey($info, 'float'), 'text' => getArrayKey($info, 'text'), 'varchar' => getArrayKey($info, 'varchar'), 'field_name' => $name);
         if ($objectId) {
             if ($object = selector::get('object')->id($objectId)) {
                 $item_arr['object-id'] = $object->id;
                 $item_arr['object-name'] = $object->name;
             }
         }
         if ($elementId) {
             if ($element = selector::get('element')->id($elementId)) {
                 $item_arr['element-id'] = $element->id;
                 $item_arr['element-name'] = $element->name;
                 $item_arr['element-link'] = $element->link;
             }
         }
         $items_arr[] = self::parseTemplate($tpl_item, $item_arr, false, $objectId);
     }
     $arr = array('field_id' => $property->getField()->getId(), 'field_name' => $name, 'name' => $name, 'title' => $title, 'subnodes:items' => $items_arr);
     return self::parseTemplate($tpl_block, $arr);
 }