first commit

This commit is contained in:
2024-11-11 15:28:20 +01:00
commit 3f5649dbc7
6231 changed files with 999089 additions and 0 deletions

View File

@@ -0,0 +1,468 @@
<?
global $db, $settings;
ob_start();
?>
<div class="logo">
<? if ( file_exists( '../' . \front\factory\GlobelusFirms::logo_url( $this -> firm['id'] ) ) ):?>
<img src="/logo/<?= $this -> firm['id'];?>/<?= \S::get_token();?>">
<? else:?>
<img src="/images/no-logo.jpg">
<? endif;?>
</div>
<div class="row mb15">
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::select(
array(
'label' => 'Profil aktywny',
'class' => 'form-edit',
'id' => 'status',
'values' => [ 0 => 'nie', 1 => 'tak' ],
'value' => $this -> firm['status'],
'params' => [ 'table' => 'globelus_users', 'column_id' => 'id', 'row_id' => $this -> firm['id'], 'column' => 'status', 'operation' => 'update' ]
)
);?>
</div>
<div class="col-xs-12 col-md-6">
<?= \Html::select(
array(
'label' => 'Widoczny na liście',
'class' => 'form-edit',
'id' => 'firm_list',
'values' => [ 0 => 'nie', 1 => 'tak' ],
'value' => $this -> firm['firm_list'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'firm_list', 'operation' => 'update' ]
)
);?>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::input( [
'type' => 'text',
'class' => 'form-edit',
'label' => 'Liczba punktów',
'id' => 'points',
'value' => $this -> firm['points'],
'params' => [ 'table' => 'globelus_users', 'column_id' => 'id', 'row_id' => $this -> firm['id'], 'column' => 'points', 'operation' => 'update' ]
]
);?>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::input( [
'type' => 'text',
'class' => 'form-edit date',
'label' => 'Dostęp do bazy CV do',
'id' => 'cv_access_date',
'value' => $this -> firm['cv_access_date'],
'params' => [ 'table' => 'globelus_users', 'column_id' => 'id', 'row_id' => $this -> firm['id'], 'column' => 'cv_access_date', 'operation' => 'update' ]
]
);?>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="col-lg-2 control-label">Przypisane branże:</label>
<div class="col-lg-8">
<div class="row">
<?
$categories[0] = '--- brak przypisanej kategorii ---';
if ( is_array( $this -> categories ) and count( $this -> categories ) ): foreach ( $this -> categories as $category ):
echo '<div class="col-xs-4">';
echo '<input type="checkbox" class="form-edit" table="globelus_firms_categories" operation="insert_delete" column_id="id" row_id="null" values="user_id;' . $this -> firm['id'] . '|category_id;' . $category['id'] . '" value="' . $category['id'] . '"'; if ( in_array( $category['id'], $this -> firm['categories'] ) ) echo ' checked="checked"'; echo '> ';
echo $category['name'];
echo '</div>';
endforeach; endif;
?>
</div>
</div>
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Nazwa firmy',
'id' => 'firm_name',
'value' => $this -> firm['firm_name'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'firm_name', 'operation' => 'update' ]
)
);?>
</div>
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Nazwa firmy (wyświetlana)',
'id' => 'firm_name_profile',
'value' => $this -> firm['firm_name_profile'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'firm_name_profile', 'operation' => 'update' ]
)
);?>
</div>
</div>
<div class='row'>
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'NIP',
'id' => 'nip_vat',
'value' => $this -> firm['nip_vat'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'nip_vat', 'operation' => 'update' ]
)
);?>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Telefon',
'id' => 'phone',
'value' => $this -> firm['phone'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'phone', 'operation' => 'update' ]
)
);?>
</div>
<div class="col-xs-12 col-md-6">
<?= \Html::form_text(
array(
'label' => 'Adres email',
'id' => 'email',
'text' => $this -> firm['email']
)
);?>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Strona www',
'id' => 'www',
'value' => $this -> firm['www'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'www', 'operation' => 'update' ]
)
);?>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<?
$countries[0] = '--- brak przypisanego kraju ---';
if ( is_array( $this -> countries ) and count( $this -> countries ) ): foreach ( $this -> countries as $country ):
$countries[ $country['id'] ] = $country['name'];
endforeach; endif;
?>
<?= \Html::select(
array(
'label' => 'Kraj',
'class' => 'form-edit',
'id' => 'country_id',
'values' => $countries,
'value' => $this -> firm['country_id'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'country_id', 'operation' => 'update' ]
)
);?>
</div>
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Region',
'id' => 'region',
'value' => $this -> firm['region'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'region', 'operation' => 'update' ]
)
);?>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Miasto',
'id' => 'city',
'value' => $this -> firm['city'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'city', 'operation' => 'update' ]
)
);?>
</div>
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Kod pocztowy',
'id' => 'postal_code',
'value' => $this -> firm['postal_code'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'postal_code', 'operation' => 'update' ]
)
);?>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Ulica',
'id' => 'street',
'value' => $this -> firm['street'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'street', 'operation' => 'update' ]
)
);?>
</div>
<div class="col-xs-12 col-md-6">
<?= \Html::input(
array(
'type' => 'text',
'class' => 'form-edit',
'label' => 'Nr budynku/lokalu',
'id' => 'apartment_number',
'value' => $this -> firm['apartment_number'],
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'apartment_number', 'operation' => 'update' ]
)
);?>
</div>
</div>
<hr />
<?= \Html::textarea(
array(
'label' => 'Krótki opis firmy',
'class' => 'form-edit',
'name' => 'other_information',
'id' => 'other_information',
'value' => $this -> firm['other_information'],
'inline' => true,
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'other_information', 'operation' => 'update' ]
)
);?>
<hr />
<?= \Html::textarea(
array(
'label' => 'Klauzula',
'class' => 'form-edit',
'name' => 'clauses',
'id' => 'clauses',
'value' => $this -> firm['clauses'],
'inline' => true,
'params' => [ 'table' => 'globelus_firms_data', 'column_id' => 'user_id', 'row_id' => $this -> firm['id'], 'column' => 'clauses', 'operation' => 'update' ]
)
);?>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'candidate-preview';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Podgląd pracodawcy';
$grid -> actions = [
'cancel' => [ 'url' => '/admin/globelus_firms/main_view/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
?>
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
var old_data = [];
$( function()
{
$( '#other_information, #clauses' ).ckeditor( {
toolbar : 'MyTool',
height:'350'
});
var editor = $( '#clauses' ).ckeditor().editor;
editor.on( 'blur', function( evt ) {
var text = evt.editor.getData();
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/globelus/save_to_db/',
data:
{
table: 'globelus_firms_data',
column_id: 'user_id',
row_id: '<?= $this -> firm['id'];?>',
column: 'clauses',
operation: 'update',
value: text
},
beforeSend: function()
{
},
success: function( data )
{
}
});
});
var editor = $('#other_information').ckeditorGet();
editor.on( 'blur', function( evt ) {
var text = evt.editor.getData();
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/globelus/save_to_db/',
data:
{
table: 'globelus_firms_data',
column_id: 'user_id',
row_id: '<?= $this -> firm['id'];?>',
column: 'other_information',
operation: 'update',
value: text
},
beforeSend: function()
{
},
success: function( data )
{
}
});
});
$( 'body' ).on( 'focus', '.form-edit', function()
{
old_data[ $( this ).attr( 'name' ) ] = $( this ).val();
});
$( 'body' ).on( 'change', '.form-edit', function()
{
var input = $( this );
var table = $( this ).attr( 'table' );
var column_id = $( this ).attr( 'column_id' );
var row_id = $( this ).attr( 'row_id' );
var column = $( this ).attr( 'column' );
var operation = $( this ).attr( 'operation' );
var value = $( this ).val();
var values = $( this ).attr( 'values' );
if ( input.attr( 'type' ) === 'checkbox' )
{
if ( !input.is( ':checked' ) )
value = null;
}
$.ajax(
{
type: 'POST',
cache: false,
url: '/admin/globelus/save_to_db/',
data:
{
table: table,
column_id: column_id,
row_id: row_id,
column: column,
operation: operation,
value: value,
values: values
},
beforeSend: function()
{
input.attr( 'readonly', 'readonly' );
},
success: function( data )
{
input.removeAttr( 'readonly' );
response = jQuery.parseJSON( data );
if ( response.status !== 'ok' )
{
if ( input.attr( 'type' ) === 'checkbox' )
{
if ( input.is( ':checked' ) === false )
input.prop( 'checked', true );
else
input.prop( 'checked', false );
}
else
input.val( old_data[ input.attr( 'name' ) ] );
}
}
});
});
$( 'body' ).on( 'click', '.status', function()
{
$.prompt( 'Na pewno chcesz aktywować wybrany profil?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v === true )
{
document.location.href="/admin/globelus_firms/firm_enabled/id=<?= $this -> firm['id'];?>";
}
},
buttons: {
'tak': true,
'nie': false
},
focus: 0
});
});
});
</script>
<style type="text/css">
hr {
margin: 10px 0;
}
#g-edit-save {
display: none;
}
.g-container .panel-body {
position: relative;
}
.logo {
height: 150px;
width: 150px;
float: right;
padding: 3px;
background: #FFF;
box-shadow: 0px 10px 25px 0px rgba(0, 0, 0, 0.2 );
}
.logo img {
width: 100%;
height: 100%;
object-fit: contain;
}
</style>

