예제 #1
0
                }
            } else {
                echo get_text('Every_user_has_answered_other_poll_can_start_publish_results');
            }
        }
    }
    ?>

            </div>
        <?php 
} else {
    if (get_init_batch_id() && !get_calculating_batch_id() && !get_accepted_batch_id()) {
        ?>
            <div class="topContent questions_list" id="parameters">
                <?php 
        $parameters = get_parameters();
        ?>
                <table>
                    <thead>
                    <tr style="text-align:center;">
                        <th><?php 
        echo get_text('Parameter');
        ?>
</th>
                        <th><?php 
        echo get_text('Value');
        ?>
</th>
                        <th><?php 
        echo get_text('Action');
        ?>
    }
    return $num;
}
try {
    $db = new ossim_db();
    $dbconn = $db->connect();
    $result = $dbconn->Execute("SELECT id, name, type, inputs, `sql`, dr FROM custom_report_types ORDER BY type,id asc");
    if (!$result) {
        die;
    }
    while (!$result->EOF) {
        $subreports[] = $result->fields;
        $result->MoveNext();
    }
    $modules = array();
    foreach ($subreports as $sr) {
        $modules[$sr['type']][] = array('id' => $sr['id'], 'name' => $sr['name'], 'parameters' => get_parameters($sr, $dbconn), 'sql' => $sr['sql'], 'dr' => $sr['dr']);
    }
    foreach ($modules as $name => $module) {
        foreach ($module as $item) {
            $parameters = implode(', ', $item['parameters']);
            $type = menu_type($parameters);
            $res = calculate_combinatory($type, $item['sql'], $dbconn);
            $query = "UPDATE custom_report_types SET dr = ? WHERE id=?";
            $params = array($res, $item['id']);
            $result = $dbconn->Execute($query, $params);
        }
    }
    $dbconn->disconnect();
} catch (Exception $e) {
}
function get_parameter($n = -1)
{
    $param = get_parameters(false);
    if ($n < 0) {
        return $param;
    }
    if (empty($param[$n])) {
        return null;
    }
    return $param[$n];
}