PageRenderTime 41ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/01.Source/01.CORE/modules/statistics/theme.php

http://creative-portal.googlecode.com/
PHP | 619 lines | 443 code | 156 blank | 20 comment | 58 complexity | 930508fe73ff6222fb0d58f624ccb596 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.0
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @copyright 2009
  6. * @createdate 10/03/2010 10:51
  7. */
  8. if(!defined('NV_IS_MOD_STATISTICS'))
  9. {
  10. die('Stop!!!');
  11. }
  12. function referer()
  13. {
  14. global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $nv_Request, $module_name, $all_page, $countries_list, $cts, $host_list, $total;
  15. $xtpl = new XTemplate("referer.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . '/modules/' . $module_file);
  16. if($total)
  17. {
  18. $xtpl->assign('CTS', $cts);
  19. foreach($cts['rows'] as $m)
  20. {
  21. if(!empty($m['count']))
  22. {
  23. $proc = ceil(($m['count'] / $cts['max']) * 100);
  24. $xtpl->assign('M', $m);
  25. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg.gif");
  26. $xtpl->assign('HEIGHT', $proc * 2);
  27. $xtpl->parse('main.loop.img');
  28. }
  29. $xtpl->parse('main.loop');
  30. }
  31. foreach($cts['rows'] as $key => $m)
  32. {
  33. $xtpl->assign('M', $m);
  34. if($key == $cts['current_month'])
  35. {
  36. $xtpl->parse('main.loop_1.m_c');
  37. }
  38. else
  39. {
  40. $xtpl->parse('main.loop_1.m_o');
  41. }
  42. $xtpl->parse('main.loop_1');
  43. }
  44. }
  45. $xtpl->parse('main');
  46. return $xtpl->text('main');
  47. }
  48. function allreferers()
  49. {
  50. global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $nv_Request, $module_name, $all_page, $countries_list, $cts, $host_list;
  51. $xtpl = new XTemplate("allreferers.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . '/modules/' . $module_file);
  52. if($all_page)
  53. {
  54. if(!empty($host_list))
  55. {
  56. $xtpl->assign('CTS', $cts);
  57. $a = 0;
  58. foreach($cts['rows'] as $key => $value)
  59. {
  60. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  61. $xtpl->assign('CLASS', $class);
  62. $xtpl->assign('VALUE', $value);
  63. $xtpl->assign('KEY', $key);
  64. if($value[0])
  65. {
  66. $proc = ceil(($value[0] / $cts['max']) * 100);
  67. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  68. $xtpl->assign('WIDTH', $proc * 3);
  69. $xtpl->parse('main.loop.img');
  70. }
  71. $a++;
  72. $xtpl->parse('main.loop');
  73. }
  74. if(!empty($cts['generate_page']))
  75. {
  76. $xtpl->parse('main.gp');
  77. }
  78. }
  79. }
  80. $xtpl->parse('main');
  81. return $xtpl->text('main');
  82. }
  83. function allbots()
  84. {
  85. global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $nv_Request, $module_name, $all_page, $bot_list, $cts;
  86. $xtpl = new XTemplate("allbrowsers.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . '/modules/' . $module_file);
  87. if($all_page)
  88. {
  89. if(!empty($bot_list))
  90. {
  91. $xtpl->assign('CTS', $cts);
  92. $a = 0;
  93. foreach($cts['rows'] as $key => $value)
  94. {
  95. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  96. $xtpl->assign('CLASS', $class);
  97. $xtpl->assign('KEY', $key);
  98. $xtpl->assign('VALUE', $value);
  99. if($value[0])
  100. {
  101. $proc = ceil(($value[0] / $cts['max']) * 100);
  102. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  103. $xtpl->assign('WIDTH', $proc * 3);
  104. $xtpl->parse('main.loop.img');
  105. }
  106. $a++;
  107. $xtpl->parse('main.loop');
  108. }
  109. if(!empty($cts['generate_page']))
  110. {
  111. $xtpl->parse('main.gp');
  112. }
  113. }
  114. }
  115. $xtpl->parse('main');
  116. return $xtpl->text('main');
  117. }
  118. function allos()
  119. {
  120. global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $nv_Request, $module_name, $all_page, $os_list, $cts;
  121. $xtpl = new XTemplate("allbrowsers.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . '/modules/' . $module_file);
  122. if($all_page)
  123. {
  124. if(!empty($os_list))
  125. {
  126. $xtpl->assign('CTS', $cts);
  127. $a = 0;
  128. foreach($cts['rows'] as $key => $value)
  129. {
  130. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  131. $xtpl->assign('CLASS', $class);
  132. $xtpl->assign('KEY', $key);
  133. $xtpl->assign('VALUE', $value);
  134. if($value[0])
  135. {
  136. $proc = ceil(($value[0] / $cts['max']) * 100);
  137. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  138. $xtpl->assign('WIDTH', $proc * 3);
  139. $xtpl->parse('main.loop.img');
  140. }
  141. $a++;
  142. $xtpl->parse('main.loop');
  143. }
  144. if(!empty($cts['generate_page']))
  145. {
  146. $xtpl->parse('main.gp');
  147. }
  148. }
  149. }
  150. $xtpl->parse('main');
  151. return $xtpl->text('main');
  152. }
  153. function allbrowsers()
  154. {
  155. global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $nv_Request, $module_name, $all_page, $browsers_list, $cts;
  156. $xtpl = new XTemplate("allbrowsers.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . '/modules/' . $module_file);
  157. if($all_page)
  158. {
  159. if(!empty($browsers_list))
  160. {
  161. $xtpl->assign('CTS', $cts);
  162. $a = 0;
  163. foreach($cts['rows'] as $key => $value)
  164. {
  165. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  166. $xtpl->assign('CLASS', $class);
  167. $xtpl->assign('KEY', $key);
  168. $xtpl->assign('VALUE', $value);
  169. if($value[0])
  170. {
  171. $proc = ceil(($value[0] / $cts['max']) * 100);
  172. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  173. $xtpl->assign('WIDTH', $proc * 3);
  174. $xtpl->parse('main.loop.img');
  175. }
  176. $a++;
  177. $xtpl->parse('main.loop');
  178. }
  179. if(!empty($cts['generate_page']))
  180. {
  181. $xtpl->parse('main.gp');
  182. }
  183. }
  184. }
  185. $xtpl->parse('main');
  186. return $xtpl->text('main');
  187. }
  188. function allcountries()
  189. {
  190. global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $nv_Request, $module_name, $all_page, $countries_list, $cts;
  191. $xtpl = new XTemplate("allcountries.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . '/modules/' . $module_file);
  192. if($all_page)
  193. {
  194. if(!empty($countries_list))
  195. {
  196. $xtpl->assign('CTS', $cts);
  197. $a = 0;
  198. foreach($cts['rows'] as $key => $value)
  199. {
  200. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  201. $xtpl->assign('CLASS', $class);
  202. $xtpl->assign('VALUE', $value);
  203. $xtpl->assign('KEY', $key);
  204. if($value[0])
  205. {
  206. $proc = ceil(($value[1] / $cts['max']) * 100);
  207. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  208. $xtpl->assign('WIDTH', $proc * 3);
  209. $xtpl->parse('main.loop.img');
  210. }
  211. $a++;
  212. $xtpl->parse('main.loop');
  213. }
  214. if(!empty($cts['generate_page']))
  215. {
  216. $xtpl->parse('main.gp');
  217. }
  218. }
  219. }
  220. $xtpl->parse('main');
  221. return $xtpl->text('main');
  222. }
  223. function main()
  224. {
  225. global $module_info, $global_config, $module_file, $db, $lang_module, $lang_global, $ctsy, $ctsm, $ctsdm, $ctsdw, $ctsc, $ctsb, $ctso, $ctsh, $contents;
  226. $xtpl = new XTemplate("main.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . '/modules/' . $module_file);
  227. $xtpl->assign('CTS', $ctsy);
  228. foreach($ctsy['rows'] as $key => $m)
  229. {
  230. if(!empty($m))
  231. {
  232. $xtpl->assign('M', $m);
  233. $proc = ceil(($m / $ctsy['max']) * 100);
  234. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg.gif");
  235. $xtpl->assign('HEIGHT', $proc * 2);
  236. $xtpl->parse('main.year.loop.img');
  237. }
  238. $xtpl->parse('main.year.loop');
  239. }
  240. foreach($ctsy['rows'] as $key => $m)
  241. {
  242. $xtpl->assign('KEY', $key);
  243. if($key == $ctsy['current_year'])
  244. {
  245. $xtpl->parse('main.year.loop_1.yc');
  246. }
  247. else
  248. {
  249. $xtpl->parse('main.year.loop_1.yc_o');
  250. }
  251. $xtpl->parse('main.year.loop_1');
  252. }
  253. $xtpl->parse('main.year');
  254. //Thong ke theo thang
  255. $xtpl->assign('CTS', $ctsm);
  256. foreach($ctsm['rows'] as $m)
  257. {
  258. if(!empty($m['count']))
  259. {
  260. $contents .= $m['count'] . "<br />";
  261. $proc = ceil(($m['count'] / $ctsm['max']) * 100);
  262. $xtpl->assign('M', $m);
  263. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg.gif");
  264. $xtpl->assign('HEIGHT', $proc * 2);
  265. $xtpl->parse('main.month.loop.img');
  266. }
  267. $xtpl->parse('main.month.loop');
  268. }
  269. foreach($ctsm['rows'] as $key => $m)
  270. {
  271. $xtpl->assign('KEY', $key);
  272. $xtpl->assign('M', $m);
  273. if($key == $ctsm['current_month'])
  274. {
  275. $xtpl->parse('main.month.loop_1.mc');
  276. }
  277. else
  278. {
  279. $xtpl->parse('main.month.loop_1.mc_o');
  280. }
  281. $xtpl->parse('main.month.loop_1');
  282. }
  283. $xtpl->parse('main.month');
  284. //Thong ke theo thang
  285. //thong ke theo ngay trong thang
  286. $xtpl->assign('CTS', $ctsdm);
  287. foreach($ctsdm['rows'] as $key => $m)
  288. {
  289. $xtpl->assign('M', $m);
  290. if(!empty($m))
  291. {
  292. $proc = ceil(($m / $ctsdm['max']) * 100);
  293. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg.gif");
  294. $xtpl->assign('HEIGHT', $proc * 2);
  295. $xtpl->parse('main.day_m.loop.img');
  296. }
  297. $xtpl->parse('main.day_m.loop');
  298. }
  299. foreach($ctsdm['rows'] as $key => $m)
  300. {
  301. $xtpl->assign('KEY', $key);
  302. if($key == $ctsdm['current_day'])
  303. {
  304. $xtpl->parse('main.day_m.loop_1.dc');
  305. }
  306. else
  307. {
  308. $xtpl->parse('main.day_m.loop_1.dc_o');
  309. }
  310. $xtpl->parse('main.day_m.loop_1');
  311. }
  312. $xtpl->parse('main.day_m');
  313. //thong ke theo ngay trong thang
  314. //Thong ke theo ngay cua tuan
  315. $xtpl->assign('CTS', $ctsdw);
  316. foreach($ctsdw['rows'] as $key => $m)
  317. {
  318. $xtpl->assign('M', $m);
  319. if(!empty($m['count']))
  320. {
  321. $proc = ceil(($m['count'] / $ctsdw['max']) * 100);
  322. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg.gif");
  323. $xtpl->assign('HEIGHT', $proc * 2);
  324. $xtpl->parse('main.day_k.loop.img');
  325. }
  326. $xtpl->parse('main.day_k.loop');
  327. }
  328. foreach($ctsdw['rows'] as $key => $m)
  329. {
  330. $xtpl->assign('KEY', $key);
  331. $xtpl->assign('M', $m);
  332. if($key == $ctsdw['current_dayofweek'])
  333. {
  334. $xtpl->parse('main.day_k.loop_1.dc');
  335. }
  336. else
  337. {
  338. $xtpl->parse('main.day_k.loop_1.dc_o');
  339. }
  340. $xtpl->parse('main.day_k.loop_1');
  341. }
  342. $xtpl->parse('main.day_k');
  343. //Thong ke theo ngay cua tuan
  344. //Thong ke theo gio trong ngay
  345. $xtpl->assign('CTS', $ctsh);
  346. if(!empty($ctsh['rows']))
  347. {
  348. foreach($ctsh['rows'] as $key => $m)
  349. {
  350. if(!empty($m))
  351. {
  352. $xtpl->assign('M', $m);
  353. $proc = ceil(($m / $ctsh['max']) * 100);
  354. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg.gif");
  355. $xtpl->assign('HEIGHT', $proc * 2);
  356. $xtpl->parse('main.hour.loop.img');
  357. }
  358. $xtpl->parse('main.hour.loop');
  359. }
  360. foreach($ctsh['rows'] as $key => $m)
  361. {
  362. $xtpl->assign('KEY', $key);
  363. if($key == $ctsh['current_hour'])
  364. {
  365. $xtpl->parse('main.hour.loop_1.h');
  366. }
  367. else
  368. {
  369. $xtpl->parse('main.hour.loop_1.h_o');
  370. }
  371. $xtpl->parse('main.hour.loop_1');
  372. }
  373. }
  374. $xtpl->parse('main.hour');
  375. //Thong ke theo gio trong ngay
  376. //Thong ke theo quoc gia
  377. $xtpl->assign('CTS', $ctsc);
  378. $a = 0;
  379. foreach($ctsc['rows'] as $key => $value)
  380. {
  381. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  382. $xtpl->assign('CLASS', $class);
  383. $xtpl->assign('VALUE', $value);
  384. $xtpl->assign('KEY', $key);
  385. if($value[1])
  386. {
  387. $proc = ceil(($value[1] / $ctsc['max']) * 100);
  388. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  389. $xtpl->assign('WIDTH', $proc * 3);
  390. $xtpl->parse('main.ct.loop.img');
  391. }
  392. $a++;
  393. $xtpl->parse('main.ct.loop');
  394. }
  395. if($ctsc['others'][1])
  396. {
  397. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  398. $xtpl->assign('CLASS', $class);
  399. $xtpl->assign('URL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=statistics&amp;" . NV_OP_VARIABLE . "=allcountries");
  400. $xtpl->parse('main.ct.ot');
  401. }
  402. $xtpl->parse('main.ct');
  403. //Thong ke theo quoc gia
  404. //Thong ke theo trinh duyet
  405. $xtpl->assign('CTS', $ctsb);
  406. $a = 0;
  407. foreach($ctsb['rows'] as $key => $value)
  408. {
  409. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  410. $xtpl->assign('CLASS', $class);
  411. $xtpl->assign('KEY', $key);
  412. $xtpl->assign('VALUE', $value);
  413. if($value[0])
  414. {
  415. $proc = ceil(($value[0] / $ctsb['max']) * 100);
  416. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  417. $xtpl->assign('WIDTH', $proc * 3);
  418. $xtpl->parse('main.br.loop.img');
  419. }
  420. $xtpl->parse('main.br.loop');
  421. $a++;
  422. }
  423. if($ctsb['others'][1])
  424. {
  425. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  426. $xtpl->assign('CLASS', $class);
  427. $xtpl->assign('URL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=statistics&amp;" . NV_OP_VARIABLE . "=allbrowsers");
  428. $xtpl->parse('main.br.ot');
  429. }
  430. $xtpl->parse('main.br');
  431. //Thong ke theo trinh duyet
  432. //Thong ke theo he dieu hanh
  433. $xtpl->assign('CTS', $ctso);
  434. $a = 0;
  435. foreach($ctso['rows'] as $key => $value)
  436. {
  437. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  438. $xtpl->assign('CLASS', $class);
  439. $xtpl->assign('KEY', $key);
  440. $xtpl->assign('VALUE', $value);
  441. if($value[0])
  442. {
  443. $proc = ceil(($value[0] / $ctso['max']) * 100);
  444. $xtpl->assign('SRC', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/statistics/bg2.gif");
  445. $xtpl->assign('WIDTH', $proc * 3);
  446. $xtpl->parse('main.os.loop.img');
  447. }
  448. $xtpl->parse('main.os.loop');
  449. $a++;
  450. }
  451. if($ctso['others'][1])
  452. {
  453. $class = ($a % 2 == 0) ? " class=\"second\"" : "";
  454. $xtpl->assign('CLASS', $class);
  455. $xtpl->assign('URL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=statistics&amp;" . NV_OP_VARIABLE . "=allos");
  456. $xtpl->parse('main.os.ot');
  457. }
  458. $xtpl->parse('main.os');
  459. //Thong ke theo he dieu hanh
  460. $xtpl->parse('main');
  461. return $xtpl->text('main');
  462. }
  463. ?>