first commit

This commit is contained in:
2024-10-25 23:02:37 +02:00
commit faeb2e52e8
7653 changed files with 1095335 additions and 0 deletions

View File

@@ -0,0 +1,419 @@
<? $this -> values['name'] ? $g_table = $this -> values['name'] : $g_table = $this -> values[ 'table' ];?>
<div class="g-container" id="g-<?= $g_table;?>" data="table:<?= $g_table;?>">
<?
if (
$this -> values['actions']['add'] === true
or
$this -> values['actions']['edit']
or
is_array( $this -> values['buttons'] )
or
$this -> values['hide_columns']
or
$this -> values['csv']
or
$this -> values['print']
):?>
<div class="row mb10" style="height: 50px;">
<?
if ( $this -> values['title'] )
echo '<div id="g-title">' . $this -> values['title'] . '</div>';
?>
<div class=" col-md-9" id="g-menu">
<? if ( ( ( $this -> values['actions']['add'] === true or $this -> values['actions']['edit'] ) ) || is_array( $this -> values['buttons'] ) ):?>
<? if ( $this -> values['actions']['add'] === true ):?>
<a href="#" id="g-add" class="btn btn-success btn-sm mr5">
<i class="fa fa-plus-circle mr5"></i>Dodaj
</a>
<? endif;?>
<a href="#" id="g-save" class="btn btn-success btn-sm mr5" url="<?= $this -> values['actions']['add_url'];?>" <? if ( $this -> values['actions']['back_url'] ):?>back_url="<?= $this -> values['actions']['back_url'];?>"<? endif;?>>
<i class="fa fa-check-circle mr5"></i>Zatwierdź
</a>
<a href="#" id="g-cancel" class="btn btn-danger btn-sm mr5">
<i class="fa fa-times-circle mr5"></i>Anuluj
</a>
<? if ( $this -> values['multiselect'] and $this -> values['actions']['delete'] ):?>
<a href="#" id="g-multidelete" class="btn btn-danger btn-sm mr5" <? if ( $this -> values['multidelete_url'] ):?>url="<?= $this -> values['multidelete_url'];?>"<? endif;?>>
<i class="fa fa-times-circle mr5"></i>Usuń wybrane
</a>
<? endif;?>
<?
if ( is_array( $this -> values['buttons'] ) )
{
foreach ( $this -> values['buttons'] as $button )
{
echo \Html::button(
array(
'class' => $button['toggle'] === true ? $button['class'] . ' g-toggle btn-sm mr5' : $button['class'] . ' btn-sm mr5',
'url' => $button['url'] != '' ? $button['url'] : null,
'text' => $button['label'],
'icon' => $button['icon'],
'js' => $button['js'] != '' ? $button['js'] : null,
'style' => $button['toggle'] === true ? 'display: none; ' . $button['style'] : $button['style']
)
);
}
}
?>
<? endif;?>
</div>
<div class="col-md-3">
<div class="row mb10 pull-right" style="position: relative;">
<div class="col col-xs-12">
<? if ( $this -> values['hide_columns'] ):?>
<a href="#" id="g-select-columns" class="btn btn-dark pull-right ml5" title="pokaż/ukryj kolumny">
<i class="fa fa-bars"></i>
</a>
<a href="#" id='g-columns-list-close' class="btn btn-danger pull-right ml5" onclick="jQuery( '#g-columns-list' ).toggle(); return false;">
<i class='fa fa-close fa-lg'></i>
</a>
<? endif;?>
<? if ( $this -> values['csv'] ):?>
<a href="#" class="btn btn-dark pull-right g-csv ml5" title="eksportuj do pliku csv">
<i class="fa fa-save mr5"></i> csv
</a>
<? endif;?>
<? if ( $this -> values['print'] ):?>
<a href="#" class="btn btn-dark pull-right g-print ml5" title="drukuj">
<i class="fa fa-print"></i>
</a>
<? endif;?>
</div>
<div id="g-columns-list" data="table:<?= $g_table;?>">
<ul>
<?
if ( is_array( $this -> values['columns_view'] ) )
{
$i = 0;
foreach ( $this -> values['columns_view'] as $column )
{
if ( $column['autoincrement'] === null and $column['action'] === null )
{
?>
<li i="<?= $i;?>">
<input type="checkbox" class="g-column-toggle" <? if ( $this -> values['hidden_columns'][$i] !== 'true' ):?>checked="checked"<? endif;?> id="<?= $g_table . '-' . $i;?>" />
<span input="<?= $g_table . '-' . $i;?>"><?= $column['name'];?></span>
</li>
<?
}
$i++;
}
}
?>
</ul>
</div>
</div>
</div>
</div>
<? endif;?>
<div id="g-results">
<?= $this -> values['content'];?>
</div>
<div id="g-loader"></div>
</div>
<? if ( $this -> values['include_plugins'] ):?>
<script type="text/javascript">
var dir = '<?= gdir;?>';
</script>
<!-- iradio -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/icheck/skins/minimal/minimal.css' />
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/icheck/skins/minimal/blue.css' />
<script type="text/javascript" src="<?= gdir;?>/plugins/icheck/icheck.min.js"></script>
<!-- ipromptu -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/impromptu/jquery-impromptu.css' />
<script type='text/javascript' src='<?= gdir;?>/plugins/impromptu/jquery-impromptu.js'></script>
<!-- tooltip -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/tooltipster-master/css/tooltipster.css' />
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/tooltipster-master/css/themes/tooltipster-punk.css' />
<script type='text/javascript' src='<?= gdir;?>/plugins/tooltipster-master/js/jquery.tooltipster.js'></script>
<!-- context menu -->
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/plugins/jq-context-menu/context.standalone.css" />
<script type="text/javascript" src="<?= gdir;?>/plugins/jq-context-menu/context.js"></script>
<!-- grid -->
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/css/grid.css" />
<script type="text/javascript" src="<?= gdir;?>/js/grid.js"></script>
<? endif;?>
<script type="text/javascript">
menu_context_<?= str_replace( '-', '_', $g_table );?> = {
id: '<?= $g_table;?>-context',
data: [
{ header: 'Opcje' }
<? if ( is_array( $this -> values['columns_view'] ) ): foreach ( $this -> values['columns_view'] as $column ):?>
<? if ( $column['action']['type'] == 'button' ):?>
, {
text: '<i class="fa fa-th-list"></i><?= $column['button']['label'];?>',
action: function( e, selector ) {
<?
if ( $column['action']['js'] )
{
echo $_SESSION[ 'g' . $g_table ] -> convertStringJS( $column['action']['js'] );
echo 'eval( out );';
}
elseif ( $column['action']['url'] )
{
echo $_SESSION[ 'g' . $g_table ] -> convertStringJS( $column['action']['url'] );
echo 'document.location.href = out;';
}
?>
}
}
<? endif;?>
<? if ( $column['action']['type'] == 'edit' ):?>
, {
text: '<i class="fa fa-cog"></i>Edytuj',
action: function( e, selector ) {
<?
if ( $column['action']['js'] )
{
echo $_SESSION[ 'g' . $g_table ] -> convertStringJS( $column['action']['js'] );
echo 'eval( out );';
}
elseif ( $column['action']['url'] )
{
echo $_SESSION[ 'g' . $g_table ] -> convertStringJS( $column['action']['url'] );
echo 'document.location.href = out;';
}
?>
}
}
<? endif;?>
<? if ( $column['action']['type'] == 'delete' ):?>
, {
text: '<i class="fa fa-trash"></i>Usuń',
action: function( e, selector ) {
jQuery.prompt( 'Na pewno chcesz usunąć wybrany element?', {
title: 'Potwierdź?',
submit: function(e,v,m,f) {
if ( v == true ) {
<?
if ( $column['action']['js'] )
{
echo $_SESSION[ 'g' . $g_table ] -> convertStringJS( $column['action']['js'] );
echo 'eval( out );';
}
elseif ( $column['action']['url'] )
{
echo $_SESSION[ 'g' . $g_table ] -> convertStringJS( $column['action']['url'] );
echo 'document.location.href = out;';
}
?>
}
},
buttons: {
'tak': true,
'nie': false
},
focus: 1
});
}
}
<? endif;?>
<? endforeach; endif;?>
<? if ( $this -> values['actions']['edit'] and $this -> values['src'] === null ):?>
, {
text: '<i class="fa fa-cog"></i>Edytuj',
action: function( e, selector )
{
var gedit = selector.attr( '<?= $this -> values['id'];?>' );
var data = selector.parents( '.g-container' ).attr( 'data' );
data = data.split( ";" );
for ( index = 0; index < data.length; ++index )
{
var vars = data[ index ].split( ':') ;
if ( vars[0] === 'table' )
var gtable = vars[1];
}
jQuery.ajax(
{
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
{
gtable: gtable,
gedit: gedit,
a: 'gedit'
},
beforeSend: function()
{
jQuery( '.dropdown-menu' ).hide();
jQuery( "#g-" + gtable ).find( '#g-loader' ).show();
},
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '.g-container' ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
{
jQuery( '#g-add, #g-search' ).hide();
jQuery( '#g-cancel, #g-save' ).show();
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
{
return jQuery.prompt( "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.", {
title: "Błąd",
buttons: { "Zamknij": true }
});
}
}
});
}
}
<? endif;?>
<? if ( $this -> values['actions']['delete'] and $this -> values['src'] === null ):?>
, {
text: '<i class="fa fa-trash"></i>Usuń',
action: function( e, selector )
{
jQuery.prompt( 'Na pewno chcesz usunąć wybrany element?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v == true )
{
var gdelete = selector.attr( '<?= $this -> values['id'];?>' );
var url = selector.find( '.g-delete' ).attr( 'url' ).replace( '[ID]', gdelete );
var data = selector.parents( '.g-container' ).attr( 'data' );
data = data.split( ";" );
for ( index = 0; index < data.length; ++index )
{
var vars = data[ index ].split( ':') ;
if ( vars[0] === 'table' )
var gtable = vars[1];
}
if ( url !== '' )
{
jQuery.ajax(
{
type: 'POST',
cache: false,
url: url,
data:
{
gdelete: gdelete,
a: 'gdelete'
},
beforeSend: function()
{
jQuery( '.dropdown-menu' ).hide();
jQuery( "#g-" + gtable ).find( '#g-loader' ).show();
},
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '.g-container' ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
{
if ( response.msg !== null )
create_message( response.msg );
jQuery.ajax(
{
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
{
gtable: gtable,
a: 'gdraw'
},
beforeSend: function()
{
jQuery( "#g-" + gtable ).find( '#g-loader' ).show();
},
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '.g-container' ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
{
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
{
return jQuery.prompt( "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.", {
title: "Błąd",
buttons: { "Zamknij": true }
});
}
}
});
}
else
{
return jQuery.prompt( "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.", {
title: "Błąd",
buttons: { "Zamknij": true }
});
}
}
});
}
else
{
jQuery.ajax(
{
type: 'POST',
cache: false,
url: dir + '/ajax.php',
data:
{
gtable: gtable,
gdelete: gdelete,
a: 'gdraw'
},
beforeSend: function()
{
jQuery( "#g-" + gtable ).find( '#g-loader' ).show();
},
success: function( data )
{
response = jQuery.parseJSON( data ); jQuery( '.g-container' ).find( '#g-loader' ).hide();
if ( response.status === 'ok' )
{
if ( response.msg !== null )
create_message( response.msg );
jQuery( '#g-' + gtable ).find( '#g-results' ).empty().html( response.output );
}
else
{
return jQuery.prompt( "Przepraszamy. Podczas wczytywania danych wystąpił błąd. Prosimy spróbować ponownie.", {
title: "Błąd",
buttons: { "Zamknij": true }
});
}
}
});
}
}
},
buttons: {
'tak': true,
'nie': false
},
focus: 1
});
}
}
<? endif;?>
]
};
jQuery( function() {
context.init({
preventDoubleContext: true,
above: 'auto'
});
jQuery( '#g-columns-list input[type="checkbox"]' ).iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
});
</script>

