コード例 #1
0
ファイル: prcimport.php プロジェクト: xhippy01/prcimport
function start_import()
{
    $started = date('d-m-Y @ G:i:s');
    echo "script started: " . $started . PHP_EOL;
    //just getting data from csv files, not adding to database at this point
    $users = grab_users();
    $courses = grab_courses();
    $userimport = create_users($users);
    //now get the top level courses.  These should be hidden from view
    $topcourses = create_topcourses($courses);
    //create cohorts,
    //attach cohorts to main course($ in csv),
    //fill cohorts with students who should be enrolled,
    //create cohort enrolment linkage in db
    $cohorts = create_cohorts($users);
    attach_cohorts($topcourses, $cohorts);
    fill_cohorts($userimport, $cohorts);
    get_enrol_data($userimport, $topcourses, 'cohort');
    //create taught units,
    //attach taught units (as meta) to main course($),
    //create meta enrollment linkage in db
    $units = create_units($courses);
    $units_with_extras = attach_meta($topcourses, $units);
    get_enrol_data($userimport, $units_with_extras, 'meta');
    $ended = date('d-m-Y @ G:i:s');
    echo "script started: " . $started . PHP_EOL;
    echo "script ended: " . $ended . PHP_EOL;
}
コード例 #2
0
function create_tables()
{
    create_ability_upgrades();
    create_additional_units();
    create_items();
    create_leagues();
    create_prize_pools();
    create_matches();
    create_picks_bans();
    create_slots();
    create_users();
    create_teams();
}
コード例 #3
0
    echo "starting query on database '{$database}'........<br>\n";
    //global $debug; $debug = true;
    $res = _query($database, $query);
    if ($res) {
        echo "success.<br>\n";
    } else {
        die("query failure ({$ERROR})<br>\n");
    }
    if (@$CONFIG["USE_AUTH"]) {
        global $OLD;
        if ($OLD) {
            echo "Keeping profiles.<br>\n";
        } else {
            echo "creating bootstrap data for profiles / languages / users ........<br>\n";
            create_profiles();
            create_languages();
            create_users();
            echo "done.<br>\n";
        }
    }
    //$debug = true;
    foreach ($INITDATA as $table => $data) {
        echo "INIT: writing \$INITDATA['{$table}']......<br>\n";
        create_data($table, $INITDATA[$table]);
    }
    echo "ready.<br>\n";
}
?>
</body>
</html>
コード例 #4
0
        //      expects: username,firstname,lastname,email,idnumber
        fgets($fh);
        //skip the first line
        while ($a_line = fgetcsv($fh, 255, ',', '"')) {
            $a_user = array();
            $a_user['username'] = $a_line[0];
            $a_user['password'] = "******";
            $a_user['firstname'] = $a_line[1];
            $a_user['lastname'] = $a_line[2];
            $a_user['email'] = $a_line[3];
            $a_user['auth'] = 'ldap';
            $a_user['idnumber'] = $a_line[4];
            $a_user['lang'] = 'en';
            array_push($a_users, $a_user);
        }
        print_r(create_users($a_users));
    } else {
        echo "Error: Missing File!";
        return;
    }
} catch (Exception $e) {
    echo $e->getMessage();
    return;
}
/**
* array(
'username'    => new external_value(PARAM_RAW, 'Username policy is defined in Moodle security config'),
'password'    => new external_value(PARAM_RAW, 'Plain text password consisting of any characters'),
'firstname'   => new external_value(PARAM_NOTAGS, 'The first name(s) of the user'),
'lastname'    => new external_value(PARAM_NOTAGS, 'The family name of the user'),
'email'       => new external_value(PARAM_EMAIL, 'A valid and unique email address'),
コード例 #5
0
ファイル: test_config.php プロジェクト: scottdavis/nimblize
function user_data()
{
    create_users();
    create_clubs();
    fill_user_photos();
    link_users_to_clubs();
}