예제 #1
0
파일: uploaduser.php 프로젝트: r007/PMoodle
    }
} else {
    $cir = new csv_import_reader($iid, 'uploaduser');
}
if (!($columns = $cir->get_columns())) {
    error('Error reading temporary file', $returnurl);
}
$mform = new admin_uploaduser_form2(null, $columns);
// get initial date from form1
$mform->set_data(array('iid' => $iid, 'previewrows' => $previewrows, 'readcount' => $readcount));
// If a file has been uploaded, then process it
if ($formdata = $mform->is_cancelled()) {
    $cir->cleanup(true);
    redirect($returnurl);
} else {
    if ($formdata = $mform->get_data(false)) {
        // no magic quotes here!!!
        // Print the header
        admin_externalpage_print_header();
        print_heading(get_string('uploadusersresult', 'admin'));
        $optype = $formdata->uutype;
        $createpasswords = (!empty($formdata->uupasswordnew) and $optype != UU_UPDATE);
        $updatepasswords = (!empty($formdata->uupasswordold) and $optype != UU_ADDNEW and $optype != UU_ADDINC);
        $allowrenames = (!empty($formdata->uuallowrenames) and $optype != UU_ADDNEW and $optype != UU_ADDINC);
        $allowdeletes = (!empty($formdata->uuallowdeletes) and $optype != UU_ADDNEW and $optype != UU_ADDINC);
        $updatetype = isset($formdata->uuupdatetype) ? $formdata->uuupdatetype : 0;
        $bulk = $formdata->uubulk;
        $noemailduplicates = $formdata->uunoemailduplicates;
        // verification moved to two places: after upload and into form2
        $usersnew = 0;
        $usersupdated = 0;
예제 #2
0
        echo $OUTPUT->heading_with_help(get_string('uploadusers', 'admin'), 'uploadusers', 'admin');
        $mform1->display();
        echo $OUTPUT->footer();
        die;
    }
} else {
    $cir = new csv_import_reader($iid, 'uploaduser');
    $filecolumns = uu_validate_user_upload_columns($cir, $STD_FIELDS, $PRF_FIELDS, $returnurl);
}
$mform2 = new admin_uploaduser_form2(null, array('columns' => $filecolumns, 'data' => array('iid' => $iid, 'previewrows' => $previewrows)));
// If a file has been uploaded, then process it
if ($formdata = $mform2->is_cancelled()) {
    $cir->cleanup(true);
    redirect($returnurl);
} else {
    if ($formdata = $mform2->get_data()) {
        // Print the header
        echo $OUTPUT->header();
        echo $OUTPUT->heading(get_string('uploadusersresult', 'admin'));
        $optype = $formdata->uutype;
        $updatetype = isset($formdata->uuupdatetype) ? $formdata->uuupdatetype : 0;
        $createpasswords = (!empty($formdata->uupasswordnew) and $optype != UU_USER_UPDATE);
        $updatepasswords = (!empty($formdata->uupasswordold) and $optype != UU_USER_ADDNEW and $optype != UU_USER_ADDINC and ($updatetype == UU_UPDATE_FILEOVERRIDE or $updatetype == UU_UPDATE_ALLOVERRIDE));
        $allowrenames = (!empty($formdata->uuallowrenames) and $optype != UU_USER_ADDNEW and $optype != UU_USER_ADDINC);
        $allowdeletes = (!empty($formdata->uuallowdeletes) and $optype != UU_USER_ADDNEW and $optype != UU_USER_ADDINC);
        $bulk = $formdata->uubulk;
        $noemailduplicates = $formdata->uunoemailduplicates;
        $standardusernames = $formdata->uustandardusernames;
        $resetpasswords = isset($formdata->uuforcepasswordchange) ? $formdata->uuforcepasswordchange : UU_PWRESET_NONE;
        // verification moved to two places: after upload and into form2
        $usersnew = 0;
예제 #3
0
    $cir = new csv_import_reader($iid, 'uploaduser');
}

if (!$columns = $cir->get_columns()) {
    print_error('cannotreadtmpfile', 'error', $returnurl);
}
$mform = new admin_uploaduser_form2(null, $columns);
// get initial date from form1
$mform->set_data(array('iid'=>$iid, 'previewrows'=>$previewrows, 'readcount'=>$readcount, 'uutypelabel'=>$choices[$uploadtype], 'uutype'=>$uploadtype));

// If a file has been uploaded, then process it
if ($formdata = $mform->is_cancelled()) {
    $cir->cleanup(true);
    redirect($returnurl);

} else if ($formdata = $mform->get_data()) {
    // Print the header
    echo $OUTPUT->header();
    echo $OUTPUT->heading(get_string('uploadusersresult', 'admin'));

    $optype = $formdata->uutype;

    $createpasswords   = (!empty($formdata->uupasswordnew) and $optype != UU_UPDATE);
    $updatepasswords   = (!empty($formdata->uupasswordold)  and $optype != UU_ADDNEW and $optype != UU_ADDINC);
    $allowrenames      = (!empty($formdata->uuallowrenames) and $optype != UU_ADDNEW and $optype != UU_ADDINC);
    $allowdeletes      = (!empty($formdata->uuallowdeletes) and $optype != UU_ADDNEW and $optype != UU_ADDINC);
    $updatetype        = isset($formdata->uuupdatetype) ? $formdata->uuupdatetype : 0;
    $bulk              = $formdata->uubulk;
    $noemailduplicates = $formdata->uunoemailduplicates;

    // verification moved to two places: after upload and into form2