Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Commit b88b8a3

Browse files
author
aFolletete
committed
[+] BO : new dashboard in Back Office
1 parent 53e9102 commit b88b8a3

21 files changed

+902
-272
lines changed

admin-dev/index.php

+252-43
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
<?php
2-
/*
3-
* 2007-2010 PrestaShop
4-
*
5-
* NOTICE OF LICENSE
6-
*
7-
* This source file is subject to the Open Software License (OSL 3.0)
8-
* that is bundled with this package in the file LICENSE.txt.
9-
* It is also available through the world-wide-web at this URL:
10-
* http://opensource.org/licenses/osl-3.0.php
11-
* If you did not receive a copy of the license and are unable to
12-
* obtain it through the world-wide-web, please send an email
13-
* to license@prestashop.com so we can send you a copy immediately.
14-
*
15-
* DISCLAIMER
16-
*
17-
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18-
* versions in the future. If you wish to customize PrestaShop for your
19-
* needs please refer to http://www.prestashop.com for more information.
20-
*
21-
* @author Prestashop SA <contact@prestashop.com>
22-
* @copyright 2007-2010 Prestashop SA
23-
* @version Release: $Revision: 1.4 $
24-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25-
* International Registred Trademark & Property of PrestaShop SA
26-
*/
2+
3+
/**
4+
* Homepage and main page for admin panel, index.php
5+
* @category admin
6+
*
7+
* @author PrestaShop <support@prestashop.com>
8+
* @copyright PrestaShop
9+
* @license http://www.opensource.org/licenses/osl-3.0.php Open-source licence 3.0
10+
* @version 1.3
11+
*
12+
*/
2713

2814
define('_PS_ADMIN_DIR_', getcwd());
29-
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_);
15+
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
3016

3117
include(PS_ADMIN_DIR.'/../config/config.inc.php');
3218
include(PS_ADMIN_DIR.'/functions.php');
@@ -39,9 +25,9 @@
3925
$tabs = array();
4026
recursiveTab($id_tab);
4127
$tabs = array_reverse($tabs);
42-
echo '<div class="path_bar"><a href="?token='.Tools::getAdminToken($tab.(int)(Tab::getIdFromClassName($tab)).(int)($cookie->id_employee)).'">'.translate('Back Office').'</a>';
28+
echo '<div class="path_bar"><a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).intval($cookie->id_employee)).'">'.translate('Back Office').'</a>';
4329
foreach ($tabs AS $key => $item)
44-
echo ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" /><img src="'.((trim($item['module']) != '') ? _MODULE_DIR_.$item['module'].'/'.$item['class_name'].'.gif' : '../img/t/'.$item['class_name'].'.gif').'" style="margin-right:5px" /><a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].(int)($item['id_tab']).(int)($cookie->id_employee)).'" '.((sizeof($tabs) - 1 == $key) ? 'class="blue" style="font-color:blue;"' : '').'>'.$item['name'].'</a>';
30+
echo ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" />'.((sizeof($tabs) - 1 > $key) ? '<a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].intval($item['id_tab']).intval($cookie->id_employee)).'">' : '').$item['name'].((sizeof($tabs) - 1 > $key) ? '</a>' : '');
4531
echo '</div>';
4632

