first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<legend><h2><?php echo __('Graf', null, 'sfStats') ?></h2></legend>
<br />
<div id="placeholder" style="width:<?php echo sfConfig::get('app_sfStats_chart_width', 800) ?>px;height:<?php echo sfConfig::get('app_sfStats_chart_height', 300) ?>px"></div>
<br />
<script type="text/javascript" charset="utf-8">
<?php if (sfConfig::get('app_sfStats_use_flot', true)): ?>
jQuery(function() {
// Use jQuery flot
data=[{label:"title1",
data: [
<?php foreach ($stats as $key => $value): ?>
[<?php echo $key * 1000, ', ', $value ?>],
<?php endforeach; ?>
], <?php echo $graph ?>: {show: true}
}];
options = {
xaxis: { mode: 'time', timeformat: "%d/%m/%y" },
legend: { show: false }
};
jQuery.plot(jQuery("#placeholder"), data, options);
});
<?php else: ?>
// Use Google charts API
var chartParams = {
'chs': '<?php echo sfConfig::get('app_sfStats_chart_width', 800) ?>x<?php echo sfConfig::get('app_sfStats_chart_height', 300) ?>',
'chd': 't:<?php echo implode($stats->getRawValue(), ',') ?>',
'chls': '3',
'chds': '0,<?php echo max($stats->getRawValue()) ?>',
'cht': 'lc',
'chco': '76A4FB',
'chm': 'B,CFE0FF,0,0,0',
'chg': '10,25,1,5',
'chxt': 'x,y',
'chxl': '0:|<?php $i=0; foreach ($stats as $key => $value): if(fmod($i, ceil(count($stats)/10)) == 0) echo format_date($key), '|'; $i++; endforeach ?>',
'chxr': '1,0,<?php echo max($stats->getRawValue()) ?>'
};
var chartParamsArray = [];
for(key in chartParams) { chartParamsArray.push(key + "=" + chartParams[key]) };
document.getElementById('placeholder').innerHTML = "<img src=\"http://chart.apis.google.com/chart?" + chartParamsArray.join('&') + "\" width=\"800\" height=\"300\">";
<?php endif; ?>
</script>

View File

@@ -0,0 +1,67 @@
<?php echo form_tag('sfStats/index', array('method' => 'get')) ?>
<fieldset>
<legend><h2><?php echo __('Filtry', null, 'sfStats') ?></h2></legend>
<div class="form-row">
<label for="updated_at" style="width: 120px; text-align: right;"><?php echo __('Typ:', null, 'sfStats') ?></label>
<div class="content" style="margin-left: 150px;">
<?php echo select_tag(
'filters[what]',
options_for_select($items, isset($filters['what']) ? $filters['what'] : sfConfig::get('app_sfStats_default_item'))
) ?>
</div>
</div>
<div class="form-row">
<label for="updated_at" style="width: 120px; text-align: right;"><?php echo __('Od:', null, 'sfStats') ?></label>
<div class="content" style="margin-left: 150px;">
<?php echo input_date_range_tag('filters[period]',
isset($filters['period']) ? $filters['period'] : null,
array (
'rich' => true,
'withtime' => true,
'culture' => 'pl',
'calendar_button_img' => '/sf/sf_admin/images/date.png',
'readonly' => true,
'middle' => '&nbsp;' . __('Do:', null, 'sfStats') . '&nbsp;'
)
) ?>
</div>
</div>
<div class="form-row">
<label for="filters_increment" style="width: 120px; text-align: right;"><?php echo __('Jednostka czasu:', null, 'sfStats') ?></label>
<div class="content" style="margin-left: 150px;">
<?php echo select_tag(
'filters[increment]',
options_for_select(array(
60 * 60 => __('Godzina', null, 'sfStats'),
60 * 60 * 24 => __('Dzień', null, 'sfStats'),
60 * 60 * 24 * 7 => __('Tydzień', null, 'sfStats'),
60 * 60 * 24 * 30 => __('Miesiąc', null, 'sfStats'),
60 * 60 * 24 * 30 * 12 => __('Rok', null, 'sfStats')
), isset($filters['increment']) ? $filters['increment'] : 60 * 60 * 24
)
) ?>
</div>
</div>
<?php foreach ($specialFilters as $filterKey => $filterParams): ?>
<div class="form-row">
<label for="filters_special_<?php echo $filterKey ?>"><?php echo $filterParams['name'] ?>:</label>
<div class="content">
<?php echo select_tag(
'filters[special]['.$filterKey.']',
'<option value=""></option>' . options_for_select($filterParams['values'], isset($filters['special'][$filterKey]) ? $filters['special'][$filterKey] : '')
) ?>
</div>
</div>
<?php endforeach; ?>
<ul class="sf_admin_actions">
<li><?php echo submit_tag(__('Szukaj', null, 'sfStats'), array('name'=>'filter', 'id'=>'commit', 'style'=>'background-image:url(/images/backend/icons/filter.png); background-position:6px 1px; background-repeat:no-repeat; background-color:transparent; border:none;')) ?></li>
<li><?php echo button_to(__('Wyczyść filtr', null, 'sfStats'), 'sfStats/index?filter=filter', array('name'=>'filter', 'id'=>'commit', 'style'=>'background-image:url(/images/backend/icons/reset.png); background-position:2px 1px; background-repeat:no-repeat; background-color:transparent; border:none;')) ?></li>
</ul>
</fieldset>
</form>

