public function getPHP($includeprevious=true) {

        $result = '';

        // The XMLDBTYPE
        switch ($this->getType()) {
            case XMLDB_TYPE_INTEGER:
                $result .= 'XMLDB_TYPE_INTEGER' . ', ';
                break;
            case XMLDB_TYPE_NUMBER:
                $result .= 'XMLDB_TYPE_NUMBER' . ', ';
                break;
            case XMLDB_TYPE_FLOAT:
                $result .= 'XMLDB_TYPE_FLOAT' . ', ';
                break;
            case XMLDB_TYPE_CHAR:
                $result .= 'XMLDB_TYPE_CHAR' . ', ';
                break;
            case XMLDB_TYPE_TEXT:
                $result .= 'XMLDB_TYPE_TEXT' . ', ';
                break;
            case XMLDB_TYPE_BINARY:
                $result .= 'XMLDB_TYPE_BINARY' . ', ';
                break;
            case XMLDB_TYPE_DATETIME:
                $result .= 'XMLDB_TYPE_DATETIME' . ', ';
                break;
            case XMLDB_TYPE_TIMESTAMP:
                $result .= 'XMLDB_TYPE_TIMESTAMP' . ', ';
                break;
        }
        // The length
        $length = $this->getLength();
        $decimals = $this->getDecimals();
        if (!empty($length)) {
            $result .= "'" . $length;
            if (!empty($decimals)) {
                $result .= ', ' . $decimals;
            }
            $result .= "', ";
        } else {
            $result .= 'null, ';
        }
        // Unsigned is not used any more since Moodle 2.3
        $result .= 'null, ';
        // Not Null
        $notnull = $this->getNotnull();
        if (!empty($notnull)) {
            $result .= 'XMLDB_NOTNULL' . ', ';
        } else {
            $result .= 'null, ';
        }
        // Sequence
        $sequence = $this->getSequence();
        if (!empty($sequence)) {
            $result .= 'XMLDB_SEQUENCE' . ', ';
        } else {
            $result .= 'null, ';
        }
        // Default
        $default =  $this->getDefault();
        if ($default !== null && !$this->getSequence()) {
            $result .= "'" . $default . "'";
        } else {
            $result .= 'null';
        }
        // Previous (decided by parameter)
        if ($includeprevious) {
            $previous = $this->getPrevious();
            if (!empty($previous)) {
                $result .= ", '" . $previous . "'";
            } else {
                $result .= ', null';
            }
        }
        // Return result
        return $result;
    }
public function getPHP($includeprevious=true) {

        $result = '';

        // The XMLDBTYPE
        switch ($this->getType()) {
            case XMLDB_TYPE_INTEGER:
                $result .= 'XMLDB_TYPE_INTEGER' . ', ';
                break;
            case XMLDB_TYPE_NUMBER:
                $result .= 'XMLDB_TYPE_NUMBER' . ', ';
                break;
            case XMLDB_TYPE_FLOAT:
                $result .= 'XMLDB_TYPE_FLOAT' . ', ';
                break;
            case XMLDB_TYPE_CHAR:
                $result .= 'XMLDB_TYPE_CHAR' . ', ';
                break;
            case XMLDB_TYPE_TEXT:
                $result .= 'XMLDB_TYPE_TEXT' . ', ';
                break;
            case XMLDB_TYPE_BINARY:
                $result .= 'XMLDB_TYPE_BINARY' . ', ';
                break;
            case XMLDB_TYPE_DATETIME:
                $result .= 'XMLDB_TYPE_DATETIME' . ', ';
                break;
            case XMLDB_TYPE_TIMESTAMP:
                $result .= 'XMLDB_TYPE_TIMESTAMP' . ', ';
                break;
        }
        // The length
        $length = $this->getLength();
        $decimals = $this->getDecimals();
        if (!empty($length)) {
            $result .= "'" . $length;
            if (!empty($decimals)) {
                $result .= ', ' . $decimals;
            }
            $result .= "', ";
        } else {
            $result .= 'null, ';
        }
        // Unsigned is not used any more since Moodle 2.3
        $result .= 'null, ';
        // Not Null
        $notnull = $this->getNotnull();
        if (!empty($notnull)) {
            $result .= 'XMLDB_NOTNULL' . ', ';
        } else {
            $result .= 'null, ';
        }
        // Sequence
        $sequence = $this->getSequence();
        if (!empty($sequence)) {
            $result .= 'XMLDB_SEQUENCE' . ', ';
        } else {
            $result .= 'null, ';
        }
        // Default
        $default =  $this->getDefault();
        if ($default !== null && !$this->getSequence()) {
            $result .= "'" . $default . "'";
        } else {
            $result .= 'null';
        }
        // Previous (decided by parameter)
        if ($includeprevious) {
            $previous = $this->getPrevious();
            if (!empty($previous)) {
                $result .= ", '" . $previous . "'";
            } else {
                $result .= ', null';
            }
        }
        // Return result
        return $result;
    }
public function getPHP ( $ includeprevious = true ) { $ result = '' ; // The XMLDBTYPE switch ( $ this -> getType ( ) ) { case XMLDB_TYPE_INTEGER : $ result .= 'XMLDB_TYPE_INTEGER' . ', ' ; break ; case XMLDB_TYPE_NUMBER : $ result .= 'XMLDB_TYPE_NUMBER' . ', ' ; break ; case XMLDB_TYPE_FLOAT : $ result .= 'XMLDB_TYPE_FLOAT' . ', ' ; break ; case XMLDB_TYPE_CHAR : $ result .= 'XMLDB_TYPE_CHAR' . ', ' ; break ; case XMLDB_TYPE_TEXT : $ result .= 'XMLDB_TYPE_TEXT' . ', ' ; break ; case XMLDB_TYPE_BINARY : $ result .= 'XMLDB_TYPE_BINARY' . ', ' ; break ; case XMLDB_TYPE_DATETIME : $ result .= 'XMLDB_TYPE_DATETIME' . ', ' ; break ; case XMLDB_TYPE_TIMESTAMP : $ result .= 'XMLDB_TYPE_TIMESTAMP' . ', ' ; break ; } // The length $ length = $ this -> getLength ( ) ; $ decimals = $ this -> getDecimals ( ) ; if ( ! empty ( $ length ) ) { $ result .= "'" . $ length ; if ( ! empty ( $ decimals ) ) { $ result .= ', ' . $ decimals ; } $ result .= "', " ; } else { $ result .= 'null, ' ; } // Unsigned is not used any more since Moodle 2.3 $ result .= 'null, ' ; // Not Null $ notnull = $ this -> getNotnull ( ) ; if ( ! empty ( $ notnull ) ) { $ result .= 'XMLDB_NOTNULL' . ', ' ; } else { $ result .= 'null, ' ; } // Sequence $ sequence = $ this -> getSequence ( ) ; if ( ! empty ( $ sequence ) ) { $ result .= 'XMLDB_SEQUENCE' . ', ' ; } else { $ result .= 'null, ' ; } // Default $ default = $ this -> getDefault ( ) ; if ( $ default !== null && ! $ this -> getSequence ( ) ) { $ result .= "'" . $ default . "'" ; } else { $ result .= 'null' ; } // Previous (decided by parameter) if ( $ includeprevious ) { $ previous = $ this -> getPrevious ( ) ; if ( ! empty ( $ previous ) ) { $ result .= ", '" . $ previous . "'" ; } else { $ result .= ', null' ; } } // Return result return $ result ; }
Returns the PHP code needed to define one xmldb_field
@param bool $includeprevious
@return string
Returns the PHP code needed to define one xmldb_field