Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
GameBadgeRules.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  abstract class GameBadgeRules
41  {
42  public static function getPassiveDisplayLabel($value)
43  {
44  throw new NotImplementedException();
45  }
46 
50  public static function getItemCountByGrade($grade)
51  {
52  assert('is_int($grade)');
53  return ArrayUtil::getArrayValue(static::$valuesIndexedByGrade, $grade);
54  }
55 
59  public static function getType()
60  {
61  $name = get_called_class();
62  $name = substr($name, 0, strlen($name) - strlen('GameBadgeRules'));
63  return $name;
64  }
65 
69  public static function getBadgeRulesData()
70  {
71  $badgeRulesData = array();
72  $modules = Module::getModuleObjects();
73  foreach ($modules as $module)
74  {
75  $rulesClassNames = $module::getAllClassNamesByPathFolder('rules.badges');
76  foreach ($rulesClassNames as $ruleClassName)
77  {
78  $classToEvaluate = new ReflectionClass($ruleClassName);
79  if (!$classToEvaluate->isAbstract())
80  {
81  $badgeRulesData[] = $ruleClassName;
82  }
83  }
84  }
85  return $badgeRulesData;
86  }
87 
95  public static function badgeGradeUserShouldHaveByPointsAndScores($userPointsByType, $userScoresByType)
96  {
97  assert('is_array($userPointsByType)');
98  assert('is_array($userScoresByType)');
99  throw new NotImplementedException();
100  }
101 
105  protected static function getBadgeGradeByValue($value)
106  {
107  assert('is_int($value)');
108  $currentGrade = 0;
109  foreach (static::$valuesIndexedByGrade as $grade => $minimumValue)
110  {
111  if ($value >= $minimumValue)
112  {
113  $currentGrade = $grade;
114  }
115  }
116  return $currentGrade;
117  }
118 
123  public static function hasBonusPointsOnCreation()
124  {
125  return true;
126  }
127 
132  public static function hasBonusPointsOnGradeChange()
133  {
134  return true;
135  }
136 
140  public static function getNewBonusPointType()
141  {
142  return GamePoint::TYPE_USER_ADOPTION;
143  }
144 
149  public static function getNewBonusPointValue()
150  {
151  return 50;
152  }
153 
157  public static function getGradeBonusPointType()
158  {
159  return GamePoint::TYPE_USER_ADOPTION;
160  }
161 
166  public static function getGradeBonusPointValue($grade)
167  {
168  assert('is_int($grade)');
169  if ($grade == 1)
170  {
171  return 50;
172  }
173  elseif ($grade == 2)
174  {
175  return 150;
176  }
177  elseif ($grade == 3)
178  {
179  return 300;
180  }
181  elseif ($grade == 4)
182  {
183  return 500;
184  }
185  elseif ($grade == 5)
186  {
187  return 750;
188  }
189  elseif ($grade == 6)
190  {
191  return 1000;
192  }
193  elseif ($grade == 7)
194  {
195  return 1250;
196  }
197  elseif ($grade == 8)
198  {
199  return 1500;
200  }
201  elseif ($grade == 9)
202  {
203  return 1750;
204  }
205  elseif ($grade == 10)
206  {
207  return 2000;
208  }
209  elseif ($grade == 11)
210  {
211  return 2250;
212  }
213  elseif ($grade == 12)
214  {
215  return 2500;
216  }
217  elseif ($grade == 13)
218  {
219  return 3000;
220  }
221  }
222  }
223 ?>
static getGradeBonusPointType()
static badgeGradeUserShouldHaveByPointsAndScores($userPointsByType, $userScoresByType)
static hasBonusPointsOnCreation()
static getGradeBonusPointValue($grade)
static getModuleObjects()
Definition: Module.php:51
static hasBonusPointsOnGradeChange()
static getArrayValue($array, $element, $defaultValue=null)
Definition: ArrayUtil.php:45
static getNewBonusPointType()
static getBadgeGradeByValue($value)
static getBadgeRulesData()
static getNewBonusPointValue()
static getItemCountByGrade($grade)
Generated on Wed Oct 21 2020 07:10:30
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.