zen.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. class chartZen extends chart
  3. {
  4. /**
  5. * 根据 chartList 获取要查看的图表。
  6. * Get the charts to view by chartList.
  7. *
  8. * @param array $chartList
  9. * @access protected
  10. * @return array
  11. */
  12. protected function getChartsToView($chartList)
  13. {
  14. $charts = array();
  15. foreach($chartList as $chart)
  16. {
  17. $group = $chart['groupID'];
  18. $chart = $this->chart->getByID($chart['chartID']);
  19. if($chart)
  20. {
  21. $chart->currentGroup = $group;
  22. $charts[] = $chart;
  23. }
  24. }
  25. return $charts;
  26. }
  27. /**
  28. * 根据 chartID 和 filterValues 获取要筛选的图表。
  29. * Get the charts to filter by chartID and filterValues.
  30. *
  31. * @param int $groupID
  32. * @param int $chartID
  33. * @param array $filterValues
  34. * @access protected
  35. * @return object|null
  36. */
  37. protected function getChartToFilter($groupID, $chartID, $filterValues = array())
  38. {
  39. $chart = $this->chart->getByID($chartID);
  40. if(!$chart) return null;
  41. $chart->currentGroup = $groupID;
  42. foreach($filterValues as $key => $value) $chart->filters[$key]['default'] = $value;
  43. return $chart;
  44. }
  45. /**
  46. * 获取菜单项。
  47. * Get menu items.
  48. *
  49. * @param array $menus
  50. * @access protected
  51. * @return array
  52. */
  53. protected function getMenuItems($menus)
  54. {
  55. $items = array();
  56. foreach($menus as $menu)
  57. {
  58. if($menu->parent == 0) continue;
  59. $items[] = $menu;
  60. }
  61. return $items;
  62. }
  63. }