View File

@@ -0,0 +1,20 @@
<?php use_stylesheet('backend/style.css'); ?>
<div class="st_horizontal_list">
<ul>
<li>
<?php if ($sf_request->getParameter('index')): ?>
<b><?php echo link_to(__('Raporty'),'sfStats')?></b>
<?php else: ?>
<?php echo link_to(__('Raporty'),'sfStats')?>
<?php endif; ?>
</li>
<li>
<?php if ($sf_request->getParameter('config')): ?>
<b><?php echo link_to(__('Konfiguracja raportów'),'sfStats/config')?></b>
<?php else: ?>
<?php echo link_to(__('Konfiguracja raportów'),'sfStats/config')?>
<?php endif; ?>
</li>
</ul>
</div>

View File

@@ -0,0 +1,36 @@
<?php
$total = 0;
foreach($stats as $key) $total += $key;
?>
<legend><h2><?php echo __('Tabela wartości', null, 'sfStats') ?></h2></legend>
<br />
<table cellspacing="0" class="sf_admin_list">
<thead>
<tr>
<th><?php echo __('Data', null, 'sfStats') ?></th>
<th style="padding: 2px 5px; text-align: right"><?php echo __('Wartość', null, 'sfStats') ?></th>
</tr>
</thead>
<tbody>
<?php $my_date=substr(($filters['period']['from']),-5, 2)?>
<?php foreach ($stats as $key => $value): ?>
<tr class="sf_admin_row">
<?php if ($filters['increment'] == 3600): ?>
<td><?php echo format_date($key).", ".$my_date.":00" ?> </td>
<?php else: ?>
<td><?php echo format_date($key) ?></td>
<?php endif; ?>
<td style="padding: 3px 5px;" align="right"><?php echo $value ?></td>
</tr>
<?php $my_date++;?>
<?php if ($my_date==24) $my_date=00;?>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<th><?php echo __('Łącznie', null, 'sfStats') ?></th>
<th style="padding: 2px 5px; text-align: right"><?php echo $total ?></th>
</tr>
</tfoot>
</table>

View File

