Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
condition_in_user_group.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/conditions/condition/condition.inc';
18 
31 {
32 
33 
40  function __construct($assetid=0)
41  {
42  parent::__construct($assetid);
43 
44  }//end constructor
45 
46 
56  public static function evaluate(Asset $asset, $condition_data)
57  {
58  if (empty($condition_data['groupids'])) return FALSE;
59 
60  // because a user can theoretically use conditions to be part of groups
61  // we need to make sure that we aren't going to recurse infinetly
62  static $evaluate_called = FALSE;
63  if ($evaluate_called) return FALSE;
64  $evaluate_called = TRUE;
65 
66  $ret_val = array_intersect($condition_data['groupids'], $GLOBALS['SQ_SYSTEM']->user->getUserGroups());
67 
68  $evaluate_called = FALSE;
69 
70  return !empty($ret_val);
71 
72  }//end evaluate()
73 
74 
75 }//end class
76 
77 ?>