Search moodle.org's
Developer Documentation

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
  • Differences Between: [Versions 310 and 34] [Versions 310 and 35] [Versions 34 and 310] [Versions 35 and 310]

    A form for cohort upload.

    Copyright: 2014 Marina Glancy
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 570 lines (23 kb)
    Included or required:0 times
    Referenced: 1 time
    Includes or requires: 0 files

    Defines 1 class


    Class: cohort_upload_form  - X-Ref

    Cohort upload form class

    definition()   X-Ref
    Form definition


    add_cohort_upload_buttons()   X-Ref
    Add buttons to the form ("Upload cohorts", "Preview", "Cancel")


    definition_after_data()   X-Ref
    Process the uploaded file and allow the submit button only if it doest not have errors.


    get_context_options()   X-Ref
    Returns the list of contexts where current user can create cohorts.

    return: array

    validation($data, $files)   X-Ref
    No description

    get_cohort_file($draftid)   X-Ref
    Returns the uploaded file if it is present.

    return: stored_file|null
    param: int $draftid

    get_cohorts_data()   X-Ref
    Returns the list of prepared objects to be added as cohorts

    return: array of stdClass objects, each can be passed to {@link cohort_add_cohort()}

    preview_uploaded_cohorts()   X-Ref
    Displays the preview of the uploaded file


    get_previewed_rows()   X-Ref
    Find up rows to show in preview

    Number of previewed rows is limited but rows with errors and warnings have priority.

    return: array

    display()   X-Ref
    No description

    process_upload_file($file, $encoding, $delimiter, $defaultcontext)   X-Ref

    return: array
    param: stored_file $file
    param: string $encoding
    param: string $delimiter
    param: context $defaultcontext

    clean_cohort_data(&$hash)   X-Ref
    Cleans input data about one cohort.

    param: array $hash

    resolve_context(&$hash, $defaultcontext)   X-Ref
    Determines in which context the particular cohort will be created

    return: array array of warning strings
    param: array $hash
    param: context $defaultcontext