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;?>

View File

@@ -0,0 +1,98 @@
<?
$grid = new \gridEdit;
$grid -> id = 'cron';
$grid -> include_plugins = true;
$grid -> title = 'Cron';
$grid -> default_buttons = false;
$grid -> external_code = '<div class="countdown callback"></div><div id="cron-container"></div>';
echo $grid -> draw();
?>
<script type="text/javascript" src="/libraries/countdown/jquery.countdown.js"></script>
<script type="text/javascript">
var delay = 1;
$( document ).ready( function()
{
$( 'header, aside' ).remove();
$( '#content_wrapper' ).css( 'margin', '0px' );
$( '.countdown.callback' ).countdown(
{
date: +(new Date) + 1000,
render: function(data)
{
$( this.el ).text( this.leadingZeros( data.sec, 2 ) + " sek" );
},
onEnd: function()
{
$( this.el ).addClass( 'ended' );
cron();
}
}).stop();
});
function cron()
{
$( '.msg:gt(48)' ).remove();
$.ajax(
{
type: 'POST',
cache: false,
url: '/cron.php',
timeout: ( 30 * 1000 ),
data:
{
cron: 'true'
},
beforeSend: function()
{
jQuery( '#cron-container' ).css( 'opacity', '0.8' );
},
success: function( data )
{
response = jQuery.parseJSON( data );
jQuery( '#cron-container' ).css( 'opacity', '1' );
if ( response.status === 'empty' )
{
delay++;
if ( delay > 120 )
delay = 120;
$( '.countdown.callback' ).removeClass('ended').data('countdown').update( +( new Date ) + delay * 1000 ).start();
if ( !isNaN( response.msg ) )
$( '#cron-container' ).prepend( '<div class="msg">' + response.msg + '</div>' );
else
$( '#cron-container' ).prepend( '<div class="msg">W tej chwili nie ma nic do wykonania.</div>' );
}
else
{
delay = 1;
$( '#cron-container' ).prepend( '<div class="msg">' + response.msg + '</div>' );
$( '.countdown.callback' ).removeClass('ended').data('countdown').update( +( new Date ) + 1000 ).start();
}
},
error: function(data)
{
delay++;
if ( delay > 120 )
delay = 120;
$( '#cron-container' ).prepend( '<div class="msg">Błąd podczas połączenia.</div>' );
$( '.countdown.callback' ).removeClass('ended').data('countdown').update( +( new Date ) + delay * 1000 ).start();
},
statusCode:
{
500: function() {
delay++;
if ( delay > 120 )
delay = 120;
$( '#cron-container' ).prepend( '<div class="msg">Błąd podczas połączenia.</div>' );
$( '.countdown.callback' ).removeClass('ended').data('countdown').update( +( new Date ) + delay * 1000 ).start();
}
}
});
}
</script>

28
templates/html/button.php Normal file
View File

@@ -0,0 +1,28 @@
<?
$out = '<a ';
$out .= 'class="btn ' . $this -> params['class'] . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
if ( $this -> params['js'] )
$out .= 'onclick="' . htmlspecialchars( $this -> params['js'] ) . '" ';
if ( $this -> params['url'] )
$out .= 'href="' . htmlspecialchars( $this -> params['url'] ) . '" ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['title'] )
$out .= 'title="' . htmlspecialchars( $this -> params['title'] ) . '" ';
if ( is_array( $this -> params['attr'] ) ) foreach ( $this -> params['attr'] as $key => $val )
$out .= $key . '="' . $val . '" ';
$out .= '>';
if ( $this -> params['icon'] )
$out .= '<i class="fa ' . $this -> params['icon'] . '"></i>';
$out .= $this -> params['text'];
$out .= '</a>';
echo $out;

View File

@@ -0,0 +1,8 @@
<div class="form-group">
<label class="col-lg-4 control-label"><?= $this -> params['label'];?><? if ( $this -> params['label'] ) echo ':';?></label>
<div class="col-lg-8">
<p class="form-control-static" id="<?= $this -> params['id'];?>">
<?= $this -> params['text'];?>
</p>
</div>
</div>

View File

@@ -0,0 +1,64 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
$out .= '">';
}
$out .= '<div class="input-group">';
$out .= '<input ';
$out .= 'type="' . $this -> params['type'] . '" ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
$out .= 'name="' . $this -> params['name'] . '" ';
$out .= 'value="' . $this -> secureHTML( $this -> params['value'] ) . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
if ( $this -> params['readonly'] )
$out .= 'readonly="readonly" ';
if ( $this -> params['autocomplete'] == 'off' )
$out .= 'autocomplete="off" ';
$out .= ' />';
$out .= '<span class="input-group-addon btn btn-info"';
if ( $this -> params['icon_js'] )
$out .= 'onclick="' . htmlspecialchars( $this -> params['icon_js'] ) . '" ';
$out .= '>';
$out .= $this -> params['icon_content'];
$out .= '</span>';
$out .= '</div>';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

View File

@@ -0,0 +1,36 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group">';
$out .= '<label class="col-lg-4 control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="col-lg-8 pt5">';
}
$out .= '<div class="switch switch-primary round switch-inline">';
$out .= '<input ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
else
$out .= 'id="' . $this -> params['name'] . '" ';
$out .= 'name="' . $this -> params['name'] . '" type="checkbox"';
if ( $this -> params['checked'] )
$out .= 'checked="checked" ';
$out .= '>';
$out .= '<label for="';
if ( $this -> params['id'] )
$out .= $this -> params['id'];
else
$out .= $this -> params['name'];
$out .= '"></label>';
$out .= '</div>';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

54
templates/html/input.php Normal file
View File

