echo '</table>'; ?> <div class="clear"></div> <?php // ################### LOCATIONS ################### echo_item_location_form($Form, $edited_Item); if ($Blog->get_setting('show_location_coordinates')) { $Form->hidden('item_latitude', $edited_Item->get_setting('latitude')); $Form->hidden('item_longitude', $edited_Item->get_setting('longitude')); $Form->hidden('google_map_zoom', $edited_Item->get_setting('map_zoom')); $Form->hidden('google_map_type', $edited_Item->get_setting('map_type')); } // ################### PROPERTIES ################### $custom_fields = get_item_custom_fields(); if (count($custom_fields) > 0) { $Form->begin_fieldset(T_('Properties')); $Form->switch_layout('table'); $Form->labelstart = '<td class="right"><strong>'; $Form->labelend = '</strong></td>'; echo $Form->formstart; foreach ($custom_fields as $field) { // Display each custom field if ($field['type'] == 'varchar') { $field_note = ''; $field_params = array('maxlength' => 255, 'style' => 'width:100%'); } else { // type == double $field_note = T_('can be decimal'); $field_params = array();
/** * Display all custom fields of current Item * * @param array Params */ function custom_fields($params = array()) { // Make sure we are not missing any param: $params = array_merge(array('before' => '<table class="item_custom_fields">', 'field_format' => '<tr><th>$title$:</th><td>$value$</td></tr>', 'after' => '</table>'), $params); if (empty($this->custom_fields)) { $this->custom_fields = get_item_custom_fields(); } if (count($this->custom_fields) == 0) { // No custom fields return; } $fields_exist = false; $html = $params['before']; $mask = array('$title$', '$value$'); foreach ($this->custom_fields as $field) { $custom_field_value = $this->get_setting('custom_' . $field['name']); if (!empty($custom_field_value) || $field['type'] == 'double' && $custom_field_value == '0') { // Display only the filled field AND also numeric field with '0' value $values = array($field['title'], $custom_field_value); $html .= str_replace($mask, $values, $params['field_format']); $fields_exist = true; } } $html .= $params['after']; if ($fields_exist) { // Print out if at least one field is filled for this item echo $html; } }