4733
if (Validate::isLoadedObject($adminObj))
@@ -79,33 +65,256 @@
7965
}
8066
else /* Else display homepage */
8167
{
82-
$isoDefault = Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT')));
83-
$isoUser = Language::getIsoById((int)($cookie->id_lang));
84-
echo '<div id="adminHeader">
85-
<img src="../img/logo.jpg" alt="Logo" title="Logo" /><br /><br />
86-
<h2>'.translate('Welcome to your Back Office').'</h2>
87-
'.translate('Click the tabs to navigate.').'
88-
<br /><br /><br />';
68+
$protocol = (isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http';
69+
$isoDefault = Language::getIsoById(intval(Configuration::get('PS_LANG_DEFAULT')));
70+
$isoUser = Language::getIsoById(intval($cookie->id_lang));
71+
echo '<div id="adminHeader">';
72+
echo '<div class="path_bar"><a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).intval($cookie->id_employee)).'">'.translate('Back Office').'</a>';
73+
echo ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" />'.translate('Dashboard');
74+
echo '</div>';
75+
echo '
76+
<h1>'.translate('Dashboard').'</h1>
77+
<hr style="background-color: #812143;color: #812143;" />
78+
<br />';
8979
if (@ini_get('allow_url_fopen') AND $update = checkPSVersion())
9080
echo '<div class="warning warn" style="margin-bottom:30px;"><h3>'.translate('New PrestaShop version available').' : <a style="text-decoration: underline;" href="'.$update['link'].'">'.translate('Download').'&nbsp;'.$update['name'].'</a> !</h3></div>';
9181
elseif (!@ini_get('allow_url_fopen'))
9282
{
9383
echo '<p>'.translate('Update notification unavailable').'</p>';
9484
echo '<p>&nbsp;</p>';
95-
echo '<p>'.translate('To receive PrestaShop update warnings, you need to activate the <b>allow_url_fopen</b> command in your <b>php.ini</b> config file.').' [<a href="http://www.php.net/manual/'.$isoUser.'/ref.filesystem.php">'.translate('more info').'</a>]</p>';
85+
echo '<p>'.translate('To receive PrestaShop update warnings, you need to activate the <b>allow_url_fopen</b> command in your <b>php.ini</b> config file.').' [<a href="http://www.php.net/manual/'.$isoUser.'/ref.filesystem.php">'.translate('more infos').'</a>]</p>';
9686
echo '<p>'.translate('If you don\'t know how to do that, please contact your host administrator !').'</p><br>';
9787
}
9888
echo '</div>';
89+
90+
echo'
91+
<!--<div id="adminpresentation">
92+
<div id="iframe">
93+
94+
</div>
95+
<div id="list_video">
96+
<h3>Chapter 1</h3>
97+
<ul class="clearfix">
98+
<li class="viewed"><a href="#">Video loreem video loreem</a></li>
99+
<li class="viewed"><a href="#">video loreem video </a></li>
100+
<li><a href="#">Video loreemvideo loreem</a></li>
101+
<li><a href="#">video loreem video loreem</a></li>
102+
<li><a href="#">video loreemvideo </a></li>
103+
<li><a href="#">video loreemvideo loreem</a></li>
104+
<li><a href="#">video loreem video loreem</a></li>
105+
<li><a href="#">video loreemvideo </a></li>
106+
</ul>
107+
</div>
108+
<div id="list_video">
109+
<h3>Chapter 2</h3>
110+
<ul class="clearfix">
111+
<li class="viewed"><a href="#">Video loreem video loreem</a></li>
112+
<li class="viewed"><a href="#">video loreem video </a></li>
113+
<li><a href="#">video loreemvideo loreem</a></li>
114+
<li><a href="#">video loreem video loreem</a></li>
115+
<li><a href="#">video loreemvideo </a></li>
116+
<li><a href="#">video loreemvideo loreem</a></li>
117+
<li><a href="#">video loreem video loreem</a></li>
118+
<li><a href="#">video loreemvideo </a></li>
119+
</ul>
120+
</div>
121+
<div id="footer_iframe_home">
122+
<a href="#">'.translate('View more video tutorials').'</a>
123+
<input type="checkbox" value="" name="" id="dont_show_again"><label for="dont_show_again">'.translate('don\'t show again').'</label>
124+
</div>
125+
</div>-->
126+
<div id="column_left">
127+
<ul class="F_list clearfix">
128+
<li id="first_block">
129+
<h4><a href="index.php?tab=AdminCatalog&id_category=1&addproduct&token='.Tools::getAdminTokenLite('AdminCatalog').'">'.translate('New product').'</a></h4>
130+
<p>Le Lorem Ipsum est simplement du faux texte employ dans Le Lorem Ipsum est simplement du</p>
131+
</li>
132+
<li id="second_block">
133+
<h4><a href="index.php?tab=AdminCustomers&addcustomer&token='.Tools::getAdminTokenLite('AdminCustomers').'">'.translate('New customer').'</a></h4>
134+
<p>Le Lorem Ipsum est simplement du faux texte employ dans du faux tex </p>
135+
</li>
136+
<li id="third_block">
137+
<h4><a href="index.php?tab=AdminStats&token='.Tools::getAdminTokenLite('AdminStats').'">'.translate('Check statistics').'</a></h4>
138+
<p>Le Lorem Ipsum est siploy dans </p>
139+
</li>
140+
<li id="fourth_block">
141+
<h4><a href="index.php?tab=AdminEmployees&addemployee&token='.Tools::getAdminTokenLite('AdminEmployees').'">'.translate('New employees').'</a></h4>
142+
<p>Le Lorem Ipsum est simplement du faux texte employ dans oy dans</p>
143+
</li>
144+
</ul>
145+
';
146+
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
147+
SELECT SUM(o.`total_paid_real` / o.conversion_rate) as total_sales, COUNT(*) as total_orders
148+
FROM `'._DB_PREFIX_.'orders` o
149+
WHERE o.valid = 1
150+
AND o.`invoice_date` BETWEEN \''.date('Y-m').'-01 00:00:00\' AND \''.date('Y-m').'-31 23:59:59\' ');
151+
$result2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
152+
SELECT COUNT(`id_customer`) AS total_registrations
153+
FROM `'._DB_PREFIX_.'customer` c
154+
WHERE c.`date_add` BETWEEN \''.date('Y-m').'-01 00:00:00\' AND \''.date('Y-m').'-31 23:59:59\'');
155+
$result3 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
156+
SELECT SUM(pv.`counter`) AS total_viewed
157+
FROM `'._DB_PREFIX_.'page_viewed` pv
158+
LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range`
159+
LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page`
160+
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`
161+
WHERE pt.`name` = \'product.php\'
162+
AND dr.`time_start` BETWEEN \''.date('Y-m').'-01 00:00:00\' AND \''.date('Y-m').'-31 23:59:59\'
163+
AND dr.`time_end` BETWEEN \''.date('Y-m').'-01 00:00:00\' AND \''.date('Y-m').'-31 23:59:59\'');
164+
$results = array_merge($result, array_merge($result2, $result3));
165+
$currency = Currency::getCurrency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
166+
echo '
167+
<div class="table_info">
168+
<h5><a href="index.php?tab=AdminStats&token='.Tools::getAdminTokenLite('AdminStats').'">'.translate('View more').'</a> '.translate('Overview Statistics').' </h5>
169+
<table class="table_info_details">
170+
<tr class="tr_odd">
171+
<td class="td_align_left">
172+
'.translate('Sales').'
173+
</td>
174+
<td>
175+
'.Tools::displayPrice($results['total_sales'], $currency).'
176+
</td>
177+
</tr>
178+
<tr>
179+
<td class="td_align_left">
180+
'.translate('Total registrations').'
181+
</td>
182+
<td>
183+
'.(int)($results['total_registrations']).'
184+
</td>
185+
</tr>
186+
<tr class="tr_odd">
187+
<td class="td_align_left">
188+
'.translate('Total orders').'
189+
</td>
190+
<td>
191+
'.(int)($results['total_orders']).'
192+
</td>
193+
</tr>
194+
<tr>
195+
<td class="td_align_left">
196+
'.translate('Product pages viewed').'
197+
</td>
198+
<td>
199+
'.(int)($results['total_viewed']).'
200+
</td>
201+
</tr>
202+
</table>
203+
</div>
204+
';
205+
$all = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_thread');
206+
$unread = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'customer_thread` WHERE `status` = "open"');
207+
$pending = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'customer_thread` WHERE `status` LIKE "%pending%"');
208+
$close = $all - ($unread + $pending);
209+
echo '
210+
<div class="table_info" id="table_info_last">
211+
<h5><a href="index.php?tab=AdminCustomerThreads&token='.Tools::getAdminTokenLite('AdminCustomerThreads').'">'.translate('View more').'</a> '.translate('Customers service').'</h5>
212+
<table class="table_info_details">
213+
<tr class="tr_odd">
214+
<td class="td_align_left">
215+
'.translate('Thread unread').'
216+
</td>
217+
<td>
218+
'.$unread.'
219+
</td>
220+
</tr>
221+
<tr>
222+
<td class="td_align_left">
223+
'.translate('Thread pending').'
224+
</td>
225+
<td>
226+
'.$pending.'
227+
</td>
228+
</tr>
229+
<tr class="tr_odd">
230+
<td class="td_align_left">
231+
'.translate('Thread closed').'
232+
</td>
233+
<td>
234+
'.$close.'
235+
</td>
236+
</tr>
237+
<tr>
238+
<td class="td_align_left">
239+
'.translate('Total thread').'
240+
</td>
241+
<td>
242+
'.$all.'
243+
</td>
244+
</tr>
245+
</table>
246+
</div>
247+
248+
<div id="table_info_large">
249+
<h5><a href="#">'.translate('View more').'</a> <strong>'.translate('Statistics').'</strong> / '.translate('Sales of the week').'</h5>
250+
<div id="stat_google">
251+
252+
</div>
253+
</div>
254+
<table cellpadding="0" cellspacing="0" id="table_customer">
255+
<thead>
256+
<tr>
257+
<th class="order_id"><span class="first">'.translate('ID').'</span></th>
258+
<th class="order_customer"><span>'.translate('Customer Name').'</span></th>
259+
<th class="order_status"><span>'.translate('Status').'</span></th>
260+
<th class="order_total"><span>'.translate('Total').'</span></th>
261+
<th class="order_action"><span class="last">'.translate('Action').'</span></th>
262+
<tr>
263+
</thead>
264+
<tbody>';
265+
266+
$orders = Order::getOrdersWithInformations(10);
267+
$i = 0;
268+
foreach ($orders AS $order)
269+
{
270+
$currency = Currency::getCurrency((int)$order['id_currency']);
271+
echo '
272+
<tr '.($i % 2 ? 'id="order_line1' : '').'">
273+
<td class="order_td_first order_id">'.(int)$order['id_order'].'</td>
274+
<td class="order_customer">'.Tools::htmlentitiesUTF8($order['firstname']).' '.Tools::htmlentitiesUTF8($order['lastname']).'</td>
275+
<td class="order_status">'.Tools::htmlentitiesUTF8($order['state_name']).'</td>
276+
<td class="order_total">'.Tools::displayPrice((float)$order['total_paid'], $currency).'</td>
277+
<td class="order_action">
278+
<a href="index.php?tab=AdminOrders&id_order='.(int)$order['id_order'].'&vieworder&token='.Tools::getAdminTokenLite('AdminOrders').'" title="'.translate('Details').'"><img src="../img/admin/details.gif" alt="Voir" /></a>
279+
</td>
280+
</tr>
281+
';
282+
$i++;
283+
}
284+
//id="order_line1"
99285