@@ -0,0 +1,54 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
$out .= '">';
}
$out .= '<input ';
$out .= 'type="' . $this -> params['type'] . '" ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
$out .= 'name="' . $this -> params['name'] . '" ';
$out .= 'value="' . $this -> secureHTML( $this -> params['value'] ) . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
if ( $this -> params['readonly'] )
$out .= 'readonly="readonly" ';
if ( $this -> params['autocomplete'] == 'off' )
$out .= 'autocomplete="off" ';
$out .= ' />';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

8
templates/html/panel.php Normal file
View File

@@ -0,0 +1,8 @@
<div class="panel <?= $this -> params['class'];?>">
<div class="panel-heading">
<span class="panel-title"><?= $this -> params['title'];?></span>
</div>
<div class="panel-body">
<?= $this -> params['content'];?>
</div>
</div>

56
templates/html/select.php Normal file
View File

@@ -0,0 +1,56 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
$out .= '">';
}
$out .= '<select ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
$out .= 'name="' . $this -> params['name'] . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
$out .= '>';
if ( $this -> params['empty'] )
$out .= '<option value="">--- ' . mb_strtolower( $this -> params['label'], 'UTF-8' ) . ' ---</option>';
if ( is_array( $this -> params['values'] ) ) foreach ( $this -> params['values'] as $key => $val )
{
$out .= '<option value="' . $key . '"'; if ( $key == $this -> params['value'] ) $out .= 'selected="selected"'; $out .='>' . $val . '</option>';
}
$out .= '</select>';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

View File

@@ -0,0 +1,46 @@
<?
if ( $this -> params['label'] )
{
$out .= '<div class="form-group ';
if ( $this -> params['inline'] )
$out .= 'pl10 pr10';
$out .= '">';
$out .= '<label class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-4 ';
if ( $this -> params['inline'] )
$out .= 'mb5 ';
$out .= 'control-label">' . $this -> params['label'] . ':</label>';
$out .= '<div class="';
if ( !$this -> params['inline'] )
$out .= 'col-lg-8';
$out .= '">';
}
$out .= '<textarea ';
if ( $this -> params['id'] )
$out .= 'id="' . $this -> params['id'] . '" ';
if ( $this -> params['class'] or $this -> params['label'] )
{
if ( $this -> params['label'] )
$out .= 'class="' . $this -> params['class'] . ' form-control" ';
else if ( $this -> params['class'] )
$out .= 'class="' . $this -> params['class'] . '" ';
}
$out .= 'name="' . $this -> params['name'] . '" ';
if ( $this -> params['style'] )
$out .= 'style="' . $this -> params['style'] . '" ';
$out .= ' rows="' . $this -> params['rows'] . '">' . $this -> secureHTML( $this -> params['value'] ) . '</textarea>';
if ( $this -> params['label'] )
{
$out .= '</div>';
$out .= '</div>';
}
echo $out;

View File

@@ -0,0 +1,31 @@
<div class="action-icons">
<a class='btn btn_add' onClick='$("#import").submit();'>Importuj</a>
<a class="btn btn_cancel" href="./">Anuluj</a>
</div>
<div class="browse">
<div class="edit-row">
<form method='POST' action='index.php?rw=import' id='import'>
<div class="group">
<label>Kategoria</label>
<div class="content">
<select name="category_id">
<option value="0">---- wybierz kategorię ----</option>
<?
if ( is_array( $this -> _categories ) ) foreach ( $this -> _categories as $cat )
{
echo '<option value="' . $cat['id'] . '">' . $cat['category'] . '</option>';
}
?>
</select>
</div>
</div>
<div class="group">
<label>Tekst</label>
<div class="content">
<textarea name='text' style="width: 700px; height: 200px;"></textarea>
</div>
<div class="clearfix"></div>
</div>
</form>
</div>
</div>

View File

@@ -0,0 +1,47 @@
<? if ( is_array( $this -> _messages ) ):?>
<div id="messages">
<div id="title"><span class="icon right" onclick="showMessages();"></span>Komunikaty:</div>
<div id="content">
<? foreach ( $this -> _messages as $msg ):?>
<div class="message">
<div class="text">
<a href="<?= $msg['link'];?>">
<?= $msg['text'];?>
</a>
</div>
<a class="delete" href="#" onclick="$( this ).parent( '.message' ).hide(); xajax_markMessageAsReaded( <?= $msg['id'];?> ); return false;">
<i class="icon-delete"></i>
</a>
<div class="date"><span><?= date( 'H:i', strtotime( $msg['date'] ) );?></span><br /><?= date( 'Y-m-d', strtotime( $msg['date'] ) );?></div>
<div class="clearfix"></div>
</div>
<? endforeach;?>
</div>
</div>
<div id="messages-show">
<span class="icon left" onclick="hideMessages();"></span>
</div>
<? endif; ?>
<script type="text/javascript">
function showMessages() {
$( "#messages" ).animate({
right: "-400"
}, 500, function(){
$( "#messages-show" ).animate({
right: "0"
}, 500
)
});
}
function hideMessages() {
$( "#messages-show" ).animate({
right: "-35"
}, 500, function(){
$( "#messages" ).animate({
right: "0"
}, 500
)
});
}
</script>

View File

