Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

Using the File API: diferència entre les revisions

De MoodleDocs
Salta a:navegació, cerca
Cap resum de modificació
Cap resum de modificació
Línia 1: Línia 1:
{{Moodle 2.0}}
{{stub}}
{{stub}}


{{Moodle 2.0}}
Well, in the absence of other information, here is my guess:
Well, in the absence of other information, here is my guess:


Línia 21: Línia 21:
==See also==
==See also==


* [[Development:File API|File API system design]]
* [[Roadmap|Moodle 2.0 roadmap]]


[[Category:Developer]]
[[Category:Developer]]

Revisió del 10:23, 6 nov 2008


Plantilla:Moodle 2.0 Well, in the absence of other information, here is my guess:

If you already have a file, move it into a file area

For example, if you have just built a file at the path

$from_zip_file = $CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/".$preferences->backup_name;

And you want to move it into the course_backup file area, do

$context = get_context_instance(CONTEXT_COURSE, $preferences->backup_course);
$fs = get_file_storage();
$file_record = array('contextid'=>$context->id, 'filearea'=>'course_backup',
        'itemid'=>0, 'filepath'=>'/', 'filename'=>$preferences->backup_name,
        'timecreated'=>time(), 'timemodified'=>time());
$fs->create_file_from_pathname($file_record, $from_zip_file);

See also