first commit
This commit is contained in:
180
admin/templates/banners/banner-edit.php
Normal file
180
admin/templates/banners/banner-edit.php
Normal file
@@ -0,0 +1,180 @@
|
||||
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
|
||||
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
|
||||
<?
|
||||
\S::set_session( 'admin', true );
|
||||
global $db;
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div id="settings-tabs">
|
||||
<ul class="resp-tabs-list settings-tabs">
|
||||
<li><i class="fa fa-wrench"></i>Ustawienia</li>
|
||||
<li><i class="fa fa-file"></i>Zawartość</li>
|
||||
</ul>
|
||||
<div class="resp-tabs-container settings-tabs">
|
||||
<div>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'label' => 'Nazwa',
|
||||
'name' => 'name',
|
||||
'id' => 'name',
|
||||
'value' => $this -> banner['name'],
|
||||
'class' => 'require'
|
||||
) );
|
||||
?>
|
||||
<?= \Html::input_switch(
|
||||
array(
|
||||
'label' => 'Aktywny',
|
||||
'name' => 'status',
|
||||
'checked' => $this -> banner['status'] == 1 or ! $this -> banner['id'] ? true : false
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?= Html::input(
|
||||
array(
|
||||
'label' => 'Data rozpoczęcia',
|
||||
'name' => 'date_start',
|
||||
'id' => 'date_start',
|
||||
'value' => $this -> banner['date_start'],
|
||||
'class' => 'date'
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'label' => 'Data zakończenia',
|
||||
'name' => 'date_end',
|
||||
'id' => 'date_end',
|
||||
'value' => $this -> banner['date_end'],
|
||||
'class' => 'date'
|
||||
) );
|
||||
?>
|
||||
<?= \Html::input_switch(
|
||||
array(
|
||||
'label' => 'Slajder / Strona główna',
|
||||
'name' => 'home_page',
|
||||
'checked' => $this -> banner['home_page'] == 1 ? true : false
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div>
|
||||
<div id="languages-main">
|
||||
<ul class="resp-tabs-list languages-main htabs">
|
||||
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
||||
<? if ( $lg['status'] ):?>
|
||||
<li><?= $lg['name'];?></a></li>
|
||||
<? endif;?>
|
||||
<? endforeach;
|
||||
endif;?>
|
||||
</ul>
|
||||
<div class="resp-tabs-container languages-main">
|
||||
<? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
|
||||
<? if ( $lg['status'] ):?>
|
||||
<div>
|
||||
<?= \Html::input_icon(
|
||||
array(
|
||||
'label' => 'Obraz',
|
||||
'name' => 'src[' . $lg['id'] . ']',
|
||||
'id' => 'src_' . $lg['id'],
|
||||
'value' => $this -> banner['languages'][ $lg['id'] ]['src'],
|
||||
'icon_content' => 'przeglądaj',
|
||||
'icon_js' => "window.open ( 'http://" . $_SERVER['SERVER_NAME'] . "/libraries/filemanager-9.14.1/dialog.php?type=1&popup=1&field_id=src_" . $lg['id'] . "&akey=c3cb2537d25c0efc9e573d059d79c3b8', 'mywindow', 'location=1,status=1,scrollbars=1, width=1100,height=700');"
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'label' => 'Url',
|
||||
'name' => 'url[' . $lg['id'] . ']',
|
||||
'id' => 'url_' . $lg['id'],
|
||||
'value' => $this -> banner['languages'][ $lg['id'] ]['url']
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?= \Html::textarea(
|
||||
array(
|
||||
'label' => 'Kod html',
|
||||
'name' => 'html[' . $lg['id'] . ']',
|
||||
'id' => 'html_' . $lg['id'],
|
||||
'value' => $this -> banner['languages'][$lg['id']]['html']
|
||||
)
|
||||
);
|
||||
?>
|
||||
<?= \Html::textarea(
|
||||
array(
|
||||
'label' => 'Treść',
|
||||
'name' => 'text[' . $lg['id'] . ']',
|
||||
'id' => 'text_' . $lg['id'],
|
||||
'value' => $this -> banner['languages'][$lg['id']]['text']
|
||||
)
|
||||
);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#text_<?= $lg['id'];?>').ckeditor({
|
||||
toolbar: 'MyTool',
|
||||
height: '300'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
$out = ob_get_clean();
|
||||
|
||||
$grid = new \gridEdit;
|
||||
$grid -> id = 'banner-edit';
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> include_plugins = true;
|
||||
$grid -> title = 'Edycja baneru';
|
||||
$grid -> fields = [
|
||||
[
|
||||
'db' => 'id',
|
||||
'type' => 'hidden',
|
||||
'value' => $this -> banner['id']
|
||||
]
|
||||
];
|
||||
$grid -> external_code = $out;
|
||||
$grid -> actions = [
|
||||
'save' => [ 'url' => '/admin/banners/banner_save/', 'back_url' => '/admin/banners/view_list/' ],
|
||||
'cancel' => [ 'url' => '/admin/banners/view_list/' ]
|
||||
];
|
||||
$grid -> persist_edit = true;
|
||||
$grid -> id_param = 'id';
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(function ()
|
||||
{
|
||||
disable_menu();
|
||||
|
||||
$('input[type="text"].date').datetimepicker({
|
||||
format: "YYYY-MM-DD",
|
||||
pickTime: false
|
||||
});
|
||||
|
||||
$( '#settings-tabs' ).easyResponsiveTabs({
|
||||
width: 'auto',
|
||||
fit: true,
|
||||
tabidentify: 'settings-tabs',
|
||||
type: 'vertical'
|
||||
});
|
||||
|
||||
$('#languages-main').easyResponsiveTabs({
|
||||
width: 'auto',
|
||||
fit: true,
|
||||
tabidentify: 'languages-main'
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>
|
||||
78
admin/templates/banners/banners-list.php
Normal file
78
admin/templates/banners/banners-list.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
global $gdb;
|
||||
|
||||
$grid = new \grid( 'pp_banners' );
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
|
||||
$grid -> search = [
|
||||
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
|
||||
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
|
||||
];
|
||||
$grid -> columns_view = [
|
||||
[
|
||||
'name' => 'Lp.',
|
||||
'th' => [ 'class' => 'g-lp' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'autoincrement' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Nazwa',
|
||||
'db' => 'name',
|
||||
'php' => 'echo "<a href=\'/admin/banners/banner_edit/id=[id]\'>[name]</a>";',
|
||||
'sort' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Aktywny',
|
||||
'db' => 'status',
|
||||
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
],
|
||||
[
|
||||
'name' => 'Strona główna',
|
||||
'db' => 'home_page',
|
||||
'replace' => [ 'array' => [ 0 => 'nie', 1 => '<span class="text-system">tak</span>' ] ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
],
|
||||
[
|
||||
'name' => 'Slajder',
|
||||
'db' => 'home_page',
|
||||
'replace' => [ 'array' => [ 1 => 'nie', 0 => '<span class="text-system">tak</span>' ] ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
],
|
||||
[
|
||||
'name' => 'Data rozpoczęcia',
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'php' => 'if ( "[date_start]" ) echo date( "Y-m-d", strtotime( "[date_start]" ) ); else echo "-";'
|
||||
],
|
||||
[
|
||||
'name' => 'Data zakończenia',
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'php' => 'if ( "[date_end]" ) echo date( "Y-m-d", strtotime( "[date_end]" ) ); else echo "-";'
|
||||
],
|
||||
[
|
||||
'name' => 'Edytuj',
|
||||
'action' => [ 'type' => 'edit', 'url' => '/admin/banners/banner_edit/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
],
|
||||
[
|
||||
'name' => 'Usuń',
|
||||
'action' => [ 'type' => 'delete', 'url' => '/admin/banners/banner_delete/id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
||||
'td' => [ 'class' => 'g-center' ]
|
||||
]
|
||||
];
|
||||
$grid -> buttons = [
|
||||
[
|
||||
'label' => 'Dodaj baner',
|
||||
'url' => '/admin/banners/banner_edit/',
|
||||
'icon' => 'fa-plus-circle',
|
||||
'class' => 'btn-success'
|
||||
]
|
||||
];
|
||||
echo $grid -> draw();
|
||||
Reference in New Issue
Block a user