/** * GetBehaviorAlteration * * Used by modules to determine if a behaviour is altered and get the paramters for * the alteration * * @todo REFACTOR THIS. The name is confusing and it serves two purposes. * @param OnePanelBehaviouralConfigObject $possibly_affected_object * @param string $behaviour_name * @return unknown_type */ public static function GetBehaviorAlteration(OnePanelBehaviouralConfigObject $possibly_affected_object, $behaviour_name) { // Debug $success = OnePanelDebug::Track('Getting behavioural adjustments for ' . get_class($possibly_affected_object) . '[' . $possibly_affected_object->GetName() . '] on ' . $behaviour_name); // Set initial response $return = false; // Does this object have behavioural alterations? if (OnePanelConfig::BehaviourAdjusted($possibly_affected_object)) { // Get the behaviours for the config module $behaviours =& OnePanelConfig::GetModuleBehaviours($possibly_affected_object); foreach ($behaviours as &$behaviour) { if (OnePanelConfig::BehaviourIsActive($behaviour)) { $outcomes =& $behaviour->GetOutcomes(); // Find the one with the desired outcome foreach ($outcomes as &$outcome) { // If we find it alter the query $params =& $outcome->GetParameters(); if ($params[0] == $behaviour_name && $outcome->GetAffectedModule() == $possibly_affected_object) { $return = $params; break 2; // NASTY } } } else { $return = false; } } } else { $return = false; } $success->Affirm(); return $return; }