View File

@@ -0,0 +1,227 @@
<div class="row">
<div class="col col-xs-12">
<div class="g-container" data="table:<?= $this -> values['id'];?>">
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title"><?= $this -> values['title'];?></span>
</div>
<div class="panel-heading p10 pl15" id="g-menu" style="height: auto;">
<? if ( $this -> values['default_buttons'] === true ):?>
<? if ( $this -> values['persist_edit'] ):?>
<a href="#" id="g-edit-save" class="btn btn-system btn-sm" persist_edit="0" back_url="<?= $this -> values['actions']['save']['back_url'];?>" url="<?= $this -> values['actions']['save']['url'];?>" <? if ( $this -> values['actions']['save']['js'] ):?>onclick="<?= htmlspecialchars( $this -> values['actions']['save']['js'] );?> return false;"<? endif;?>>
<i class="fa fa-check-circle mr5"></i>Zatwierdź i zamknij
</a>
<? endif;?>
<a href="#" id="g-edit-save" class="btn btn-success btn-sm" persist_edit="<?= $this -> values['persist_edit'];?>" id_param="<?= $this -> values['id_param'];?>" back_url="<?= $this -> values['actions']['save']['back_url'];?>" url="<?= $this -> values['actions']['save']['url'];?>" <? if ( $this -> values['actions']['save']['js'] ):?>onclick="<?= htmlspecialchars( $this -> values['actions']['save']['js'] );?> return false;"<? endif;?>>
<i class="fa fa-check-circle mr5"></i>Zatwierdź
</a>
<a href="<?= $this -> values['actions']['cancel']['url'] ? $this -> values['actions']['cancel']['url'] : $tmp = '#';?>" class="btn btn-dark btn-sm" id="g-edit-cancel">
<i class="fa fa-reply mr5"></i>Wstecz
</a>
<? endif;?>
<?
if ( is_array( $this -> values['buttons'] ) )
{
foreach ( $this -> values['buttons'] as $button )
{
echo \Html::button(
array(
'class' => $button['toggle'] === true ? $button['class'] . ' g-toggle btn-sm mr5' : $button['class'] . ' btn-sm mr5',
'url' => $button['url'] != '' ? $button['url'] : null,
'text' => $button['label'],
'icon' => $button['icon'],
'js' => $button['js'] != '' ? $button['js'] : null,
'style' => $button['toggle'] === true ? 'display: none; ' . $button['style'] : $button['style'],
"target" => $button['target'],
'id' => $button['id']
)
);
}
}
?>
</div>
<div class="panel-body">
<?
if ( $this -> values['form'] === true )
{
echo '<form method="POST" id="fg-' . $this -> values['id'] . '" class="g-form form-horizontal" ';
if ( $this -> values['post_action'] !== null )
echo 'action="' . $this -> values['post_action'] . '" ';
echo 'enctype="multipart/form-data">';
}
?>
<? if ( is_array( $this -> values['fields'] ) ): foreach ( $this -> values['fields'] as $field ):?>
<? if ( $field['type'] == 'hidden' ):?>
<input type="hidden" name="<?= $field['db'];?>" id="<?= $field['db'];?>"
<?
if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ):
echo $key . '="' . $val . '"';
endforeach; endif;
?> value="<?= htmlspecialchars( $field['value'] );?>" />
<? else:?>
<div class="form-group row">
<label for="<?= $field['db'];?>" class="col-lg-3 control-label"><?= $field['name'];?><? if ( $field['name'] ) echo ':';?></label>
<?
if ( $field['type'] == 'text' )
{
?>
<div class="col-lg-9">
<input type="text" class="form-control" name="<?= $field['db'];?>" id="<?= $field['db'];?>" <? if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ): echo $key . '="' . $val . '"'; endforeach; endif;?> value="<?= htmlspecialchars( $field['value'] );?>" />
</div>
<?
}
elseif ( $field['type'] == 'password' )
{
?>
<div class="col-lg-9">
<input type="password" class="form-control" name="<?= $field['db'];?>" id="<?= $field['db'];?>" <? if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ): echo $key . '="' . $val . '"'; endforeach; endif;?> value="<?= htmlspecialchars( $field['value'] );?>" />
</div>
<?
}
elseif ( $field['type'] == 'select' )
{
?>
<div class="col-lg-9">
<select name="<?= $field['db'];?>" id="<?= $field['db'];?>" class="form-control" <? if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ): echo $key . '="' . $val . '"'; endforeach; endif;?>>
<option value="null">---- <?= mb_strtolower( $field['name'], 'UTF-8' );?> ----</option>
<?
if ( $field['replace']['sql'] )
{
$results = $_SESSION[ 'g-edit-' . $this -> values['id'] ] -> connectToDb() -> query( $field['replace']['sql'] ) -> fetchAll();
if ( is_array( $results ) ) foreach ( $results as $row )
{
echo '<option value="' . $row[0] . '"';
if ( $row[0] == $field['value'] )
echo ' selected="selected"';
echo '>' . $row[1] . '</option>';
}
}
else if ( is_array( $field['replace']['array'] ) )
{
foreach ( $field['replace']['array'] as $key => $val )
{
echo '<option value="' . $key . '"'; if ( $key == $field['value'] ) echo 'selected="selected"'; echo '>' . $val . '</option>';
}
}
?>
</select>
</div>
<?
}
elseif ( $field['type'] == 'radio' )
{
if ( is_array( $field['replace']['array'] ) ) foreach ( $field['replace']['array'] as $key => $val )
{
?>
<input type="radio" class="g-radio" name="<?= $field['db'];?>" id="<?= $field['db'] . '_' . $key;?>" value="<?= $key;?>" />
<label for="<?= $field['db'];?>" id="<?= $field['db'] . '_' . $key;?>"><?= $val;?></label>
<?
}
}
elseif ( $field['type'] == 'input_switch' )
{
?>
<div class="col-lg-9 pt5">
<div>
<input id="<?= $field['db'];?>" name="<?= $field['db'];?>" type="checkbox" <? if ( $field['checked'] ) echo 'checked="checked" ';?>>
</div>
</div>
<?
}
elseif ( $field['type'] == 'textarea' )
{
?>
<textarea name="<?= $field['db'];?>" id="<?= $field['db'];?>" <? if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ): echo $key . '="' . $val . '"'; endforeach; endif;?>><?= $field['value'];?></textarea>
<?
}
elseif ( $field['type'] == 'checkbox' )
{
if ( $field['replace']['sql'] )
{
$results = $_SESSION[ 'g-edit-' . $this -> values['id'] ] -> connectToDb() -> query( $field['replace']['sql'] ) -> fetchAll();
if ( is_array( $results ) ) foreach ( $results as $row )
{
?>
<input type="checkbox" class="g-checkbox" name="<?= $field['db'];?>" value="<?= $row[0];?>" <? if ( is_array( $field['value'] ) and in_array( $row[0], $field['value'] ) ):?>checked="checked"<? endif;?> /><?= $row[1];?>
<?
}
}
}
elseif ( $field['type'] == 'button' )
{
?>
<a href="<?= $field['button']['url'] ? $field['button']['url'] : $tmp = '#';?>" class="g-button-form"
<? if ( $field['button']['js'] ):?>onclick="<?= htmlspecialchars( $field['button']['js'] );?> return false;"<? endif;?>
style="<? if ( $field['button']['bgcolor'] ):?>background: <?= $field['button']['bgcolor'];?>;<? endif;?>"
>
<i class="fa <?= $field['button']['icon'];?>"></i><?= $field['button']['label'];?>
</a>
<?
}
elseif ( $field['type'] == 'label' )
{
if ( $field['replace']['sql'] )
{
$sql = $_SESSION[ 'g-edit-' . $this -> values['id'] ] -> convertString( $field['replace']['sql'], $row );
$results = $_SESSION[ 'g-edit-' . $this -> values['id'] ] -> connectToDb() -> query( $sql ) -> fetchAll();
if ( $results[0][0] )
echo $results[0][0];
else
echo '-';
}
else
echo '<div class="g-edit-text">' . $field['value'] . '</div>';
}
?>
</div>
<? endif;?>
<? endforeach; endif;?>
<?
if ( $this -> values['form_html_src'] !== null )
include_once $this -> values['form_html_src'];
if ( $this -> values['external_code'] !== null )
echo $this -> values['external_code'];
?>
<?
if ( $this -> values['form'] === true )
echo '</form>';
?>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
jQuery( function() {
jQuery( '.g-checkbox, .g-radio' ).iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
});
</script>
<? if ( $this -> values['include_plugins'] ):?>
<script type="text/javascript">
var dir = '<?= gdir;?>';
</script>
<!-- fontawsome -->
<!--<link rel="stylesheet" type="text/css" href="<?= gdir;?>/plugins/font-awesome-4.2.0/css/font-awesome.min.css" />-->
<!-- iradio -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/icheck/skins/minimal/minimal.css' />
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/icheck/skins/minimal/blue.css' />
<script type="text/javascript" src="<?= gdir;?>/plugins/icheck/icheck.min.js"></script>
<!-- ipromptu -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/impromptu/jquery-impromptu.css' />
<script type='text/javascript' src='<?= gdir;?>/plugins/impromptu/jquery-impromptu.js'></script>
<!-- tooltip -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/tooltipster-master/css/tooltipster.css' />
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/tooltipster-master/css/themes/tooltipster-punk.css' />
<script type='text/javascript' src='<?= gdir;?>/plugins/tooltipster-master/js/jquery.tooltipster.js'></script>
<!-- context menu -->
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/plugins/jq-context-menu/context.standalone.css" />
<script type="text/javascript" src="<?= gdir;?>/plugins/jq-context-menu/context.js"></script>
<!-- grid -->
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/css/grid.css" />
<script type="text/javascript" src="<?= gdir;?>/js/grid.js"></script>
<? endif;?>