@@ -0,0 +1,70 @@
<?php use_helper('stAdminGenerator', 'I18N', 'Date', 'Validation') ?>
<?php use_stylesheet('backend/style.css'); ?>
<?php use_stylesheet('backend/sfStatsPlugin.css'); ?>
<?php echo st_get_admin_head('stStatsPlugin', __('Konfiguracja raportów'), __('Raporty sklepu'), array("stProduct"=>"stProduct", "stOrder"=>"stOrder", "stUser"=>"stUser")) ?>
<?php echo form_tag('sfStats/config', array()) ?>
<div id="sf_admin_header">
<?php include_partial('menu', array()) ?><br /><br />
</div>
<?php if ($sf_flash->has('notice')): ?>
<div class="save-ok">
<h2><?php echo $sf_flash->get('notice') ?></h2>
</div>
<?php endif; ?>
<div class="form-row">
<label id="stats_config_name"><?php echo __('Przedział czasowy raportów:') ?></label>
<div id="sf_admin_content">
<?php echo select_tag(
'st_stats[from]',
options_for_select(array(
'day' => __('Dzień'),
'week' => __('Tydzień'),
'month' => __('Miesiąc'),
'quarter' => __('Kwartał'),
'year' => __('Rok'),
), $config->get('from')
)
) ?>
</div>
<br class="st_clear_all">
</div>
<div class="form-row">
<label id="stats_config_name"><?php echo __('Pokaż graf:') ?></label>
<div id="sf_admin_content">
<?php echo checkbox_tag('st_stats[graf]', true, $config->get('graf')) ?>
</div>
<br class="st_clear_all">
</div>
<div class="form-row">
<label id="stats_config_name"><?php echo __('Rodzaj wizualizacji grafu:') ?></label>
<div id="sf_admin_content">
<?php echo select_tag(
'st_stats[graph]',
options_for_select(array(
'lines' => __('Liniowy'),
'points' => __('Punktowy'),
'bars' => __('Słupkowy'),
), $config->get('graph')
)
) ?>
</div>
<br class="st_clear_all">
</div>
<div class="form-row">
<label id="stats_config_name"><?php echo __('Pokaż tabele wartości:') ?></label>
<div id="sf_admin_content">
<?php echo checkbox_tag('st_stats[statistics]', true, $config->get('statistics')) ?>
</div>
<br class="st_clear_all">
</div>
<?php echo st_get_admin_actions_head() ?>
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, 'name=save') ?>
<?php echo st_get_admin_actions_foot() ?>
</form>
<?php echo st_get_admin_foot() ?>

View File

@@ -0,0 +1,43 @@
<?php use_helper('stAdminGenerator', 'I18N', 'Date', 'Validation') ?>
<?php use_stylesheet('backend/stStatsPlugin.css'); ?>
<?php if (sfConfig::get('app_sfStats_include_jquery', true)): ?>
<?php use_javascript('/js/flot/jquery.js') ?>
<?php endif; ?>
<?php use_javascript('/js/flot/jquery.flot.js') ?>
<?php echo st_get_admin_head('stStatsPlugin', __('Generowanie raportów'), __('Raporty sklepu'), array("stProduct"=>"stProduct", "stOrder"=>"stOrder", "stUser"=>"stUser")) ?>
<div id="sf_admin_header">
<?php include_partial('menu', array()) ?><br /><br />
<?php include_partial('filters', array(
'filters' => $filters,
'items' => $items,
'specialFilters' => isset($specialFilters) ? $specialFilters : array()
)) ?>
</div>
<div id="sf_admin_content">
<?php if (!$statistics && !$graf): ?>
<?php echo __('Niestety nie jest ustawiona wizualizacja raportów.') ?>
<?php else: ?>
<?php if (isset($stats)): ?>
<?php if($graf): ?>
<?php include_partial('chart', array('stats' => $stats, 'graph' => $graph)) ?>
<?php endif; ?>
<?php if ($statistics): ?>
<?php include_partial('table_of_values', array('stats' => $stats, 'filters' => $filters)) ?>
<?php endif; ?>
<?php elseif (count($item_config)): ?>
<?php echo __('Wybierz typ raportów z listy') ?>
<?php endif; ?>
<?php endif; ?>
</div>
<br class="st_clear_all">
<div id="sf_admin_footer">
</div>
<?php echo st_get_admin_foot() ?>