31 if (isset($_POST[
'hide_admin_help']) && $_POST[
'hide_admin_help']) {
37 $this->aBlocks = array(
38 'help' =>
'on' ==
getParam(
'sys_show_admin_help') ?
true :
false,
49 foreach($this->aBlocks
as $sName => $bActive) {
53 $sMethod =
'getCode' . str_replace(
' ',
'', ucwords(str_replace(
'_',
' ',
$sName)));
54 if(!method_exists($this, $sMethod))
64 $sContent =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'dashboard_links.html', array());
69 $sContent =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'dashboard_help.html', array(
70 'content' =>
_t(
'_adm_txt_dashboard_help', CH_WSB_URL_ADMIN, CH_WSB_URL_ROOT),
77 $aObjects =
$GLOBALS[
'MySQL']->getAll(
"SELECT * FROM `sys_objects_charts` WHERE `active` = 1 ORDER BY `order` ASC");
78 foreach ($aObjects
as $k => $a)
79 $aObjects[$k][
'title'] =
_t($a[
'title']);
80 $sContent =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'dashboard_charts.html', array(
82 'admin_url' => CH_WSB_URL_ADMIN,
83 'from' => date(
'Y-m-d',
time() - 30*24*60*60),
84 'to' => date(
'Y-m-d',
time()),
85 'ch_repeat:objects' => $aObjects,
99 $aTmplItemsCom = $aTmplItemsImp = array();
100 foreach($aStats
as $aStat) {
102 if($mixedItem !==
false)
103 $aTmplItemsCom[] = $mixedItem;
106 if($mixedItem !==
false)
107 $aTmplItemsImp[] = $mixedItem;
110 $aCommonChartData = array();
111 foreach ($aTmplItemsCom
as $r)
112 $aCommonChartData[] = array(
113 'value' => $r[
'number'],
114 'color' =>
'#' . dechex(rand(0x000000, 0xFFFFFF)),
118 $sCommonChartData = json_encode($aCommonChartData);
120 $GLOBALS [
'oAdmTemplate']->addJsSystem(array(
124 $sContent =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'dashboard_stats.html', array(
125 'ch_repeat:items_common' => $aTmplItemsCom,
126 'ch_repeat:items_important' => $aTmplItemsImp,
127 'common_chart_data' => $sCommonChartData,
133 if(
empty($aStat[$sPrefix .
'query']))
136 $iNumber = (int)
$GLOBALS[
'MySQL']->getOne($aStat[$sPrefix .
'query']);
137 if(!
empty($sPrefix) && $iNumber == 0)
140 $sCaption =
_t(
'_' . $aStat[
'capt'] . ($sPrefix !=
'' ?
'_' . trim($sPrefix,
'_') .
'_stats' :
''));
141 $bLink = !
empty($aStat[$sPrefix .
'link']);
143 $aStat[$sPrefix .
'link'] = str_replace(array(
'{site_url}',
'{admin_url}'), array(CH_WSB_URL_ROOT, CH_WSB_URL_ADMIN), $aStat[$sPrefix .
'link']);
144 if(substr($aStat[$sPrefix .
'link'], 0, 4) !=
'http')
145 $aStat[$sPrefix .
'link'] = CH_WSB_URL_ROOT . $aStat[$sPrefix .
'link'];
149 'number' => $iNumber,
151 'ch_if:show_link' => array(
152 'condition' => $bLink,
154 'link' => $aStat[$sPrefix .
'link'],
155 'number' => $iNumber,
159 'ch_if:show_text' => array(
160 'condition' => !$bLink,
162 'number' => $iNumber,