first commit

This commit is contained in:
2024-12-12 15:33:18 +01:00
commit 2c8998663e
3360 changed files with 777573 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
<? global $user;?>
<!DOCTYPE html>
<html>
<head>
<title>rank24.pl</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="www.project-pro.pl - internetowe rozwiązania dla biznesu" />
<link rel="stylesheet" href="/libraries/framework/skin/default_skin/css/theme.css" />
<link rel="stylesheet" href="/libraries/framework/admin-tools/admin-forms/css/admin-forms.css" />
<link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700'>
<link rel="stylesheet" href="/libraries/framework/vendor/plugins/magnific/magnific-popup.css">
<link rel="stylesheet" href="/libraries/framework/vendor/plugins/datepicker/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="/libraries/framework/vendor/plugins/colorpicker/css/bootstrap-colorpicker.min.css">
<link rel="Stylesheet" type="text/css" href="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.structure.min.css">
<link rel="Stylesheet" type="text/css" href="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.theme.min.css">
<link rel="Stylesheet" type="text/css" href="/libraries/framework/vendor/plugins/daterange/daterangepicker.css">
<script src="/libraries/framework/vendor/jquery/jquery-1.11.1.min.js"></script>
<script src="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.min.js"></script>
<script src="/libraries/framework/vendor/plugins/magnific/jquery.magnific-popup.js"></script>
<script src="/libraries/framework/vendor/plugins/moment/moment.js"></script>
<script src="/libraries/framework/vendor/plugins/moment/pl.js"></script>
<script src="/libraries/framework/vendor/plugins/datepicker/js/bootstrap-datetimepicker.js"></script>
<script src="/libraries/framework/vendor/plugins/daterange/daterangepicker.js"></script>
<script src="/libraries/framework/vendor/plugins/colorpicker/js/bootstrap-colorpicker.min.js"></script>
<script src="/libraries/functions.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="/layout/style-css/custom.css" />
</head>
<body class="sb-top sb-top-sm">
<div id="main">
<header class="navbar navbar-fixed-top navbar-shadow">
<div class="navbar-branding">
<a class="navbar-brand" href="/?p=dashboard">
<b>rank</b>24
</a>
</div>
<div class="nav navbar-nav navbar-right">
<li class="dropdown menu-merge">
<a href="#" class="dropdown-toggle fw600 p15" data-toggle="dropdown" aria-expanded="false">
<img src="/layout/user-icon.png" alt="avatar" class="mw30 br64 mr15"> <?= $this -> _user['login'];?>
<span class="caret caret-tp hidden-xs"></span>
</a>
<ul class="dropdown-menu list-group dropdown-persist w250" role="menu">
<li class="list-group-item">
<a href="/?rw=user_logout" class="animated animated-short fadeInUp">
<span class="fa fa-power-off"></span>Wyloguj się
</a>
</li>
</ul>
</li>
<li id="toggle_sidemenu_t">
<span class="fa fa-bars"></span>
</li>
</div>
</header>
<aside id="sidebar_left">
<div class="sidebar-left-content nano-content">
<ul class="nav sidebar-menu">
<li>
<a class="accordion-toggle" href="#">
<span class="sidebar-title">Monitoring</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="/ranker_clients/main_view/">Lista stron</a>
</li>
<? if ( $this -> _user['type'] == 'client' ):?>
<li>
<a href="/?p=client_summary">Podsumowanie</a>
</li>
<li>
<a href="/?p=client_reports">Raporty</a>
</li>
<? endif;?>
</ul>
</li>
</ul>
</div>
</aside>
<section id="content_wrapper">
<section id="content">
<? if ( $alert = \S::get_session( 'alert' ) ):
\S::alert( false );
?>
<div class="container-fluid">
<div class="row mb10">
<div class="alert alert-danger col col-xs-12 alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?= $alert;?>
</div>
</div>
</div>
<?
endif; ?>
<?= $this -> _content;?>
</section>
</section>
</div>
<div id="overlay"></div>
<script src="/libraries/framework/js/utility/utility.js"></script>
<script src="/libraries/framework/js/main.js"></script>
<script type="text/javascript">
jQuery( document ).ready( function()
{
"use strict";
Core.init();
});
</script>
</body>
</html>

View File

@@ -0,0 +1,186 @@
<? global $config, $user;?>
<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">
<select name="month_global" class="form-control ranker-select" id="month_global" onChange="document.location.href='./?p=client_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=client_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">
<div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
<div class="panel panel-info panel-border top">
<div class="panel-body p0">
<table class="table table-bordered table-condensed table-striped table-hover">
<thead>
<tr>
<th>Strona</th>
<th class="text-right">Netto</th>
<th class="text-right">Brutto</th>
</tr>
</thead>
<tbody>
<?
$client_sum = 0;
if ( is_array( $this -> _sites ) ) foreach ( $this -> _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'] and !$user['reseller_id'] )
$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>
<?
}
?>
<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>
</div>
<div class="browse" style="margin: 10px 0; clear: both; background: #FFF; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);">
<?
if ( is_array( $this -> _phrases ) )
{
?>
<div id="prices" style="margin: 10px 0;">
<?
$suma = 0;
if ( is_array( $this -> _phrases ) ) 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="phrase-cost">
<div class="phrase-cost-title"><?= $phrase['phrase'];?> <? if ( $discount ):?><span class="discount">rabat <?= $discount;?>%</span><? endif;?></div>
<?
if ( is_array( $phrase['prices'] ) )
{
$sum = 0;
?>
<table class="price_table no">
<thead>
<tr>
<td>Przedział</td>
<td>Stawka</td>
<td>Ilość dni</td>
<td>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><?= $price['start'];?> - <?=$price['end'];?></td>
<td <? if ( $discount ):?> class="discount" <? endif;?>>
<?= $price_c . ' PLN';?>
</td>
<td><?= $price['count'];?></td>
<td>
<?= number_format( $price_c * $price['count'], 2, '.', ' ' ) . ' PLN';?>
</td>
</tr>
<?
$sum = $sum + $price_c * $price['count'];
$suma = $suma + $price_c * $price['count'];
}
?>
<tr>
<td colspan="3" style="text-align: right;">suma:</td>
<td class="header right"><?= number_format( $sum, 2, '.', ' ' );?> PLN</td>
</tr>
</tbody>
</table>
<?
}
?>
</div>
<?
}
}
echo '<div class="clearfix"></div>';
if ( $suma )
{
?>
<div class="group">
<label>Razem netto:</label>
<div class="content">
<?= number_format( $suma, 2, '.', ' ' ) . ' PLN';?>
</div>
</div>
<div class="group">
<label>Razem brutto:</label>
<div class="content">
<?= number_format( $suma * 1.23, 2, '.', ' ' ) . ' PLN';?>
</div>
</div>
<?
}
?>
</div>
<?
}
?>
</div>

View File

@@ -0,0 +1,133 @@
<?
global $user;
$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 ):?>
<? $page['subscription'] ? $suma_all = $page['subscription'] : $suma_all = 0;?>
<? if ( is_array( $page['phrases'] ) ): foreach( $page['phrases'] as $phrase ):?>
<?
$discount = '';
if ( $page['discount'] and !$user['reseller_id'] )
$discount = $page['discount'];
if ( $phrase['discount'] )
$discount = $phrase['discount'];
$suma = 0;
$price_tmp = 0;
?>
<table style="margin: 0 0 10px 0; border-collapse: collapse;">
<? if ( is_array( $phrase['prices'] ) ): foreach ( $phrase['prices'] as $price ):?>
<?
if ( $discount > 0 )
$price_tmp += number_format( number_format( $price['price'] - ( $price['price'] * $discount / 100 ), 2 ) * $price['count'], 2, '.', ' ' );
else
$price_tmp += number_format( $price['price'] * $price['count'], 2, '.', ' ' );
?>
<? endforeach; endif;?>
<? if ( $price_tmp > 0 ):?>
<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 and !$user['reseller_id'] ):?><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;?>
<? endif;?>
<? if ( $suma > 0 ):?>
<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>
<? endif;?>
</table>
<? endforeach; endif;?>
<? if ( $page['subscription'] ):?>
<div style="margin: 15px 0 5px 0; font-size: 12px;">Abonament: <b><?= number_format( $page['subscription'], 2, '.', ' ' );?> PLN</b></div>
<? endif;?>
<? if ( $suma_all > 0 ):?>
<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;?>
<? endif;?>
<? endforeach;?>
<? endif;?>

View 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=client_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[]" checked="checked">
<label for="site_<?= $site['id'];?>"><?= $site['name'];?></label>
</div>
</div>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>

View File

@@ -0,0 +1,58 @@
<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' => '/?p=ranker_sites',
'icon' => 'fa-times mr5'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method='POST' action='./?p=ranker_sites' id="formularz" class="form-horizontal">
<input type="hidden" name="rw" value="save" />
<input type="hidden" name="id" value="<?= $this -> _site['id'];?>" />
<div class="row">
<div class="col col-md-6">
<?= \Html::textarea(
array(
'name' => 'comments',
'id' => 'comment',
'value' => $this -> _site['comments'],
"label" => 'Komentarz'
)
);?>
</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>

View File

@@ -0,0 +1,318 @@
<? global $config, $user;?>
<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_clients/main_view/id=' . $this -> prev_site_id,
'icon' => 'fa-backward'
)
);?>
<?= \Html::button(
array(
'class' => 'btn-sm btn-default',
'title' => 'Następna strona',
'url' => '/ranker_clients/main_view/id=' . $this -> next_site_id,
'icon' => 'fa-forward'
)
);?>
<select name="page" class="form-control ranker-select" id="page" onChange="var id = $(this).val(); document.location.href='/ranker_clients/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 'Abonament: <b>' . \S::number( $this -> site['subscription'] ) . ' zł</b>';?>
</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_clients/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_clients/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_clients/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_clients/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"></div>
</div>
<? if ( is_array( $this -> phrases ) ): 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">
<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>
</div>
</div>
<? endforeach; endif;?>
</div>
<div class="right-column">
<div class="table-responsive" style="padding-left: 0;">
<?
$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 table-hover">
<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 ) ):?>
<? 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><?= empty( $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 == '' and $this -> year . '-' . $this -> month . '-' . $d == date( 'Y-m-d' ) and $class != 'end position' ) echo 'class="spin"';?>>
<?= $pos;?>
<?
if ( $pos == '' and $this -> year . '-' . $this -> month . '-' . $d == date( 'Y-m-d' ) and $class != 'end position' )
echo '<i class="fa fa-refresh"></i>';
?>
</span>
</td>
<? endfor;?>
</tr>
<? endforeach;?>
<? endif;?>
</tbody>
</table>
</div>
</div>
</div>
<!-- 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;?>