コード例 #1
0
 public static function getSettingsItemEditHTML($property, $sDef, $value, $additionalParams = null, $tag = 'div')
 {
     global $editsForSettings;
     $pStr = '';
     if ($additionalParams) {
         foreach ($additionalParams as $pN => $p) {
             $pStr .= $pN . (!is_null($p) ? '-' . $p : '') . ' ';
         }
     }
     $html = '';
     if (!empty($sDef['html_before'])) {
         $html .= $sDef['html_before'];
     }
     $html .= '<' . $tag . ' class="value ' . (!empty($editsForSettings[$sDef['format']]) ? $editsForSettings[$sDef['format']] : '') . ' ' . 'xProperty-' . $property . ' ' . (empty($sDef['html_entities']) ? 'xNoHTMLEntities' : '') . ' ' . 'xCSSUnits-' . (empty($sDef['css_units']) ? '0' : '1') . ' ' . 'xRequired-' . (!empty($sDef['allow_blank']) ? '0' : '1') . ' ' . (!empty($sDef['validator']) ? 'xValidator-' . $sDef['validator'] . ' ' : '') . $pStr . '" title="' . htmlspecialchars($sDef['default']) . '"';
     if ($sDef['format'] == 'select' || $sDef['format'] == 'fontselect') {
         $values = array();
         if ($sDef['values'] == 'templates') {
             $values = BertaTemplate::getAllTemplates();
         } else {
             //	var_dump($sDef['values']);
             foreach ($sDef['values'] as $vK => $vV) {
                 $values[$vK] = is_string($vK) ? $vK . '|' . $vV : $vV;
             }
         }
         $html .= ' x_options="' . htmlspecialchars(implode('||', $values)) . '"';
         $value = isset($values[$value]) ? $sDef['values'][$value] : $value;
     }
     $html .= '>';
     $html .= $value . '</' . $tag . '>';
     if (!empty($sDef['html_after'])) {
         $html .= $sDef['html_after'];
     }
     return $html;
 }