286+
echo '
287+
</tbody>
288+
</table>
289+
290+
</div>
291+
<div id="column_right">
292+
<div id="table_info_link">
293+
<h5>'.translate('PrestaShop Link').'</h5>
294+
<ul id="prestashop_link">
295+
<li>
296+
<p>'.translate('Discover the latest official guide :').'</p>
297+
<a href ="#">'.translate('User Guide PrestaShop 1.3').'</a>
298+
<a href ="#">'.translate('Technical Docummentation').'</a>
299+
</li>
300+
<li>
301+
<p>'.translate('Use the PrestaShop forum & discover a great community').'</p>
302+
<a href ="http://www.prestashop.com/forums/">'.translate('Go to forums.prestashop.com').'</a>
303+
</li>
304+
<li>
305+
<p>'.translate('Enhance your Shop with a new templates & modules').'</p>
306+
<a href ="http://addons.prestashop.com">'.translate('Go to addons.prestashop.com').'</a>
307+
</li>
308+
</ul>
309+
</div>
310+
<iframe frameborder="no" style="margin: 0px; padding: 0px; width: 315px; height: 450px;" src="'.$protocol.'://www.prestashop.com/rss/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe>
311+
</div>
312+
<div class="clear"></div>
313+
';
314+
100315
echo Module::hookExec('backOfficeHome');
101-
102-
/* News from PrestaShop website */
103-
echo '<div id="adminNews">
104-
<h2>'.translate('PrestaShop live feed').'</h2>';
105-
$protocol = (isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http';
106-
echo'<iframe frameborder="no" style="margin: 0px; padding: 0px; width: 780px; height: 380px;" src="'.$protocol.'://www.prestashop.com/rss/news.php?v='._PS_VERSION_.'&lang='.$isoUser.'&activity='.(int)Configuration::get('PS_SHOP_ACTIVITY').'"></iframe></div>';
107316
}
108317

109318
include(PS_ADMIN_DIR.'/footer.inc.php');
110319

111-
320+
?>

admin-dev/login.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
2525
* International Registred Trademark & Property of PrestaShop SA
2626
*/
27-
27+
2828
ob_start();
2929
define('PS_ADMIN_DIR', getcwd());
3030

@@ -121,7 +121,7 @@
121121

122122
echo '
123123
<div id="login">
124-
<h1>'.Configuration::get('PS_SHOP_NAME').'</h1>
124+
<h1>'.Tools::htmlentitiesUTF8(Configuration::get('PS_SHOP_NAME')).'</h1>
125125
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">';
126126

127127
$randomNb = rand(100, 999);
@@ -146,9 +146,7 @@
146146
</div>
147147
';
148148
}
149-
150149
?>
151-
152150
<script type="text/javascript">
153151
<!--
154152
if (document.getElementById('email')) document.getElementById('email').focus();
@@ -162,5 +160,3 @@
162160
</div>
163161
</body>
164162
</html>';
165-
166-

0 commit comments

Comments
 (0)