1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-22 21:28:08 +01:00
This commit is contained in:
Thomas Zilio 2018-02-14 18:39:41 +01:00
parent e858c09107
commit bb41a50314
6 changed files with 34 additions and 10 deletions

12
add.php
View File

@ -37,19 +37,19 @@ echo '
// Campi personalizzati
echo '
<div class="hide" id="custom_fields_top">
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "top" )}
<div class="hide" id="custom_fields_top-add">
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "top", "place": "add" )}
</div>
<div class="hide" id="custom_fields_bottom">
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "bottom" )}
<div class="hide" id="custom_fields_bottom-add">
{( "name": "custom_fields", "id_module": "'.$id_module.'", "position": "bottom", "place": "add" )}
</div>
<script>
$(document).ready(function(){
$("#form_'.$id_module.'-'.$id_plugin.' form:first").prepend($("#custom_fields_top").html());
$("#form_'.$id_module.'-'.$id_plugin.' form:first").prepend($("#custom_fields_top-add").html());
$("#form_'.$id_module.'-'.$id_plugin.' form:first .panel").last().after($("#custom_fields_bottom").html());
$("#form_'.$id_module.'-'.$id_plugin.' form:first .panel").last().after($("#custom_fields_bottom-add").html());
});
</script>';

View File

@ -38,7 +38,7 @@ echo '
<div class="row">
<div class="col-md-8">
{[ "type": "email", "label": "<?php echo tr('Oggetto') ?>", "name": "subject", "value": "$subject$" ]}
{[ "type": "text", "label": "<?php echo tr('Oggetto') ?>", "name": "subject", "value": "$subject$" ]}
</div>
<div class="col-md-4">

View File

@ -33,7 +33,7 @@ if (get('anteprima') !== null) {
}
?>
<form class="canvas" action="<?php echo $rootdir; ?>/editor.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>" method="post" id="form-firma">
<form action="<?php echo $rootdir; ?>/editor.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>" method="post" id="form-firma" class="hide">
<input type="hidden" name="op" value="firma">
<input type="hidden" name="backto" value="record-edit">

View File

@ -100,6 +100,9 @@ class HTMLBuilder
$result = !empty($class) ? $class->manage($json) : '';
$html = str_replace($value, !empty($result) ? $result : $value, $html);
// Ricorsione
$html = self::replace($html);
}
// Gestione del formato di input HTML semplificato
@ -110,6 +113,9 @@ class HTMLBuilder
$result = self::generate($json);
$html = str_replace($value, !empty($result) ? $result : $value, $html);
// Ricorsione
$html = self::replace($html);
}
return $html;

View File

@ -30,6 +30,10 @@ class FieldManager implements ManagerInterface
$query .= ' AND `id_record` = '.prepare($options['id_record']);
}
if (isset($options['place']) && $options['place'] == 'add') {
$query .= ' AND `on_add` = 1';
}
$query .= ' AND `top` = '.((isset($options['position']) && $options['position'] == 'top') ? 1 : 0).' ORDER BY `order`';
$results = $database->fetchArray($query);
@ -51,9 +55,19 @@ class FieldManager implements ManagerInterface
$field['value'] = isset($field['value']) ? $field['value'] : '';
$replace = [
'value' => $field['value'],
'label' => $field['name'],
'name' => $field['html_name'],
];
foreach ($replace as $key => $value) {
$field['content'] = str_replace('|'.$key.'|', $value, $field['content']);
}
$result .= '
<div class="col-xs-4">
'.str_replace('|value|', $field['value'], $field['content']).'
'.$field['content'].'
</div>';
if (($key + 1) % 3 == 0) {

View File

@ -223,14 +223,18 @@ UPDATE `zz_widgets` SET `help` = 'Fatturato IVA inclusa.' WHERE `zz_widgets`.`na
CREATE TABLE IF NOT EXISTS `zz_fields` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_module` int(11) NOT NULL,
`id_module` int(11),
`id_plugin` int(11),
`name` varchar(255) NOT NULL,
`html_name` varchar(255) NOT NULL,
`content` text NOT NULL,
`options` text,
`order` int(11) NOT NULL,
`on_add` boolean NOT NULL,
`top` boolean NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_module`) REFERENCES `zz_modules`(`id`) ON DELETE CASCADE
FOREIGN KEY (`id_plugin`) REFERENCES `zz_plugins`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB;
--