View File

@@ -0,0 +1,95 @@
<? $this -> values['name'] ? $g_table = $this -> values['name'] : $g_table = $this -> values[ 'table' ];?>
<div class="row">
<div class="col col-md-6">
<div class="g-container" data="table:<?= $this -> values['id'];?>">
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title"><?= $this -> element[ $this -> values['id'] ] ? $tmp = 'Edytuj element' : $tmp = 'Dodaj element';?></span>
</div>
<div class="panel-body">
<form method="POST" id="fg-<?= $g_table;?>" class="g-form form-horizontal">
<input type="hidden" name="<?= $this -> values['id'];?>" value="<?= $this -> element[ $this -> values['id'] ];?>" />
<? if ( is_array( $this -> values['columns_edit'] ) ): foreach ( $this -> values['columns_edit'] as $ce ):?>
<? if ( $ce['type'] == 'hidden' ):?>
<input type="hidden" name="<?= $ce['db'];?>" value="<?= $ce['value'];?>" />
<? else:?>
<div class="form-group row">
<label for="<?= $ce['db'];?>" class="col-lg-3 control-label"><?= $ce['name'];?>:</label>
<? if ( $ce['type'] == 'text' ):?>
<div class="col-lg-9">
<input type="text" class="form-control <? if ( $ce['require'] ):?>require<? endif;?>" name="<?= $ce['db'];?>" id="<?= $ce['db'];?>"
<?
if ( is_array( $ce['params'] ) ): foreach( $ce['params'] as $key => $val ):
echo $key . '="' . $val . '"';
endforeach; endif;
?> value="<?= htmlspecialchars( $this -> element[ $ce['db'] ] );?>" <? if ( $ce['readonly-edit'] and $this -> element[ $this -> values['id'] ] ):?>readonly="readonly"<? endif;?> />
</div>
<? elseif ( $ce['type'] == 'select' ):?>
<div class="col-lg-9">
<select name="<?= $ce['db'];?>" id="<?= $ce['db'];?>" class="form-control <? if ( $ce['require'] ):?>require<? endif;?>"
<?
if ( is_array( $ce['params'] ) ): foreach( $ce['params'] as $key => $val ):
echo $key . '="' . $val . '"';
endforeach; endif;
?>>
<option value="null">---- <?= $ce['name'];?> ----</option>
<? if ( $ce['replace']['sql'] ):?>
<?
$results = $_SESSION[ 'g' . $g_table ] -> connectToDb() -> query( $ce['replace']['sql'] ) -> fetchAll();
if ( is_array( $results ) ) foreach ( $results as $row )
{
echo '<option value="' . $row[0] . '"';
if ( $this -> element[ $ce['db'] ] !== null and $row[0] == $this -> element[ $ce['db'] ] )
echo ' selected="selected" ';
echo '>' . $row[1] . '</option>';
}
?>
<? else:?>
<?
if ( is_array( $ce['replace']['array'] ) ): foreach ( $ce['replace']['array'] as $key => $val ):
?>
<option value="<?= $key;?>"
<? if (
( $this -> element[ $ce['db'] ] !== null and $key == $this -> element[ $ce['db'] ] )
or
( $this -> element[ $ce['db'] ] === null and isset( $ce['default_value'] ) and $ce['default_value'] == $key )
):?>
selected="selected"
<? endif;?>
>
<?= $val;?>
</option>
<?
endforeach; endif;
?>
<? endif;?>
</select>
</div>
<? elseif ( $ce['type'] == 'radio' ):?>
<div class="col col-lg-9">
<? if ( is_array( $ce['replace']['array'] ) ): foreach ( $ce['replace']['array'] as $key => $val ):?>
<div class="radio-custom mt10" style="display: inline-block;">
<input type="radio" name="<?= $ce['db'];?>" id="<?= $ce['db'] . '_' . $key;?>" value="<?= $key;?>" <? if ( $this -> element[ $ce['db'] ] == $key ):?>checked="checked"<? endif;?> />
<label for="<?= $ce['db'] . '_' . $key;?>"><?= $val;?></label>
</div>
<? endforeach; endif;?>
</div>
<? elseif ( $ce['type'] == 'textarea' ):?>
<div class="col col-lg-9">
<textarea name="<?= $ce['db'];?>" id="<?= $ce['db'];?>" class="form-control"
<?
if ( is_array( $ce['params'] ) ): foreach( $ce['params'] as $key => $val ):
echo $key . '="' . $val . '"';
endforeach; endif;
?>><?= $this -> element[ $ce['db'] ];?></textarea>
</div>
<? endif;?>
</div>
<? endif;?>
<? endforeach; endif;?>
</form>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,109 @@
<?
$this -> values['name'] ? $g_table = $this -> values['name'] : $g_table = $this -> values[ 'table' ];
?>
<? if ( is_array( $this -> values['results'] ) ):?>
<table style="border-collapse: collapse; width: 100%; font-family: Verdana; font-size: 11px;">
<thead>
<tr>
<?
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
if ( $column['autoincrement'] )
echo '<td style="background: #000; color: #FFF; text-align: left; font-weight: normal; padding: 3px 5px; width: 30px; text-align: center;' . $column['th']['style'] . '">' . $column['name'] . '</td>';
else if ( $column['action'] == null )
echo '<td style="background: #000; color: #FFF; text-align: left; font-weight: normal; padding: 3px 5px;' . $column['th']['style'] . '">' . $column['name'] . '</td>';
}
?>
</tr>
</thead>
<tbody>
<?
$i = ( $this -> values['cp'] - 1 ) * $this -> values['limit'];
$context = false;
if ( is_array( $this -> values['results'] ) ) foreach ( $this -> values['results'] as $row )
{
echo '<tr'; if ( $i%2 == 0 ) echo 'style="background: #E8E8E8;"'; echo '>';
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
if ( $column['autoincrement'] )
echo '<td style="padding: 3px 5px; border: 1px solid #DFDFDF; text-align: center;' . $column['td']['style'] . '">' . ++$i . '.</td>';
else if ( $column['action'] == null )
{
echo '<td style="padding: 3px 5px; border: 1px solid #DFDFDF;' . $column['td']['style'] . '">';
if ( $column['content'] )
echo $_SESSION[ 'g' . $g_table ] -> convertString( $column['content'], $row );
else
{
/* podmiana na wartości tablicy */
if ( is_array( $column['replace']['array'] ) )
echo $_SESSION[ 'g' . $g_table ] -> convertString( $column['replace']['array'][ $row[ $column['db'] ] ], $row );
else if ( $column['replace']['sql'] )
{
$sql = $_SESSION[ 'g' . $g_table ] -> convertString( $column['replace']['sql'], $row );
$results = $_SESSION[ 'g' . $g_table ] -> connectToDb() -> query( $sql ) -> fetchAll();
if ( $results[0][0] )
echo $results[0][0];
else
echo '-';
}
/* modyfikacja wyświetlania daty */
else if ( $column['date_mod'] )
{
if ( grid::validateDate( $row[ $column['db'] ] ) )
echo date( $column['date_mod'], strtotime( $row[ $column['db'] ] ) );
else
echo '-';
}
/* ucunianie długich wartości */
else if ( $column['cut'] )
{
echo '<span class="tip" title="' . htmlspecialchars( $row[ $column['db'] ] ) . '">';
echo mb_substr( $row[ $column['db'] ], 0, $column['cut'], 'UTF-8' );
if ( mb_strlen( $row[ $column['db'] ], 'UTF-8' ) > $column['cut'] )
echo '...';
echo '</span>';
}
else if ( $column['php'] )
eval( $_SESSION[ 'g' . $g_table ] -> convertString( $column['php'], $row ) );
/* zwykla wartość */
else
echo $row[ $column['db'] ];
}
echo '</td>';
}
}
echo '</tr>';
}
if ( is_array( $this -> values['summary'] ) )
{
echo '<tr>';
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
if ( $column['action'] == null )
{
echo '<td style="padding: 3px 5px; border: 1px solid #DFDFDF; text-align: center; font-weight: bold;">';
if ( !empty( $this -> values['summary'][ $column['db'] ] ) )
echo 'Σ: ' . $this -> values['summary'][ $column['db'] ];
echo '</td>';
}
}
echo '</tr>';
}
?>
</tbody>
</table>
<? else:?>
<div class="g-alert"><i class="fa fa-exclamation-circle fa-lg"></i><?= $this -> values['empty_txt'];?></div>
<? endif;?>
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/css/grid.css" />
<script type="text/javascript">
window.print();
</script>

