function getNextKey($key = null, $tail = '') { global $range, $trans; // bad if ($key === null) { $key = getLastKey(); } if (empty($key)) { return "a{$tail}"; } $keylen = strlen($key); $lastChar = $key[$keylen - 1]; if ($lastChar != '9') { return substr($key, 0, $keylen - 1) . $range[$trans[$lastChar] + 1] . $tail; } else { return getNextKey(substr($key, 0, -1), "a{$tail}"); } }
function recorridaRecursiva($matriz, $padre = null, $GXDynPropConditions, $GXDynPropActions, &$array, $ultimo) { if (!empty($matriz)) { foreach ($matriz as $key => $value) { if (is_array($value)) { //si es un array sigo recorriendo $condiciones = array(); recorridaRecursiva($value, $key, $GXDynPropConditions, $GXDynPropActions, $array, getLastKey($value)); } else { //si es un elemento lo cambio if (!is_null($padre)) { $array[$padre][$key] = $value; foreach ($GXDynPropConditions as $GXDPkey => $GXDPvalue) { if (array_key_exists($key, $GXDPvalue)) { echo "<br> va a evaluar en " . $GXDPkey . " " . $key . " " . $value . " " . $GXDPvalue[$key]['logic_operator'] . " " . $value . $GXDPvalue[$key]['operator'] . $GXDPvalue[$key]['value']; $condiciones[] = array('oper' => $GXDPvalue[$key]['logic_operator'], 'cond' => stringEvaluator($value, $GXDPvalue[$key]['value'], $GXDPvalue[$key]['operator']) == 1 ? 1 : 0); } if ($ultimo == $key && !empty($condiciones)) { if (conditionEvaluator($condiciones) == 1) { $array[$padre]['Gxdynprop'] = $GXDynPropActions[$GXDPkey]; } else { $array[$padre]['Gxdynprop'] = array(); } $condiciones = array(); } echo "<br>*** termino de correr" . $GXDPkey; } } } } } }