View File

@@ -0,0 +1,153 @@
<?php
global $gdb;
$grid = new \grid( 'globelus_firms' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'gu.id, firm_name, phone, email, nip_vat, status, register_date, firm_list, hash, gu.points, cv_access, '
. '(SELECT COUNT(0) FROM globelus_adverts AS ga WHERE ga.user_id = gu.id AND visible = 1 ) AS visible_adverts, '
. '(SELECT COUNT(0) FROM globelus_adverts AS ga WHERE ga.user_id = gu.id AND visible = 0 ) AS invisible_adverts '
. 'FROM '
. 'globelus_users AS gu '
. 'LEFT JOIN globelus_firms_data AS gfd ON gfd.user_id = gu.id '
. 'WHERE '
. 'type = 1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'gu.id, firm_name, phone, email, nip_vat, status, register_date, firm_list, hash, gu.points, cv_access, '
. '(SELECT COUNT(0) FROM globelus_adverts AS ga WHERE ga.user_id = gu.id AND visible = 1 ) AS visible_adverts, '
. '(SELECT COUNT(0) FROM globelus_adverts AS ga WHERE ga.user_id = gu.id AND visible = 0 ) AS invisible_adverts '
. 'FROM '
. 'globelus_users AS gu '
. 'LEFT JOIN globelus_firms_data AS gfd ON gfd.user_id = gu.id '
. 'WHERE '
. 'type = 1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'firm_name', 'type' => 'ASC' ];
$grid -> search = [
[ 'name' => 'Nazwa', 'db' => 'firm_name', 'type' => 'text' ],
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Na liście', 'db' => 'firm_list', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Telefon', 'db' => 'phone', 'type' => 'text' ],
[ 'name' => 'Email', 'db' => 'email', 'type' => 'text' ],
[ 'name' => 'NIP', 'db' => 'nip', 'type' => 'text' ],
[ 'name' => 'Data rejestracji', 'db' => 'register_date', 'type' => 'date_range' ],
[ 'name' => 'Dostęp do CV', 'db' => 'cv_access', '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' => 'firm_name',
'sort' => true
],
[
'name' => 'Email',
'db' => 'email'
],
[
'name' => 'Telefon',
'db' => 'phone',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center' ]
],
[
'name' => 'Aktywny',
'db' => 'status',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
'sort' => true
],
[
'name' => 'Na liście',
'db' => 'firm_list',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
'sort' => true
],
[
'name' => 'Data rejestracji',
'db' => 'register_date',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'php' => 'echo date( "Y-m-d", strtotime( "[register_date]" ) );',
'sort' => true
],
[
'name' => 'Aktywny do',
'db' => 'active_to',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
'sort' => true
],
[
'name' => 'Odświeżono',
'db' => 'last_refresh',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
],
[
'name' => 'Ogłoszenia aktywne',
'db' => 'visible_adverts',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
'sort' => true
],
[
'name' => 'Ogłoszenia nieaktywne',
'db' => 'invisible_adverts',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
'sort' => true
],
[
'name' => 'Punkty',
'db' => 'points',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 75px;' ],
'sort' => true
], [
'name' => 'Dostęp do CV',
'db' => 'cv_access',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 125px;' ],
'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ],
],
[
'name' => 'Akcja',
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
'content' => '<a href="/admin/globelus_firms/firm_preview/id=[id]">podgląd</a>'
],
[
'name' => 'Akcja',
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
'content' => '<a href="/login-as/[hash]" target="_blank">zaloguj jako</a>'
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/globelus_firms/firm_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
echo $grid -> draw();

View File

@@ -0,0 +1,94 @@
<?php
global $gdb;
$grid = new \grid( 'globelus_orders' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'go.id, go.date_order, go.points, go.price, gfd.firm_name, gfd.nip_vat, gfd.street, gfd.postal_code, gfd.apartment_number, gfd.city, gu.email, fvat '
. 'FROM '
. 'globelus_orders AS go '
. 'LEFT JOIN globelus_firms_data AS gfd ON gfd.user_id = go.user_id '
. 'LEFT JOIN globelus_users AS gu ON gu.id = go.user_id '
. 'WHERE '
. 'go.status = 1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'go.id, go.date_order, go.points, go.price, gfd.firm_name, gfd.nip_vat, gfd.street, gfd.postal_code, gfd.apartment_number, gfd.city, gu.email, fvat '
. 'FROM '
. 'globelus_orders AS go '
. 'LEFT JOIN globelus_firms_data AS gfd ON gfd.user_id = go.user_id '
. 'LEFT JOIN globelus_users AS gu ON gu.id = go.user_id '
. 'WHERE '
. 'go.status = 1 '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'date_order', 'type' => 'DESC' ];
$grid -> search = [
[ 'name' => 'Firma', 'db' => 'firm_name', 'type' => 'text' ],
[ 'name' => 'Faktura', 'db' => 'fvat', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Data zamówienia',
'db' => 'date_order',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_order]" ) );',
'sort' => true
], [
'name' => 'Punkty',
'db' => 'points',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ]
], [
'name' => 'Cena',
'db' => 'price',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
'php' => 'echo "[price] zł";'
], [
'name' => 'Firma',
'db' => 'firm_name'
], [
'name' => 'Email',
'db' => 'email',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center' ]
], [
'name' => 'NIP',
'db' => 'nip_vat'
], [
'name' => 'Adres',
'php' => 'echo "[postal_code] [city], [street] [apartment_number]";'
], [
'name' => 'Faktura',
'db' => 'fvat',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center fvat', 'style' => 'cursor: pointer;' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
]
];
echo $grid -> draw();
?>
<script type="text/javascript">
jQuery( 'body' ).on( 'click', '.fvat', function()
{
document.location.href = '/admin/globelus_firms/order_fvat_switch/order-id=' + jQuery( this ).parent( 'tr' ).attr( 'id' );
});
</script>