@@ -0,0 +1,72 @@
<?
if ( $this -> _back || $this -> _save || $this -> _save_ajax || $this -> _cancel || $this -> _add || $this -> _update )
{
?>
<div class="action-icons">
<?
if ( $this -> _back )
{
?>
<div class='icon' onClick='document.location.href="index.php?act=back";'>
<i class="img back mr5"></i>
Wstecz
</div>
<?
}
if ( $this -> _save )
{
?>
<a class="btn btn_add"href="#" onclick='$( "#<?= $this -> _id_form;?>" ).submit(); return false;'>
<?= $this -> _save === true ? $tmp = 'Zatwierdź' : $tmp = $this -> _save;?>
</a>
<?
}
if ( $this -> _save_ajax )
{
?>
<div class='btn' onClick='<?= $this -> _save_ajax;?>'>
<i class="img save-ajax mr5"></i>
Zapisz
</div>
<?
}
if ( $this -> _cancel )
{
?>
<a href="./" class="btn btn_cancel">
Anuluj
</a>
<?
}
if ( $this -> _add )
{
?>
<a href="/?rw=add" class="btn btn_add">
<?= $this -> _add === true ? $tmp = 'Dodaj' : $tmp = $this -> _add;?>
</a>
<?
}
if ( $this -> _update )
{
?>
<div class='btn' onClick='document.location.href="index.php?rw=update";'>
<img src='../images/sico_update.png'>
Aktualizuj
</div>
<?
}
if ( $this -> _checkbox )
{
?>
<div class='btn btn_delete' onClick='<?= $this -> _checkbox['action'];?>'>
<i class="img delete-ajax mr5"></i>
<?= $this -> _checkbox['name'];?>
</div>
<?
}
?>
</div>
<?
}

40
templates/other/pager.php Normal file
View File

@@ -0,0 +1,40 @@
<div id='pagin' style="margin-top: 10px;">
<div id="info">
Rekordy: <?= $this -> _start > $this -> _count ? $tmp = $this -> _count : $tmp = $this -> _start;?> - <?= $this -> _end > $this -> _count ? $tmp = $this -> _count : $tmp = $this -> _end;?> z <?= $this -> _count;?>
</div>
<div id="pagings" style="min-width: 300px;">
<?
if ( $this -> _bs > 1 )
{
?>
<a href='./?<?= $this -> _link;?>bs=1' class='arrow' title="piersza"><i class="icon-left-max"></i></a>
<a href='./?<?= $this -> _link;?>bs=<?= ( $this -> _bs - 1 );?>' class='arrow' title="poprzednia"><i class="icon-left"></i></a>
<?
}
else
{
?>
<a class='arrow inactive'><i class="icon-left-max"></i></a>
<a class='arrow inactive'><i class="icon-left"></i></a>
<?
}
?>
<input type='text' value='<?= $this -> _bs;?>' class="input-text center" id='page-bs' onKeyPress='changePage(event)'>
<?
if ( $this -> _bs < $this -> _ls )
{
?>
<a href='./?<?= $this -> _link;?>bs=<?= ( $this -> _bs + 1 );?>' class='arrow' title="następna"><i class="icon-right"></i></a>
<a href='./?<?= $this -> _link;?>bs=<?= $this -> _ls;?>' class='arrow' title="ostatnia"><i class="icon-right-max"></i></a>
<?
}
else
{
?>
<a class='arrow inactive'><i class="icon-right"></i></a>
<a class='arrow inactive'><i class="icon-right-max"></i></a>
<?
}
?>
</div>
</div>

View File

@@ -0,0 +1,155 @@
<? global $settings;?>
<script type="text/javascript">
jQuery(function() {
$( '#slider-code' ).tinycarousel({
pager: true
});
$( "#sites-page-rank" ).slider({
min: 1,
max: 14,
value: <?= (int)$settings['sites-page-rank'];?>,
slide: function( event, ui ) {
$( "#sites-page-rank-val" ).html( ui.value + " dni" );
},
change: function( event, ui ) {
xajax_saveSettings( 'sites-page-rank', ui.value );
}
});
$( "#sites-page-rank-val" ).html( $( "#sites-page-rank" ).slider( "value" ) + " dni" );
$( "#sites-google-site" ).slider({
min: 1,
max: 14,
value: <?= (int)$settings['sites-google-site'];?>,
slide: function( event, ui ) {
$( "#sites-google-site-val" ).html( ui.value + " dni" );
},
change: function( event, ui ) {
xajax_saveSettings( 'sites-google-site', ui.value );
}
});
$( "#sites-google-site-val" ).html( $( "#sites-google-site" ).slider( "value" ) + " dni" );
$( "#cron-proxy-limit" ).slider({
min: 1,
max: 14,
value: <?= (int)$settings['cron-proxy-limit'];?>,
slide: function( event, ui ) {
$( "#cron-proxy-limit-val" ).html( ui.value );
},
change: function( event, ui ) {
xajax_saveSettings( 'cron-proxy-limit', ui.value );
}
});
$( "#cron-proxy-limit-val" ).html( $( "#cron-proxy-limit" ).slider( "value" ) );
$( "#cron-proxy-php" ).slider({
min: 1,
max: 14,
value: <?= (int)$settings['cron-proxy-php'];?>,
slide: function( event, ui ) {
$( "#cron-proxy-php-val" ).html( ui.value );
},
change: function( event, ui ) {
xajax_saveSettings( 'cron-proxy-php', ui.value );
}
});
$( "#cron-proxy-php-val" ).html( $( "#cron-proxy-php" ).slider( "value" ) );
$( "#cron-proxy-http" ).slider({
min: 1,
max: 14,
value: <?= (int)$settings['cron-proxy-http'];?>,
slide: function( event, ui ) {
$( "#cron-proxy-http-val" ).html( ui.value );
},
change: function( event, ui ) {
xajax_saveSettings( 'cron-proxy-http', ui.value );
}
});
$( "#cron-proxy-http-val" ).html( $( "#cron-proxy-http" ).slider( "value" ) );
$( "#smonitor" ).slider({
min: 1,
max: 720,
value: <?= (int)$settings['smonitor'];?>,
slide: function( event, ui ) {
$( "#smonitor-val" ).html( ui.value );
},
change: function( event, ui ) {
xajax_saveSettings( 'smonitor', ui.value );
}
});
$( "#smonitor-val" ).html( $( "#smonitor" ).slider( "value" ) );
});
</script>
<style type="text/css">
.ui-widget-content {
background: #e1e4e9;
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
border: 0;
}
.ui-widget-content {
height: 15px;
}
.ui-corner-all {
border-radius: 0;
}
.ui-slider .ui-slider-handle {
height: 23px;
background: #5191d1;
border: 0;
}
</style>
<div class="edit-row">
<form method='POST' action='./' id='formularz'>
<input type='hidden' name='rw' value='save_settings'>
<div id="slider-code">
<ul class="pager">
<li><a rel="1" class="pagenum" href="#"><span class="badge">1</span>Cron</a></li>
</ul>
<a class="buttons prev tip" href="#" title="Wstecz">
<img src="../../images/system/img-left.png" />
</a>
<div class="viewport">
<ul class="overview">
<li>
<div class="slide-title">Cron</div>
<div id="tabs" class="tabs-container">
<div class="group">
<label>Liczba połączeń przez proxy:</label>
<div class="content">
<div id="cron-proxy-limit" class="slider"></div>
<div id="cron-proxy-limit-val" class="slider-value"></div>
</div>
</div>
<div class="group">
<label>Liczba spr. proxy PHP:</label>
<div class="content">
<div id="cron-proxy-php" class="slider"></div>
<div id="cron-proxy-php-val" class="slider-value"></div>
</div>
</div>
<div class="group">
<label>Liczba spr. proxy HTTP:</label>
<div class="content">
<div id="cron-proxy-http" class="slider"></div>
<div id="cron-proxy-http-val" class="slider-value"></div>
</div>
</div>
<div class="group">
<label>Sprawdzaj stan stron co:</label>
<div class="content">
<div id="smonitor" class="slider"></div>
<div id="smonitor-val" class="slider-value"></div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</form>
</div>

