Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
condition.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/asset.inc';
18 
30 class Condition extends Asset
31 {
32 
33 
40  function __construct($assetid=0)
41  {
42  parent::__construct($assetid);
43 
44  }//end constructor
45 
46 
68  public static function evaluateRestriction(Asset $asset, Array &$restriction, $condition_type_code)
69  {
70  $condition_data = empty($restriction['condition_data']) ? Array() : $restriction['condition_data'];
71  $evaluation_instruction = '$ret = '.$condition_type_code.'::evaluate($asset, $condition_data);';
72 
73  $GLOBALS['SQ_SYSTEM']->am->includeAsset($condition_type_code);
74  eval($evaluation_instruction);
75 
76  if (isset($restriction) && (isset($restriction['match'])) && !$restriction['match']) {
77  $ret = !$ret;
78  }
79 
80  return $ret;
81 
82  }//end evaluateRestriction()
83 
84 
94  public static function evaluate(Asset $asset, Array $condition_data)
95  {
96  return FALSE;
97 
98  }//end evaluate()
99 
100 
115  public static function updateKeywords(Array $logical_keywords, Array &$condition_data)
116  {
117  return;
118 
119  }//end updateKeywords()
120 
121 
135  public static function getRequiredKeywords(Array $condition_data)
136  {
137  return Array();
138 
139  }//end getRequiredKeywords()
140 
141 
158  public static function getMatchKeywords($type_code)
159  {
160  $match_options = Array(
161  '1' => translate($type_code.'_true'),
162  '0' => translate($type_code.'_false'),
163  );
164 
165  return $match_options;
166 
167  }//end getMatchKeywords()
168 
169 
170 }//end class
171 
172 ?>