View File

@@ -0,0 +1,447 @@
<?
$this -> values['name'] ? $g_table = $this -> values['name'] : $g_table = $this -> values[ 'table' ];
?>
<div class="table-responsive">
<table id="g-list" class="table mbn table-hover table-striped <? if ( $this -> values['condensed'] ):?>table-condensed<? endif;?> table-bordered">
<thead>
<tr>
<?
if ( $this -> values['multiselect'] )
echo '<th class="g-lp">' .
'<input type="checkbox" class="g-checkbox-all" />' .
'</th>';
if ( is_array( $this -> values['columns_view'] ) )
{
$c_index = 0;
$visible_columns = 0;
foreach ( $this -> values['columns_view'] as $column )
{
if ( filter_var( $this -> values['hidden_columns'][$c_index], FILTER_VALIDATE_BOOLEAN ) === false or $this -> values['hidden_columns'][$c_index] === null )
{
$column['sort'] ? $sort = 'g-sort' : $sort = '';
if ( $column['sort'] )
{
$sort_data = 'data="sort-column:' . $column['db'] . ';sort-type:';
if ( $column['db'] == $this -> values['order']['column'] )
$sort_data .= $this -> values['order']['type'];
else
$sort_data .= 'DESC';
$sort_data .= '"';
}
else
$sort_data = '';
echo '<th class="' . $column['th']['class'] . ' ' . $sort . '" style="' . $column['th']['style'] . '" ' . $sort_data . '>';
if ( $column['db'] == $this -> values['order']['column'] && $column['sort'] )
{
if ( $this -> values['order']['type'] == 'ASC' )
echo '<i class="fa fa fa-long-arrow-up g-tip" title="Sortowanie rosnące"></i>';
if ( $this -> values['order']['type'] == 'DESC' )
echo '<i class="fa fa fa-long-arrow-down g-tip" title="Sortowanie malejące"></i>';
}
if ( $column['sort'] and $column['db'] != $this -> values['order']['column'] )
echo '<i class="fa fa-arrows-v g-tip" title="Sortuj" style="opacity: 0.5"></i>';
echo $column['name'];
echo '</th>';
$visible_columns++;
}
$c_index++;
}
}
if ( $this -> values['actions']['edit'] )
{
echo '<th class="g-center" style="width: 50px;">Edytuj</th>';
$visible_columns++;
}
if ( $this -> values['actions']['delete'] )
{
echo '<th class="g-center" style="width: 50px;">Usuń</th>';
$visible_columns++;
}
?>
</tr>
<?
if ( is_array( $this -> values['search'] ) )
{
$c_index = 0;
echo '<tr>';
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
$search_found = false;
if ( filter_var( $this -> values['hidden_columns'][$c_index], FILTER_VALIDATE_BOOLEAN ) === false or $this -> values['hidden_columns'][$c_index] === null )
{
foreach ( $this -> values['search'] as $search )
{
if ( !empty( $column['db'] ) and $search['db'] == $column['db'] )
{
$search_found = true;
if ( $search['type'] == 'text' )
{
echo '<th>'
. '<input type="text" '
. 'name="' . $search['db'] . '" '
. 'autocomplete="off" '
. 'placeholder="Szukaj: ' . mb_strtolower( $search['name'], 'UTF-8' ) . '" '
. 'title="Szukaj: ' . $search['name'] . '" '
. 'class="g-search-input form-control input-sm" '
. 'value="' . $this -> values['filters'][ $search['db'] ]['value'] . '" '
. 'data="search-column:' . $search['db'] . ';search-type:like" '
. '/>'
. '</th>';
}
if ( $search['type'] == 'select' )
{
echo '<th>'
. '<select name="' . $search['db'] . '" '
. 'title="Szukaj: ' . $search['name'] . '" '
. 'class="g-search-select form-control input-sm" '
. 'data="search-column:' . $search['db'] . ';search-type:equal">'
. '<option value="null" style="text-align: center;">- ' . mb_strtolower( $search['name'], 'UTF-8' ) . ' -</option>';
if ( is_array( $search['replace']['array'] ) )
{
foreach ( $search['replace']['array'] as $key => $val )
{
echo '<option value="' . $key . '"';
if ( isset( $this -> values['filters'][ $search['db'] ]['value'] ) and $key == $this -> values['filters'][ $search['db'] ]['value'] )
echo ' selected="selected" ';
echo '>' . $val . '</option>';
}
}
if ( $search['replace']['sql'] )
{
$results = $_SESSION[ 'g' . $g_table ] -> connectToDb() -> query( $search['replace']['sql'] ) -> fetchAll();
if ( is_array( $results ) ) foreach ( $results as $row )
echo '<option value="' . $row[0] . '">' . $row[1] . '</option>';
}
echo '</select>'
. '</th>';
}
if ( $search['type'] == 'date_range' )
{
echo '<th>';
echo '<div class="input-group">'
. '<span class="input-group-addon cursor date-range-icon">'
. '<i class="fa fa-calendar"></i>'
. '</span>'
. '<input type="text" '
. 'name="' . $search['db'] . '" '
. 'data="search-column:' . $search['db'] . ';search-type:date_range" '
. 'class="g-search-input form-control input-sm date-range"'
. 'value="' . $this -> values['filters'][ $search['db'] ]['value'] . '"/>'
. '</div>';
echo '</th>';
}
}
}
if ( !$search_found )
echo '<th></th>';
}
$c_index++;
}
echo '</tr>';
}
?>
</thead>
<tbody>
<?
$i = ( $this -> values['cp'] - 1 ) * $this -> values['limit'];
$context = false;
if ( is_array( $this -> values['results'] ) and !empty( $this -> values['results'] ) ) foreach ( $this -> values['results'] as $row )
{
$columns = array();
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
$columns = array_merge( $columns, $_SESSION[ 'g' . $g_table ] -> getParams( $column['action']['url'] ) );
$columns = array_merge( $columns, $_SESSION[ 'g' . $g_table ] -> getParams( $column['action']['js'] ) );
}
$columns = array_unique( $columns );
echo '<tr ' . $this -> values['id'] . '="' . $row[ $this -> values['id'] ] . '" ';
if ( is_array( $columns ) ) foreach ( $columns as $column )
echo $column . '="' . $row[ $column ] . '" ';
echo '>';
if ( $this -> values['multiselect'] )
echo '<td>' .
'<input type="checkbox" class="g-checkbox" value="' . $row[ $this -> values['id'] ] . '" />' .
'</td>';
$c_index = 0;
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
if ( filter_var( $this -> values['hidden_columns'][$c_index], FILTER_VALIDATE_BOOLEAN ) === false or $this -> values['hidden_columns'][$c_index] === null )
{
if ( $column['autoincrement'] )
echo '<td class="' . $column['td']['class'] . '" style="' . $column['td']['style'] . '">' . ++$i . '.</td>';
else
{
echo '<td class="' . $column['td']['class'] . '" style="' . $column['td']['style'] . ''; if ( $column['td']['js'] ) echo 'cursor: pointer;'; echo '"';
if ( $column['td']['js'] )
{
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['td']['js'], $row );
echo 'onclick="' . htmlspecialchars( $out_js ) . '"';
}
echo '>';
if ( $column['content'] )
echo $_SESSION[ 'g' . $g_table ] -> convertString( $column['content'], $row );
else
{
/* podmiana na wartości tablicy */
if ( is_array( $column['replace']['array'] ) )
echo $_SESSION[ 'g' . $g_table ] -> convertString( $column['replace']['array'][ $row[ $column['db'] ] ], $row );
else if ( $column['replace']['sql'] )
{
$sql = $_SESSION[ 'g' . $g_table ] -> convertString( $column['replace']['sql'], $row );
$results = $_SESSION[ 'g' . $g_table ] -> connectToDb() -> query( $sql ) -> fetchAll();
if ( $results[0][0] != '' )
echo $results[0][0];
else
echo '-';
}
/* modyfikacja wyświetlania daty */
else if ( $column['date_mod'] )
{
if ( grid::validateDate( $row[ $column['db'] ] ) )
echo date( $column['date_mod'], strtotime( $row[ $column['db'] ] ) );
else
echo '-';
}
/* wyświtalania linku typu button */
else if ( $column['action']['type'] == 'button' )
{
if ( $column['action']['url'] )
$out_url = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['url'], $row );
else
$out_url = '#';
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['js'], $row );
if ( $column['action']['js'] )
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['js'], $row );
$column['button']['title'] ? $title = $column['button']['title'] : $title = $column['button']['label'];
echo '<a href="' . $out_url . '"' .
'onclick="' . htmlspecialchars( $out_js ) . '" ' .
'class="g-tip g-button ' . $column['button']['class' ] . '" ' .
'title="' . htmlspecialchars( $title ) . '" ' .
'style="' . $column['button']['style'] . '">' . $column['button']['label'] .
'</a>';
}
/* wyświtalania linku do edycji */
else if ( $column['action']['type'] == 'edit' )
{
$out_url = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['url'], $row );
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['js'], $row );
echo '<a href="' . $out_url . '" onclick="' . htmlspecialchars( $out_js ) . '" class="g-tip" title="edytuj"><i class="fa fa-cog fa-lg"></i></a>';
}
/* wyświtalania linku do usuwania */
else if ( $column['action']['type'] == 'delete' )
{
$out_url = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['url'], $row );
$out_js = $_SESSION[ 'g' . $g_table ] -> convertString( $column['action']['js'], $row );
echo '<a href="#" class="g-tip" title="usuń" onclick="$( this ).blur(); jQuery.prompt( \'Na pewno chcesz usunąć wybrany element?\', { title: \'Potwierdź?\', submit: function(e,v,m,f) { if ( v == true ) ';
if ( $out_js )
echo htmlspecialchars( $out_js );
else
echo htmlspecialchars( 'document.location.href="' . $out_url . '";' );
echo ' }, buttons: { \'tak\': true, \'nie\': false }, focus: 0 } );"><i class="fa fa-trash fa-lg"></i></a>';
}
/* ucunianie długich wartości */
else if ( $column['cut'] )
{
echo '<span class="tip" title="' . htmlspecialchars( $row[ $column['db'] ] ) . '">';
echo htmlspecialchars( mb_substr( $row[ $column['db'] ], 0, $column['cut'], 'UTF-8' ) );
if ( mb_strlen( $row[ $column['db'] ], 'UTF-8' ) > $column['cut'] )
echo '...';
echo '</span>';
}
else if ( $column['php'] )
{
eval( $_SESSION[ 'g' . $g_table ] -> convertString( $column['php'], $row ) );
}
/* zwykla wartość */
else
echo $row[ $column['db'] ];
}
echo '</td>';
}
}
$c_index++;
}
if ( $this -> values['actions']['edit'] )
echo '<td class="center">' .
'<a href="#" class="g-edit g-tip" title="edytuj" element-id="' . $row[ $this -> values['id'] ] . '">' .
'<i class="fa fa-cog fa-lg"></i>' .
'</a>' .
'</td>';
if ( $this -> values['actions']['delete'] )
echo '<td class="g-center">'
. '<a href="#" class="g-delete g-tip" title="usuń" element-id="' . $row[ $this -> values['id'] ] . '" url="' . $this -> values['actions']['delete_url'] . '" back-url="' . $this -> values['actions']['back_url'] . '">'
. '<i class="fa fa-trash fa-lg"></i>'
. '</a>'
. '</td>';
echo '</tr>';
}
else
echo '<tr><td colspan="' . $visible_columns . '" style="padding: 0;"><div class="alert alert-danger" style="margin: 0;">' . $this -> values['empty_txt'] . '</div></td></tr>';
if ( is_array( $this -> values['summary'] ) )
{
echo '<tr>';
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
{
echo '<td>';
if ( !empty( $this -> values['summary'][ $column['db'] ] ) )
echo '<div class="g-bold g-center">Σ: ' . $this -> values['summary'][ $column['db'] ] . '</div>';
echo '</td>';
}
echo '</tr>';
}
?>
</tbody>
</table>
</div>
<? if ( is_array( $this -> values['results'] ) and $this -> values['show_paging'] === true ):?>
<div class="row">
<? $ls = ceil( $this -> values['count'] / $this -> values['limit'] );?>
<div class="col col-xs-12 col-sm-6 text-centred-xs">
<ul id="g-pager" class="pagination pull-left-sm">
<? if ( $this -> values['cp'] > 1 ):?>
<li>
<a href='#' title="Przejdź do pierwszej strony" class="g-first" page="1">
<i class="fa fa-fast-backward"></i>
</a>
</li>
<li>
<a href='#' title="Przejdź do poprzedniej strony" class="g-previous" page="<?= $this -> values['cp'] - 1;?>">
<i class="fa fa-backward"></i>
</a>
</li>
<? else:?>
<li class="disabled">
<a href="#" title="Przejdź do pierwszej strony">
<i class="fa fa-fast-backward"></i>
</a>
</li>
<li class="disabled">
<a href="#" title="Przejdź do poprzedniej strony">
<i class="fa fa-backward"></i>
</a>
</li>
<? endif;?>
<? for ( $i = $this -> values['cp'] - 3; $i <= $this -> values['cp'] + 3; $i++ ):?>
<? if ( $i > 0 && $i <= $ls ):?>
<li class="<? if ( $i == $this -> values['cp'] ):?>active<? endif;?>
<?
if (
$i == $this -> values['cp'] - 2
or
$i == $this -> values['cp'] + 2
or
$i == $this -> values['cp'] + 3
or
$i == $this -> values['cp'] - 3
):?> hidden-xs<? endif;?>">
<a href="#" class="g-page" rel="prev" title="Przejdź do strony nr: <?= $i;?>" page="<?= $i;?>"><?= $i;?></a>
</li>
<? endif;?>
<? endfor;?>
<? if ( $this -> values['cp'] < $ls ):?>
<li>
<a href="#" title="Przejdź do następnej strony" class="g-next" page="<?= $this -> values['cp'] + 1;?>">
<i class="fa fa-forward"></i>
</a>
</li>
<li>
<a href="#" title="Przejdź do ostatniej strony" class="g-last" page="<?= $ls;?>">
<i class="fa fa-fast-forward"></i>
</a>
</li>
<? else:?>
<li class="disabled">
<a href="#" title="Przejdź do następnej strony">
<i class="fa fa-forward"></i>
</a>
</li>
<li class="disabled">
<a href="#" title="Przejdź do ostatniej strony">
<i class="fa fa-fast-forward"></i>
</a>
</li>
<? endif;?>
</ul>
</div>
<div class="col col-xs-12 col-sm-6 p20 text-right text-centred-xs pull-right-sm">
Wyświetlaj <select id="g-row-limit" class="form-control"><? if ( is_array( $this -> values['limits'] ) ): foreach ( $this -> values['limits'] as $key => $val ):?><option value="<?= $val;?>" <? if ( $this -> values['limit'] == $val ):?>selected="selected"<? endif;?>><?= $val;?></option><? endforeach; endif;?></select> rekordów
</div>
</div>
<? endif;?>
<script type="text/javascript">
jQuery( function()
{
context.attach( '#g-<?= $g_table;?> #g-list tbody tr', menu_context_<?= str_replace( '-', '_', $g_table );?> );
jQuery( '#g-<?= $g_table;?> #g-list .g-checkbox, #g-<?= $g_table;?> #g-list .g-radio' ).on( 'ifToggled', function()
{
var checkedVals = jQuery( '.g-checkbox:checked' ).map( function()
{
return this.value;
}).get();
if ( checkedVals != '' )
{
jQuery( '#g-<?= $g_table;?> #g-multidelete' ).show();
jQuery( '#g-<?= $g_table;?> .g-toggle' ).show();
}
else
{
jQuery( '#g-<?= $g_table;?> #g-multidelete' ).hide();
jQuery( '#g-<?= $g_table;?> .g-toggle' ).hide();
}
}).iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
jQuery( '#g-<?= $g_table;?> #g-list .g-checkbox-all' ).on( 'ifToggled', function()
{
jQuery( '#g-<?= $g_table;?> #g-list .g-checkbox' ).iCheck( 'toggle' );
}).iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
jQuery( '#g-<?= $g_table;?> #g-list #g-multidelete' ).hide();
});
</script>

