first commit
This commit is contained in:
14
templates/ranker/checker.php
Normal file
14
templates/ranker/checker.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<div class="browse">
|
||||
<div class="edit-row">
|
||||
<div class='header' id='header'>
|
||||
Trwa sprawdzanie pozycji: - pozostało:
|
||||
<p id='count_sites'>x</p>
|
||||
</div>
|
||||
<div id='site_content'></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function(){
|
||||
xajax_rankerCheckery();
|
||||
});
|
||||
</script>
|
||||
101
templates/ranker/client-edit.php
Normal file
101
templates/ranker/client-edit.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<div class="panel panel-info panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Edycja klienta: <u><?= $this -> _client['login'];?></u></span>
|
||||
</div>
|
||||
<div class="panel-heading p5" style="height: auto;">
|
||||
<div class="row mb10 pl5">
|
||||
<div class="col col-xs-12">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-success',
|
||||
'text' => 'Zatwierdź',
|
||||
'js' => 'checkForm( "formularz" );',
|
||||
'icon' => 'fa-check-circle mr5'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-danger',
|
||||
'text' => 'Anuluj',
|
||||
'url' => '/?p=ranker_clients',
|
||||
'icon' => 'fa-times mr5'
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<form method="POST" action="/?p=ranker_clients" id="formularz" class="form-horizontal">
|
||||
<? if ( $this -> _client ):?>
|
||||
<input type='hidden' name='rw' value='save' />
|
||||
<input type='hidden' id="idk" name='client_id' value='<?= $this -> _client['id'];?>' />
|
||||
<? else:?>
|
||||
<input type='hidden' name='rw' value='add_new' />
|
||||
<input type='hidden' name='check' value='<?= mktime();?>' />
|
||||
<? endif;?>
|
||||
<div class="row">
|
||||
<div class="col col-md-6">
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'login',
|
||||
'class' => 'require',
|
||||
'value' => $this -> _client['login'],
|
||||
'label' => 'Login'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'password',
|
||||
'label' => 'Hasło'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input_switch(
|
||||
array(
|
||||
'name' => 'enabled',
|
||||
'label' => 'Aktywny',
|
||||
'checked' => $this -> _client['enabled'] ? true : false,
|
||||
'values' => [
|
||||
'0' => 'nie',
|
||||
'1' => 'tak'
|
||||
]
|
||||
)
|
||||
);?>
|
||||
<?= \Html::select(
|
||||
array(
|
||||
'name' => 'type',
|
||||
'value' => $this -> _client['type'],
|
||||
'label' => 'Typ',
|
||||
'values' => [
|
||||
'0' => 'klient',
|
||||
'1' => 'reseller',
|
||||
'2' => 'pracownik'
|
||||
]
|
||||
)
|
||||
);?>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-4 control-label">Strony:</label>
|
||||
<div class="col-lg-8">
|
||||
<div class="row">
|
||||
<? if ( is_array( $this -> _sites ) ): foreach ( $this -> _sites as $site ):?>
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<div class="checkbox-custom fill checkbox-primary mt10">
|
||||
<input id="site_<?= $site['id'];?>" type="checkbox" value="<?= $site['id'];?>" name="sites[]" <? if ( in_array( $site['id'], $this -> _client['sites'] ) ):?>checked="checked"<? endif;?> />
|
||||
<label for="site_<?= $site['id'];?>"><?= $site['name'];?></label>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
$( function()
|
||||
{
|
||||
disable_menu();
|
||||
});
|
||||
</script>
|
||||
120
templates/ranker/client-list.php
Normal file
120
templates/ranker/client-list.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<? global $config, $gdb, $mdb, $user;?>
|
||||
<div class="panel panel-info panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Lista klientów</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?
|
||||
$grid = new \grid( 'pro_rr_clients', 'reseller-clients' );
|
||||
$grid -> sql = 'SELECT '
|
||||
. 'id, login, enabled, last_logged, type '
|
||||
. 'FROM '
|
||||
. 'pro_rr_clients AS prc '
|
||||
. '[where] '
|
||||
. 'ORDER BY '
|
||||
. '[order_p1] [order_p2]';
|
||||
$grid -> sql_count = 'SELECT '
|
||||
. 'COUNT(0) '
|
||||
. 'FROM '
|
||||
. 'pro_rr_clients '
|
||||
. '[where] ';
|
||||
$grid -> debug = true;
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> search = [
|
||||
[ 'name' => 'Login', 'db' => 'login', 'type' => 'text' ]
|
||||
];
|
||||
$grid -> order = [ 'column' => 'last_logged', 'type' => 'DESC' ];
|
||||
$grid -> columns_view = [
|
||||
[
|
||||
'name' => 'Lp.',
|
||||
'th' => [ 'class' => 'g-lp' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'autoincrement' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Ost. logowanie',
|
||||
'db' => 'last_logged',
|
||||
'th' => [ 'style' => 'width: 120px; text-align: center;' ],
|
||||
'td' => [ 'style' => 'text-align: center;' ],
|
||||
'date_mod' => 'Y-m-d H:i',
|
||||
'sort' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Login',
|
||||
'db' => 'login',
|
||||
'sort' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Typ',
|
||||
'th' => [ 'style' => 'width: 120px; text-align: center;' ],
|
||||
'td' => [ 'style' => 'text-align: center;' ],
|
||||
'db' => 'type',
|
||||
'replace' => [
|
||||
'array' => [
|
||||
0 => 'klient',
|
||||
1 => 'reseller',
|
||||
2 => 'pracownik'
|
||||
]
|
||||
],
|
||||
'sort' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Aktywny',
|
||||
'th' => [ 'style' => 'width: 120px; text-align: center;' ],
|
||||
'td' => [ 'style' => 'text-align: center;' ],
|
||||
'db' => 'enabled',
|
||||
'replace' => [
|
||||
'array' => [
|
||||
0 => '<span class="text-danger">nie</span>',
|
||||
1 => '<span class="text-primary">tak</span>'
|
||||
]
|
||||
],
|
||||
'sort' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Akcja',
|
||||
'action' => [ 'type' => 'edit', 'url' => '/?p=ranker_clients&rw=edit&id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center' ],
|
||||
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ]
|
||||
],
|
||||
[
|
||||
'name' => 'Usuń',
|
||||
'action' => [ 'type' => 'delete', 'url' => '/?p=ranker_clients&rw=del&id=[id]' ],
|
||||
'th' => [ 'class' => 'g-center' ],
|
||||
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ]
|
||||
]
|
||||
];
|
||||
$grid -> buttons = [
|
||||
[
|
||||
'label' => 'Dodaj klienta',
|
||||
'class' => 'btn-success',
|
||||
'icon' => 'fa-plus-circle mr5',
|
||||
'url' => '/?p=ranker_clients&rw=add'
|
||||
]
|
||||
];
|
||||
$grid -> hide_columns = false;
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$( document ).ready( function()
|
||||
{
|
||||
$( 'body' ).on( 'click', '#downloads-delete', function()
|
||||
{
|
||||
$.prompt( 'Na pewno chcesz usunąć pobrane linki?', {
|
||||
title: 'Potwierdź?',
|
||||
submit: function(e,v,m,f)
|
||||
{
|
||||
if ( v === true )
|
||||
$( '#f-downloads-delete' ).submit();
|
||||
},
|
||||
buttons: {
|
||||
'tak': true,
|
||||
'nie': false
|
||||
},
|
||||
focus: 0
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
956
templates/ranker/main-view.php
Normal file
956
templates/ranker/main-view.php
Normal file
@@ -0,0 +1,956 @@
|
||||
<? global $config, $user;?>
|
||||
<? if ( count( $this -> sites_to_confirm ) ):?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="panel panel-error panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Niepotwierdzone strony</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<? foreach ( $this -> sites_to_confirm as $site ):?>
|
||||
<a href="/ranker/main_view/id=<?= $site['id'];?>"><?= $site['name'];?></a><? if ( $site != end( $this -> sites_to_confirm ) ):?> | <? endif;?>
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-8">
|
||||
<div class="panel panel-success panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Informacje: <a href="http://<?= $this -> site['url'];?>" target="_blank" class="text-primary"><?= $this -> site['url'];?></a></span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="mb10">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-sm btn-default',
|
||||
'title' => 'Poprzednia strona',
|
||||
'url' => '/ranker/main_view/id=' . $this -> prev_site_id,
|
||||
'icon' => 'fa-backward'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-sm btn-default',
|
||||
'title' => 'Następna strona',
|
||||
'url' => '/ranker/main_view/id=' . $this -> next_site_id,
|
||||
'icon' => 'fa-forward'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-sm btn-default',
|
||||
'title' => 'Dodaj stronę',
|
||||
'url' => '/ranker/site_edit/',
|
||||
'icon' => 'fa-plus'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-sm btn-default',
|
||||
'title' => 'Edytuj stronę',
|
||||
'url' => '/ranker/site_edit/id=' . $this -> site['id'],
|
||||
'icon' => 'fa-cog'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-sm btn-default site-delete',
|
||||
'title' => 'Usuń stronę',
|
||||
'icon' => 'fa-trash'
|
||||
)
|
||||
);?>
|
||||
<? if ( $this -> site['date_confirm'] < date( 'Y-m-d' ) and $this -> site['need_confirm'] ):?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-sm btn-success site-confirm',
|
||||
'title' => 'Potwierdź wyniki',
|
||||
'icon' => 'fa-check',
|
||||
'attr' => [ 'site-id' => $this -> site['id'] ]
|
||||
)
|
||||
);?>
|
||||
<? endif;?>
|
||||
<select name="page" class="form-control ranker-select" id="page" onChange="var id = $(this).val(); document.location.href='/ranker/main_view/id=' + id;" style='max-width: 250px;'>
|
||||
<?
|
||||
if ( is_array ( $this -> sites ) ) foreach ( $this -> sites as $site )
|
||||
{
|
||||
if ( $this -> site['id'] == $site['id'] )
|
||||
$name = $site['name'];
|
||||
?>
|
||||
<option value="<?= $site['id'];?>" <? if ( $this -> site['id'] == $site['id'] ) echo 'selected="selected"';?>>
|
||||
<?= $site['name'];?>
|
||||
</option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<? if ( $this -> site['subscription'] > 0 ) echo 'Ab: <b>' . \S::number( $this -> site['subscription'] ) . ' zł</b>';?>
|
||||
</div>
|
||||
<div>
|
||||
<? if ( $this -> site['majestic'] ):?>
|
||||
TF: <a href="#" class="chart" type="tf" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> majestic['tf'];?></a> |
|
||||
CF: <a href="#" class="chart" type="cf" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> majestic['cf'];?></a> |
|
||||
BL: <a href="#" class="chart" type="bl" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> majestic['feb'];?></a> |
|
||||
RD: <a href="#" class="chart" type="rd" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> majestic['rd'];?></a> |
|
||||
<? endif;?>
|
||||
<? if ( $this -> site['semstorm'] ):?>
|
||||
Top3: <a href="#" class="chart" type="top3" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> semstorm['top3'];?></a> |
|
||||
Top10: <a href="#" class="chart" type="top10" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> semstorm['top10'];?></a> |
|
||||
Top50: <a href="#" class="chart" type="top50" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> semstorm['top50'];?></a> |
|
||||
<? endif;?>
|
||||
<?= \factory\Ranker::last_login_client( $this -> site['id'] );?> | Liczba fraz: <b><?= count( $this -> phrases );?></b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-4">
|
||||
<div class="panel panel-success panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Zarobki</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="mb10">Dzisiaj (netto): <span id="day-profit" class="bold"><?= $this -> day_profit;?></span> <a href="#" id="refresh-earnings" class="btn btn-primary btn-xs ml10"><i class="fa fa-refresh"></i></a></div>
|
||||
<div>Netto ogółem: <span id="month-profit" class="bold"><?= $this -> month_profit;?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary panel-border top mbn">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Lista fraz</span>
|
||||
<div class="pull-right">
|
||||
<a href="/ranker/main_view/id=<?= $this -> site['id'];?>&year=<?= date( 'Y', strtotime( '-1 months', strtotime( $this -> year . '-' . $this -> month . '-01' ) ) );?>&month=<?= date( 'm', strtotime( '-1 months', strtotime( $this -> year . '-' . $this -> month . '-01' ) ) );?>" class="btn btn-sm btn-default" title="Poprzedni m-c">
|
||||
<i class="fa fa-backward"></i>
|
||||
</a>
|
||||
<a href="/ranker/main_view/id=<?= $this -> site['id'];?>&year=<?= date( 'Y', strtotime( '+1 months', strtotime( $this -> year . '-' . $this -> month . '-01' ) ) );?>&month=<?= date( 'm', strtotime( '+1 months', strtotime( $this -> year . '-' . $this -> month . '-01' ) ) );?>" class="btn btn-sm btn-default" title="Następny m-c">
|
||||
<i class="fa fa-forward"></i>
|
||||
</a>
|
||||
<select name="month_global" class="form-control ranker-select" id="month_global" onChange="document.location.href='/ranker/main_view/id=<?= $this -> site['id'];?>&year=' + $( '#year_global' ).val() + '&month=' + $( this ).val();">
|
||||
<option value="01" <? if ( $this -> month == '01' ) echo 'selected="selected"'; ?>>Styczeń</option>
|
||||
<option value="02" <? if ( $this -> month == '02' ) echo 'selected="selected"'; ?>>Luty</option>
|
||||
<option value="03" <? if ( $this -> month == '03' ) echo 'selected="selected"'; ?>>Marzec</option>
|
||||
<option value="04" <? if ( $this -> month == '04' ) echo 'selected="selected"'; ?>>Kwiecień</option>
|
||||
<option value="05" <? if ( $this -> month == '05' ) echo 'selected="selected"'; ?>>Maj</option>
|
||||
<option value="06" <? if ( $this -> month == '06' ) echo 'selected="selected"'; ?>>Czerwiec</option>
|
||||
<option value="07" <? if ( $this -> month == '07' ) echo 'selected="selected"'; ?>>Lipiec</option>
|
||||
<option value="08" <? if ( $this -> month == '08' ) echo 'selected="selected"'; ?>>Sierpień</option>
|
||||
<option value="09" <? if ( $this -> month == '09' ) echo 'selected="selected"'; ?>>Wrzesień</option>
|
||||
<option value="10" <? if ( $this -> month == '10' ) echo 'selected="selected"'; ?>>Październik</option>
|
||||
<option value="11" <? if ( $this -> month == '11' ) echo 'selected="selected"'; ?>>Listopad</option>
|
||||
<option value="12" <? if ( $this -> month == '12' ) echo 'selected="selected"'; ?>>Grudzień</option>
|
||||
</select>
|
||||
<select name="year_global" id="year_global" class="form-control ranker-select" onChange="document.location.href='/ranker/main_view/id=<?= $this -> site['id'];?>&year=' + $( this ).val() + '&month=' + $( '#month_global' ).val();">
|
||||
<? for ( $i = date( 'Y') - 2; $i <= date( 'Y') + 2; $i++ ):?>
|
||||
<option value="<?= $i;?>" <? if ( $i == $this -> year ) echo 'selected="selected"'; ?>><?=$i;?></option>
|
||||
<? endfor;?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="positions">
|
||||
<div class="left-column">
|
||||
<div class="row mn">
|
||||
<div class="col-xs-12 phrase-info">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-xs btn-success',
|
||||
'title' => 'Dodaj frazy',
|
||||
'url' => '/ranker/phrase_edit/site-id=' . $this -> site['id'],
|
||||
'icon' => 'fa-plus mr5',
|
||||
'text' => 'Dodaj frazy'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn-xs btn-danger site-refresh',
|
||||
'title' => 'Odśwież wszystkie pozycje',
|
||||
'icon' => 'fa-refresh mr5',
|
||||
'attr' => [ 'site-id' => $this -> site['id'] ],
|
||||
'text' => 'Odśwież'
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
<? if ( is_array( $this -> phrases ) and count( $this -> phrases ) <= 200 ): foreach ( $this -> phrases as $phrase ):?>
|
||||
<?
|
||||
$phrase_class = '';
|
||||
|
||||
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) or new DateTime( $this -> site['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
|
||||
$phrase_class = 'text-danger';
|
||||
|
||||
if ( $phrase['date_start'] and new DateTime( $phrase['date_start'] ) > new DateTime( date( 'Y-m-d' ) ) )
|
||||
$phrase_class = 'text-danger';
|
||||
|
||||
$pos = $phrase['positions'][ date( 'Y-m-d' ) ]['position'];
|
||||
|
||||
if ( $pos <= 10 )
|
||||
$start = 0;
|
||||
else
|
||||
{
|
||||
$start = 10 * floor( $pos / 10 );
|
||||
if ( $pos%10 == 0 )
|
||||
$start = $start - 10;
|
||||
}
|
||||
?>
|
||||
<div class="row mn">
|
||||
<div class="col-xs-12 phrase-info phrase-info-<?= $phrase['id'];?>">
|
||||
<a href="http://www.google.pl/search?q=<?= urlencode( $phrase['phrase'] );?>&num=10&ie=utf8&hl=pl&start=<?= $start;?>" target="_blank" title="<?= $phrase['phrase'];?>" class="phrase <?= $phrase_class;?>">
|
||||
<?= $phrase['phrase'];?>
|
||||
</a>
|
||||
<a href="<?= $phrase['last_url'];?>" class="text-muted phrase-url" id="phrase-url-<?= $phrase['id'];?>" target="_blank" title="<?= $phrase['last_url'];?>">
|
||||
<?= $phrase['last_url'];?>
|
||||
</a>
|
||||
<div class="phrase-options">
|
||||
<? if ( $phrase['localization'] ):?><i class="fa fa-map-marker"></i><? endif;?>
|
||||
<a href="#" class="btn phrase-refresh" site-id="<?= $this -> site['id'];?>" phrase-id="<?= $phrase['id'];?>" title="Wymuś ponowne sprawdzenie pozycji">
|
||||
<i class="fa fa-refresh"></i>
|
||||
</a>
|
||||
<a href="/ranker/phrase_edit/phrase-id=<?= $phrase['id'];?>&site-id=<?= $this -> site['id'];?>" class="btn" title="Edytuj wybraną frazę">
|
||||
<i class="fa fa-cog"></i>
|
||||
</a>
|
||||
<a href="#" class="btn phrase-delete" site-id="<?= $this -> site['id'];?>" phrase-id="<?= $phrase['id'];?>" title="Usuń wybraną frazę">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
<a href="/ranker/phrase_costs_edit/phrase-id=<?= $phrase['id'];?>&site-id=<?= $this -> site['id'];?>" class="btn" title="Płatności za frazę">
|
||||
<i class="fa fa-dollar"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
<div class="right-column">
|
||||
<div class="table-responsive">
|
||||
<?
|
||||
$start = date( 'Y-m-d', mktime( 0, 0, 0, $this -> month, 1, $this -> year ) );
|
||||
$days = date( 't', strtotime( $start ) );
|
||||
?>
|
||||
<table class="table table-bordered table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center text-muted" site-id="<?= $this -> site['id'];?>" date="<?= date( 'Y-m-t', strtotime( '-1 month', strtotime( $this -> year . '-' . $this -> month ) ) );?>">
|
||||
<?= date( 't', strtotime( '-1 month', strtotime( $this -> year . '-' . $this -> month ) ) );?>
|
||||
</th>
|
||||
<? for ( $i = 1; $i <= $days; $i++ ):?>
|
||||
<th class="text-center pointer table-date <? if ( $this -> comments[ date( 'Y-m-d', strtotime( $this -> year . '-' . $this -> month . '-' . $i ) ) ] ) echo "event-exists";?>" site-id="<?= $this -> site['id'];?>" date="<?= date( 'Y-m-d', strtotime( $this -> year . '-' . $this -> month . '-' . $i ) );?>">
|
||||
<?= $i;?>
|
||||
</th>
|
||||
<? endfor;?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? if ( is_array( $this -> phrases ) and count( $this -> phrases ) <= 200 ):?>
|
||||
<? foreach ( $this -> phrases as $phrase ):?>
|
||||
<tr>
|
||||
<?
|
||||
$date_tmp = date( 'Y-m-t', strtotime( '-1 month', strtotime( $this -> year . '-' . $this -> month ) ) );
|
||||
|
||||
$pos = $phrase['positions'][ $date_tmp ]['position'];
|
||||
$map = $phrase['positions'][ $date_tmp ]['map'];
|
||||
$url = $phrase['positions'][ $date_tmp ]['url'];
|
||||
|
||||
$class = 'position';
|
||||
$text = '';
|
||||
$end = '';
|
||||
|
||||
if ( $pos == 1 )
|
||||
$class = 'pos_1';
|
||||
if ( $pos == 2 || $pos == 3 )
|
||||
$class = 'pos_2';
|
||||
if ( $pos >= 4 && $pos <= 6 )
|
||||
$class = 'pos_4';
|
||||
if ( $pos >= 7 && $pos <= 10 )
|
||||
$class = 'pos_7';
|
||||
if ( $pos >= 11 && $pos <= 20 )
|
||||
$class = 'pos_11';
|
||||
if ( $pos == 0 || $pos >= 21 )
|
||||
$class = 'pos_21';
|
||||
|
||||
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) or new DateTime( $this -> site['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
|
||||
$class = 'end position';
|
||||
|
||||
if ( $phrase['date_start'] and new DateTime( $phrase['date_start'] ) > new DateTime( date( 'Y-m-d' ) ) )
|
||||
$class = 'end position';
|
||||
|
||||
if ( $pos != '' )
|
||||
$pos = $pos;
|
||||
else
|
||||
$pos = '-';
|
||||
?>
|
||||
<td class="position text-center small <?= $class;?>" id="<?= $phrase['id'] . '-' . $date_tmp;?>" phrase-id="<?= $phrase['id'];?>" date="<?= $date_tmp;?>" title="<?= $url;?>">
|
||||
<span><?= $pos == '' ? '-' : $pos;?></span>
|
||||
</td>
|
||||
<? for ( $i = 1; $i <= $days; $i++ ):
|
||||
$i < 10 ? $d = '0' . $i : $d = $i;
|
||||
|
||||
$pos = $phrase['positions'][ $this -> year . '-' . $this -> month . '-' . $d ]['position'];
|
||||
$map = $phrase['positions'][ $this -> year . '-' . $this -> month . '-' . $d ]['map'];
|
||||
$url = $phrase['positions'][ $this -> year . '-' . $this -> month . '-' . $d ]['url'];
|
||||
|
||||
$class = 'position';
|
||||
$text = '';
|
||||
$end = '';
|
||||
|
||||
if ( $pos == 1 )
|
||||
$class = 'pos_1';
|
||||
if ( $pos == 2 || $pos == 3 )
|
||||
$class = 'pos_2';
|
||||
if ( $pos >= 4 && $pos <= 6 )
|
||||
$class = 'pos_4';
|
||||
if ( $pos >= 7 && $pos <= 10 )
|
||||
$class = 'pos_7';
|
||||
if ( $pos >= 11 && $pos <= 20 )
|
||||
$class = 'pos_11';
|
||||
if ( $pos == 0 || $pos >= 21 )
|
||||
$class = 'pos_21';
|
||||
|
||||
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) or new DateTime( $this -> site['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
|
||||
$class = 'end position';
|
||||
|
||||
if ( $phrase['date_start'] and new DateTime( $phrase['date_start'] ) > new DateTime( date( 'Y-m-d' ) ) )
|
||||
$class = 'end position';
|
||||
?>
|
||||
<td class="position text-center small <? if ( $pos != '' ):?>pointer<? endif;?> <?= $class;?>" id="<?= $phrase['id'] . '-' . $this -> year . '-' . $this -> month . '-' . $d;?>" phrase="<?= $phrase['id'];?>" date="<?= $this -> year . '-' . $this -> month . '-' . $d;?>" title="<?= $url;?>">
|
||||
<span>
|
||||
<?
|
||||
if ( $pos != '' ) {
|
||||
echo $pos;
|
||||
}
|
||||
else {
|
||||
if ( $phrase['days_offset'] and date( 'Y-m-d', strtotime( '+' . $phrase['days_offset'] . 'days', strtotime( $phrase['last_checked'] ) ) ) != date( 'Y-m-d' ) ) {
|
||||
echo '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $pos == '' and $this -> year . '-' . $this -> month . '-' . $d == date( 'Y-m-d' ) and $class != 'end position' ) {
|
||||
echo '<i class="fa fa-refresh spin"></i>';
|
||||
?><script type="text/javascript">
|
||||
$( function() {
|
||||
ajax_check_phrase_position( <?= $phrase['id'];?> );
|
||||
});
|
||||
</script><?
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
<input type="text" class="position-edit" value="<?= $pos;?>">
|
||||
</td>
|
||||
<? endfor;?>
|
||||
</tr>
|
||||
<? endforeach;?>
|
||||
<? endif;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- komentarz dzienny -->
|
||||
<div id="comment-info">
|
||||
<form method="POST" action="#" class="form-horizontal">
|
||||
<input type="hidden" id="comment-date" value="">
|
||||
<input type="hidden" id="comment-site-id" value="">
|
||||
<div class="row">
|
||||
<div class="col col-xs-12">
|
||||
<div class="form-group ">
|
||||
<div class="col-lg-12">
|
||||
<textarea class="comment form-control" name="comment-text" id="comment-text" rows="6"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-12 text-left">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-success',
|
||||
'text' => 'Zatwierdź',
|
||||
'js' => '',
|
||||
'icon' => 'fa-check-circle mr5'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-dark',
|
||||
'text' => 'Zamknij',
|
||||
'js' => '$( "#overlay" ).hide(); $( "#comment-info" ).hide();',
|
||||
'icon' => 'fa-times mr5'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-danger pull-right',
|
||||
'text' => 'Usun',
|
||||
'js' => '',
|
||||
'icon' => 'fa-trash mr5'
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- komentarz -->
|
||||
<? if ( $this -> site['comments'] ):?>
|
||||
<div class="panel panel-danger panel-border top">
|
||||
<div class="panel-body">
|
||||
<?= $this -> site['comments'];?>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
|
||||
<!-- stawki -->
|
||||
<? if ( is_array( $this -> phrases ) ):?>
|
||||
<div class="row">
|
||||
<?
|
||||
$suma = 0;
|
||||
foreach ( $this -> phrases as $phrase )
|
||||
{
|
||||
$discount = '';
|
||||
|
||||
if ( $this -> site['discount'] )
|
||||
$discount = $this -> site['discount'];
|
||||
|
||||
if ( $phrase['discount'] )
|
||||
$discount = $phrase['discount'];
|
||||
|
||||
if ( is_array( $phrase['prices'] ) )
|
||||
{
|
||||
?>
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading small"><?= $phrase['phrase'];?> <? if ( $discount > 0 ):?><span class="fr">(rabat <?= $discount;?>%)</span><? endif;?></div>
|
||||
<div class="panel-body p0">
|
||||
<?
|
||||
if ( is_array( $phrase['prices'] ) )
|
||||
{
|
||||
$sum = 0;
|
||||
?>
|
||||
<table class="table table-condensed table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="text-right">Przedział</td>
|
||||
<td class="text-right">Stawka</td>
|
||||
<td class="text-right">Ilość dni</td>
|
||||
<td class="text-right">Należność</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?
|
||||
foreach ( $phrase['prices'] as $price )
|
||||
{
|
||||
$price_c = \S::number( $price['price'] - \S::number( $price['price'] * $discount / 100 ) );
|
||||
?>
|
||||
<tr <? if ( !$price['count'] ):?> style="background: #efefef;"<? endif;?>>
|
||||
<td class="text-right">
|
||||
<?= $price['start'];?> - <?= $price['end'];?>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<?= \S::number_display( $price_c );?>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<?= $price['count'];?>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<?= \S::number_display( $price_c * $price['count'] );?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
$sum = $sum + $price_c * $price['count'];
|
||||
$suma = $suma + $price_c * $price['count'];
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" class="text-right">Suma:</td>
|
||||
<td class="alert-dark dark text-right"><?= \S::number_display( $sum );?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<? if ( $suma ):?>
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-dark">
|
||||
<div class="panel-heading">
|
||||
Razem netto: <?= \S::number_display( $suma );?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-dark">
|
||||
<div class="panel-heading">
|
||||
Razem brutto: <?= \S::number_display( $suma * $config['profit']['vat'] );?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
|
||||
<div id="swl-content">
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
|
||||
<div id="chart"></div>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/libraries/framework/vendor/plugins/c3charts/c3.min.css">
|
||||
<script type="text/javascript" src="/libraries/framework/vendor/plugins/c3charts/d3.min.js"></script>
|
||||
<script type="text/javascript" src="/libraries/framework/vendor/plugins/c3charts/c3.min.js"></script>
|
||||
<script type="text/javascript" src="/libraries/jquery.bpopup.min.js"></script>
|
||||
<script type="text/javascript" src="/libraries/framework/vendor/plugins/highcharts/highcharts-all.js"></script>
|
||||
<script type="text/javascript">
|
||||
$( function()
|
||||
{
|
||||
var timer;
|
||||
|
||||
Highcharts.setOptions(
|
||||
{
|
||||
lang: {
|
||||
loading: 'Ładowanie...',
|
||||
months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
|
||||
weekdays: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
|
||||
shortMonths: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź','Lis', 'Gru'],
|
||||
exportButtonTitle: "Export",
|
||||
printButtonTitle: "Drukowanie",
|
||||
rangeSelectorFrom: "Od",
|
||||
rangeSelectorTo: "Do",
|
||||
rangeSelectorZoom: "Przybliżenie",
|
||||
downloadPNG: 'Pobierz obraz PNG',
|
||||
downloadJPEG: 'Pobierz obraz JPEG',
|
||||
downloadPDF: 'Pobierz dokument PDF',
|
||||
downloadSVG: 'Pobierz obraz SVG',
|
||||
thousandsSep: " ",
|
||||
decimalPoint: ','
|
||||
}
|
||||
});
|
||||
|
||||
$( '#chart' ).appendTo( '#ajax-container' );
|
||||
var chart;
|
||||
var url;
|
||||
var title_text;
|
||||
var yaxis_title;
|
||||
|
||||
$( 'body' ).on( 'click', '.chart', function()
|
||||
{
|
||||
var site_url = $( this ).attr( 'site-url' );
|
||||
var site_id = $( this ).attr( 'site-id' );
|
||||
var type = $( this ).attr( 'type' );
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case 'top3':
|
||||
url = "/json.php?action=site_top3&site_id=" + site_id;
|
||||
title_text = 'Semstorm Top3: ';
|
||||
yaxis_title = 'Semstorm Top3';
|
||||
break;
|
||||
case 'top10':
|
||||
url = "/json.php?action=site_top10&site_id=" + site_id;
|
||||
title_text = 'Semstorm Top10: ';
|
||||
yaxis_title = 'Semstorm Top10';
|
||||
break;
|
||||
case 'top50':
|
||||
url = "/json.php?action=site_top50&site_id=" + site_id;
|
||||
title_text = 'Semstorm Top50: ';
|
||||
yaxis_title = 'Semstorm Top50';
|
||||
break;
|
||||
case 'bl':
|
||||
url = "/json.php?action=site_feb&site_id=" + site_id;
|
||||
title_text = 'Backlinks strony: ';
|
||||
yaxis_title = 'Backlinks';
|
||||
break;
|
||||
case 'rd':
|
||||
url = "/json.php?action=site_rd&site_id=" + site_id;
|
||||
title_text = 'Referring Domains strony: ';
|
||||
yaxis_title = 'Referring Domains';
|
||||
break;
|
||||
case 'cf':
|
||||
url = "/json.php?action=site_cf&site_id=" + site_id;
|
||||
title_text = 'Citation Flow strony: ';
|
||||
yaxis_title = 'Citation Flow';
|
||||
break;
|
||||
case 'tf':
|
||||
url = "/json.php?action=site_tf&site_id=" + site_id;
|
||||
title_text = 'Trust Flow strony: ';
|
||||
yaxis_title = 'Trust Flow';
|
||||
break;
|
||||
}
|
||||
|
||||
$( '#ajax-container' ).css({
|
||||
'height': '600px',
|
||||
'width' : '90%'
|
||||
});
|
||||
|
||||
$( '#chart' ).css({
|
||||
'width': '100%'
|
||||
});
|
||||
|
||||
$( '#overlay, #ajax-container' ).show();
|
||||
|
||||
$.getJSON( url, function( json )
|
||||
{
|
||||
chart = new Highcharts.Chart(
|
||||
{
|
||||
chart: {
|
||||
renderTo: 'chart',
|
||||
type: 'line',
|
||||
marginRight: 130,
|
||||
marginBottom: 25
|
||||
},
|
||||
title: {
|
||||
text: title_text + '<b>' + site_url + '</b>',
|
||||
x: -20
|
||||
},
|
||||
subtitle: {
|
||||
text: '',
|
||||
x: -20
|
||||
},
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
dateTimeLabelFormats: {
|
||||
day: '%Y-%m-%d'
|
||||
},
|
||||
title: {
|
||||
text: 'Data'
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
title: {
|
||||
text: yaxis_title
|
||||
},
|
||||
plotLines: [{
|
||||
value: 0,
|
||||
width: 1,
|
||||
color: '#808080'
|
||||
}]
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return '' + Highcharts.dateFormat( "%Y-%m-%d", this.x ) + ':<br /><b>' + this.y + '</b>';
|
||||
}
|
||||
},
|
||||
series: json
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '#refresh-earnings', function()
|
||||
{
|
||||
var button = $( this );
|
||||
|
||||
if ( button.attr( 'disabled' ) == 'disabled' )
|
||||
return false;
|
||||
|
||||
jQuery.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/ajax.php',
|
||||
data:
|
||||
{
|
||||
a: 'refresh-earnings'
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
button.attr( 'disabled', 'disabled' );
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
data = jQuery.parseJSON( response );
|
||||
$( '#day-profit' ).html( data.day_profit );
|
||||
$( '#month-profit' ).html( data.month_profit );
|
||||
button.removeAttr( 'disabled' );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'dblclick', '.position', function()
|
||||
{
|
||||
var id = $( this ).attr( 'id' );
|
||||
$( 'td#' + id ).children( 'span' ).addClass( 'hide' );
|
||||
$( 'td#' + id ).children( 'input' ).show().focus().select();
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'focusout keypress', '.position-edit', function(event)
|
||||
{
|
||||
if ( event.type == 'keypress' && event.keyCode === 13 || event.type == 'focusout' )
|
||||
{
|
||||
var new_class = '';
|
||||
var input = $( this );
|
||||
var date = $( this ).parent( 'td' ).attr( 'date' );
|
||||
var position = $( this ).val();
|
||||
var phrase_id = $( this ).parent( 'td' ).attr( 'phrase' );
|
||||
|
||||
jQuery.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/ajax.php',
|
||||
data:
|
||||
{
|
||||
date: date,
|
||||
phrase_id: phrase_id,
|
||||
position: position,
|
||||
a: 'change_phrase_position'
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
$( '#' + phrase_id + '-' + date ).removeClass( 'pos_1 pos_2 pos_4 pos_7 pos_11 pos_21' );
|
||||
$( '#' + phrase_id + '-' + date + ' span' ).html( '' );
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
input.hide();
|
||||
input.parent( 'td' ).children( 'span' ).html( position ).removeClass( 'hide' );
|
||||
|
||||
if ( position == 1 )
|
||||
new_class = 'pos_1';
|
||||
if ( position == 2 || position == 3 )
|
||||
new_class = 'pos_2';
|
||||
if ( position >= 4 && position <= 6 )
|
||||
new_class = 'pos_4';
|
||||
if ( position >= 7 && position <= 10 )
|
||||
new_class = 'pos_7';
|
||||
if ( position >= 11 && position <= 20 )
|
||||
new_class = 'pos_11';
|
||||
if ( position == 0 || position >= 21 )
|
||||
new_class = 'pos_21';
|
||||
|
||||
$( '#' + phrase_id + '-' + date ).addClass( new_class );
|
||||
|
||||
jQuery( '#overlay' ).hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.phrase-refresh', function()
|
||||
{
|
||||
var site_id = $( this ).attr( 'site-id' );
|
||||
var phrase_id = $( this ).attr( 'phrase-id' );
|
||||
|
||||
ajax_refresh_phrase_position( site_id, phrase_id );
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.swl-stats', function()
|
||||
{
|
||||
var swl_id = $( this ).attr( 'swl-id' );
|
||||
|
||||
$('#swl-content').bPopup(
|
||||
{
|
||||
content:'iframe',
|
||||
contentContainer:'.content',
|
||||
loadUrl:'http://www.projectpro.pl/swl/group_links/iframe=true&pswd=ec97fb1b23aac077cef7188f90e1a74b&link-id=' + swl_id
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'dblclick', '.site-confirm', function()
|
||||
{
|
||||
$( this ).blur().addClass( 'disabled' );
|
||||
ajax_site_confirm( $( this ).attr( 'site-id' ), <?= $this -> next_site_id;?> );
|
||||
});
|
||||
|
||||
/* odświeżenie wszystkich pozycji */
|
||||
$( 'body' ).on( 'click', '.site-refresh', function()
|
||||
{
|
||||
$.alert(
|
||||
{
|
||||
title: 'Potwierdź',
|
||||
content: 'Na pewno chcesz odświerzyć wszystkie pozycje?',
|
||||
type: 'orange',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
buttons:
|
||||
{
|
||||
confirm:
|
||||
{
|
||||
text: 'Zatwierdź',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function()
|
||||
{
|
||||
$( '.positions .left-column .phrase-options .phrase-refresh' ).each( function()
|
||||
{
|
||||
$( this ).trigger( 'click' );
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel:
|
||||
{
|
||||
text: 'Anuluj',
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.site-delete', function()
|
||||
{
|
||||
$.alert(
|
||||
{
|
||||
title: 'Potwierdź',
|
||||
content: 'Na pewno chcesz usunąć wybraną stronę?',
|
||||
type: 'orange',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
buttons:
|
||||
{
|
||||
confirm:
|
||||
{
|
||||
text: 'Zatwierdź',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function()
|
||||
{
|
||||
document.location.href = "/ranker/site_delete/site-id=<?= $this -> site['id'];?>";
|
||||
}
|
||||
},
|
||||
cancel:
|
||||
{
|
||||
text: 'Anuluj',
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.phrase-delete', function()
|
||||
{
|
||||
var site_id = $( this ).attr( 'site-id' );
|
||||
var phrase_id = $( this ).attr( 'phrase-id' );
|
||||
|
||||
$.alert(
|
||||
{
|
||||
title: 'Potwierdź',
|
||||
content: 'Na pewno chcesz usunąć wybraną frazę?',
|
||||
type: 'orange',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
buttons:
|
||||
{
|
||||
confirm:
|
||||
{
|
||||
text: 'Zatwierdź',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function()
|
||||
{
|
||||
document.location.href = '/ranker/phrase_delete/phrase-id=' + phrase_id + '&site-id=' + site_id;
|
||||
}
|
||||
},
|
||||
cancel:
|
||||
{
|
||||
text: 'Anuluj',
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.table-date', function()
|
||||
{
|
||||
var date = $( this ).attr( 'date' );
|
||||
var site_id = $( this ).attr( 'site-id' );
|
||||
|
||||
jQuery.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/ajax.php',
|
||||
data:
|
||||
{
|
||||
date: date,
|
||||
site_id: site_id,
|
||||
a: 'comment_details'
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
$( '#overlay' ).show();
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
$( '#comment-date' ).val( date );
|
||||
$( '#comment-site-id' ).val( site_id );
|
||||
$( '#comment-text' ).val( response );
|
||||
$( '#comment-info' ).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '#comment-info .btn-success', function()
|
||||
{
|
||||
var date = $( '#comment-date' ).val();
|
||||
var site_id = $( '#comment-site-id' ).val();
|
||||
var comment = $( '#comment-text' ).val();
|
||||
|
||||
jQuery.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/ajax.php',
|
||||
data:
|
||||
{
|
||||
date: date,
|
||||
site_id: site_id,
|
||||
comment: comment,
|
||||
a: 'comment_save'
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
$( '#comment-info, #overlay' ).hide();
|
||||
$( 'th[date=' + date + ']' ).addClass( 'event-exists' );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '#comment-info .btn-danger', function()
|
||||
{
|
||||
var date = $( '#comment-date' ).val();
|
||||
var site_id = $( '#comment-site-id' ).val();
|
||||
|
||||
jQuery.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/ajax.php',
|
||||
data:
|
||||
{
|
||||
date: date,
|
||||
site_id: site_id,
|
||||
a: 'comment_delete'
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
$( '#comment-info, #overlay' ).hide();
|
||||
$( 'th[date=' + date + ']' ).removeClass( 'event-exists' );
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
232
templates/ranker/phrase-costs-edit.php
Normal file
232
templates/ranker/phrase-costs-edit.php
Normal file
@@ -0,0 +1,232 @@
|
||||
<div class="panel panel-info panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Edycja stawek: <u><?= $this -> phrase['phrase'];?></u></span>
|
||||
</div>
|
||||
<div class="panel-heading p5" style="height: auto;">
|
||||
<div class="row mb10 pl5">
|
||||
<div class="col col-xs-12">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-success',
|
||||
'text' => 'Zatwierdź',
|
||||
'js' => 'checkForm( "formularz" );',
|
||||
'icon' => 'fa-check-circle mr5'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-danger',
|
||||
'text' => 'Anuluj',
|
||||
'url' => '/ranker/main_view/id=' . $this -> site_id,
|
||||
'icon' => 'fa-times mr5'
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form method="POST" action="/ranker/phrase_costs_save/" id="formularz" class="form-horizontal">
|
||||
<input type="hidden" name="site-id" value="<?= $this -> site_id;?>">
|
||||
<input type='hidden' name='phrase-id' value='<?= $this -> phrase['id'];?>'>
|
||||
<div class="row">
|
||||
<div class="col col-md-12 col-lg-8">
|
||||
<div class="form-group">
|
||||
<label class="col-lg-4 control-label">Zakresy:</label>
|
||||
<div class="col-lg-8">
|
||||
<div id="prices-edit">
|
||||
<?
|
||||
if ( !$this -> prices )
|
||||
{
|
||||
$i = 1;
|
||||
?>
|
||||
<div class="price-box" id="price-box-1" count="1">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">
|
||||
od: <input type="text" class="form-control text-center from" id="from_1" name="from[1]" onChange="checkIntFrom( 1 )" value="1" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
do: <input type="text" class="form-control text-center to" id="to_1" name="to[1]" onChange="checkIntTo( 1 )" value="3" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">
|
||||
st. / st. m-c: <input type="text" class="form-control text-right" id="price_1" name="price[1]" onChange="checkPrice( 1 )" style="width: 60px; margin: 0 5px; display: inline-block;" /> /
|
||||
<input type="text" class="form-control text-right" id="price_month_1" onChange="checkPriceMonth( 1 );" style="width: 60px; margin: 0 5px; display: inline-block" /> zł
|
||||
<a href='#' onClick="deletePrice( 1 ); return false;">
|
||||
<i class="fa fa-trash fa-lg ml10 text-danger"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m5" style="border: 1px solid #ccc;"></div>
|
||||
</div>
|
||||
<div class="price-box" id="price-box-2" count="2">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">
|
||||
od: <input type="text" class="form-control text-center from" id="from_2" name="from[2]" onChange="checkIntFrom( 2 )" value="4" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
do: <input type="text" class="form-control text-center to" id="to_2" name="to[2]" onChange="checkIntTo( 2 )" value="6" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">
|
||||
st. / st. m-c: <input type="text" class="form-control text-right" id="price_2" name="price[2]" onChange="checkPrice( 2 )" style="width: 60px; margin: 0 5px; display: inline-block;" /> /
|
||||
<input type="text" class="form-control text-right" id="price_month_2" onChange="checkPriceMonth( 2 );" style="width: 60px; margin: 0 5px; display: inline-block" /> zł
|
||||
<a href='#' onClick="deletePrice( 2 ); return false;">
|
||||
<i class="fa fa-trash fa-lg ml10 text-danger"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m5" style="border: 1px solid #ccc;"></div>
|
||||
</div>
|
||||
<div class="price-box" id="price-box-3" count="3">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">
|
||||
od: <input type="text" class="form-control text-center from" id="from_3" name="from[3]" onChange="checkIntFrom( 3 )" value="7" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
do: <input type="text" class="form-control text-center to" id="to_3" name="to[3]" onChange="checkIntTo( 3 )" value="10" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">
|
||||
st. / st. m-c: <input type="text" class="form-control text-right" id="price_3" name="price[3]" onChange="checkPrice( 3 )" style="width: 60px; margin: 0 5px; display: inline-block;" /> /
|
||||
<input type="text" class="form-control text-right" id="price_month_3" onChange="checkPriceMonthRecursive();" style="width: 60px; margin: 0 5px; display: inline-block" /> zł
|
||||
<a href='#' onClick="deletePrice( 3 ); return false;">
|
||||
<i class="fa fa-trash fa-lg ml10 text-danger"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m5" style="border: 1px solid #ccc;"></div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
else
|
||||
{
|
||||
$i = 0;
|
||||
foreach ( $this -> prices as $price )
|
||||
{
|
||||
$i++;
|
||||
?>
|
||||
<div class="price-box" id="price-box-<?= $i;?>" count="<?= $i;?>">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">
|
||||
od: <input type="text" class="form-control text-center from" id="from_<?= $i;?>" name="from[<?= $i;?>]" value="<?= $price['start'];?>" onChange="checkIntFrom( <?= $i;?> )" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
do: <input type="text" class="form-control text-center to" id="to_<?= $i;?>" name="to[<?= $i;?>]" value="<?= $price['end'];?> "onChange="checkIntTo( <?= $i;?> )" style="width: 45px; margin: 0 5px; display: inline-block;" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">
|
||||
st. / st. m-c: <input type="text" class="form-control text-right" id="price_<?= $i;?>" value="<?= $price['price'];?>" name="price[<?= $i;?>]" onChange="checkPrice( <?= $i;?> )" style="width: 60px; margin: 0 5px; display: inline-block;" /> /
|
||||
<input type="text" class="form-control text-right" id="price_month_<?= $i;?>" value="" onChange="checkPriceMonth( <?= $i;?> );" style="width: 60px; margin: 0 5px; display: inline-block" /> zł
|
||||
<a href='#' onClick="deletePrice( <?= $i;?> ); return false;">
|
||||
<i class="fa fa-trash fa-lg ml10 text-danger"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m5" style="border: 1px solid #ccc;"></div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<a onClick="addPriceBox(); return false;" class="btn btn-sm btn-success">dodaj zakres</a>
|
||||
<input type="hidden" name="count_prices" id="count_prices" value="<?= $i;?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function deletePrice( id )
|
||||
{
|
||||
$( '#price-box-' + id ).remove();
|
||||
}
|
||||
|
||||
function addPriceBox()
|
||||
{
|
||||
var i = 0;
|
||||
var z = 0;
|
||||
|
||||
$( '.price-box' ).each( function()
|
||||
{
|
||||
if ( i < parseInt( $( this ).attr( 'count' ) ) )
|
||||
i = parseInt( $( this ).attr( 'count' ) );
|
||||
});
|
||||
|
||||
$( '.to' ).each( function()
|
||||
{
|
||||
if ( z < parseInt( $( this ).val() ) )
|
||||
z = parseInt( $( this ).val() );
|
||||
});
|
||||
|
||||
var text = '<div class="price-box" id="price-box-' + ( i + 1 ) + '" count="' + ( i + 1 ) + '">\n' +
|
||||
'<div class="row">' +
|
||||
'<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">' +
|
||||
'od: <input type="text" class="form-control text-center from" value="' + ( z + 1 ) + '" id="from_' + ( i + 1 ) + '" name="from[' + ( i + 1 ) + ']" onChange="checkIntFrom( ' + ( i + 1 ) + ' )" style="width: 45px; margin: 0 5px; display: inline-block;" />' +
|
||||
'do: <input type="text" class="form-control text-center to" value="' + ( z + 1 ) + '" id="to_' + ( i + 1 ) + '" name="to[' + ( i + 1 ) + ']" onChange="checkIntTo( ' + ( i + 1 ) + ' )" style="width: 45px; margin: 0 5px; display: inline-block;" />' +
|
||||
'</div>' +
|
||||
'<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">' +
|
||||
'st. / st. m-c: <input type="text" class="form-control text-right" id="price_' + ( i + 1 ) + '" name="price[' + ( i + 1 ) + ']" onChange="checkPrice( ' + ( i + 1 ) + ' )" style="width: 60px; margin: 0 5px; display: inline-block;"> / ' +
|
||||
'<input type="text" class="form-control text-right" id="price_month_' + ( i + 1 ) + '" onChange="checkPriceMonth( ' + ( i + 1 ) + ' )" style="width: 60px; margin: 0 5px; display: inline-block;"> zł' +
|
||||
' <a href="#" onClick="deletePrice( ' + ( i + 1 ) + ' )">' +
|
||||
'<i class="fa fa-trash fa-lg text-danger ml10"></i>' +
|
||||
'</a>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="m5" style="border: 1px solid #ccc;"></div>' +
|
||||
'</div>';
|
||||
|
||||
$ ( '#prices-edit' ).append( text );
|
||||
$( '#count_prices' ).val( z + 1 );
|
||||
}
|
||||
|
||||
function checkIntFrom( id )
|
||||
{
|
||||
var val = $( '#from_' + id ).val();
|
||||
val = parseInt( val );
|
||||
if ( !val )
|
||||
val = 1;
|
||||
$( '#from_' + id ).val( val );
|
||||
}
|
||||
|
||||
function checkIntTo( id )
|
||||
{
|
||||
var val = $( '#to_' + id ).val();
|
||||
val = parseInt( val );
|
||||
|
||||
if ( !val )
|
||||
val = 1;
|
||||
|
||||
$( '#to_' + id ).val( val );
|
||||
};
|
||||
|
||||
function checkPriceMonthRecursive()
|
||||
{
|
||||
var val = $( '#price_month_3' ).val();
|
||||
val = parseFloat( val.replace( ',', '.' ) * 1 );
|
||||
|
||||
$( '#price_month_3' ).val( number_format( val, 2 , '.', '' ) );
|
||||
$( '#price_month_2' ).val( number_format( val * 1.25, 2 , '.', '' ) ).trigger( 'change' );
|
||||
$( '#price_month_1' ).val( number_format( val * 1.5, 2 , '.', '' ) ).trigger( 'change' );
|
||||
|
||||
if ( isNaN( val ) )
|
||||
val = 0;
|
||||
|
||||
val = number_format( val / 30 , 2 , '.', '' );
|
||||
$( '#price_3' ).val( val );
|
||||
}
|
||||
|
||||
function checkPriceMonth( id )
|
||||
{
|
||||
var val = $( '#price_month_' + id ).val();
|
||||
val = parseFloat( val.replace( ',', '.' ) * 1 );
|
||||
|
||||
$( '#price_month_' + id ).val( number_format( val, 2 , '.', '' ) );
|
||||
|
||||
if ( isNaN( val ) )
|
||||
val = 0;
|
||||
|
||||
val = number_format( val / 30 , 2 , '.', '' );
|
||||
$( '#price_' + id ).val( val );
|
||||
}
|
||||
|
||||
function checkPrice( id )
|
||||
{
|
||||
var val = $( '#price_' + id ).val();
|
||||
val = parseFloat( val.replace( ',', '.' ) * 1 );
|
||||
if ( isNaN( val ) )
|
||||
val = 0;
|
||||
val = number_format( val , 2 , '.', '' );
|
||||
$( '#price_' + id ).val( val );
|
||||
}
|
||||
</script>
|
||||
112
templates/ranker/phrase-edit.php
Normal file
112
templates/ranker/phrase-edit.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<div class="panel panel-info panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Edycja frazy: <u><?= $this -> phrase['phrase'];?></u></span>
|
||||
</div>
|
||||
<div class="panel-heading p5" style="height: auto;">
|
||||
<div class="row mb10 pl5">
|
||||
<div class="col col-xs-12">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-success',
|
||||
'text' => 'Zatwierdź',
|
||||
'js' => 'checkForm( "formularz" );',
|
||||
'icon' => 'fa-check-circle mr5'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-danger',
|
||||
'text' => 'Anuluj',
|
||||
'url' => '/ranker/main_view/id=' . $this -> site_id,
|
||||
'icon' => 'fa-times mr5'
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form method="POST" action="/ranker/phrase_save/>" id="formularz" class="form-horizontal">
|
||||
<input type='hidden' name='phrase_id' value='<?= $this -> phrase['id'];?>'>
|
||||
<div class="row">
|
||||
<div class="col col-md-6">
|
||||
<? if ( $this -> phrase ):?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'phrase',
|
||||
'class' => 'require',
|
||||
'value' => $this -> phrase['phrase'],
|
||||
'label' => 'Fraza'
|
||||
)
|
||||
);?>
|
||||
<? else:?>
|
||||
<?= \Html::textarea(
|
||||
array(
|
||||
'name' => 'phrase',
|
||||
'class' => 'require',
|
||||
'label' => 'Fraza'
|
||||
)
|
||||
);?>
|
||||
<? endif;?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'localization',
|
||||
'value' => $this -> phrase['localization'],
|
||||
'label' => 'Lokalizacja'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'discount',
|
||||
'value' => $this -> phrase['discount'],
|
||||
'label' => 'Rabat w %',
|
||||
'class' => 'number-format'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'date_start',
|
||||
'value' => $this -> phrase['date_start'] != '0000-00-00' ? $this -> phrase['date_start'] : null,
|
||||
'label' => 'Początek',
|
||||
'class' => 'date'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'date_end',
|
||||
'value' => $this -> phrase['date_end'] != '0000-00-00' ? $this -> phrase['date_end'] : null,
|
||||
'label' => 'Koniec',
|
||||
'class' => 'date'
|
||||
)
|
||||
);?>
|
||||
<?
|
||||
if ( is_array( $this -> sites ) ) foreach ( $this -> sites as $site )
|
||||
$sites[ $site['id'] ] = $site['name'];
|
||||
?>
|
||||
|
||||
<?= \Html::select(
|
||||
array(
|
||||
'name' => 'site_id',
|
||||
'label' => 'Strona',
|
||||
'value' => $this -> site_id,
|
||||
'values' => $sites
|
||||
)
|
||||
);?>
|
||||
<hr />
|
||||
<?= \Html::input( [
|
||||
'name' => 'days_offset',
|
||||
'value' => $this -> phrase['days_offset'],
|
||||
'label' => 'Sprawdza co X dni'
|
||||
] );?>
|
||||
<?= \Html::input_switch( [
|
||||
'name' => 'to_all',
|
||||
'label' => 'Zastosuj do wszystkich',
|
||||
'checked' => false,
|
||||
'values' => [
|
||||
'0' => 'nie',
|
||||
'1' => 'tak'
|
||||
]
|
||||
] );?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
113
templates/ranker/reports-pdf.php
Normal file
113
templates/ranker/reports-pdf.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?
|
||||
$datetime1 = date( 'Y-m-', strtotime( $this -> _date_from ) ) . '01';
|
||||
$datetime2 = date( 'Y-m-', strtotime( $this -> _date_to ) ) . date( 't', strtotime( $this -> _date_to ) );
|
||||
$x = floor( ( strtotime( $datetime2 ) - strtotime( $datetime1 ) ) / 2628000 );
|
||||
$months = \S::getMonthNames();
|
||||
?>
|
||||
<div style="text-align: right; font-size: 14px; margin-bottom: 30px; font-family: Verdana;">Raport pozycji od <?= $this -> _date_from;?> do <?= $this -> _date_to;?></div>
|
||||
<?
|
||||
if ( is_array( $this -> _pages ) ):
|
||||
foreach ( $this -> _pages as $page ):?>
|
||||
<div style="background: #618FB0; color: #FFF; padding: 10px; font-family: Verdana; margin: 20px auto 10px; text-align: center; font-size: 13px;">Raport dla strony <b><?= $page['url'];?></b></div>
|
||||
<? for ( $i = 0; $i <= $x; $i++ ):?>
|
||||
<div style="margin: 15px 0 5px 0; font-size: 12px;"><?= $months[ date( 'n', strtotime( '+' . $i . ' months', strtotime( $this -> _date_from ) ) )];?> <?= date( 'Y', strtotime( '+' . $i . ' months', strtotime( $this -> _date_from ) ) );?></div>
|
||||
<? if ( is_array( $page['phrases'] ) ):?>
|
||||
<table style="border-collapse: collapse; border: 1px solid #6F6F6F; width: 100%; font-size: 10px; font-family: verdana; margin-bottom: 10px;">
|
||||
<tr>
|
||||
<td style="background: #618FB0; color: #FFF; border: 1px solid #000; padding-left: 5px; height: 25px; width: 250px; font-family: Verdana; font-size: 10px;">Fraza</td>
|
||||
<? for ( $z = 1; $z <= date( 't', strtotime( '+' . $i . ' months', strtotime( $this -> _date_from ) ) ); $z++ ):?>
|
||||
<td style="background: #618FB0; color: #FFF; border: 1px solid #000; text-align: center; width: 25px; font-family: Verdana; font-size: 10px;"><?= $z;?></td>
|
||||
<? endfor;?>
|
||||
</tr>
|
||||
<? foreach( $page['phrases'] as $phrase ):?>
|
||||
<tr>
|
||||
<td style="border: 1px solid #000; padding: 2px 5px; height: 25px; font-family: Verdana; font-size: 10px;"><?= $phrase['phrase'];?></td>
|
||||
</tr>
|
||||
<?
|
||||
for ( $z = 1; $z <= date( 't', strtotime( '+' . $i . ' months', strtotime( $this -> _date_from ) ) ); $z++ )
|
||||
{
|
||||
$date = date( 'Y-m-', strtotime( '+' . $i . ' months', strtotime( $this -> _date_from ) ) );
|
||||
$z < 10 ? $date .= '0' . $z : $date .= $z;
|
||||
$phrase['positions'][ $date ] ? $pos = $phrase['positions'][ $date ] : $pos = '-';
|
||||
|
||||
if ( $pos == 1 )
|
||||
$style = 'background: #6a8da7 !important; color: #fff !important;';
|
||||
if ( $pos == 2 || $pos == 3 )
|
||||
$style = 'background: #56bc76 !important; color: #fff !important;';
|
||||
if ( $pos >= 4 && $pos <= 6 )
|
||||
$style = 'background: #cb60b3 !important; color: #fff !important;';
|
||||
if ( $pos >= 7 && $pos <= 10 )
|
||||
$style = 'background: #e5603b !important; color: #fff !important;';
|
||||
if ( $pos >= 11 && $pos <= 20 )
|
||||
$style = 'background: #666666 !important; color: #fff !important;';
|
||||
if ( $pos == 0 || $pos >= 21 )
|
||||
$style = '';
|
||||
?>
|
||||
<td style="color: #000; border: 1px solid #000; text-align: center; font-family: Verdana; font-size: 10px; <?= $style;?>"><?= $pos;?></td>
|
||||
<?
|
||||
};?>
|
||||
<? endforeach;?>
|
||||
</table>
|
||||
<? endif;?>
|
||||
<? endfor;?>
|
||||
<? if ( $this -> _report_form == 2 ):?>
|
||||
<? $suma_all = 0;?>
|
||||
<? if ( is_array( $page['phrases'] ) ): foreach( $page['phrases'] as $phrase ):?>
|
||||
<?
|
||||
$discount = '';
|
||||
|
||||
if ( $page['discount'] )
|
||||
$discount = $page['discount'];
|
||||
|
||||
if ( $phrase['discount'] )
|
||||
$discount = $phrase['discount'];
|
||||
|
||||
$suma = 0;
|
||||
?>
|
||||
<table style="margin: 0 0 10px 0; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #e0e4e8; padding: 2px 5px 2px 0; height: 25px; color: #000; font-family: Verdana; font-size: 11px; font-weight: bold;" colspan="4"><?= $phrase['phrase'];?> <? if ( $discount > 0 ):?><span class="discount">rabat <?= $discount;?>%</span><? endif;?></td>
|
||||
</tr>
|
||||
<? if ( is_array( $phrase['prices'] ) ): foreach ( $phrase['prices'] as $price ):?>
|
||||
<tr>
|
||||
<td style="width: 100px; border-bottom: 1px solid #e0e4e8; font-family: Verdana; font-size: 10px; height: 25px;">Pozycja <?= $price['start'];?> - <?= $price['end'];?>:</td>
|
||||
<td style="text-align: right; border-bottom: 1px solid #e0e4e8; font-family: Verdana; font-size: 10px; width: 80px;">
|
||||
<?
|
||||
if ( $discount > 0 )
|
||||
echo number_format( number_format( $price['price'] - ( $price['price'] * $discount / 100 ), 2 ), 2, '.', ' ' );
|
||||
else
|
||||
echo number_format( $price['price'], 2, '.', ' ' ) . ' PLN';
|
||||
?>
|
||||
</td>
|
||||
<td style="text-align: right; border-bottom: 1px solid #e0e4e8; font-family: Verdana; font-size: 10px; width: 80px;"><?= (int)$price['count'];?></td>
|
||||
<td style="text-align: right; border-bottom: 1px solid #e0e4e8; font-family: Verdana; font-size: 10px; width: 80px;">
|
||||
<?
|
||||
if ( $discount > 0 )
|
||||
echo number_format( number_format( $price['price'] - ( $price['price'] * $discount / 100 ), 2 ) * $price['count'], 2, '.', ' ' );
|
||||
else
|
||||
echo number_format( $price['price'] * $price['count'], 2, '.', ' ' ) . ' PLN';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
$suma += number_format( number_format( $price['price'] - ( $price['price'] * $discount / 100 ), 2 ) * $price['count'], 2 );
|
||||
$suma_all += number_format( number_format( $price['price'] - ( $price['price'] * $discount / 100 ), 2 ) * $price['count'], 2 );
|
||||
?>
|
||||
<? endforeach; endif;?>
|
||||
<tr>
|
||||
<td colspan="2" style="height: 20px; width: 300px;"></td>
|
||||
<td style="font-family: Verdana; font-size: 10px; text-align: right;">Razem netto:</td>
|
||||
<td style="font-family: Verdana; font-size: 10px; font-weight: bold; text-align: right;"><?= number_format( $suma, 2, '.', ' ' );?> PLN</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="height: 20px;"></td>
|
||||
<td style="font-family: Verdana; font-size: 10px; text-align: right;">Razem brutto:</td>
|
||||
<td style="font-family: Verdana; font-size: 10px; font-weight: bold; text-align: right;"><?= number_format( $suma * 1.23, 2, '.', ' ' );?> PLN</td>
|
||||
</tr>
|
||||
</table>
|
||||
<? endforeach; endif;?>
|
||||
<div style="margin: 15px 0 5px 0; font-size: 12px;">Razem netto: <b><?= number_format( $suma_all, 2, '.', ' ' );?> PLN</b></div>
|
||||
<div style="margin: 15px 0 5px 0; font-size: 12px;">Razem brutto: <b><?= number_format( $suma_all * 1.23, 2, '.', ' ' );?> PLN</b></div>
|
||||
<? endif;?>
|
||||
<? endforeach;?>
|
||||
<? endif;?>
|
||||
60
templates/ranker/reports.php
Normal file
60
templates/ranker/reports.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<div class="panel panel-info panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Raporty</span>
|
||||
</div>
|
||||
<div class="panel-heading p5" style="height: auto;">
|
||||
<div class="row mb10 pl5">
|
||||
<div class="col col-xs-12">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-success',
|
||||
'text' => 'Generuj raport',
|
||||
'js' => '$( "#formularz" ).submit(); return false;',
|
||||
'icon' => 'fa-check-circle mr5'
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form method="POST" action="/?p=ranker_reports" id="formularz" class="form-horizontal">
|
||||
<input type="hidden" name="rw" value="create-report" />
|
||||
<div class="row">
|
||||
<div class="col col-md-6">
|
||||
<?= \Html::select(
|
||||
array(
|
||||
'name' => 'report-form',
|
||||
'values' => [
|
||||
'1' => 'Tylko pozycje',
|
||||
'2' => 'Pozycje i koszty'
|
||||
],
|
||||
'label' => 'Rodzaj raportu'
|
||||
)
|
||||
);?>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-4 control-label">Przedział czasowy:</label>
|
||||
<div class="col-lg-8">
|
||||
od <input type="text" name="date-from" class="form-control date" value="<?= date( 'Y-m' );?>-01" style="width: 170px; text-align: right; display: inline-block;" />
|
||||
do <input type="text" name="date-to" class="form-control date" value="<?= date( 'Y-m' );?>-<?= date( 't' );?>" style="width: 170px; text-align: right; display: inline-block;" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-4 control-label">Strony:</label>
|
||||
<div class="col-lg-8">
|
||||
<div class="row">
|
||||
<? if ( is_array( $this -> _sites ) ): foreach ( $this -> _sites as $site ):?>
|
||||
<div class="col-xs-6">
|
||||
<div class="checkbox-custom fill checkbox-primary mt10">
|
||||
<input id="site_<?= $site['id'];?>" type="checkbox" value="<?= $site['id'];?>" name="sites[]" <? if ( in_array( $site['id'], $this -> client['sites'] ) ):?>checked="checked"<? endif;?> />
|
||||
<label for="site_<?= $site['id'];?>"><?= $site['name'];?></label>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
138
templates/ranker/site-edit.php
Normal file
138
templates/ranker/site-edit.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<div class="panel panel-info panel-border top">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title">Edycja strony: <u><?= $this -> site['name'];?></u></span>
|
||||
</div>
|
||||
<div class="panel-heading p5" style="height: auto;">
|
||||
<div class="row mb10 pl5">
|
||||
<div class="col col-xs-12">
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-success',
|
||||
'text' => 'Zatwierdź',
|
||||
'js' => 'checkForm( "formularz" );',
|
||||
'icon' => 'fa-check-circle mr5'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::button(
|
||||
array(
|
||||
'class' => 'btn btn-sm btn-danger',
|
||||
'text' => 'Anuluj',
|
||||
'url' => '/ranker/main_view/id=' . $this -> site['id'],
|
||||
'icon' => 'fa-times mr5'
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form method='POST' action='/ranker/site_save/' id="formularz" class="form-horizontal">
|
||||
<input type="hidden" name="id" value="<?= $this -> site['id'];?>" />
|
||||
<div class="row">
|
||||
<div class="col col-md-6">
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'name',
|
||||
'value' => $this -> site['name'],
|
||||
'class' => 'require',
|
||||
'label' => 'Nazwa'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'url',
|
||||
'value' => $this -> site['url'],
|
||||
'class' => 'require',
|
||||
'label' => 'Url (bez http://)'
|
||||
)
|
||||
)?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'subscription',
|
||||
'class' => 'number-format',
|
||||
'value' => $this -> site['subscription'] != '0.00' ? $this -> site['subscription'] : null,
|
||||
'label' => 'Abonament miesięczny'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'date_start',
|
||||
'class' => 'date',
|
||||
'value' => $this -> site['date_start'] != '0000-00-00' ? $this -> site['date_start'] : null,
|
||||
'label' => 'Data rozpoczęcia'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'date_end',
|
||||
'class' => 'date',
|
||||
'value' => $this -> site['date_end'] != '0000-00-00' ? $this -> site['date_end'] : null,
|
||||
'label' => 'Data zakończenia'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input(
|
||||
array(
|
||||
'name' => 'discount',
|
||||
'class' => 'number-format',
|
||||
'value' => $this -> site['discount'] != '0.00' ? $this -> site['discount'] : null,
|
||||
'label' => 'Rabat w %'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::textarea(
|
||||
array(
|
||||
'name' => 'comments',
|
||||
'id' => 'comment',
|
||||
'value' => $this -> site['comments'],
|
||||
"label" => 'Komentarz'
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input_switch(
|
||||
array(
|
||||
'name' => 'majestic',
|
||||
'label' => 'Sprawdzaj parametry Majestic',
|
||||
'checked' => $this -> site['majestic'] ? 1 : 0,
|
||||
'values' => [
|
||||
'1' => 'tak',
|
||||
'0' => 'nie'
|
||||
]
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input_switch(
|
||||
array(
|
||||
'name' => 'semstorm',
|
||||
'label' => 'Sprawdzaj parametry Semstorm',
|
||||
'checked' => $this -> site['semstorm'] ? 1 : 0,
|
||||
'values' => [
|
||||
'1' => 'tak',
|
||||
'0' => 'nie'
|
||||
]
|
||||
)
|
||||
);?>
|
||||
<?= \Html::input_switch(
|
||||
array(
|
||||
'name' => 'need_confirm',
|
||||
'label' => 'Wymagaj potwierdzenia',
|
||||
'checked' => $this -> site['need_confirm'] ? 1 : 0,
|
||||
'values' => [
|
||||
'1' => 'tak',
|
||||
'0' => 'nie'
|
||||
]
|
||||
)
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/ckeditor.js"></script>
|
||||
<script type="text/javascript" src="/libraries/framework/vendor/plugins/ckeditor/adapters/jquery.js"></script>
|
||||
<script type="text/javascript">
|
||||
$( document ).ready( function ()
|
||||
{
|
||||
$( 'textarea#comment' ).ckeditor(
|
||||
{
|
||||
toolbar : 'Basic',
|
||||
language: 'pl',
|
||||
height:'100'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
1143
templates/ranker/site-list.php
Normal file
1143
templates/ranker/site-list.php
Normal file
File diff suppressed because it is too large
Load Diff
88
templates/ranker/summary.php
Normal file
88
templates/ranker/summary.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<? global $config;?>
|
||||
<div class="panel panel-info panel-border top">
|
||||
<div class="panel-heading" style="height: auto; padding-bottom: 4px;">
|
||||
<div class="row" style="color: #666666;">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 text-centred-xs">
|
||||
<span class="pr25">Netto ogółem: <b><?= $this -> _profit;?></b></span>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-4 text-centred-xs">
|
||||
<select name="month_global" class="form-control ranker-select" id="month_global" onChange="document.location.href='./?p=ranker_summary&id=<?= $this -> _site['id'];?>&year=' + $( '#year_global' ).val() + '&month=' + $( this ).val();">
|
||||
<option value="01" <? if ( $this -> _month == '01' ) echo 'selected="selected"'; ?>>Styczeń</option>
|
||||
<option value="02" <? if ( $this -> _month == '02' ) echo 'selected="selected"'; ?>>Luty</option>
|
||||
<option value="03" <? if ( $this -> _month == '03' ) echo 'selected="selected"'; ?>>Marzec</option>
|
||||
<option value="04" <? if ( $this -> _month == '04' ) echo 'selected="selected"'; ?>>Kwiecień</option>
|
||||
<option value="05" <? if ( $this -> _month == '05' ) echo 'selected="selected"'; ?>>Maj</option>
|
||||
<option value="06" <? if ( $this -> _month == '06' ) echo 'selected="selected"'; ?>>Czerwiec</option>
|
||||
<option value="07" <? if ( $this -> _month == '07' ) echo 'selected="selected"'; ?>>Lipiec</option>
|
||||
<option value="08" <? if ( $this -> _month == '08' ) echo 'selected="selected"'; ?>>Sierpień</option>
|
||||
<option value="09" <? if ( $this -> _month == '09' ) echo 'selected="selected"'; ?>>Wrzesień</option>
|
||||
<option value="10" <? if ( $this -> _month == '10' ) echo 'selected="selected"'; ?>>Październik</option>
|
||||
<option value="11" <? if ( $this -> _month == '11' ) echo 'selected="selected"'; ?>>Listopad</option>
|
||||
<option value="12" <? if ( $this -> _month == '12' ) echo 'selected="selected"'; ?>>Grudzień</option>
|
||||
</select>
|
||||
<select name="year_global" id="year_global" class="form-control ranker-select" onChange="document.location.href='./?p=ranker_summary&id=<?= $this -> _site['id'];?>&year=' + $( this ).val() + '&month=' + $( '#month_global' ).val();">
|
||||
<? for ( $i = date( 'Y') - 2; $i <= date( 'Y') + 2; $i++ ):?>
|
||||
<option value="<?= $i;?>" <? if ( $i == $this -> _year ) echo 'selected="selected"'; ?>><?=$i;?></option>
|
||||
<? endfor;?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row auto-clear">
|
||||
<? if ( is_array( $this -> _clients ) ): foreach ( $this -> _clients as $client ):?>
|
||||
<? if ( $client['type'] != 2 ):?>
|
||||
<div class="col-xs-12 col-sm-6 col-lg-4">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading">
|
||||
<span class="panel-title"><?= $client['login'];?></span>
|
||||
</div>
|
||||
<div class="panel-body p0">
|
||||
<table class="table table-bordered table-condensed table-striped table-hover">
|
||||
<tbody>
|
||||
<? $client_sum = 0;?>
|
||||
<? if ( is_array( $client['sites'] ) ): foreach ( $client['sites'] as $site ):?>
|
||||
<tr>
|
||||
<td><?= $site['name'];?><? if ( $site['subscription'] > 0 ) echo ' (<span class="text-danger">Ab: ' . \S::number_display( $site['subscription'] ) . '</span>)';?></td>
|
||||
<td class="text-right <? if ( $site['subscription'] > 0 ) echo 'text-system';?>">
|
||||
<?
|
||||
$site_sum = 0;
|
||||
|
||||
if ( is_array( $site['phrases'] ) ) foreach ( $site['phrases'] as $phrase )
|
||||
{
|
||||
$discount = '';
|
||||
|
||||
if ( $site['discount'] )
|
||||
$discount = $site['discount'];
|
||||
|
||||
if ( $phrase['discount'] )
|
||||
$discount = $phrase['discount'];
|
||||
|
||||
if ( is_array( $phrase['prices'] ) ) foreach ( $phrase['prices'] as $price )
|
||||
{
|
||||
$price_c = \S::number( $price['price'] - \S::number( $price['price'] * $discount / 100 ) );
|
||||
$site_sum = $site_sum + $price_c * $price['count'];
|
||||
}
|
||||
}
|
||||
$client_sum = $client_sum + $site_sum + $site['subscription'];
|
||||
echo \S::number_display( $site_sum + $site['subscription'] );
|
||||
?>
|
||||
</td>
|
||||
<td class="text-right <? if ( $site['subscription'] > 0 ) echo 'text-system';?>">
|
||||
<?= \S::number_display( ( $site_sum + $site['subscription'] ) * $config['profit']['vat'] );?>
|
||||
</td>
|
||||
</tr>
|
||||
<? endforeach; endif;?>
|
||||
<tr>
|
||||
<td class="text-right">Razem:</td>
|
||||
<td class="alert-dark dark text-right"><?= \S::number_display( $client_sum );?></td>
|
||||
<td class="alert-dark dark text-right"><?= \S::number_display( $client_sum * $config['profit']['vat'] );?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user