Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
ChartRules.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
40  class ChartRules
41  {
42  const TYPE_BAR_2D = 'Bar2D';
43 
44  const TYPE_BAR_3D = 'Bar3D';
45 
46  const TYPE_COLUMN_2D = 'Column2D';
47 
48  const TYPE_COLUMN_3D = 'Column3D';
49 
50  const TYPE_DONUT_2D = 'Donut2D';
51 
52  const TYPE_DONUT_3D = 'Donut3D';
53 
54  const TYPE_PIE_2D = 'Pie2D';
55 
56  const TYPE_PIE_3D = 'Pie3D';
57 
58  const TYPE_STACKED_BAR_2D = 'StackedBar2D';
59 
60  const TYPE_STACKED_BAR_3D = 'StackedBar3D';
61 
62  const TYPE_STACKED_COLUMN_2D = 'StackedColumn2D';
63 
64  const TYPE_STACKED_COLUMN_3D = 'StackedColumn3D';
65 
66  const TYPE_STACKED_AREA = 'StackedArea';
67 
68  const TYPE_LINE = 'Line';
69 
70  const TYPE_DONUT_PROGRESSION = 'DonutProgression';
71 
72  const TYPE_FUNNEL = 'Funnel';
73 
74  const TYPE_PYRAMID = 'Pyramid';
75 
76  const TYPE_RADAR = 'Radar';
77 
81  public static function getChartTypesRequiringSecondInputs()
82  {
83  return array(self::TYPE_STACKED_BAR_2D,
84  self::TYPE_STACKED_BAR_3D,
85  self::TYPE_STACKED_COLUMN_2D,
86  self::TYPE_STACKED_COLUMN_3D,
87  self::TYPE_STACKED_AREA,
88  );
89  }
90 
91  public static function isStacked($type)
92  {
93  assert('is_string($type)');
94  if (in_array($type, self::getChartTypesRequiringSecondInputs()))
95  {
96  return true;
97  }
98  return false;
99  }
100 
101  public static function getTranslatedTypeLabel($type)
102  {
103  assert('is_string($type)');
104  $labels = self::translatedTypeLabels();
105  if (isset($labels[$type]))
106  {
107  return $labels[$type];
108  }
109  throw new NotSupportedException();
110  }
111 
112  public static function translatedTypeLabels()
113  {
114  return array(ChartRules::TYPE_BAR_2D => Zurmo::t('Core', '2D Horizontal Bar Graph'),
115  ChartRules::TYPE_BAR_3D => Zurmo::t('Core', '3D Horizontal Bar Graph'),
116  ChartRules::TYPE_COLUMN_2D => Zurmo::t('Core', '2D Vertical Bar Graph'),
117  ChartRules::TYPE_COLUMN_3D => Zurmo::t('Core', '3D Vertical Bar Graph'),
118  ChartRules::TYPE_DONUT_2D => Zurmo::t('Core', 'Donut 2D'),
119  ChartRules::TYPE_DONUT_3D => Zurmo::t('Core', 'Donut 3D'),
120  ChartRules::TYPE_PIE_2D => Zurmo::t('Core', 'Pie 2D'),
121  ChartRules::TYPE_PIE_3D => Zurmo::t('Core', 'Pie 3D'),
122  ChartRules::TYPE_STACKED_BAR_2D => Zurmo::t('Core', 'Stacked Bar 2D'),
123  ChartRules::TYPE_STACKED_BAR_3D => Zurmo::t('Core', 'Stacked Bar 3D'),
124  ChartRules::TYPE_STACKED_COLUMN_2D => Zurmo::t('Core', 'Stacked Column 2D'),
125  ChartRules::TYPE_STACKED_COLUMN_3D => Zurmo::t('Core', 'Stacked Column 3D'),
126  ChartRules::TYPE_STACKED_AREA => Zurmo::t('Core', 'Stacked Area'),
127  ChartRules::TYPE_DONUT_PROGRESSION => Zurmo::t('Core', 'Donut Progression'),
128  ChartRules::TYPE_FUNNEL => Zurmo::t('Core', 'Funnel'),
129  ChartRules::TYPE_PYRAMID => Zurmo::t('Core', 'Pyramid'),
130  ChartRules::TYPE_RADAR => Zurmo::t('Core', 'Radar')
131  );
132  }
133 
134  public static function availableTypes()
135  {
136  return array(ChartRules::TYPE_BAR_2D,
137  ChartRules::TYPE_BAR_3D,
138  ChartRules::TYPE_COLUMN_2D,
139  ChartRules::TYPE_COLUMN_3D,
140  ChartRules::TYPE_DONUT_2D,
141  ChartRules::TYPE_DONUT_3D,
142  ChartRules::TYPE_PIE_2D,
143  ChartRules::TYPE_PIE_3D,
144  ChartRules::TYPE_STACKED_BAR_2D,
145  ChartRules::TYPE_STACKED_BAR_3D,
146  ChartRules::TYPE_STACKED_COLUMN_2D,
147  ChartRules::TYPE_STACKED_COLUMN_3D,
148  ChartRules::TYPE_STACKED_AREA,
149  ChartRules::TYPE_FUNNEL,
150  ChartRules::TYPE_PYRAMID,
151  );
152  }
153 
154  public static function getSingleSeriesDataAndLabels()
155  {
156  $translatedLabels = static::translatedTypeLabels();
157  return array(
158  ChartRules::TYPE_COLUMN_2D => $translatedLabels[ChartRules::TYPE_COLUMN_2D],
159  ChartRules::TYPE_COLUMN_3D => $translatedLabels[ChartRules::TYPE_COLUMN_3D],
160  ChartRules::TYPE_BAR_2D => $translatedLabels[ChartRules::TYPE_BAR_2D],
161  ChartRules::TYPE_BAR_3D => $translatedLabels[ChartRules::TYPE_BAR_3D],
162  ChartRules::TYPE_DONUT_2D => $translatedLabels[ChartRules::TYPE_DONUT_2D],
163  ChartRules::TYPE_DONUT_3D => $translatedLabels[ChartRules::TYPE_DONUT_3D],
164  ChartRules::TYPE_PIE_2D => $translatedLabels[ChartRules::TYPE_PIE_2D],
165  ChartRules::TYPE_PIE_3D => $translatedLabels[ChartRules::TYPE_PIE_3D],
166  ChartRules::TYPE_FUNNEL => $translatedLabels[ChartRules::TYPE_FUNNEL],
167  ChartRules::TYPE_PYRAMID => $translatedLabels[ChartRules::TYPE_PYRAMID],
168  );
169  }
170  }
171 ?>
static getChartTypesRequiringSecondInputs()
Definition: ChartRules.php:81
Generated on Thu Jul 2 2020 07:10:30
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.