View File

@@ -0,0 +1,155 @@
<div class="g-container" data="table:<?= $this -> values['id'];?>">
<?
if ( is_array( $this -> values['buttons'] ) )
{
echo '<div id="g-menu">';
foreach ( $this -> values['buttons'] as $button )
{
$button['url'] ? $url = $button['url'] : $url = '#';
$button['toggle'] ? $toggle = 'g-tooggle' : $toggle = '';
$button['toggle'] ? $display = 'display: none; ' : $toggle = '';
$button['bgcolor'] ? $background = 'background: ' . $button['bgcolor'] : $background = '';
echo '<a href="' . $url . '" ' .
'class="' . $toggle . '" ';
if ( $button['js'] )
echo 'onclick="' . htmlspecialchars( $button['js'] ) . ' return false;" ';
echo 'style="' . $display . $background . '" ' .
'> ' .
'<i class="fa ' . $button['icon'] . '"></i><p>' . $button['label'] . '</p>' .
'</a>';
}
echo '<div class="g-clear"></div>';
echo '</div>';
}
?>
<div class="g-form-edit">
<div class="g-title">
<i class="fa fa-bars fa-lg"></i>
<p><?= $this -> values['title'];?></p>
<a href="#" class="g-collapse">
<i class="fa fa-chevron-up"></i>
</a>
</div>
<div class="g-content">
<form id="<?= $this -> values['id'];?>" action="<?= gdir;?>/upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="gtable" value="<?= $this -> values['id'];?>">
<?
if ( is_array( $this -> values['fields'] ) ) foreach ( $this -> values['fields'] as $field )
{
if ( $field['type'] == 'hidden' )
{
?>
<input type="hidden" name="<?= $field['db'];?>" id="<?= $field['db'];?>" <? if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ): echo $key . '="' . $val . '"'; endforeach; endif;?> value="<?= htmlspecialchars( $field['value'] );?>" />
<?
}
else
{
echo '<div class="g-form-data">';
echo '<label for="' . $field['db'] . '">' . $field['name']; if ( $field['name'] ) echo ':'; echo '</label>';
if ( $field['type'] == 'text' )
{
?>
<input type="text" name="<?= $field['db'];?>" id="<?= $field['db'];?>" <? if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ): echo $key . '="' . $val . '"'; endforeach; endif;?> value="<?= htmlspecialchars( $field['value'] );?>" />
<?
}
else if ( $field['type'] == 'textarea' )
{
?>
<textarea name="<?= $field['db'];?>" id="<?= $field['db'];?>" <? if ( is_array( $field['params'] ) ): foreach( $field['params'] as $key => $val ): echo $key . '="' . $val . '"'; endforeach; endif;?>><?= $field['value'];?></textarea>
<?
}
echo '</div>';
}
}
?>
<div class="g-form-data">
<label>Plik:</label>
<input type="file" name="file">
</div>
<div class="g-form-data">
<a href="#" class="g-button-form" onclick="$( '#<?= $this -> values['id'];?>' ).submit();">wyślij</a>
</div>
<div class="g-form-data">
<label></label>
<div class="g-progress" style="margin-left: 150px; display: none;">
<div class="g-progress-bar">
<span class="g-progress-percent">0%</span>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript">
var dir = '<?= gdir;?>';
</script>
<? if ( $this -> values['include_plugins'] ):?>
<!-- fontawsome -->
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/plugins/font-awesome-4.2.0/css/font-awesome.min.css" />
<!-- iradio -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/icheck/skins/minimal/minimal.css' />
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/icheck/skins/minimal/blue.css' />
<script type="text/javascript" src="<?= gdir;?>/plugins/icheck/icheck.min.js"></script>
<!-- ipromptu -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/impromptu/jquery-impromptu.min.css' />
<script type='text/javascript' src='<?= gdir;?>/plugins/impromptu/jquery-impromptu.js'></script>
<!-- tooltip -->
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/tooltipster-master/css/tooltipster.css' />
<link rel='stylesheet' type='text/css' href='<?= gdir;?>/plugins/tooltipster-master/css/themes/tooltipster-punk.css' />
<script type='text/javascript' src='<?= gdir;?>/plugins/tooltipster-master/js/jquery.tooltipster.js'></script>
<!-- grid -->
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/css/grid.css" />
<script type="text/javascript" src="<?= gdir;?>/js/grid.js"></script>
<? endif;?>
<script type="text/javascript" src="<?= gdir;?>/plugins/jquery-form/jquery.form.js"></script>
<script type="text/javascript">
jQuery(function() {
var options = {
beforeSend: function()
{
jQuery( ".g-progress" ).show();
jQuery( ".g-progress .g-progress-bar" ).width( '0%' );
jQuery( ".g-progress .g-progress-bar .g-progress-percent" ).html( "0%" );
},
uploadProgress: function( event, position, total, percentComplete )
{
jQuery( ".g-progress .g-progress-bar" ).width( percentComplete + '%' );
jQuery( ".g-progress .g-progress-bar .g-progress-percent" ).html( percentComplete + '%' );
},
success: function()
{
jQuery( ".g-progress .g-progress-bar" ).width( '100%' );
jQuery( ".g-progress .g-progress-bar .g-progress-percent" ).html( '100%' );
},
complete: function( data )
{
response = jQuery.parseJSON( data.responseText );
if ( response.status === 'ok' )
{
if ( response.msg )
var msg = response.msg;
else
var msg = 'Plik został wysłany na serwer.';
create_message( msg );
<?
if ( $this -> values['after_send_js'] )
echo $this -> values['after_send_js'] . '( response.file );';
?>
}
else
{
if ( response.msg )
var msg = response.msg;
else
var msg = "Przepraszamy. Podczas wysyłania pliku wystąpił błąd. Prosimy spróbować ponownie.";
create_error( msg );
}
}
};
jQuery( "#<?= $this -> values['id'];?>" ).ajaxForm( options );
});
</script>