You are here

public static function AcquiaLiftAgent::convertOptionSetsToDecisions in Acquia Lift Connector 7

Implements AcquiaLiftAgent::convertOptionSetsToDecisions().

Overrides AcquiaLiftAgentInterface::convertOptionSetsToDecisions

5 calls to AcquiaLiftAgent::convertOptionSetsToDecisions()
AcquiaLiftAgent::errors in plugins/agent_types/AcquiaLiftAgent.inc
Implements PersonalizeAgentInterface::errors().
AcquiaLiftAgent::stopNow in plugins/agent_types/AcquiaLiftAgent.inc
Implements PersonalizeAgentInterface::stopNow().
acquia_lift_get_sync_operations_for_agents in ./acquia_lift.batch.inc
Gets the required operations for syncing the specified agents to Lift.
acquia_lift_report_custom in ./acquia_lift.admin.inc
Form build function for a custom Acquia Lift agent report.
acquia_lift_sync_option_sets in ./acquia_lift.module
Makes sure all option set changes are sync'd to Acquia Lift.

File

plugins/agent_types/AcquiaLiftAgent.inc, line 619
Provides an agent type for Acquia Lift

Class

AcquiaLiftAgent

Code

public static function convertOptionSetsToDecisions($option_sets) {
  $points = array();
  foreach ($option_sets as $option_set) {

    // If for some reason one of our option sets is missing a point name or
    // decision name, throw an exception as we cannot proceed.
    if (!isset($option_set->decision_point) || !isset($option_set->decision_name)) {
      throw new AcquiaLiftException('Cannot convert option sets to a structured decision hierarchy without decision points and decision names');
    }
    $points[$option_set->decision_point] = isset($points[$option_set->decision_point]) ? $points[$option_set->decision_point] : array();
    $points[$option_set->decision_point][$option_set->decision_name] = isset($points[$option_set->decision_point][$option_set->decision_name]) ? $points[$option_set->decision_point][$option_set->decision_name] : array();
    foreach ($option_set->options as $option) {
      $points[$option_set->decision_point][$option_set->decision_name][] = $option['option_id'];
    }
  }
  return $points;
}