예제 #1
0
function create_linked_user($username, $email, $password, $panelType)
{
    // Global variables
    global $redis_enabled, $redis_server;
    // Connect to the DB
    $ret = create_connection($connection);
    if ($ret !== true) {
        return $ret;
    }
    // Connect to Redis
    if ($redis_enabled === true) {
        $redis = new Redis();
        if (!$redis->connect($redis_server)) {
            $redis = false;
        }
    } else {
        $redis = false;
    }
    // Validate input
    $ret = validate_input($username, $email, $password, $panelType);
    if ($ret !== true) {
        end_connection(true, $connection);
        return $ret;
    }
    // Create user
    if (create_user($username, $email, $password, $userid, $apikey, $connection) !== true) {
        end_connection(true, $connection);
        return 'Username already exists';
    }
    // Set the type of user profile
    $prefix = 'data/' . $panelType;
    // Create feeds
    if (create_feeds($prefix . '_feeds.json', $feeds, $apikey) !== true) {
        end_connection(true, $connection);
        return 'Error while creating the feeds';
    }
    // Create inputs
    if (create_inputs($prefix . '_inputs.json', $userid, $inputs, $connection, $redis) !== true) {
        end_connection(true, $connection);
        return 'Error while creating the inputs';
    }
    // Create processes
    if (create_processes($prefix . '_processes.json', $feeds, $inputs, $apikey) !== true) {
        end_connection(true, $connection);
        return 'Error while creating the processes';
    }
    end_connection(false, $connection);
    return true;
}
?>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">Application configuration</div>
        <div class="panel-body">
            <label>Application input</label>
            <div class="well">
                <div class="form-group">
                    <p><strong>Current inputs</strong></p>
                    <?php 
list_input_files($experiment);
?>
                </div>
                <?php 
create_inputs($experiment->applicationId, false);
?>
            </div>

        <div class="form-group">
            <label for="compute-resource">Compute Resource</label>
            <?php 
create_compute_resources_select($experiment->applicationId, $scheduling->resourceHostId);
?>
        </div>

    <div class="form-group">
        <label for="node-count">Node Count</label>
        <input type="number"
               class="form-control"
               name="node-count"
create_application_select($application, !$disabled);
echo '</div>';
if (!isset($_POST['continue'])) {
    echo '<div class="btn-toolbar">
        <input name="continue" type="submit" class="btn btn-primary" value="Continue">
        <input name="clear" type="reset" class="btn btn-default" value="Reset values">
        </div>
        ';
} else {
    echo '<div class="panel panel-default">
        <div class="panel-heading">Application configuration</div>
        <div class="panel-body">
        <label>Application input</label>
        <div class="well">
        ';
    create_inputs($application, true);
    echo '</div>
            <div class="form-group">
                <label for="compute-resource">Compute Resource</label>';
    create_compute_resources_select($application, null);
    echo '
            </div>
            <div class="form-group">
                <label for="node-count">Node Count</label>
                <input type="number" class="form-control" name="node-count" id="node-count" value="1" min="1">
            </div>
            <div class="form-group">
                <label for="cpu-count">Total Core Count</label>
                <input type="number" class="form-control" name="cpu-count" id="cpu-count" value="4" min="1">
            </div>
            <!--