/** * BehaviourIsActive * * Used by OnePanelModule to discern whether the requirements have been * met for a particular behaviour. * * @param $behaviour * @return boolean */ public static function BehaviourIsActive(OnePanelBehaviour &$behaviour) { $requirements =& $behaviour->GetRequirements(); foreach ($requirements as &$requirement) { if ($requirement instanceof OnePanelHomePageLayout) { if (class_exists('OnePanelTheme')) { $active_layout =& OnePanelTheme::GetActiveLayout(); if ($active_layout == $requirement) { return true; } } } else { // TODO ADD SKINS } return false; } }
/** * PrepareAddBehaviourOutput * * Generates the log output for when a behaviour is added in the config file. * * @param OnePanelBehaviour $behaviour * @return string */ public static function PrepareAddBehaviourOutput(OnePanelBehaviour &$behaviour) { // TODO only do this if the log level warrants it. $outcomes = $behaviour->GetOutcomes(); if (count($outcomes) > 0) { $message = 'Adding a behavioural modification to '; foreach ($outcomes as $key => &$outcome) { $affected_object =& $outcome->GetAffectedModule(); /* * BREAKAGE WARNING * TODO this next line of code might be iffy if we later * decide to allow behavioural modifications to anything * other than highlights. * Suggested having a BehaviouralElement(?) class that we * can use for extension. */ $message .= '[' . get_class($affected_object) . ':' . $affected_object->GetName() . ']'; } return $message; } else { return 'Skipping behaviour with no outcome'; } }