• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP moodle1_converter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中moodle1_converter的典型用法代码示例。如果您正苦于以下问题:PHP moodle1_converter类的具体用法?PHP moodle1_converter怎么用?PHP moodle1_converter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了moodle1_converter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: process_facetoface

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/FACETOFACE
  * data available
  */
 public function process_facetoface($data)
 {
     global $CFG;
     // Get the course module id and context id.
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // Replay the upgrade step 2009042006.
     if ($CFG->texteditors !== 'textarea') {
         $data['intro'] = text_to_html($data['description'], false, false, true);
         $data['introformat'] = FORMAT_HTML;
     }
     // Get a fresh new file manager for this instance.
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_facetoface');
     // Convert course files embedded into the intro.
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // Start writing facetoface.xml.
     $this->open_xml_writer("activities/facetoface_{$this->moduleid}/facetoface.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'facetoface', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('facetoface', array('id' => $instanceid));
     unset($data['id']);
     foreach ($data as $field => $value) {
         $this->xmlwriter->full_tag($field, $value);
     }
     return $data;
 }
开发者ID:Mihailoff,项目名称:facetoface-2.0,代码行数:33,代码来源:lib.php


示例2: process_label

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/LABEL
  * data available
  */
 public function process_label($data)
 {
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
     // get a fresh new file manager for this instance
     $fileman = $this->converter->get_file_manager($contextid, 'mod_label');
     // convert course files embedded into the intro
     $fileman->filearea = 'intro';
     $fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $fileman);
     // write inforef.xml
     $this->open_xml_writer("activities/label_{$moduleid}/inforef.xml");
     $this->xmlwriter->begin_tag('inforef');
     $this->xmlwriter->begin_tag('fileref');
     foreach ($fileman->get_fileids() as $fileid) {
         $this->write_xml('file', array('id' => $fileid));
     }
     $this->xmlwriter->end_tag('fileref');
     $this->xmlwriter->end_tag('inforef');
     $this->close_xml_writer();
     // write label.xml
     $this->open_xml_writer("activities/label_{$moduleid}/label.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $moduleid, 'modulename' => 'label', 'contextid' => $contextid));
     $this->write_xml('label', $data, array('/label/id'));
     $this->xmlwriter->end_tag('activity');
     $this->close_xml_writer();
     return $data;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:35,代码来源:lib.php


示例3: process_forum

 /**
  * Converts /MOODLE_BACKUP/COURSE/MODULES/MOD/FORUM data
  */
 public function process_forum($data)
 {
     global $CFG;
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_forum');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // Convert the introformat if necessary.
     if ($CFG->texteditors !== 'textarea') {
         $data['intro'] = text_to_html($data['intro'], false, false, true);
         $data['introformat'] = FORMAT_HTML;
     }
     // start writing forum.xml
     $this->open_xml_writer("activities/forum_{$this->moduleid}/forum.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'forum', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('forum', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     $this->xmlwriter->begin_tag('discussions');
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:lib.php


示例4: process_hsuforum

 /**
  * Converts /MOODLE_BACKUP/COURSE/MODULES/MOD/HSUFORUM data
  */
 public function process_hsuforum($data)
 {
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_hsuforum');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     if (!array_key_exists('maxattachments', $data)) {
         $data['maxattachments'] = 1;
     }
     if (array_key_exists('multiattach', $data) && empty($data['multiattach'])) {
         $data['maxattachments'] = 0;
     }
     unset($data['multiattach']);
     // start writing forum.xml
     $this->open_xml_writer("activities/hsuforum_{$this->moduleid}/hsuforum.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'hsuforum', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('hsuforum', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     $this->xmlwriter->begin_tag('discussions');
     return $data;
 }
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:35,代码来源:lib.php


示例5: process_assignment

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/ASSIGNMENT
  * data available
  */
 public function process_assignment($data)
 {
     global $CFG;
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     //store assignment type for possible subplugin conversions.
     $this->currentsubpluginname = $data['assignmenttype'];
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_assignment');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // convert the introformat if necessary
     if ($CFG->texteditors !== 'textarea') {
         $data['intro'] = text_to_html($data['intro'], false, false, true);
         $data['introformat'] = FORMAT_HTML;
     }
     // start writing assignment.xml
     $this->open_xml_writer("activities/assignment_{$this->moduleid}/assignment.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'assignment', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('assignment', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     //after writing the assignment type element, let the subplugin add on whatever it wants.
     $this->handle_assignment_subplugin($data);
     $this->xmlwriter->begin_tag('submissions');
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:39,代码来源:lib.php


示例6: process_feedback

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/FEEDBACK
  * data available
  */
 public function process_feedback($data)
 {
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_feedback');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // start writing feedback.xml
     $this->open_xml_writer("activities/feedback_{$this->moduleid}/feedback.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'feedback', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('feedback', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     $this->xmlwriter->begin_tag('items');
     return $data;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:29,代码来源:lib.php


示例7: process_legacy_resource

 /**
  * Converts /MOODLE_BACKUP/COURSE/MODULES/MOD/RESOURCE data
  * Called by moodle1_mod_resource_handler::process_resource()
  */
 public function process_legacy_resource(array $data, array $raw = null)
 {
     $instanceid = $data['id'];
     $currentcminfo = $this->get_cminfo($instanceid);
     $moduleid = $currentcminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
     // Prepare the new imscp instance record.
     $imscp = array();
     $imscp['id'] = $data['id'];
     $imscp['name'] = $data['name'];
     $imscp['intro'] = $data['intro'];
     $imscp['introformat'] = $data['introformat'];
     $imscp['revision'] = 1;
     $imscp['keepold'] = 1;
     $imscp['structure'] = null;
     $imscp['timemodified'] = $data['timemodified'];
     // Prepare a fresh new file manager for this instance.
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_imscp');
     // Convert course files embedded into the intro.
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $imscp['intro'] = moodle1_converter::migrate_referenced_files($imscp['intro'], $this->fileman);
     // Migrate package backup file.
     if ($data['reference']) {
         $packagename = basename($data['reference']);
         $packagepath = $this->converter->get_tempdir_path() . '/moddata/resource/' . $data['id'] . '/' . $packagename;
         if (file_exists($packagepath)) {
             $this->fileman->filearea = 'backup';
             $this->fileman->itemid = 1;
             $this->fileman->migrate_file('moddata/resource/' . $data['id'] . '/' . $packagename);
         } else {
             $this->log('missing imscp package', backup::LOG_WARNING, 'moddata/resource/' . $data['id'] . '/' . $packagename);
         }
     }
     // Migrate extracted package data.
     $this->fileman->filearea = 'content';
     $this->fileman->itemid = 1;
     $this->fileman->migrate_directory('moddata/resource/' . $data['id']);
     // Parse manifest.
     $structure = $this->parse_structure($this->converter->get_tempdir_path() . '/moddata/resource/' . $data['id'] . '/imsmanifest.xml', $imscp, $contextid);
     $imscp['structure'] = is_array($structure) ? serialize($structure) : null;
     // Write imscp.xml.
     $this->open_xml_writer("activities/imscp_{$moduleid}/imscp.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $moduleid, 'modulename' => 'imscp', 'contextid' => $contextid));
     $this->write_xml('imscp', $imscp, array('/imscp/id'));
     $this->xmlwriter->end_tag('activity');
     $this->close_xml_writer();
     // Write inforef.xml.
     $this->open_xml_writer("activities/imscp_{$moduleid}/inforef.xml");
     $this->xmlwriter->begin_tag('inforef');
     $this->xmlwriter->begin_tag('fileref');
     foreach ($this->fileman->get_fileids() as $fileid) {
         $this->write_xml('file', array('id' => $fileid));
     }
     $this->xmlwriter->end_tag('fileref');
     $this->xmlwriter->end_tag('inforef');
     $this->close_xml_writer();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:62,代码来源:lib.php


示例8: process_scorm

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/SCORM
  * data available
  */
 public function process_scorm($data)
 {
     global $CFG;
     // get the course module id and context id
     $instanceid = $data['id'];
     $currentcminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $currentcminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // conditionally migrate to html format in intro
     if ($CFG->texteditors !== 'textarea') {
         $data['intro'] = text_to_html($data['intro'], false, false, true);
         $data['introformat'] = FORMAT_HTML;
     }
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_scorm');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // check 1.9 version where backup was created
     $backupinfo = $this->converter->get_stash('backup_info');
     if ($backupinfo['moodle_version'] < 2007110503) {
         // as we have no module version data, assume $currmodule->version <= $module->version
         // - fix data as the source 1.9 build hadn't yet at time of backing up.
         $data['grademethod'] = $data['grademethod'] % 10;
     }
     // update scormtype (logic is consistent as done in scorm/db/upgrade.php)
     $ismanifest = preg_match('/imsmanifest\\.xml$/', $data['reference']);
     $iszippif = preg_match('/.(zip|pif)$/', $data['reference']);
     $isurl = preg_match('/^((http|https):\\/\\/|www\\.)/', $data['reference']);
     if ($isurl) {
         if ($ismanifest) {
             $data['scormtype'] = 'external';
         } else {
             if ($iszippif) {
                 $data['scormtype'] = 'localtype';
             }
         }
     }
     // migrate scorm package file
     $this->fileman->filearea = 'package';
     $this->fileman->itemid = 0;
     $this->fileman->migrate_file('course_files/' . $data['reference']);
     // start writing scorm.xml
     $this->open_xml_writer("activities/scorm_{$this->moduleid}/scorm.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'scorm', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('scorm', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     $this->xmlwriter->begin_tag('scoes');
     return $data;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:59,代码来源:lib.php


示例9: convert_configdata

 protected function convert_configdata(array $olddata)
 {
     $instanceid = $olddata['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);
     $configdata = unserialize(base64_decode($olddata['configdata']));
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'block_html');
     // convert course files embedded in the block content
     $this->fileman->filearea = 'content';
     $this->fileman->itemid = 0;
     $configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);
     $configdata->format = FORMAT_HTML;
     return base64_encode(serialize($configdata));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:lib.php


示例10: process_legacy_resource

    /**
     * Converts /MOODLE_BACKUP/COURSE/MODULES/MOD/RESOURCE data
     * Called by moodle1_mod_resource_handler::process_resource()
     */
    public function process_legacy_resource(array $data, array $raw = null) {
        // get the course module id and context id
        $instanceid     = $data['id'];
        $currentcminfo  = $this->get_cminfo($instanceid);
        $moduleid       = $currentcminfo['id'];
        $contextid      = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);

        // convert legacy data into the new folder record
        $folder                 = array();
        $folder['id']           = $data['id'];
        $folder['name']         = $data['name'];
        $folder['intro']        = $data['intro'];
        $folder['introformat']  = $data['introformat'];
        $folder['revision']     = 1;
        $folder['timemodified'] = $data['timemodified'];

        // get a fresh new file manager for this instance
        $this->fileman = $this->converter->get_file_manager($contextid, 'mod_folder');

        // migrate the files embedded into the intro field
        $this->fileman->filearea = 'intro';
        $this->fileman->itemid   = 0;
        $folder['intro'] = moodle1_converter::migrate_referenced_files($folder['intro'], $this->fileman);

        // migrate the folder files
        $this->fileman->filearea = 'content';
        $this->fileman->itemid   = 0;
        $this->fileman->migrate_directory('course_files/'.$data['reference']);

        // write folder.xml
        $this->open_xml_writer("activities/folder_{$moduleid}/folder.xml");
        $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $moduleid,
            'modulename' => 'folder', 'contextid' => $contextid));
        $this->write_xml('folder', $folder, array('/folder/id'));
        $this->xmlwriter->end_tag('activity');
        $this->close_xml_writer();

        // write inforef.xml
        $this->open_xml_writer("activities/folder_{$moduleid}/inforef.xml");
        $this->xmlwriter->begin_tag('inforef');
        $this->xmlwriter->begin_tag('fileref');
        foreach ($this->fileman->get_fileids() as $fileid) {
            $this->write_xml('file', array('id' => $fileid));
        }
        $this->xmlwriter->end_tag('fileref');
        $this->xmlwriter->end_tag('inforef');
        $this->close_xml_writer();
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:52,代码来源:lib.php


示例11: process_data

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/DATA
  * data available
  */
 public function process_data($data)
 {
     global $CFG;
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // replay the upgrade step 2007101512
     if (!array_key_exists('asearchtemplate', $data)) {
         $data['asearchtemplate'] = null;
     }
     // replay the upgrade step 2007101513
     if (is_null($data['notification'])) {
         $data['notification'] = 0;
     }
     // conditionally migrate to html format in intro
     if ($CFG->texteditors !== 'textarea') {
         $data['intro'] = text_to_html($data['intro'], false, false, true);
         $data['introformat'] = FORMAT_HTML;
     }
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_data');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // @todo: user data - upgrade content to new file storage
     // add 'export' tag to list and single template.
     $pattern = '/\\#\\#delete\\#\\#(\\s+)\\#\\#approve\\#\\#/';
     $replacement = '##delete##$1##approve##$1##export##';
     $data['listtemplate'] = preg_replace($pattern, $replacement, $data['listtemplate']);
     $data['singletemplate'] = preg_replace($pattern, $replacement, $data['singletemplate']);
     //@todo: user data - move data comments to comments table
     //@todo: user data - move data ratings to ratings table
     // start writing data.xml
     $this->open_xml_writer("activities/data_{$this->moduleid}/data.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'data', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('data', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     $this->xmlwriter->begin_tag('fields');
     return $data;
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:51,代码来源:lib.php


示例12: process_customlabel

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/CUSTOMLABEL
  * data available
  */
 public function process_customlabel($data)
 {
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
     // shifts content from name (moodle 1.9 label hacking location) to processed content and
     // computes a new explicit name
     $storedcontent = base64_decode($data['content']);
     $customlabel = json_decode($storedcontent);
     $data['processedcontent'] = $data['name'];
     $data['name'] = $customlabel->labelclass . $data['id'];
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_customlabel');
     // convert course files embedded into the content
     $this->fileman->filearea = 'content';
     $this->fileman->itemid = 0;
     // try get files and reencode from stored content stub.
     $storedcontent = moodle1_converter::migrate_referenced_files($storedcontent, $this->fileman);
     $data['content'] = base64_encode($storedcontent);
     $data['processedcontent'] = moodle1_converter::migrate_referenced_files($data['processedcontent'], $this->fileman);
     // write inforef.xml
     $this->open_xml_writer("activities/customlabel_{$moduleid}/inforef.xml");
     $this->xmlwriter->begin_tag('inforef');
     $this->xmlwriter->begin_tag('fileref');
     foreach ($this->fileman->get_fileids() as $fileid) {
         $this->write_xml('file', array('id' => $fileid));
     }
     $this->xmlwriter->end_tag('fileref');
     $this->xmlwriter->end_tag('inforef');
     $this->close_xml_writer();
     // write customlabel.xml
     $this->open_xml_writer("activities/customlabel_{$moduleid}/customlabel.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $moduleid, 'modulename' => 'customlabel', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('customlabel', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     // finish writing customlabel.xml
     $this->xmlwriter->end_tag('customlabel');
     $this->xmlwriter->end_tag('activity');
     $this->close_xml_writer();
     return $data;
 }
开发者ID:SmartPlanetInternational,项目名称:moodle-mod_customlabel,代码行数:51,代码来源:lib.php


示例13: process_geogebra

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/GEOGEBRA
  * data available
  */
 public function process_geogebra($data)
 {
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_geogebra');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // migrate geogebra package file
     $this->fileman->filearea = 'content';
     $this->fileman->itemid = 0;
     // Migrate file
     parse_str($data['url'], $parsedVarsURL);
     try {
         $this->fileman->migrate_file('course_files/' . $parsedVarsURL['filename']);
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), ' File: \'' . $parsedVarsURL['filename'] . '\' (from URL \'', $data['url'], '\') on GeoGebra activity \'' . $data['name'] . '\' <br>';
     }
     // From Moodle 2, URL field only contains information about the GGB file location
     $data['url'] = $parsedVarsURL['filename'];
     if (strrpos($data['url'], '/') !== FALSE) {
         // Remove folder path to leave only file name
         $data['url'] = substr($data['url'], strrpos($data['url'], '/') + 1);
     }
     // Remove filename from parsedVarsURL array (to avoid save twice)
     unset($parsedVarsURL['filename']);
     // Store other attributes in the new param
     $data['attributes'] = http_build_query($parsedVarsURL, '', '&');
     // start writing geogebra.xml
     $this->open_xml_writer("activities/geogebra_{$this->moduleid}/geogebra.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'geogebra', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('geogebra', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     return $data;
 }
开发者ID:ninelanterns,项目名称:moodle-mod_geogebra,代码行数:48,代码来源:lib.php


示例14: process_jclic

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/JCLIC
  * data available
  */
 public function process_jclic($data)
 {
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_jclic');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // migrate jclic package file
     $this->fileman->filearea = 'content';
     $this->fileman->itemid = 0;
     if (!jclic_is_valid_external_url($data['url'])) {
         // Migrate file
         try {
             $this->fileman->migrate_file('course_files/' . $data['url']);
         } catch (Exception $e) {
             echo 'Caught exception: ', $e->getMessage(), ' File: \'', $data['url'], '\' on JClic activity \'' . $data['name'] . '\' <br>';
         }
     }
     // To avoid problems if maxgrade is null
     if ($data['maxgrade'] === NULL) {
         $data['maxgrade'] = 100;
     }
     // get grade value from maxgrade
     $data['grade'] = $data['maxgrade'];
     // start writing jclic.xml
     $this->open_xml_writer("activities/jclic_{$this->moduleid}/jclic.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'jclic', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('jclic', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     return $data;
 }
开发者ID:danielvdml,项目名称:moodleyarcho,代码行数:45,代码来源:lib.php


示例15: process_rcontent

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/RCONTENT
  * data available
  */
 public function process_rcontent($data)
 {
     global $CFG;
     // get the course module id and context id
     $instanceid = $data['id'];
     $currentcminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $currentcminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // conditionally migrate to html format in summary
     if ($CFG->texteditors !== 'textarea') {
         $data['intro'] = text_to_html($data['intro'], false, false, true);
     }
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_rcontent');
     // convert course files embedded into the summary
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // check 1.9 version where backup was created
     $backupinfo = $this->converter->get_stash('backup_info');
     if ($backupinfo['moodle_version'] < 2007110503) {
         // as we have no module version data, assume $currmodule->version <= $module->version
         // - fix data as the source 1.9 build hadn't yet at time of backing up.
         if (isset($data['grademethod'])) {
             $data['grademethod'] = $data['grademethod'] % 10;
         }
     }
     // start writing rcontent.xml
     $this->open_xml_writer("activities/rcontent_{$this->moduleid}/rcontent.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'rcontent', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('rcontent', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     $this->xmlwriter->begin_tag('grades');
     return $data;
 }
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:43,代码来源:lib.php


示例16: process_basiclti

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/LTI
  * data available
  */
 public function process_basiclti($data)
 {
     global $DB;
     // Get the course module id and context id.
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // Get a fresh new file manager for this instance.
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_lti');
     // Convert course files embedded into the intro.
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // Start writing assignment.xml.
     $this->open_xml_writer("activities/lti_{$this->moduleid}/lti.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'lti', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('lti', array('id' => $instanceid));
     $ignorefields = array('id', 'modtype');
     if (!$DB->record_exists('lti_types', array('id' => $data['typeid']))) {
         $ntypeid = $DB->get_field('lti_types_config', 'typeid', array('name' => 'toolurl', 'value' => $data['toolurl']), IGNORE_MULTIPLE);
         if ($ntypeid === false) {
             $ntypeid = $DB->get_field('lti_types_config', 'typeid', array(), IGNORE_MULTIPLE);
         }
         if ($ntypeid === false) {
             $ntypeid = 0;
         }
         $data['typeid'] = $ntypeid;
     }
     if (empty($data['servicesalt'])) {
         $data['servicesalt'] = uniqid('', true);
     }
     foreach ($data as $field => $value) {
         if (!in_array($field, $ignorefields)) {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:43,代码来源:lib.php


示例17: process_quiz

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/QUIZ
  * data available
  */
 public function process_quiz($data)
 {
     global $CFG;
     // replay the upgrade step 2008081501
     if (is_null($data['sumgrades'])) {
         $data['sumgrades'] = 0;
         //@todo for user data: quiz_attempts SET sumgrades=0 WHERE sumgrades IS NULL
         //@todo for user data: quiz_grades.grade should be not be null , convert to default 0
     }
     // replay the upgrade step 2009042000
     if ($CFG->texteditors !== 'textarea') {
         $data['intro'] = text_to_html($data['intro'], false, false, true);
         $data['introformat'] = FORMAT_HTML;
     }
     // replay the upgrade step 2009031001
     $data['timelimit'] *= 60;
     // get the course module id and context id
     $instanceid = $data['id'];
     $cminfo = $this->get_cminfo($instanceid);
     $this->moduleid = $cminfo['id'];
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_quiz');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'intro';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
     // start writing quiz.xml
     $this->open_xml_writer("activities/quiz_{$this->moduleid}/quiz.xml");
     $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'quiz', 'contextid' => $contextid));
     $this->xmlwriter->begin_tag('quiz', array('id' => $instanceid));
     foreach ($data as $field => $value) {
         if ($field != 'id') {
             $this->xmlwriter->full_tag($field, $value);
         }
     }
     return $data;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:42,代码来源:lib.php


示例18: process_flashcard_deckdata

 /**
  * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/FEEDBACK/ITEMS/ITEM
  * data available
  */
 public function process_flashcard_deckdata($data)
 {
     $this->write_xml('deck', $data, array('/deck/id'));
     $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
     // get a fresh new file manager for this instance
     $this->fileman = $this->converter->get_file_manager($contextid, 'mod_flashcard');
     // convert course files embedded into the intro
     $this->fileman->filearea = 'answertext';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['answertext'], $this->fileman);
     // convert course files embedded into the intro
     $this->fileman->filearea = 'responsetext';
     $this->fileman->itemid = 0;
     $data['intro'] = moodle1_converter::migrate_referenced_files($data['responsetext'], $this->fileman);
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:19,代码来源:lib.php


示例19: test_referenced_course_files

    public function test_referenced_course_files()
    {
        $text = 'This is a text containing links to file.php
as it is parsed from the backup file. <br /><br /><img border="0" width="110" vspace="0" hspace="0" height="92" title="News" alt="News" src="$@FILEPHP@$$@SLASH@$pics$@SLASH@$news.gif" /><a href="$@FILEPHP@$$@SLASH@$pics$@SLASH@$news.gif$@FORCEDOWNLOAD@$">download image</a><br />
    <br /><a href=\'$@FILEPHP@$$@SLASH@$MANUAL.DOC$@FORCEDOWNLOAD@$\'>download manual</a><br />';
        $files = moodle1_converter::find_referenced_files($text);
        $this->assertEquals(gettype($files), 'array');
        $this->assertEquals(2, count($files));
        $this->assertTrue(in_array('/pics/news.gif', $files));
        $this->assertTrue(in_array('/MANUAL.DOC', $files));
        $text = moodle1_converter::rewrite_filephp_usage($text, array('/pics/news.gif', '/another/file/notused.txt'), $files);
        $this->assertEquals($text, 'This is a text containing links to file.php
as it is parsed from the backup file. <br /><br /><img border="0" width="110" vspace="0" hspace="0" height="92" title="News" alt="News" src="@@PLUGINFILE@@/pics/news.gif" /><a href="@@PLUGINFILE@@/pics/news.gif?forcedownload=1">download image</a><br />
    <br /><a href=\'$@FILEPHP@$$@SLASH@$MANUAL.DOC$@FORCEDOWNLOAD@$\'>download manual</a><br />');
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:15,代码来源:lib_test.php


示例20: process_gradebook_grade_outcome

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP moodle_database类代码示例发布时间:2022-05-23
下一篇:
PHP modules类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap