public function hookBackOfficeHome($params) { global $cookie; $this->_postProcess(); $currency = Currency::getCurrency(intval(Configuration::get('PS_CURRENCY_DEFAULT'))); $results = $this->getResults(); $employee = new Employee(intval($cookie->id_employee)); $id_tab_stats = Tab::getIdFromClassName('AdminStats'); $access = Profile::getProfileAccess($employee->id_profile, $id_tab_stats); if (!$access['view']) { return ''; } $this->_html = ' <fieldset style="width:520px;"> <legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Statistics') . '</legend> <div style="float:left;width:240px;text-align:center"> <div style="float:left;width:120px;text-align:center"> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square1.gif\')"> <br /><br />' . Tools::displayPrice($results['total_sales'], $currency) . ' </p></center> <p>' . $this->l('of sales') . '</p> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square3.gif\')"> <br /><br />' . intval($results['total_registrations']) . ' </p></center> <p>' . ($results['total_registrations'] != 1 ? $this->l('registrations') : $this->l('registration')) . '</p> </div> <div style="float:left;width:120px;text-align:center"> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square2.gif\')"> <br /><br />' . intval($results['total_orders']) . ' </p></center> <p>' . ($results['total_orders'] != 1 ? $this->l('orders placed') : $this->l('order placed')) . '</p> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square4.gif\')"> <br /><br />' . intval($results['total_viewed']) . ' </p></center> <p>' . ($results['total_viewed'] != 1 ? $this->l('product pages viewed') : $this->l('product page viewed')) . '</p> </div> </div> <div style="float:right;text-align:right;width:240px">'; include_once dirname(__FILE__) . '/../..' . $this->_adminPath . '/tabs/AdminStats.php'; $this->_html .= AdminStatsTab::displayCalendarStatic(array('Calendar' => $this->l('Calendar'), 'Day' => $this->l('Day'), 'Month' => $this->l('Month'), 'Year' => $this->l('Year'))); $this->_html .= '<div class="space"></div> <p style=" font-weight: bold ">' . $this->l('Visitors online now:') . ' ' . intval($this->getVisitorsNow()) . '</p> </div> </fieldset> <div class="clear space"><br /><br /></div>'; return $this->_html; }
public function display() { global $currentIndex; if (!Tools::isSubmit('viewreferrer')) { echo $this->displayJavascript(); } if ($this->enableCalendar()) { echo ' <div style="float:left;margin-right:20px"> ' . AdminStatsTab::displayCalendarStatic(array('Calendar' => $this->l('Calendar'), 'Day' => $this->l('Today'), 'Month' => $this->l('Month'), 'Year' => $this->l('Year'), 'From' => $this->l('From'), 'To' => $this->l('To'))) . ' </div>'; if (!Tools::isSubmit('viewreferrer')) { echo ' <div style="float: left; margin-right: 20px;"> <fieldset style="width:630px"><legend><img src="../img/admin/tab-preferences.gif" /> ' . $this->l('Settings') . '</legend> <form action="' . $currentIndex . '&token=' . Tools::getValue('token') . '" method="post"> <label>' . $this->l('Save direct traffic') . '</label> <div class="float" style="margin-left: 200px;"> <label class="t" for="tracking_dt_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" /></label> <input type="radio" name="tracking_dt" id="tracking_dt_on" value="1" ' . ((int) Tools::getValue('tracking_dt', Configuration::get('TRACKING_DIRECT_TRAFFIC')) ? 'checked="checked"' : '') . ' /> <label class="t" for="tracking_dt_on"> ' . $this->l('Yes') . '</label> <label class="t" for="tracking_dt_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" /></label> <input type="radio" name="tracking_dt" id="tracking_dt_off" value="0" ' . (!(int) Tools::getValue('tracking_dt', Configuration::get('TRACKING_DIRECT_TRAFFIC')) ? 'checked="checked"' : '') . '/> <label class="t" for="tracking_dt_off"> ' . $this->l('No') . '</label> </div> <br class="clear" /> <p>' . $this->l('Direct traffic can be quite consuming. You should consider enabling it only if you have a strong database server and a strong need for it.') . '</p> <input type="submit" class="button" value="' . $this->l(' Save ') . '" name="submitSettings" /> </form> <hr /> <form action="' . $currentIndex . '&token=' . Tools::getValue('token') . '" method="post"> <p class="bold">' . $this->l('Indexation') . '</p> <p>' . $this->l('There is a huge quantity of data, so each connection corresponding to a referrer is indexed. You can refresh this index by clicking on the button below. Be aware that it may take a long time and it is only needed if you modified or added a referrer and if you want your changes to be retroactive.') . '</p> <input type="submit" class="button" value="' . $this->l('Refresh index') . '" name="submitRefreshIndex" /> </form> <hr /> <form action="' . $currentIndex . '&token=' . Tools::getValue('token') . '" method="post"> <p class="bold">' . $this->l('Cache') . '</p> <p>' . $this->l('For you to sort and filter your data, it is cached. You can refresh the cache by clicking on the button below.') . '</p> <input type="submit" class="button" value="' . $this->l('Refresh cache') . '" name="submitRefreshCache" /> </form> </fieldset> </div>'; } } echo '<div class="clear space"> </div>'; parent::display(); echo '<div class="clear space"> </div>'; }