本文整理汇总了PHP中restore_userdata_selected函数的典型用法代码示例。如果您正苦于以下问题:PHP restore_userdata_selected函数的具体用法?PHP restore_userdata_selected怎么用?PHP restore_userdata_selected使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了restore_userdata_selected函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qcreate_restore_mods
function qcreate_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;
//if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('Qcreate', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
}
//Now, build the QCREATE record structure
$qcreate = new object();
$qcreate->course = $restore->course_id;
$qcreate->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$qcreate->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
$qcreate->graderatio = backup_todb($info['MOD']['#']['GRADERATIO']['0']['#']);
$qcreate->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
$qcreate->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
$qcreate->allowed = backup_todb($info['MOD']['#']['ALLOWED']['0']['#']);
$qcreate->totalrequired = backup_todb($info['MOD']['#']['TOTALREQUIRED']['0']['#']);
$qcreate->studentqaccess = backup_todb($info['MOD']['#']['STUDENTQACCESS']['0']['#']);
$qcreate->timesync = 0;
$qcreate->timeopen = backup_todb($info['MOD']['#']['TIMEOPEN']['0']['#']);
$qcreate->timeclose = backup_todb($info['MOD']['#']['TIMECLOSE']['0']['#']);
$qcreate->timecreated = backup_todb($info['MOD']['#']['TIMECREATED']['0']['#']);
$qcreate->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
//We have to recode the grade field if it is <0 (scale)
if ($qcreate->grade < 0) {
$scale = backup_getid($restore->backup_unique_code, "scale", abs($qcreate->grade));
if ($scale) {
$qcreate->grade = -$scale->new_id;
}
}
//The structure is equal to the db, so insert the qcreate
$newid = insert_record("qcreate", $qcreate);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "qcreate") . " \"" . format_string(stripslashes($qcreate->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);
$status = qcreate_requireds_restore_mods($mod->id, $newid, $info, $restore) && $status;
//Now check if want to restore user data and do it.
if (restore_userdata_selected($restore, 'qcreate', $mod->id)) {
//Restore qcreate_grades
$status = qcreate_grades_restore_mods($mod->id, $newid, $info, $restore) && $status;
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例2: 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;
}
示例3: wiki_restore_mods
function wiki_restore_mods($mod, $restore)
{
global $CFG, $DB;
$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;
//if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('Wiki', $restore, $info['MOD']['#'], array('TIMEMODIFIED'));
}
//traverse_xmlize($info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the wiki record structure
$wiki->course = $restore->course_id;
$wiki->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$wiki->intro = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
$wiki->pagename = backup_todb($info['MOD']['#']['PAGENAME']['0']['#']);
$wiki->wtype = backup_todb($info['MOD']['#']['WTYPE']['0']['#']);
$wiki->ewikiprinttitle = backup_todb($info['MOD']['#']['EWIKIPRINTTITLE']['0']['#']);
$wiki->htmlmode = backup_todb($info['MOD']['#']['HTMLMODE']['0']['#']);
$wiki->ewikiacceptbinary = backup_todb($info['MOD']['#']['EWIKIACCEPTBINARY']['0']['#']);
$wiki->disablecamelcase = backup_todb($info['MOD']['#']['DISABLECAMELCASE']['0']['#']);
$wiki->setpageflags = backup_todb($info['MOD']['#']['SETPAGEFLAGS']['0']['#']);
$wiki->strippages = backup_todb($info['MOD']['#']['STRIPPAGES']['0']['#']);
$wiki->removepages = backup_todb($info['MOD']['#']['REMOVEPAGES']['0']['#']);
$wiki->revertchanges = backup_todb($info['MOD']['#']['REVERTCHANGES']['0']['#']);
$wiki->initialcontent = backup_todb($info['MOD']['#']['INITIALCONTENT']['0']['#']);
$wiki->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
//The structure is equal to the db, so insert the wiki
$newid = $DB->insert_record("wiki", $wiki);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "wiki") . " \"" . format_string($wiki->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, 'wiki', $mod->id)) {
//Restore wiki_entries
$status = wiki_entries_restore_mods($mod->id, $newid, $info, $restore);
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例4: journal_restore_mods
function journal_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;
//if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('Journal', $restore, $info['MOD']['#'], array('TIMEMODIFIED'));
}
//traverse_xmlize($info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the JOURNAL record structure
$journal->course = $restore->course_id;
$journal->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$journal->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
$journal->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
$journal->days = backup_todb($info['MOD']['#']['DAYS']['0']['#']);
$journal->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
$journal->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
//We have to recode the assessed field if it is <0 (scale)
if ($journal->assessed < 0) {
$scale = backup_getid($restore->backup_unique_code, "scale", abs($journal->assessed));
if ($scale) {
$journal->assessed = -$scale->new_id;
}
}
//The structure is equal to the db, so insert the journal
$newid = insert_record("journal", $journal);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "journal") . " \"" . format_string(stripslashes($journal->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, 'journal', $mod->id)) {
//Restore journal_entries
$status = journal_entries_restore_mods($mod->id, $newid, $info, $restore);
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例5: game_restore_mods
function game_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;
//if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('Game', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
}
//Now, build the GAME record structure
$game = new stdClass();
$game->course = $restore->course_id;
$mod_info = $info['MOD'];
$fields = array('name', 'sourcemodule', 'quizid', 'glossaryid', 'glossarycategoryid', 'questioncategoryid', 'bookid', 'gameinputid', 'gamekind', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7', 'param8', 'timemodified', 'bottomtext', 'grademethod', 'grade', 'decimalpoints', 'popup', 'review', 'attempts', 'glossaryid2', 'glossarycategoryid2', 'language');
game_restore_record($mod_info, $game, $fields);
game_recode($restore->backup_unique_code, $game, 'quizid', 'quiz');
game_recode($restore->backup_unique_code, $game, 'glossaryid', 'glossary');
game_recode($restore->backup_unique_code, $game, 'glossarycategoryid', 'glossary_categories');
game_recode($restore->backup_unique_code, $game, 'glossaryid2', 'glossary');
game_recode($restore->backup_unique_code, $game, 'glossarycategoryid2', 'glossary_categories');
game_restore_stamp($info, $restore, $map_question_categories, 'QUESTION_CATEGORIES', 'QUESTION_CATEGORY');
game_restore_stamp($info, $restore, $map_questions, 'QUESTIONS', 'QUESTION');
game_recode_questioncategoryid($game, $map_question_categories);
game_recode($restore->backup_unique_code, $game, 'bookid', 'book');
//The structure is equal to the db, so insert the game
$newid = insert_record("game", $game);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "game") . " \"" . format_string(stripslashes($game->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, 'game', $mod->id)) {
$status = game_restore_grades($newid, $info, $restore);
$status = game_restore_snakes_database($info, $restore);
$status = game_restore_bookquiz_questions($newid, $info, $restore, $map_question_categories);
//Restore game_attempts
$status = game_attempts_restore_mods($newid, $info, $restore, $map_questions);
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例6: blended_restore_mods
function blended_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('Blended', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
}
//Now, build the BLENDED record structure
$blended->course = $restore->course_id;
$blended->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$blended->description = backup_todb($info['MOD']['#']['DESCRIPTION']['0']['#']);
$blended->idmethod = backup_todb($info['MOD']['#']['IDMETHOD']['0']['#']);
$blended->idtype = backup_todb($info['MOD']['#']['IDTYPE']['0']['#']);
$blended->codebartype = backup_todb($info['MOD']['#']['CODEBARTYPE']['0']['#']);
$blended->lengthuserinfo = backup_todb($info['MOD']['#']['LENGTHUSERINFO']['0']['#']);
$blended->teammethod = backup_todb($info['MOD']['#']['TEAMMETHOD']['0']['#']);
$blended->numteams = backup_todb($info['MOD']['#']['NUMTEAMS']['0']['#']);
$blended->nummembers = backup_todb($info['MOD']['#']['MUMMEMBERS']['0']['#']);
$blended->assignment = backup_todb($info['MOD']['#']['ASSIGNMENT']['0']['#']);
$blended->randomkey = backup_todb($info['MOD']['#']['RANDOMKEY']['0']['#']);
//The structure is equal to the db, so insert the chat
$newid = insert_record("blended", $blended);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "chat") . " \"" . format_string(stripslashes($blended->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, 'blended', $mod->id)) {
//Restore chat_messages
$status = blended_jobs_restore_mods($newid, $info, $restore);
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例7: 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;
}
示例8: 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;
}
示例9: nanogong_restore_mods
function nanogong_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;
//if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('NanoGong', $restore, $info['MOD']['#'], array('TIMEDUE', 'TIMEAVAILABLE'));
}
//traverse_xmlize($info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
// Now, build the NANOGONG record structure
$nanogong->course = $restore->course_id;
$nanogong->id = backup_todb($info['MOD']['#']['ID']['0']['#']);
$nanogong->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$nanogong->message = backup_todb($info['MOD']['#']['MESSAGE']['0']['#']);
$nanogong->color = backup_todb($info['MOD']['#']['COLOR']['0']['#']);
$nanogong->maxduration = backup_todb($info['MOD']['#']['MAXDURATION']['0']['#']);
$nanogong->maxmessages = backup_todb($info['MOD']['#']['MAXMESSAGES']['0']['#']);
$nanogong->maxscore = backup_todb($info['MOD']['#']['MAXSCORE']['0']['#']);
$nanogong->allowguestaccess = backup_todb($info['MOD']['#']['ALLOWGUESTACCESS']['0']['#']);
$nanogong->timecreated = backup_todb($info['MOD']['#']['TIMECREATED']['0']['#']);
$nanogong->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
//The structure is equal to the db, so insert the nanogong
$newid = insert_record("nanogong", $nanogong);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "nanogong") . " \"" . format_string(stripslashes($nanogong->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, 'nanogong', $mod->id)) {
//Restore nanogong messages
$status = nanogong_messages_restore_mods($mod->id, $newid, $info, $restore);
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例10: mail_restore_mods
function mail_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
$oldid = backup_todb($info['#']['ID']['0']['#']);
//Now, build the mail record structure
$mail->course = $restore->course_id;
$mail->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$mail->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
$mail->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
$mail->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
//The structure is equal to the db, so insert the mail
$newid = insert_record("mail", $mail);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "mail") . " \"" . format_string(stripslashes($mail->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);
//We have to restore the mail which are held in their logical order...
$userdata = restore_userdata_selected($restore, "mail", $mod->id);
$status = mail_folders_restore_mods($mod->id, $newid, $info, $restore, $userdata);
//...and the user grades, high scores, and timer (if required)
if ($status) {
if ($userdata) {
if (!mail_groups_restore_mods($newid, $info, $restore)) {
return false;
}
if (!mail_statistics_restore_mods($restore->course_id, $info, $restore)) {
return false;
}
}
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例11: checklist_restore_mods
function checklist_restore_mods($mod, $restore)
{
global $CFG, $db;
$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;
//if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('checklist', $restore, $info['MOD']['#'], array('TIMECREATED', 'TIMEMODIFIED'));
}
//traverse_xmlize($info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the CHECKLIST record structure
$checklist = new stdClass();
$checklist->course = $restore->course_id;
$checklist->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$checklist->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
$checklist->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
$checklist->timecreated = backup_todb($info['MOD']['#']['TIMECREATED']['0']['#']);
$checklist->timecreated += $restore->course_startdateoffset;
$checklist->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
$checklist->timemodified += $restore->course_startdateoffset;
$checklist->useritemsallowed = backup_todb($info['MOD']['#']['USERITEMSALLOWED']['0']['#']);
$checklist->teacheredit = backup_todb($info['MOD']['#']['TEACHEREDIT']['0']['#']);
$checklist->theme = backup_todb($info['MOD']['#']['THEME']['0']['#']);
$checklist->duedatesoncalendar = backup_todb_chk_optional_field($info['MOD'], 'DUEDATESONCALENDAR', false);
$checklist->teachercomments = backup_todb_chk_optional_field($info['MOD'], 'TEACHERCOMMENTS', false);
$newid = insert_record('checklist', $checklist);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string('modulename', 'checklist') . " \"" . format_string(stripslashes($checklist->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);
$checklist->id = $newid;
$restore_user = restore_userdata_selected($restore, 'checklist', $mod->id);
$status = checklist_items_restore($newid, $info, $restore, $restore_user);
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例12: realtimequiz_restore_mods
function realtimequiz_restore_mods($mod, $restore)
{
global $CFG, $db;
$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;
//if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('Realtimequiz', $restore, $info['MOD']['#'], array('ASSESSTIMESTART', 'ASSESSTIMEFINISH'));
}
//traverse_xmlize($info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the REALTIMEQUIZ record structure
$quiz->course = $restore->course_id;
$quiz->type = backup_todb($info['MOD']['#']['TYPE']['0']['#']);
$quiz->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$quiz->questiontime = backup_todb($info['MOD']['#']['QUESTIONTIME']['0']['#']);
$newid = insert_record("realtimequiz", $quiz);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("modulename", "realtimequiz") . " \"" . format_string(stripslashes($quiz->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);
$quiz->id = $newid;
$restore_user = false;
//Now check if want to restore user data and do it.
if (restore_userdata_selected($restore, 'realtimequiz', $mod->id)) {
$status = realtimequiz_sessions_restore($newid, $info, $restore);
$restore_user = true;
}
// Restore the questions and answers (and any submissions)
if ($status) {
$status = realtimequiz_questions_restore($newid, $info, $restore, $restore_user);
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例13: webinar_restore_mods
/**
* API function called by the Moodle restore system
*/
function webinar_restore_mods($mod, $restore)
{
global $CFG;
$status = true;
$data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
if ($data) {
$info = $data->info;
$webinar->course = $restore->course_id;
$webinar->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$webinar->thirdparty = backup_todb($info['MOD']['#']['THIRDPARTY']['0']['#']);
$webinar->display = backup_todb($info['MOD']['#']['DISPLAY']['0']['#']);
$webinar->confirmationsubject = backup_todb($info['MOD']['#']['CONFIRMATIONSUBJECT']['0']['#']);
$webinar->confirmationinstrmngr = backup_todb($info['MOD']['#']['CONFIRMATIONINSTRMNGR']['0']['#']);
$webinar->confirmationmessage = backup_todb($info['MOD']['#']['CONFIRMATIONMESSAGE']['0']['#']);
$webinar->waitlistedsubject = backup_todb($info['MOD']['#']['WAITLISTEDSUBJECT']['0']['#']);
$webinar->waitlistedmessage = backup_todb($info['MOD']['#']['WAITLISTEDMESSAGE']['0']['#']);
$webinar->cancellationsubject = backup_todb($info['MOD']['#']['CANCELLATIONSUBJECT']['0']['#']);
$webinar->cancellationinstrmngr = backup_todb($info['MOD']['#']['CANCELLATIONINSTRMNGR']['0']['#']);
$webinar->cancellationmessage = backup_todb($info['MOD']['#']['CANCELLATIONMESSAGE']['0']['#']);
$webinar->remindersubject = backup_todb($info['MOD']['#']['REMINDERSUBJECT']['0']['#']);
$webinar->reminderinstrmngr = backup_todb($info['MOD']['#']['REMINDERINSTRMNGR']['0']['#']);
$webinar->remindermessage = backup_todb($info['MOD']['#']['REMINDERMESSAGE']['0']['#']);
$webinar->reminderperiod = backup_todb($info['MOD']['#']['REMINDERPERIOD']['0']['#']);
$webinar->timecreated = backup_todb($info['MOD']['#']['TIMECREATED']['0']['#']);
$webinar->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
$newid = insert_record('webinar', $webinar);
if (!defined('RESTORE_SILENTLY')) {
echo '<li>' . get_string('modulename', 'webinar') . ' "' . format_string(stripslashes($webinar->name), true) . '"</li>';
}
backup_flush(300);
if ($newid) {
backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
// Table: webinar_sessions
$status &= restore_webinar_sessions($newid, $info, $restore);
if (restore_userdata_selected($restore, 'webinar', $mod->id)) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br />';
}
// Table: webinar_signups_
$status &= restore_webinar_signups($newid, $info, $restore);
}
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
}
示例14: 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;
}
示例15: 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;
}