View File

@@ -0,0 +1,131 @@
<!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="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wdth,wght@0,75..100,300..800;1,75..100,300..800&display=swap" rel="stylesheet">
<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" 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">
<link rel="stylesheet" type="text/css" href="/libraries/jquery-confirm/jquery-confirm.min.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 type="text/javascript" src="/libraries/jquery-confirm/jquery-confirm.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=statistics_general">
<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['surname'] . ' ' . $this -> _user['name'];?>
<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 href="/?p=dashboard">
<span>Pulpit</span>
</a>
</li>
<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/main_view/">Lista stron</a>
</li>
<li>
<a href="/?p=ranker_clients">Lista klientów</a>
</li>
<li>
<a href="/?p=ranker_summary">Podsumowanie</a>
</li>
<li>
<a href="/?p=ranker_reports">Raporty</a>
</li>
</ul>
</li>
<!--<li>
<a href="/?p=cron">
<span class="sidebar-title">Cron</span>
</a>
</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>
<div id="ajax-container"></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,99 @@
<!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" href="/layout/style-css/custom.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body class="external-page sb-l-c sb-r-c">
<div id="main" class="animated fadeIn">
<section id="content_wrapper">
<div id="canvas-wrapper">
<canvas id="demo-canvas"></canvas>
</div>
<section id="content">
<div class="admin-form theme-info">
<div class="row mb15 table-layout">
<div class="col-xs-12">
<div class="login-links">
<a href="#"><b>rank</b>24</a>
</div>
</div>
</div>
<div class="panel panel-info br-n heading-border bg-white">
<div class="panel-body">
<div class="section-divider mb40">
<span>Logowanie</span>
</div>
<? if ( $alert = \S::get_session( 'alert' ) ):
\S::alert( false );
?>
<div class="container-fluid">
<div class="row">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="icon fa fa-ban pr10"></i><?= $alert;?>
</div>
</div>
</div>
<?
endif; ?>
<form method="POST" action="/" class="form-horizontal" rol="form">
<input type="hidden" name="rw" value="user_login" />
<div class="form-group">
<label class="col col-sm-2 control-label" for="login">Login:</label>
<div class="col col-sm-10">
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user"></i>
</span>
<input type="text" name="login" id="login" class="form-control" placeholder="Login" />
</div>
</div>
</div>
<div class="form-group">
<label class="col col-sm-2 control-label" for="password">Hasło:</label>
<div class="col col-sm-10">
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-lock"></i>
</span>
<input type="password" name="password" id="password" class="form-control" placeholder="Hasło" />
</div>
</div>
</div>
<div class="form-group">
<div class="col col-sm-10 col-sm-offset-2">
<button class="btn btn-primary btn-flat btn-sm btn-block">Zaloguj się</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
</section>
</div>
<script src="/libraries/framework/js/utility/utility.js"></script>
<script src="/libraries/framework/vendor/plugins/canvasbg/canvasbg.js"></script>
<script type="text/javascript">
jQuery( document ).ready( function()
{
$( '#login' ).focus();
"use strict";
CanvasBG.init({
Loc: {
x: window.innerWidth / 2,
y: window.innerHeight / 3.3
}
});
});
</script>
</body>
</html>

View 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>

View 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>

View 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>

View 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>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
CF: <a href="#" class="chart" type="cf" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> majestic['cf'];?></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
BL: <a href="#" class="chart" type="bl" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> majestic['feb'];?></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
RD: <a href="#" class="chart" type="rd" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> majestic['rd'];?></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
<? 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>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
Top10: <a href="#" class="chart" type="top10" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> semstorm['top10'];?></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
Top50: <a href="#" class="chart" type="top50" site-id="<?= $this -> site['id'];?>" site-url="<?= $this -> site['url'];?>"><?= $this -> semstorm['top50'];?></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
<? 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>

View 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ł' +
'&nbsp;<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>

View 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>

View 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;?>

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=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>

View 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>

File diff suppressed because it is too large Load Diff

View 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>

View File

@@ -0,0 +1,89 @@
<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=reseller_clients',
'icon' => 'fa-times mr5'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method="POST" action="/?p=reseller_clients" id="formularz" class="form-horizontal">
<input type="hidden" name="reseller_id" value="<?= $this -> _reseller_id;?>" />
<? 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'
]
)
);?>
<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>
<script type='text/javascript'>
$( function()
{
disable_menu();
});
</script>

