Exemple #1
0
function _loadActionsList($action_name, $formactions, $start = 0, $order = array(), $settings = array())
{
    if (!is_array($action_name)) {
        $action_name = array($action_name);
    }
    foreach ($action_name as $k => $action) {
        $i = $order[$k];
        //$k + $start;
        if (isset($formactions[$i]) && $formactions[$i]->type == $action) {
            echo loadActionFile($formactions[$i], $formactions[$i]->order);
        } else {
            $object = new stdClass();
            $object->type = $action;
            $object->params = '';
            if (isset($settings[$k]) && !empty($settings[$k])) {
                foreach ($settings[$k] as $ks => $setting) {
                    $object->{$ks} = $setting;
                }
            }
            echo loadActionFile($object, $order[$k]);
        }
        unset($formactions[$i]);
    }
    return $formactions;
    // = array_values($formactions);
}
Exemple #2
0
function _processActions($actions, $actionsarray)
{
    $output = '';
    $actionEvents = array();
    foreach ($actions as $loadAction => $loadActionData) {
        $actionOutput = '';
        if (!empty($loadActionData) && is_array($loadActionData)) {
            if (isset($loadActionData['events']) && !empty($loadActionData['events'])) {
                foreach ($loadActionData['events'] as $eventk => $eventv) {
                    if (!empty($eventv) && is_array($eventv) && isset($eventv['actions']) && !empty($eventv['actions'])) {
                        $eventOutput = _processActions($eventv['actions'], $actionsarray);
                        $actionEvents[$eventk] = $eventOutput;
                    } else {
                        continue;
                    }
                }
            }
            $actionOutput = loadActionFile($actionsarray[$loadAction], $actionsarray[$loadAction]->order);
            foreach ($actionEvents as $eventName => $eventOutput) {
                $pattern_input = '/<div id="' . $eventName . '"([^>]*?)>(.*?)<\\/div>/is';
                preg_match_all($pattern_input, $actionOutput, $matches);
                if (isset($matches[0][0])) {
                    $rawEventOutput = $matches[0][0];
                    $newEventOutput = str_replace('</div>', $eventOutput . '</div>', $rawEventOutput);
                    $actionOutput = str_replace($rawEventOutput, $newEventOutput, $actionOutput);
                } else {
                }
            }
            $output .= $actionOutput;
        } else {
            $output .= loadActionFile($actionsarray[$loadAction], $actionsarray[$loadAction]->order);
        }
    }
    return $output;
}