id) |(CL,pk->id,?????) | // | -------------------- // | // ----------------------------------- // | | // survey_analysis survey_answers // (UL,pk->id, fk->survey) (UL,pk->id, fk->survey) // // Meaning: pk->primary key field of the table // fk->foreign key to link with parent // nt->nested field (recursive data) // CL->course level info // UL->user level info // files->table may have files) // //----------------------------------------------------------- //This function returns a log record with all the necessary transformations //done. It's used by restore_log_module() to restore modules log. function survey_restore_logs($restore,$log) { $status = false; //Depending of the action, we recode different things switch ($log->action) { case "add": if ($log->cmid) { //Get the new_id of the module (to recode the info field) $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); if ($mod) { $log->url = "view.php?id=".$log->cmid; $log->info = $mod->new_id; $status = true; } } break; case "submit": if ($log->cmid) { //Get the new_id of the module (to recode the info field) $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); if ($mod) { $log->url = "view.php?id=".$log->cmid; $log->info = $mod->new_id; $status = true; } } break; case "update": if ($log->cmid) { //Get the new_id of the module (to recode the info field) $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); if ($mod) { $log->url = "view.php?id=".$log->cmid; $log->info = $mod->new_id; $status = true; } } break; case "view form": if ($log->cmid) { //Get the new_id of the module (to recode the info field) $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); if ($mod) { $log->url = "view.php?id=".$log->cmid; $log->info = $mod->new_id; $status = true; } } break; case "view graph": if ($log->cmid) { //Get the new_id of the module (to recode the info field) $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); if ($mod) { $log->url = "view.php?id=".$log->cmid; $log->info = $mod->new_id; $status = true; } } break; case "view report": if ($log->cmid) { //Get the new_id of the module (to recode the info field) $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); if ($mod) { $log->url = "report.php?id=".$log->cmid; $log->info = $mod->new_id; $status = true; } } break; case "view all": $log->url = "index.php?id=".$log->course; $status = true; break; case "download": if ($log->cmid) { //Get the new_id of the module (to recode the info field) $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); if ($mod) { //Rebuild the url, extracting the type (txt, xls) $filetype = substr($log->url,-3); $log->url = "download.php?id=".$log->cmid."&type=".$filetype; $log->info = $mod->new_id; $status = true; } } break; default: if (!defined('RESTORE_SILENTLY')) { echo "action (".$log->module."-".$log->action.") unknown. Not restored
"; //Debug } break; } if ($status) { $status = $log; } return $status; }