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


PHP backup_putid函数代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例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: 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

示例8: insert_category_ids

function insert_category_ids($course, $backup_unique_code, $instances = null)
{
    global $CFG;
    include_once "{$CFG->dirroot}/mod/quiz/lib.php";
    //Create missing categories and reasign orphaned questions.
    fix_orphaned_questions($course);
    // First, all categories from this course.
    $status = execute_sql("INSERT INTO {$CFG->prefix}backup_ids\n                                   (backup_code, table_name, old_id, info)\n                               SELECT '{$backup_unique_code}', 'question_categories', qc.id, ''\n                               FROM {$CFG->prefix}question_categories qc\n                               WHERE qc.course = {$course}", false);
    // Then published categories from other courses used by the quizzes we are backing up.
    $from = "{$CFG->prefix}quiz quiz,";
    $where = "AND quiz.course = '{$course}'\n                     AND qqi.quiz = quiz.id";
    if (!empty($instances) && is_array($instances) && count($instances)) {
        $from = '';
        $where = 'AND qqi.quiz IN (' . implode(',', array_keys($instances)) . ')';
    }
    $categories = get_records_sql("\n                SELECT id, parent, 0 AS childrendone\n                FROM {$CFG->prefix}question_categories\n                WHERE course <> {$course}\n                  AND id IN (\n                    SELECT DISTINCT question.category \n                    FROM {$CFG->prefix}question question,\n                         {$from}\n                         {$CFG->prefix}quiz_question_instances qqi\n                    WHERE qqi.question = question.id\n                      {$where}\n                )", false);
    if (!$categories) {
        $categories = array();
    }
    // Add the parent categories, of these categories up to the top of the category tree.
    foreach ($categories as $category) {
        while ($category->parent != 0) {
            if (array_key_exists($category->parent, $categories)) {
                // Parent category already on the list.
                break;
            }
            $currentid = $category->id;
            $category = get_record('question_categories', 'id', $category->parent, '', '', '', '', 'id, parent, 0 AS childrendone');
            if ($category) {
                $categories[$category->id] = $category;
            } else {
                // Parent not found: this indicates an error, but just fix it.
                set_field('question_categories', 'parent', 0, 'id', $currentid);
                break;
            }
        }
    }
    // Now we look for categories from other courses containing random questions
    // in our quiz that select from the category and its subcategories. That implies
    // those subcategories also need to be backed up. (The categories themselves
    // and their parents will already have been included.)
    $categorieswithrandom = get_records_sql("\n                SELECT DISTINCT question.category AS id\n                FROM {$CFG->prefix}quiz_question_instances qqi,\n                     {$from}\n                     {$CFG->prefix}question question\n                WHERE question.id = qqi.question\n                  AND question.qtype = '" . RANDOM . "'\n                  AND question.questiontext = '1'\n                  {$where}\n                ");
    if ($categorieswithrandom) {
        foreach ($categorieswithrandom as $category) {
            $status = quiz_backup_add_sub_categories($categories, $category->id);
        }
    }
    // Finally, add all these extra categories to the backup_ids table.
    foreach ($categories as $category) {
        $status = $status && backup_putid($backup_unique_code, 'question_categories', $category->id, 0);
    }
    return $status;
}
开发者ID:veritech,项目名称:pare-project,代码行数:53,代码来源:backuplib.php

示例9: 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

示例10: podcast_restore_mods

/**
 * Fonction de sauvegarde de l'activité Podcast. 
 */
function podcast_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 podcast record structure
        $podcast->course = $restore->course_id;
        $podcast->userid = backup_todb($info['MOD']['USERID']['0']['#']);
        $podcast->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $podcast->author = backup_todb($info['MOD']['#']['AUTHOR']['0']['#']);
        $podcast->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $podcast->owner = backup_todb($info['MOD']['#']['OWNER']['0']['#']);
        $podcast->owner_email = backup_todb($info['MOD']['#']['OWNER_EMAIL']['0']['#']);
        $podcast->copyright = backup_todb($info['MOD']['#']['COPYRIGHT']['0']['#']);
        $podcast->lang = backup_todb($info['MOD']['#']['LANG']['0']['#']);
        $podcast->pubdate = backup_todb($info['MOD']['#']['PUBDATE']['0']['#']);
        $podcast->image_url = backup_todb($info['MOD']['#']['IMAGE_URL']['0']['#']);
        $podcast->image_img = backup_todb($info['MOD']['#']['IMAGE_IMG']['0']['#']);
        $podcast->category = backup_todb($info['MOD']['#']['CATEGORY']['0']['#']);
        $podcast->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        //The structure is equal to the db, so insert the podcast
        $newid = insert_record("podcast", $podcast);
        //We have to recode the userid field
        $user = backup_getid($restore->backup_unique_code, "user", $item->userid);
        if ($user) {
            $podcast->userid = $user->new_id;
        }
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "podcast") . " \"" . format_string(stripslashes($podcast->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, 'podcast', $mod->id)) {
                //Restore podcast_items
                $status = podcast_items_restore_mods($mod->id, $newid, $info, $restore);
            }
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:53,代码来源:restorelib.php

示例11: 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

示例12: restore_map

 function restore_map($old_question_id, $new_question_id, $info, $restore)
 {
     $multianswers = $info['#']['MULTIANSWERS']['0']['#']['MULTIANSWER'];
     foreach ($multianswers as $multianswer) {
         $sequence = $multianswer['#']['SEQUENCE']['0']['#'];
         $child_question_ids = array_filter(explode(',', $sequence));
         foreach ($child_question_ids as $child_question_id) {
             if (!record_exists('question', 'id', $child_question_id)) {
                 throw new SharingCart_XmlException('cloze child question not found');
             }
             backup_putid($restore->backup_unique_code, 'question', $child_question_id, $child_question_id);
         }
     }
     return backup_putid($restore->backup_unique_code, 'question', $old_question_id, $new_question_id);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:15,代码来源:SharingCart_qtype_cloze.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: chat_restore_mods

function chat_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
        // if necessary, write to restorelog and adjust date/time fields
        if ($restore->course_startdateoffset) {
            restore_log_date_changes('Chat', $restore, $info['MOD']['#'], array('CHATTIME'));
        }
        //Now, build the CHAT record structure
        $chat->course = $restore->course_id;
        $chat->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $chat->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $chat->keepdays = backup_todb($info['MOD']['#']['KEEPDAYS']['0']['#']);
        $chat->studentlogs = backup_todb($info['MOD']['#']['STUDENTLOGS']['0']['#']);
        $chat->schedule = backup_todb($info['MOD']['#']['SCHEDULE']['0']['#']);
        $chat->chattime = backup_todb($info['MOD']['#']['CHATTIME']['0']['#']);
        $chat->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        //The structure is equal to the db, so insert the chat
        $newid = insert_record("chat", $chat);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "chat") . " \"" . format_string(stripslashes($chat->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, 'chat', $mod->id)) {
                //Restore chat_messages
                $status = chat_messages_restore_mods($mod->id, $newid, $info, $restore);
            }
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:48,代码来源:restorelib.php

示例15: 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


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