View File

@@ -0,0 +1,101 @@
<? 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-' . $user['id'] );
$grid -> sql = 'SELECT '
. 'id, login, enabled '
. 'FROM '
. 'pro_rr_clients AS prc '
. 'WHERE '
. 'reseller_id = ' . $user['id'] . ' [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) '
. 'FROM '
. 'pro_rr_clients '
. 'WHERE '
. 'reseller_id = ' . $user['id'] . ' [where] ';
$grid -> debug = true;
$grid -> gdb_opt = $gdb;
$grid -> limit = 50;
$grid -> search = [
[ 'name' => 'Login', 'db' => 'login', 'type' => 'text' ]
];
$grid -> order = [ 'column' => 'login', 'type' => 'ASC' ];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Login',
'db' => 'login',
'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=reseller_clients&rw=edit&id=[id]' ],
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/?p=reseller_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=reseller_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>

View File

@@ -0,0 +1,190 @@
<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'
)
);?>
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-danger',
'text' => 'Anuluj',
'url' => '/?p=client_sites',
'icon' => 'fa-times'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method="POST" action="/?p=client_sites&id=<?= $this -> _site_id;?>" 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'];?>'>
<input type="hidden" name="reseller_id" value="<?= $this -> _reseller_id;?>" />
<input type='hidden' name='rw' value='save_costs' />
<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="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">
stawka / stawka 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>
</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()
{
disable_menu();
});
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ł' +
'&nbsp;<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 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>

View File

@@ -0,0 +1,112 @@
<!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">
<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/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="/?p=reseller_sites">Lista stron</a>
</li>
<li>
<a href="/?p=reseller_clients">Lista klientów</a>
</li>
<li>
<a href="/?p=reseller_summary">Podsumowanie</a>
</li>
<li>
<a href="/?p=reseller_reports">Raporty</a>
</li>
</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,54 @@
<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' => '/?p=reseller_sites',
'icon' => 'fa-times mr5'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method="POST" action="/?p=client_sites&id=<?= $this -> _site_id;?>" 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'];?>' />
<input type='hidden' name='check' value='<?= mktime();?>' />
<input type='hidden' name='rw' value='save_phrase' />
<input type="hidden" name="reseller_id" value="<?= $this -> _reseller_id;?>" />
<div class="row">
<div class="col col-md-6">
<?= \Html::input(
array(
'name' => 'discount',
'value' => $this -> _phrase['discount'],
'label' => 'Rabat w %',
'class' => 'number-format'
)
);?>
</div>
</div>
</form>
</div>
</div>
<script type='text/javascript'>
$( function()
{
disable_menu();
});
</script>

View File