View File

@@ -0,0 +1,159 @@
<?php
global $gdb;
$grid = new \grid( 'globelus_points_history' );
$grid -> gdb_opt = $gdb;
$grid -> sql = 'SELECT *'
. 'FROM ( '
. 'SELECT '
. 'gph.date_event, gph.points, gph.event_type, gfd.firm_name, gfd.nip_vat, gfd.street, gfd.postal_code, gfd.apartment_number, gfd.city, gu.email '
. 'FROM '
. 'globelus_points_history AS gph '
. 'LEFT JOIN globelus_firms_data AS gfd ON gfd.user_id = gph.user_id '
. 'LEFT JOIN globelus_users AS gu ON gu.id = gph.user_id '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) FROM ( '
. 'SELECT '
. 'gph.date_event, gph.points, gph.event_type, gfd.firm_name, gfd.nip_vat, gfd.street, gfd.postal_code, gfd.apartment_number, gfd.city, gu.email '
. 'FROM '
. 'globelus_points_history AS gph '
. 'LEFT JOIN globelus_firms_data AS gfd ON gfd.user_id = gph.user_id '
. 'LEFT JOIN globelus_users AS gu ON gu.id = gph.user_id '
. ') AS q1 '
. 'WHERE '
. '1=1 [where] ';
$grid -> debug = true;
$grid -> order = [ 'column' => 'date_event', 'type' => 'DESC' ];
$grid -> search = [
[
'name' => 'Typ wydarzenia',
'db' => 'event_type',
'type' => 'select',
'replace' => [
'array' => [
1 => 'wyróżnienie ogłoszenia',
2 => 'polecenie ogłoszenia',
3 => 'odświeżenie ogłoszenia',
4 => 'dodanie ogłoszenia',
5 => 'dostęp do bazy kandydatów',
6 => 'dodatkowa promocja ogłoszenia'
]
]
], [
'name' => 'Nazwa firmy',
'db' => 'firm_name',
'type' => 'text'
]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Data wydarzenia',
'db' => 'date_event',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
'php' => 'echo date( "Y-m-d H:i", strtotime( "[date_event]" ) );',
'sort' => true
], [
'name' => 'Punkty',
'db' => 'points',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ]
], [
'name' => 'Typ wydarzenia',
'db' => 'event_type',
'replace' => [
'array' => [
1 => 'wyróżnienie ogłoszenia',
2 => 'polecenie ogłoszenia',
3 => 'odświeżenie ogłoszenia',
4 => 'dodanie ogłoszenia',
5 => 'dostęp do bazy kandydatów',
6 => 'dodatkowa promocja ogłoszenia'
]
],
], [
'name' => 'Firma',
'db' => 'firm_name'
], [
'name' => 'Email',
'db' => 'email',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center' ]
], [
'name' => 'NIP',
'db' => 'nip_vat'
], [
'name' => 'Adres',
'php' => 'echo "[postal_code] [city], [street] [apartment_number]";'
]
// [
// 'name' => 'Aktywny',
// 'db' => 'status',
// 'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
// 'td' => [ 'class' => 'g-center' ],
// 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
// 'sort' => true
// ],
// [
// 'name' => 'Na liście',
// 'db' => 'firm_list',
// 'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
// 'td' => [ 'class' => 'g-center' ],
// 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
// 'sort' => true
// ],
// [
// 'name' => 'Aktywny do',
// 'db' => 'active_to',
// 'td' => [ 'class' => 'g-center' ],
// 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
// 'sort' => true
// ],
// [
// 'name' => 'Odświeżono',
// 'db' => 'last_refresh',
// 'td' => [ 'class' => 'g-center' ],
// 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ],
// ],
// [
// 'name' => 'Ogłoszenia aktywne',
// 'db' => 'visible_adverts',
// 'td' => [ 'class' => 'g-center' ],
// 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ]
// ],
// [
// 'name' => 'Ogłoszenia nieaktywne',
// 'db' => 'invisible_adverts',
// 'td' => [ 'class' => 'g-center' ],
// 'th' => [ 'class' => 'g-center', 'style' => 'width: 120px;' ]
// ],
// [
// 'name' => 'Akcja',
// 'th' => [ 'class' => 'g-center' ],
// 'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ],
// 'content' => '<a href="/admin/globelus_firms/firm_preview/id=[id]">podgląd</a>'
// ],
// [
// 'name' => 'Akcja',
// 'th' => [ 'class' => 'g-center' ],
// 'td' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
// 'content' => '<a href="/login-as/[hash]" target="_blank">zaloguj jako</a>'
// ],
// [
// 'name' => 'Usuń',
// 'action' => [ 'type' => 'delete', 'url' => '/admin/globelus_firms/firm_delete/id=[id]' ],
// 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
// 'td' => [ 'class' => 'g-center' ]
// ]
];
echo $grid -> draw();