Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 45... Línea 45...
45
     * @param null|array $options general options for course module. Since 2.6 it is
45
     * @param null|array $options general options for course module. Since 2.6 it is
46
     *     possible to omit this argument by merging options into $record
46
     *     possible to omit this argument by merging options into $record
47
     * @return stdClass record from module-defined table with additional field
47
     * @return stdClass record from module-defined table with additional field
48
     *     cmid (corresponding id in course_modules table)
48
     *     cmid (corresponding id in course_modules table)
49
     */
49
     */
50
    public function create_instance($record = null, array $options = null): stdClass {
50
    public function create_instance($record = null, ?array $options = null): stdClass {
51
        global $CFG, $USER;
51
        global $CFG, $USER;
52
        // Ensure the record can be modified without affecting calling code.
52
        // Ensure the record can be modified without affecting calling code.
53
        $record = (object)(array)$record;
53
        $record = (object)(array)$record;
Línea 54... Línea 54...
54
 
54
 
55
        // Fill in optional values if not specified.
55
        // Fill in optional values if not specified.
56
        if (!isset($record->packagefilepath)) {
56
        if (!isset($record->packagefilepath)) {
57
            $record->packagefilepath = $CFG->dirroot.'/h5p/tests/fixtures/h5ptest.zip';
57
            $record->packagefilepath = $CFG->dirroot.'/h5p/tests/fixtures/ipsums.h5p';
58
        } else if (strpos($record->packagefilepath, $CFG->dirroot) !== 0) {
58
        } else if (strpos($record->packagefilepath, $CFG->dirroot) !== 0) {
59
            $record->packagefilepath = "{$CFG->dirroot}/{$record->packagefilepath}";
59
            $record->packagefilepath = "{$CFG->dirroot}/{$record->packagefilepath}";
60
        }
60
        }
61
        if (!isset($record->grade)) {
61
        if (!isset($record->grade)) {