Example #1
0
function get_input_processlist_desc($userid, $id)
{
    $process_list = get_input_processlist($userid, $id);
    // Get the input's process list
    $list = array();
    if ($process_list) {
        $array = explode(",", $process_list);
        // input process list is comma seperated
        foreach ($array as $row) {
            $row = explode(":", $row);
            // Divide into process id and arg
            $processid = $row[0];
            $arg = $row[1];
            // Named variables
            $process = get_process($processid);
            // gets process details of id given
            $processDescription = $process[0];
            // gets process description
            if ($process[1] == ProcessArg::INPUTID) {
                $arg = get_input_name($arg);
            } elseif ($process[1] == ProcessArg::FEEDID) {
                $arg = get_feed_name($arg);
            }
            // if feed: get feed name
            $list[] = array($processDescription, $arg);
            // Populate list array
        }
    }
    return $list;
}
Example #2
0
function process_inputs($userid, $inputs, $time)
{
    //--------------------------------------------------------------------------------------------------------------
    // 3) Process inputs according to input processlist
    //--------------------------------------------------------------------------------------------------------------
    foreach ($inputs as $input) {
        $id = $input[0];
        $input_processlist = get_input_processlist($userid, $id);
        if ($input_processlist) {
            $processlist = explode(",", $input_processlist);
            $value = $input[2];
            foreach ($processlist as $inputprocess) {
                $inputprocess = explode(":", $inputprocess);
                // Divide into process id and arg
                $processid = $inputprocess[0];
                // Process id
                $arg = $inputprocess[1];
                // Can be value or feed id
                $process_list = get_process_list();
                $process_function = $process_list[$processid][2];
                // get process function name
                $value = $process_function($arg, $time, $value);
                // execute process function
            }
        }
    }
}