当前位置: 首页>>代码示例>>PHP>>正文


PHP backup_todb函数代码示例

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


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

示例1: slideshow_captions_restore_mods

function slideshow_captions_restore_mods($old_slideshow_id, $new_slideshow_id, $info, $restore)
{
    global $CFG;
    $status = true;
    //Get the captions array
    $captions = $info['MOD']['#']['CAPTIONS']['0']['#']['CAPTION'];
    //Iterate over captions
    for ($i = 0; $i < sizeof($captions); $i++) {
        $cap_info = $captions[$i];
        //traverse_xmlize($cap_info);                                                                 //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //We'll need this later!!
        $oldid = backup_todb($cap_info['#']['ID']['0']['#']);
        $olduserid = backup_todb($cap_info['#']['USERID']['0']['#']);
        //Now, build the SLIDESHOW_MESSAGES record structure
        $caption->slideshow = $new_slideshow_id;
        $caption->image = backup_todb($cap_info['#']['IMAGE']['0']['#']);
        $caption->title = backup_todb($cap_info['#']['TITLE']['0']['#']);
        $caption->caption = backup_todb($cap_info['#']['CAPTION']['0']['#']);
        //The structure is equal to the db, so insert the slideshow_message
        $newid = insert_record("slideshow_captions", $caption);
        //Do some output
        if (($i + 1) % 50 == 0) {
            if (!defined('RESTORE_SILENTLY')) {
                echo ".";
                if (($i + 1) % 1000 == 0) {
                    echo "<br />";
                }
            }
            backup_flush(300);
        }
    }
    return $status;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:35,代码来源:restorelib.php

示例2: diplome_restore_mods

function diplome_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //Now, build the ACCOUNTING record structure
        $diplome->course = $restore->course_id;
        $diplome->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $diplome->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $diplome->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
        $diplome->timecreated = time();
        $diplome->timemodified = time();
        //The structure is equal to the db, so insert the label
        $newid = insert_record("diplome", $diplome);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "diplome") . " \"" . format_string(stripslashes($diplome->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:ruxandra25,项目名称:diplome,代码行数:34,代码来源:restorelib.php

示例3: label_restore_mods

function label_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the LABEL record structure
        $label->course = $restore->course_id;
        $label->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $label->content = backup_todb($info['MOD']['#']['CONTENT']['0']['#']);
        $label->timemodified = $info['MOD']['#']['TIMEMODIFIED']['0']['#'];
        //The structure is equal to the db, so insert the label
        $newid = insert_record("label", $label);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "label") . " \"" . format_string(stripslashes($label->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:35,代码来源:restorelib.php

示例4: lightboxgallery_restore_metadata

function lightboxgallery_restore_metadata($galleryid, $info, $restore)
{
    $status = true;
    if (isset($info['MOD']['#']['IMAGEMETAS']['0']['#']['IMAGEMETA'])) {
        $imagemetas = $info['MOD']['#']['IMAGEMETAS']['0']['#']['IMAGEMETA'];
    } else {
        $imagemetas = array();
    }
    for ($i = 0; $i < sizeof($imagemetas); $i++) {
        $sub_info = $imagemetas[$i];
        $oldid = backup_todb($sub_info['#']['ID']['0']['#']);
        $record = new object();
        $record->gallery = $galleryid;
        $record->image = backup_todb($sub_info['#']['IMAGE']['0']['#']);
        $record->metatype = backup_todb($sub_info['#']['METATYPE']['0']['#']);
        $record->description = backup_todb($sub_info['#']['DESCRIPTION']['0']['#']);
        $newid = insert_record('lightboxgallery_image_meta', $record);
        if (($i + 1) % 50 == 0) {
            if (!defined('RESTORE_SILENTLY')) {
                echo '.';
                if (($i + 1) % 1000 == 0) {
                    echo '<br />';
                }
            }
            backup_flush(300);
        }
        if ($newid) {
            backup_putid($restore->backup_unique_code, 'lightboxgallery_image_meta', $oldid, $newid);
        } else {
            $status = false;
        }
    }
    return $status;
}
开发者ID:itziko,项目名称:Moodle-jQuery-Lightbox-Gallery,代码行数:34,代码来源:restorelib.php

示例5: tab_restore_mods

function tab_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the tab record structure
        $tab->course = $restore->course_id;
        $tab->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $tab->tab1 = backup_todb($info['MOD']['#']['TAB1']['0']['#']);
        $tab->tab2 = backup_todb($info['MOD']['#']['TAB2']['0']['#']);
        $tab->tab3 = backup_todb($info['MOD']['#']['TAB3']['0']['#']);
        $tab->tab4 = backup_todb($info['MOD']['#']['TAB4']['0']['#']);
        $tab->tab5 = backup_todb($info['MOD']['#']['TAB5']['0']['#']);
        $tab->tab6 = backup_todb($info['MOD']['#']['TAB6']['0']['#']);
        $tab->tab7 = backup_todb($info['MOD']['#']['TAB7']['0']['#']);
        $tab->tab8 = backup_todb($info['MOD']['#']['TAB8']['0']['#']);
        $tab->tab9 = backup_todb($info['MOD']['#']['TAB9']['0']['#']);
        $tab->tab0 = backup_todb($info['MOD']['#']['TAB0']['0']['#']);
        $tab->tab1content = backup_todb($info['MOD']['#']['TAB1CONTENT']['0']['#']);
        $tab->tab2content = backup_todb($info['MOD']['#']['TAB2CONTENT']['0']['#']);
        $tab->tab3content = backup_todb($info['MOD']['#']['TAB3CONTENT']['0']['#']);
        $tab->tab4content = backup_todb($info['MOD']['#']['TAB4CONTENT']['0']['#']);
        $tab->tab5content = backup_todb($info['MOD']['#']['TAB5CONTENT']['0']['#']);
        $tab->tab6content = backup_todb($info['MOD']['#']['TAB6CONTENT']['0']['#']);
        $tab->tab7content = backup_todb($info['MOD']['#']['TAB7CONTENT']['0']['#']);
        $tab->tab8content = backup_todb($info['MOD']['#']['TAB8CONTENT']['0']['#']);
        $tab->tab9content = backup_todb($info['MOD']['#']['TAB9CONTENT']['0']['#']);
        $tab->tab0content = backup_todb($info['MOD']['#']['TAB0CONTENT']['0']['#']);
        $tab->css = backup_todb($info['MOD']['#']['CSS']['0']['#']);
        $tab->menucss = backup_todb($info['MOD']['#']['MENUCSS']['0']['#']);
        $tab->displaymenu = backup_todb($info['MOD']['#']['DISPLAYMENU']['0']['#']);
        $tab->menuname = backup_todb($info['MOD']['#']['MENUNAME']['0']['#']);
        $tab->timemodified = $info['MOD']['#']['TIMEMODIFIED']['0']['#'];
        //The structure is equal to the db, so insert the tab
        $newid = insert_record("tab", $tab);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "tab") . " \"" . format_string(stripslashes($tab->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:58,代码来源:restorelib.php

示例6: webscheme_restore_mods

function webscheme_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        // (STOLEN FROM CHOICE) if necessary, write to restorelog and adjust date/time fields
        if ($restore->course_startdateoffset) {
            restore_log_date_changes('Webscheme', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
        }
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the WEBSCHEME record structure
        $webscheme->course = $restore->course_id;
        $webscheme->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $webscheme->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $webscheme->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
        $webscheme->timecreated = $info['MOD']['#']['TIMECREATED']['0']['#'];
        $webscheme->timemodified = $info['MOD']['#']['TIMEMODIFIED']['0']['#'];
        $ws_settings = $info['MOD']['#']['WS_SETTINGS']['0']['#'];
        $ws_settings = backup_todb(html_entity_decode($ws_settings));
        $webscheme->ws_settings = $ws_settings;
        $ws_events = $info['MOD']['#']['WS_EVENTS']['0']['#'];
        $ws_events = backup_todb(html_entity_decode($ws_events));
        $webscheme->ws_events = $ws_events;
        $ws_initexpr = $info['MOD']['#']['WS_INITEXPR']['0']['#'];
        $ws_initexpr = backup_todb(html_entity_decode($ws_initexpr));
        $webscheme->ws_initexpr = $ws_initexpr;
        $ws_loadurls = $info['MOD']['#']['WS_LOADURLS']['0']['#'];
        $ws_loadurls = backup_todb(html_entity_decode($ws_loadurls));
        $webscheme->ws_loadurls = $ws_loadurls;
        $ws_html = $info['MOD']['#']['WS_HTML']['0']['#'];
        $ws_html = backup_todb(html_entity_decode($ws_html));
        $webscheme->ws_html = $ws_html;
        //The structure is equal to the db, so insert the webscheme
        //  ah?  Do we need to addslashes or anything?
        $newid = insert_record("webscheme", $webscheme);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "webscheme") . " \"" . format_string($webscheme->name, true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:andrewhuang,项目名称:webscheme,代码行数:57,代码来源:restorelib.php

示例7: podcast_items_restore_mods

}
//This function restores the podcast_items
function podcast_items_restore_mods($old_podcast_id, $new_podcast_id, $info, $restore)
{
    global $CFG;
    $status = true;
    //Get the items array
    $items = $info['MOD']['#']['ITEMS']['0']['#']['ITEM'];
    //Iterate over items
    for ($i = 0; $i < sizeof($items); $i++) {
        $items_info = $items[$i];
        //We'll need this later!!
        $oldid = backup_todb($items_info['#']['ID']['0']['#']);
        //Now, build the podcast_itemS record structure
        $item->id_podcast = $new_podcast_id;
        $item->title = backup_todb($items_info['#']['TITLE']['0']['#']);
        $item->lien = backup_todb($items_info['#']['LIEN']['0']['#']);
        $item->intro = backup_todb($items_info['#']['INTRO']['0']['#']);
        $item->pubdate = backup_todb($items_info['#']['PUBDATE']['0']['#']);
        $item->date_html = backup_todb($items_info['#']['DATE_HTML']['0']['#']);
        $item->duration = backup_todb($items_info['#']['DURATION']['0']['#']);
        $item->length = backup_todb($items_info['#']['LENGTH']['0']['#']);
        //The structure is equal to the db, so insert the podcast_item
        $newid = insert_record("podcast_structure", $item);
        //Now copy moddata associated files
        if ($newid) {
            // Check folder permissions
            if (!is_writable($CFG->dirroot . "/mod/podcast/media/") && !defined('RESTORE_SILENTLY')) {
                echo "<li style='color:red;font-size:0.9em;font-weight:bold;'>";
                echo get_string('chmod_media_1', 'podcast') . "<br />";
                echo get_string('chmod_media_2', 'podcast');
                echo "</li>";
                $status = false;
            }
            if (!is_writable($CFG->dirroot . "/mod/podcast/publication/") && !defined('RESTORE_SILENTLY')) {
                echo "<li style='color:red;font-size:0.9em;font-weight:bold;'>";
                echo get_string('chmod_publication_1', 'podcast') . "<br />";
                echo get_string('chmod_publication_2', 'podcast');
                echo "</li>";
                $status = false;
            }
            if ($status) {
                $status = podcast_restore_files($old_podcast_id, $new_podcast_id, $oldid, $newid, $restore);
            }
        }
        backup_flush(300);
        //Do some output
        if (($i + 1) % 50 == 0) {
            if (!defined('RESTORE_SILENTLY')) {
                echo ".";
                if (($i + 1) % 1000 == 0) {
                    echo "<br />";
                }
            }
            backup_flush(300);
        }
    }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:57,代码来源:restorelib.php

示例8: voiceauthoring_restore_mods

function voiceauthoring_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    $userdata = restore_userdata_selected($restore, "voiceauthoring", $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //add logs
        //Now, build the voiceauthoring record structure
        $resource = get_record("voiceauthoring_resources", "fromrid", $info['MOD']['#']['RID']['0']['#'], "course", $restore->course_id);
        if (empty($resource)) {
            $resourceCopy = voicetools_api_copy_resource($info['MOD']['#']['RID']['0']['#'], null, "0");
            if ($resourceCopy === false) {
                return false;
                //error to copy the resource
            }
            $resourceId = $resourceCopy->getRid();
            voiceauthoring_createResourceFromResource($info['MOD']['#']['RID']['0']['#'], $resourceId, $restore->course_id);
        }
        if ($userdata === false) {
            $mid = $resource->mid + 1;
            $resource->mid = $resource->mid + 1;
            update_record("voiceauthoring_resources", $resource);
            $name = str_replace(backup_todb($info['MOD']['#']['MID']['0']['#']), $mid, backup_todb($info['MOD']['#']['NAME']['0']['#']));
        } else {
            $mid = backup_todb(backup_todb($info['MOD']['#']['MID']['0']['#']));
            $name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        }
        $voiceauthoring->course = backup_todb($restore->course_id);
        $voiceauthoring->rid = backup_todb($resourceId);
        $voiceauthoring->mid = $mid;
        $voiceauthoring->name = str_replace(backup_todb($info['MOD']['#']['RID']['0']['#']), $resourceId, $name);
        $voiceauthoring->activityname = backup_todb($info['MOD']['#']['ACTIVITY_NAME']['0']['#']);
        $voiceauthoring->section = backup_todb($info['MOD']['#']['SECTION']['0']['#']);
        $voiceauthoring->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        $voiceauthoring->isfirst = 1;
        //The structure is equal to the db, so insert the voiceauthoring
        $newid = insert_record("voiceauthoring", $voiceauthoring);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "voiceauthoring") . " \"" . format_string(stripslashes(stripslashes($voiceauthoring->name)), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:57,代码来源:restorelib.php

示例9: restore_map

 function restore_map($old_question_id, $new_question_id, $info, $restore)
 {
     $matchs = $info['#']['MATCHS']['0']['#']['MATCH'];
     foreach ($matchs as $match) {
         $match_sub_id = backup_todb($match['#']['ID']['0']['#']);
         if (!record_exists('question_match_sub', 'id', $match_sub_id)) {
             throw new SharingCart_XmlException('match sub question not found');
         }
         backup_putid($restore->backup_unique_code, 'question_match_sub', $match_sub_id, $match_sub_id);
     }
     return backup_putid($restore->backup_unique_code, 'question', $old_question_id, $new_question_id);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:SharingCart_qtype_match.php

示例10: voiceemail_restore_mods

function voiceemail_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    $userdata = restore_userdata_selected($restore, "voiceemail", $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //add logs
        //Now, build the voiceemail record structure
        if ($userdata === true) {
            $copyOptions = "0";
            //top message
        } else {
            $copyOptions = "2";
            //top message
        }
        $oldResource = get_record("voiceemail_resources", "id", $info['MOD']['#']['RID']['0']['#']);
        $resourceId = $oldResource->rid;
        $resource = voicetools_api_copy_resource($resourceId, null, $copyOptions);
        if ($resource === false) {
            return false;
            //error to copy the resource
        }
        $bdId = voiceemail_createResourceFromResource($resourceId, $resource->getRid(), $restore->course_id);
        $voiceemail->course = backup_todb($restore->course_id);
        $voiceemail->rid = backup_todb($bdId);
        $voiceemail->recipients_email = backup_todb(backup_todb($info['MOD']['#']['RECIPIENTS_EMAIL']['0']['#']));
        $voiceemail->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $voiceemail->section = backup_todb($info['MOD']['#']['SECTION']['0']['#']);
        $voiceemail->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        $voiceemail->isfirst = 1;
        //The structure is equal to the db, so insert the voiceemail
        $newid = insert_record("voiceemail", $voiceemail);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "voiceemail") . " \"" . format_string(stripslashes($voiceemail->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:52,代码来源:restorelib.php

示例11: topcoll_restore_format_data

function topcoll_restore_format_data($restore, $data)
{
    global $CFG;
    $status = true;
    // Get the backup data
    if (!empty($data['FORMATDATA']['#']['LAYOUT']['0'])) {
        $layout_info = $data['FORMATDATA']['#']['LAYOUT']['0'];
        $layoutelement = backup_todb($layout_info['#']['LAYOUTELEMENT']['0']['#']);
        $layoutstructure = backup_todb($layout_info['#']['LAYOUTSTRUCTURE']['0']['#']);
        put_layout($restore->course_id, $layoutelement, $layoutstructure);
        // In $CFG->dirroot.'/course/format/topcoll/lib.php'.
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:14,代码来源:restorelib.php

示例12: textanalysis_restore_mods

function textanalysis_restore_mods($mod, $restore)
{
    global $CFG, $oldidarray;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        // if necessary, write to restorelog and adjust date/time fields
        if ($restore->course_startdateoffset) {
            restore_log_date_changes('textanalysis', $restore, $info['MOD']['#'], array('TEXTANALYSISTIME'));
        }
        //Now, build the textanalysis record structure
        $textanalysis->course = $restore->course_id;
        $textanalysis->teacher = backup_todb($info['MOD']['#']['TEACHER']['0']['#']);
        $textanalysis->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $textanalysis->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $textanalysis->type = backup_todb($info['MOD']['#']['TYPE']['0']['#']);
        $textanalysis->time = backup_todb($info['MOD']['#']['TIME']['0']['#']);
        $user = backup_getid($restore->backup_unique_code, "user", $textanalysis->teacher);
        if ($user) {
            $textanalysis->teacher = $user->new_id;
        }
        //The structure is equal to the db, so insert the textanalysis
        $newid = insert_record("textanalysis", $textanalysis);
        //Do some output
        //if (!defined('RESTORE_SILENTLY')) {
        //    echo "<li>".get_string("modulename","textanalysis")." \"".format_string(stripslashes($textanalysis->name),true)."\"</li>";
        //}
        //backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
            //Now check if want to restore user data and do it.
            if (restore_userdata_selected($restore, 'textanalysis', $mod->id)) {
                //Restore textanalysis_messages
            }
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:e-rasvet,项目名称:textanalysis,代码行数:49,代码来源:restorelib.php

示例13: sloodle_restore_mods

/**
 * Restore everything from the given backup.
 */
function sloodle_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        // Get the XML backup data as an array
        $info = $data->info;
        // Build our SLOODLE DB record
        $sloodle = new object();
        $sloodle->course = $restore->course_id;
        $sloodle->type = backup_todb($info['MOD']['#']['SUBTYPE']['0']['#']);
        $sloodle->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $sloodle->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $sloodle->timecreated = backup_todb($info['MOD']['#']['TIMECREATED']['0']['#']);
        $sloodle->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        $newid = insert_record("sloodle", $sloodle);
        // Inform the user what we are restoring
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "sloodle") . " \"" . format_string(stripslashes($sloodle->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            // We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
            // Should we restore userdata?
            $includeuserdata = restore_userdata_selected($restore, 'sloodle', $mod->id);
            // Attempt to get a SloodleModule object for this module sub-type
            $dummysession = new SloodleSession(false);
            // We need to provide this to keep the module happy!
            $moduleobj = sloodle_load_module($sloodle->type, $dummysession);
            if ($moduleobj != false) {
                // Attempt to restore this module's secondary data
                if (!$moduleobj->restore($newid, $info['MOD']['#']['SECONDARYDATA']['0']['#'], $includeuserdata)) {
                    $status = false;
                }
            } else {
                echo "<li>Failed to fully restore SLOODLE module type {$sloodle->type}. This type may not be available on your installation.</li>";
            }
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:51,代码来源:restorelib.php

示例14: wwassignment_restore_mods

function wwassignment_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //error_log("mod id ".$mod->id);
    //         if ($mod->id == "66666") {
    //         	$wwlinkdata  = backup_getid($restore->backup_unique_code,"wwassignment_bridge","wwassignment_bridge");
    //             error_log("wwlink data ".print_r($wwlinkdata, true ));
    //             return $status;
    //          }
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //if necessary, write to restorelog and adjust date/time fields
        if ($restore->course_startdateoffset) {
            //restore_log_date_changes('Wwassignment', $restore, $info['MOD']['#'], array('TIMEDUE', 'TIMEAVAILABLE'));
        }
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the ASSIGNMENT record structure
        $wwassignment->course = $restore->course_id;
        $wwassignment->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $wwassignment->description = backup_todb($info['MOD']['#']['DESCRIPTION']['0']['#']);
        $wwassignment->webwork_set = backup_todb($info['MOD']['#']['WEBWORK_SET']['0']['#']);
        $wwassignment->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        //The structure is equal to the db, so insert the assignment
        $newid = insert_record("wwassignment", $wwassignment);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "wwassignment") . " \"" . format_string(stripslashes($wwassignment->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    //error_log("mod id is ".print_r($mod,true));
    return $status;
}
开发者ID:bjornbe,项目名称:wwassignment,代码行数:47,代码来源:restorelib.php

示例15: restore

 function restore($old_question_id, $new_question_id, $info, $restore)
 {
     global $DB;
     $status = true;
     //Get the truefalse array
     if (array_key_exists('TRUEFALSE', $info['#'])) {
         $truefalses = $info['#']['TRUEFALSE'];
     } else {
         $truefalses = array();
     }
     //Iterate over truefalse
     for ($i = 0; $i < sizeof($truefalses); $i++) {
         $tru_info = $truefalses[$i];
         //Now, build the question_truefalse record structure
         $truefalse = new stdClass();
         $truefalse->question = $new_question_id;
         $truefalse->trueanswer = stripslashes(backup_todb($tru_info['#']['TRUEANSWER']['0']['#']));
         $truefalse->falseanswer = stripslashes(backup_todb($tru_info['#']['FALSEANSWER']['0']['#']));
         ////We have to recode the trueanswer field
         $answer = backup_getid($restore->backup_unique_code, "question_answers", $truefalse->trueanswer);
         if ($answer) {
             $truefalse->trueanswer = $answer->new_id;
         }
         ////We have to recode the falseanswer field
         $answer = backup_getid($restore->backup_unique_code, "question_answers", $truefalse->falseanswer);
         if ($answer) {
             $truefalse->falseanswer = $answer->new_id;
         }
         //The structure is equal to the db, so insert the question_truefalse
         $newid = $DB->insert_record("question_truefalse", $truefalse);
         //Do some output
         if (($i + 1) % 50 == 0) {
             if (!defined('RESTORE_SILENTLY')) {
                 echo ".";
                 if (($i + 1) % 1000 == 0) {
                     echo "<br />";
                 }
             }
             backup_flush(300);
         }
         if (!$newid) {
             $status = false;
         }
     }
     return $status;
 }
开发者ID:e-rasvet,项目名称:reader,代码行数:46,代码来源:questiontype.php


注:本文中的backup_todb函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。