@@ -0,0 +1,177 @@
<? 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">
<select name="month_global" class="form-control ranker-select" id="month_global" onChange="document.location.href='./?p=reseller_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=reseller_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="alert alert-dark light p5">
<small>Stawki podstawowe</small>
</div>
<div class="row">
<div class="col-xs-12">
<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'];?></td>
<td class="text-right">
<?
$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;
echo \S::number_display( $site_sum );
?>
</td>
<td class="text-right">
<?= \S::number_display( $site_sum * $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>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
<div class="alert alert-dark light p5">
<small>Stawki resellera</small>
</div>
<div class="row">
<div class="col-xs-12">
<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_res ) ) foreach ( $this -> _sites_res as $site )
{
?>
<tr>
<td><?= $site['name'];?></td>
<td class="text-right">
<?
$site_sum = 0;
if ( is_array( $site['phrases'] ) ) foreach ( $site['phrases'] as $phrase )
{
$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;
echo \S::number_display( $site_sum );
?>
</td>
<td class="text-right">
<?= \S::number_display( $site_sum * $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>
</div>
<script type="text/javascript">
$( document ).ready( function() {
$( 'td.position' ).dblclick( function() {
var id = $( this ).attr( 'id' );
$( 'td#' + id ).children( 'span' ).addClass( 'hide' );
$( 'td#' + id ).children( 'input' ).removeClass( 'hide' ).focus();
})
$( '.new-pos' ).blur( function() {
var date = $( this ).parent( 'td' ).attr( 'date' );
var position = $( this ).val();
var phrase_id = $( this ).parent( 'td' ).attr( 'phrase' );
xajax_changePhrasePosition( phrase_id, date, position );
$( this ).addClass( 'hide' );
$( this ).parent( 'td' ).children( 'span' ).html( position ).removeClass( 'hide' );
})
})
</script>

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=reseller_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>

View File

@@ -0,0 +1,587 @@
<? 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-6 col-lg-6 text-centred-xs text-centred-sm">
<div class="btn-group">
<?= \Html::button(
array(
'class' => 'btn-sm btn-default btn-gradient',
'title' => 'Poprzednia strona',
'url' => '/?p=client_sites&id=' . $this -> _prev_site_id,
'icon' => 'fa-backward'
)
);?>
<?= \Html::button(
array(
'class' => 'btn-sm btn-default btn-gradient',
'title' => 'Następna strona',
'url' => '/?p=client_sites&id=' . $this -> _next_site_id,
'icon' => 'fa-forward'
)
);?>
</div>
<select name="page" class="form-control ranker-select" id="page" onChange="var id = $(this).val(); document.location.href='./?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>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-2 text-centred-xs hidden-md hidden-xs hidden-sm">
<a href="http://<?= $this -> _site['url'];?>" target="_blank"><?= $this -> _site['url'];?></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 text-centred-xs text-centred-sm text-right">
<select name="month_global" class="form-control ranker-select" id="month_global" onChange="document.location.href='./?p=client_sites&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_sites&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="panel hidden-sm hidden-md hidden-lg">
<div class="panel-body p0">
<div class="row">
<?
if ( is_array( $this -> _phrases ) ) foreach ( $this -> _phrases as $phrase )
{
$phrase_class = '';
if ( new DateTime( $phrase['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="col-xs-12">
<div style="<? if ( $phrase['color'] ) echo 'border-top: 5px solid ' . $phrase['color'];?>">
<div class="text-left p5" >
<a href="http://www.google.pl/search?q=<?= urlencode( $phrase['phrase'] );?>&num=10&ie=utf8&hl=pl&start=<?= $start;?><? if ( $phrase['localization'] ) echo '&uule=' . \factory\Ranker::uule( $phrase['localization'] );?>" target="_blank" title="<?= $phrase['phrase'];?>" class="<?= $phrase_class;?>">
<?= $phrase['phrase'];?>
</a>
<div class="page-options fr">
<a href="./?rw=edit_phrase&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Edytuj wybraną frazę">
<i class="fa fa-file-text text-dark" style="font-size: 14px; margin: 0 5px;"></i>
</a>
<a href="./?rw=edit_costs_reseller&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Definiuj własne zakresy">
<i class="fa fa-list text-dark" style="font-size: 14px; margin: 0 5px; position: relative; top: 1px;"></i>
</a>
</div>
<a href="<?= $phrase['last_url'];?>" class="text-muted small clearfix" target="_blank" title="<?= $phrase['last_url'];?>">
<?= $phrase['last_url'];?>
</a>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="table-responsive" <? if ( $z++ < 1 ):?>id="positions-xs"<? endif;?>>
<?
$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 table-positions">
<thead>
<tr>
<th class="text-center" <? if ( $z < 2 ):?>id="date-xs-<?= date( 'Y-m-d', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );?>"<? endif;?>><?= date( 't', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );?></th>
<? for ( $i = 1; $i <= $days; $i++ ):?>
<th class="text-center" <? if ( $z < 2 ):?>id="date-xs-<?= date( 'Y-m-d', strtotime( $this -> _year . '-' . $this -> _month . '-' . $i ) );?>"<? endif;?>><?= $i;?></th>
<? endfor;?>
</tr>
</thead>
<tbody>
<tr style="height: 45px;">
<?
$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' ) ) )
$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="<?= $phrase['id'];?>" date="<?= $date_tmp;?>" <? if ( $map ):?> style="box-shadow: inset 0 0 10px rgba( 0, 0, 0, 0.4 );"<? endif;?> title="<?= $url;?>">
<span><?= $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' ) ) )
$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'] . '-' . $this -> _year . '-' . $this -> _month . '-' . $d;?>" phrase="<?= $phrase['id'];?>" date="<?= $this -> _year . '-' . $this -> _month . '-' . $d;?>" <? if ( $map ):?> style="box-shadow: inset 2px 2px 10px rgba( 0, 0, 0, 0.5 );"<? endif;?> title="<?= $url;?>">
<span><?= $pos;?></span>
</td>
<? endfor;?>
</tr>
</tbody>
</table>
</div>
</div>
<?
}
?>
</div>
</div>
</div>
<div class="panel hidden-xs">
<div class="panel-body" style="padding: 0px;">
<div class="row">
<div class="col-sm-5 col-md-4 col-lg-3">
<table class="table table-bordered table-striped table-condensed" id="table-phrases">
<thead>
<tr>
<th class="title">Fraza</th>
</tr>
</thead>
<tbody>
<?
if ( is_array( $this -> _phrases ) ) foreach ( $this -> _phrases as $phrase )
{
$phrase_class = '';
if ( new DateTime( $phrase['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;
}
?>
<tr style="height: 45px;">
<td>
<div class="text-right" >
<a href="http://www.google.pl/search?q=<?= urlencode( $phrase['phrase'] );?>&num=10&ie=utf8&hl=pl&start=<?= $start;?><? if ( $phrase['localization'] ) echo '&uule=' . \factory\Ranker::uule( $phrase['localization'] );?>" target="_blank" title="<?= $phrase['phrase'];?>" class="a-icon <?= $phrase_class;?>">
<?= $phrase['phrase'];?>
</a>
<div class="page-options">
<a href="./?rw=edit_phrase&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Edytuj wybraną frazę">
<i class="fa fa-file-text text-dark" style="font-size: 14px; margin: 0 5px;"></i>
</a>
<a href="./?rw=edit_costs_reseller&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Definiuj własne zakresy">
<i class="fa fa-list text-dark" style="font-size: 14px; margin: 0 5px; position: relative; top: 1px;"></i>
</a>
</div>
<a href="<?= $phrase['last_url'];?>" class="text-muted small clearfix phrase_url" target="_blank" title="<?= $phrase['last_url'];?>">
<?= $phrase['last_url'];?>
</a>
</div>
</td>
</tr>
<?
}
?>
</tbody>
</table>
</div>
<div class="col-sm-7 col-md-8 col-lg-9">
<div class="table-responsive" id="positions-not-xs">
<?
$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 table-positions">
<thead>
<tr>
<th class="text-center" 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" 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 style="height: 45px;">
<?
$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' ) ) )
$class = 'end position';
if ( $pos != '' )
$pos = $pos;
else
$pos = '-';
?>
<td class="position text-center small <?= $class;?>" id="<?= $phrase['id'] . '-' . $date_tmp;?>" phrase="<?= $phrase['id'];?>" date="<?= $date_tmp;?>" <? if ( $map ):?> style="box-shadow: inset 0 0 10px rgba( 0, 0, 0, 0.4 );"<? endif;?> title="<?= $url;?>">
<span><?= $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' ) ) )
$class = 'end position';
if ( $pos != '' )
$pos = $pos;
else
$pos = '-';
?>
<td class="position text-center small <?= $class;?>" id="<?= $phrase['id'] . '-' . $this -> _year . '-' . $this -> _month . '-' . $d;?>" phrase="<?= $phrase['id'];?>" date="<?= $this -> _year . '-' . $this -> _month . '-' . $d;?>" <? if ( $map ):?> style="box-shadow: inset 2px 2px 10px rgba( 0, 0, 0, 0.5 );"<? endif;?> title="<?= $url;?>">
<span><?= $pos;?></span>
</td>
<? endfor;?>
</tr>
<? endforeach;?>
<? endif;?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<? if ( is_array( $this -> _phrases ) ):?>
<div class="alert alert-dark light p5">
<small>Stawki podstawowe</small>
</div>
<div class="row">
<?
$suma = 0;
foreach ( $this -> _phrases as $phrase )
{
$discount = '';
if ( $this -> _site['discount'] > 0 )
$discount = $this -> _site['discount'];
if ( $phrase['discount'] > 0 )
$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">
<small><?= $phrase['phrase'];?> <? if ( $discount > 0 ):?><span class="fr">rabat <?= $discount;?>%</span><? endif;?></small>
</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 small">
<small>Razem netto: <?= \S::number_display( $suma );?></small>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-dark">
<div class="panel-heading small">
<small>Razem brutto: <?= \S::number_display( $suma * $config['profit']['vat'] );?></small>
</div>
</div>
</div>
<? endif;?>
</div>
<div class="alert alert-dark light p5">
<small>Stawki resellera</small>
</div>
<div class="row">
<?
$suma = 0;
if ( is_array( $this -> _phrases_reseller ) ) foreach ( $this -> _phrases_reseller as $phrase )
{
$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">
<small><?= $phrase['phrase'];?> <? if ( $discount > 0 ):?><span class="text-dark">(rabat <?= $discount;?>%)</span><? endif;?></small>
</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 small">
<small>Razem netto: <?= \S::number_display( $suma );?></small>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-dark">
<div class="panel-heading small">
<small>Razem brutto: <?= \S::number_display( $suma * $config['profit']['vat'] );?></small>
</div>
</div>
</div>
<? endif;?>
</div>
<? endif;?>
<script type="text/javascript">
$( document ).ready( function()
{
if ( $( '#positions-not-xs' ).hasScrollBar() === true )
{
$( '#positions-not-xs' ).animate( { scrollLeft: $( '#date-<?= date( 'Y-m-d' );?>' ).position().left - 50 }, 500);
}
if ( $( '#positions-xs' ).hasScrollBar() === true )
{
$( '.hidden-sm .table-responsive' ).animate( { scrollLeft: $( '#date-xs-<?= date( 'Y-m-d' );?>' ).position().left - 50 }, 500);
}
$( '.phrase_url' ).css( 'width', $( '#table-phrases tr:first-child td:first-child' ).width() + 'px' ).css( 'display', 'block' );
});
</script>

View File

@@ -0,0 +1,242 @@
<? global $gdb, $config, $user;?>
<!--<div class="row">
<div class="col col-xs-12 col-lg-6">
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Monitoring pozycji</span>
</div>
<div class="progress progress-bar-xl">
<div class="progress-bar progress-bar-system" role="progressbar" aria-valuenow="<?= round( $this -> ranker['ok'] / ( $this -> ranker['ok'] + $this -> ranker['bad'] ) * 100 );?>" aria-valuemin="0" aria-valuemax="100" style="width: <?= round( $this -> ranker['ok'] / ( $this -> ranker['ok'] + $this -> ranker['bad'] ) * 100 );?>%; min-width: 250px;">
<span>Sprawdzone: <b><?= round( $this -> ranker['ok'] / ( $this -> ranker['ok'] + $this -> ranker['bad'] ) * 100 );?>%</b> (<?= $this -> ranker['ok'] . '/' . ( $this -> ranker['ok'] + $this -> ranker['bad'] );?>)</span>
</div>
</div>
</div>
</div>
<div class="col col-xs-12 col-lg-6">
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Proxy PHP</span>
</div>
<div class="progress progress-bar-xl">
<div class="progress-bar progress-bar-system" role="progressbar" aria-valuenow="<?= round( $this -> proxy['ok'] / ( $this -> proxy['ok'] + $this -> proxy['bad'] ) * 100 );?>" aria-valuemin="0" aria-valuemax="100" style="width: <?= round( $this -> proxy['ok'] / ( $this -> proxy['ok'] + $this -> proxy['bad'] ) * 100 );?>%; min-width: 250px;">
<span>Działające: <b><?= round( $this -> proxy['ok'] / ( $this -> proxy['ok'] + $this -> proxy['bad'] ) * 100 );?>%</b> (<?= $this -> proxy['ok'] . '/' . ( $this -> proxy['ok'] + $this -> proxy['bad'] );?>)</span>
</div>
</div>
</div>
</div>
</div>-->
<div class="row">
<div class="col col-xs-12 col-lg-6">
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Ranking wzrostów</span>
</div>
<div class="panel-body">
<?
$grid = new \grid( 'pro_rr_phrases', 'phrases_up' );
$grid -> debug = true;
$grid -> gdb_opt = $gdb;
$grid -> src = $this -> phrases_diffs;
$grid -> order = [ 'column' => 'diff', 'type' => 'DESC' ];
$grid -> columns_view = [
[
'name' => 'Fraza',
'db' => 'phrase',
'th' => [ 'style' => 'background: #666; color: #FFF' ],
],
[
'name' => 'Domena',
'db' => 'domain',
'th' => [ 'style' => 'background: #666; color: #FFF' ],
],
[
'name' => 'Wzrost',
'db' => 'diff',
'th' => [ 'style' => 'text-align: right; background: #666; color: #FFF' ],
'td' => [ 'style' => 'text-align: right; font-weight: bold;' ],
'php' => 'echo "[today]";'
. 'if ( [diff] > 0 ) echo "<i class=\'ml10 mr10 fa-lg text-system fa fa-arrow-circle-o-up\'></i>[diff]";'
. 'if ( [diff] < 0 ) echo "<i class=\'ml10 mr10 fa-lg text-danger fa fa-arrow-circle-o-down\'></i>[diff]";'
]
];
$grid -> hide_columns = false;
$grid -> condensed = true;
$grid -> limit = 25;
echo $grid -> draw();
?>
</div>
</div>
</div>
<div class="col col-xs-12 col-lg-6">
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Ranking spadków</span>
</div>
<div class="panel-body">
<?
$grid = new \grid( 'pro_rr_phrases', 'phrases_down' );
$grid -> debug = true;
$grid -> gdb_opt = $gdb;
$grid -> src = $this -> phrases_diffs;
$grid -> order = [ 'column' => 'diff', 'type' => 'ASC' ];
$grid -> columns_view = [
[
'name' => 'Fraza',
'db' => 'phrase',
'th' => [ 'style' => 'background: #666; color: #FFF' ],
],
[
'name' => 'Domena',
'db' => 'domain',
'th' => [ 'style' => 'background: #666; color: #FFF' ],
],
[
'name' => 'Spadek',
'db' => 'diff',
'th' => [ 'style' => 'text-align: right; background: #666; color: #FFF' ],
'td' => [ 'style' => 'text-align: right; font-weight: bold;' ],
'php' => 'echo "[today]"; '
. 'if ( [diff] > 0 ) echo "<i class=\'ml10 mr10 fa-lg text-system fa fa-arrow-circle-o-up\'></i>[diff]";'
. 'if ( [diff] < 0 ) echo "<i class=\'ml10 mr10 fa-lg text-danger fa fa-arrow-circle-o-down\'></i>[diff]";'
]
];
$grid -> hide_columns = false;
$grid -> condensed = true;
$grid -> limit = 25;
echo $grid -> draw();
?>
</div>
</div>
</div>
</div>
<!--<div class="row mb20">
<div class="col col-xs-12">
<div class="table-responsive">
<table class="table table-hover table-striped table-bordered table-condensed" style="background: #FFF;">
<thead>
<tr>
<th style="width: 100px;"></th>
<? for ( $i = 1; $i <= 15; $i++ ):?>
<th class="text-right" style="background: #666; color: #FFF"><?= $i;?></th>
<? endfor;?>
</tr>
</thead>
<tbody>
<? for ( $z = 0; $z < count( $this -> phrases_positions ); $z++ ):?>
<tr>
<th class="text-right">
<?
echo $date = date( 'Y-m-d', strtotime( '-' . $z . ' days', strtotime( date( 'Y-m-d' ) ) ) );
$date_prev = date( 'Y-m-d', strtotime( '-' . ( $z + 1 ) . ' days', strtotime( date( 'Y-m-d' ) ) ) );
?>
</th>
<? for ( $i = 1; $i <= 15; $i++ ):?>
<td class="text-right">
<?
$sum = 0;
$sum_prev = 0;
for ( $j = 1; $j <= $i; $j++ )
$sum += $this -> phrases_positions[$date][$j];
for ( $j = 1; $j <= $i; $j++ )
$sum_prev += $this -> phrases_positions[$date_prev][$j];
if ( $sum < $sum_prev )
echo '<span class="text-danger">' . $sum . '</span>';
if ( $sum > $sum_prev )
echo '<span class="text-system">' . $sum . '</span>';
if ( $sum == $sum_prev )
echo $sum;
if ( $user['type'] == 'admin' )
{
if ( $i > 1 )
{
$all = array_sum( $this -> phrases_positions[$date] );
$all_prev = array_sum( $this -> phrases_positions[$date_prev] );
$percent = $sum / $all * 100;
$percent_prev = $sum_prev / $all_prev * 100;
if ( $percent < $percent_prev )
echo ' | <span class="text-danger">' . number_format( $percent, 1, '.', ' ' ) . '%</span>';
if ( $percent > $percent_prev )
echo ' | <span class="text-system">' . number_format( $percent, 1, '.', ' ' ) . '%</span>';
if ( $percent == $percent_prev )
echo ' | ' . number_format( $percent, 1, '.', ' ' ) . '%';
}
else
{
$all = array_sum( $this -> phrases_positions[$date] );
$all_prev = array_sum( $this -> phrases_positions[$date_prev] );
$percent = $this -> phrases_positions[$date][$i] / $all * 100;
$percent_prev = $this -> phrases_positions[$date_prev][$i] / $all_prev * 100;
if ( $percent < $percent_prev )
echo ' | <span class="text-danger">' . number_format( $percent, 1, '.', ' ' ) . '%</span>';
if ( $percent > $percent_prev )
echo ' | <span class="text-success">' . number_format( $percent, 1, '.', ' ' ) . '%</span>';
if ( $percent == $percent_prev )
echo ' | ' . number_format( $percent, 1, '.', ' ' ) . '%';
}
}
?>
</td>
<? endfor;?>
</tr>
<? endfor;?>
</tbody>
</table>
</div>
</div>
</div>-->
<script type="text/javascript">
$( document ).ready( function()
{
$( 'body' ).on( 'click', '.panel-heading .fa-trash', function()
{
var type = $( this ).attr( 'type' );
var kind = $( this ).attr( 'kind' );
$.prompt( 'Na pewno chcesz usunąć wybraną grupę?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v === true )
{
$.ajax(
{
type: 'POST',
cache: false,
url: 'ajax.php',
data:
{
type: type,
kind: kind,
a: 'delete_logs'
},
success: function( data )
{
document.location.href = './?p=dashboard';
}
});
}
},
buttons: {
'tak': true, 'nie': false
},
focus: 1
});
});
});
</script>