public function load_csv_content($text, $encoding, $separator, $previewrows) {
        $this->raise_limits();

        $this->iid = csv_import_reader::get_new_iid('grade');
        $csvimport = new csv_import_reader($this->iid, 'grade');

        $csvimport->load_csv_content($text, $encoding, $separator);
        $this->error = $csvimport->get_error();

        // If there are no import errors then proceed.
        if (empty($this->error)) {

            // Get header (field names).
            $this->headers = $csvimport->get_columns();
            $this->trim_headers();

            $csvimport->init();
            $this->previewdata = array();

            for ($numlines = 0; $numlines <= $previewrows; $numlines++) {
                $lines = $csvimport->next();
                if ($lines) {
                    $this->previewdata[] = $lines;
                }
            }
        }
    }
public function load_csv_content($text, $encoding, $separator, $previewrows) {
        $this->raise_limits();

        $this->iid = csv_import_reader::get_new_iid('grade');
        $csvimport = new csv_import_reader($this->iid, 'grade');

        $csvimport->load_csv_content($text, $encoding, $separator);
        $this->error = $csvimport->get_error();

        // If there are no import errors then proceed.
        if (empty($this->error)) {

            // Get header (field names).
            $this->headers = $csvimport->get_columns();
            $this->trim_headers();

            $csvimport->init();
            $this->previewdata = array();

            for ($numlines = 0; $numlines <= $previewrows; $numlines++) {
                $lines = $csvimport->next();
                if ($lines) {
                    $this->previewdata[] = $lines;
                }
            }
        }
    }
public function load_csv_content ( $ text , $ encoding , $ separator , $ previewrows ) { $ this -> raise_limits ( ) ; $ this -> iid = csv_import_reader :: get_new_iid ( 'grade' ) ; $ csvimport = new csv_import_reader ( $ this -> iid , 'grade' ) ; $ csvimport -> load_csv_content ( $ text , $ encoding , $ separator ) ; $ this -> error = $ csvimport -> get_error ( ) ; // If there are no import errors then proceed. if ( empty ( $ this -> error ) ) { // Get header (field names). $ this -> headers = $ csvimport -> get_columns ( ) ; $ this -> trim_headers ( ) ; $ csvimport -> init ( ) ; $ this -> previewdata = array ( ) ; for ( $ numlines = 0 ; $ numlines <= $ previewrows ; $ numlines ++ ) { $ lines = $ csvimport -> next ( ) ; if ( $ lines ) { $ this -> previewdata [ ] = $ lines ; } } } }
Load CSV content for previewing.

@param string $text The grade data being imported.
@param string $encoding The type of encoding the file uses.
@param string $separator The separator being used to define each field.
@param int $previewrows How many rows are being previewed.
Load CSV content for previewing .