<?php require_once '../../config.php'; //error_reporting(E_ALL); require_once './shared/SharingCart_Backup.php'; require_once './sharing_cart_table.php'; global $DB; $course_id = required_param('course', PARAM_INT); $section_id = required_param('section', PARAM_INT); $cm_id = required_param('module', PARAM_INT); $return_to = urldecode(required_param('return', PARAM_LOCALURL)); try { // バックアップオブジェクト (※ $preferences は Moodle グローバル変数として予約されているので使用不可) $worker = new SharingCart_Backup($course_id, $section_id); // サイレントモード $worker->setSilent(); // コースオブジェクト取得 $course = $worker->getCourse(); // コースモジュールが存在するかチェック $modinfo = get_fast_modinfo($course) and isset($modinfo->cms[$cm_id]) or print_error('err_module_id', 'block_sharing_cart', $return_to); // コースモジュール取得 $cm = $modinfo->cms[$cm_id]; // モジュールが存在するかチェック $module = $DB->get_record('modules', array('name' => $cm->modname)) or print_error('err_module_id', 'block_sharing_cart', $return_to); // 設定開始 $worker->beginPreferences(); // ZIPファイル名設定 /* $zipname = sharing_cart_table::gen_zipname($worker->getUnique()); $worker->setZipName($zipname);*/ // モジュールをバックアップリストに追加 $worker->addModule($module, $cm->id);
$to_section_i = optional_param('tosection'); $newdirectoryname = optional_param('newdirectoryname'); $launch = optional_param('launch'); $cancel = optional_param('cancel'); // キャンセル if ($cancel) { redirect($CFG->wwwroot . '/course/view.php?id=' . $course_id, get_string('backupcancelled')); exit; } if (file_exists($shared_lib = $CFG->dirroot . '/blocks/sharing_cart/shared/SharingCart_Backup.php')) { require_once $shared_lib; } else { require_once dirname(__FILE__) . '/shared/SharingCart_Backup.php'; } try { $worker = new SharingCart_Backup($course_id, $section_i); //Get strings $str_sectionbackup = get_string("sectionbackup", "format_project"); $str_administration = get_string("administration"); $course = $worker->getCourse(); // HTMLの出力 //$navlinks[] = array('name' => $course->fullname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'misc'); $navlinks[] = array('name' => $str_sectionbackup, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header("{$course->shortname}: {$str_sectionbackup}", $course->fullname, $navigation); if (!$launch) { // バックアップチェックの実行 include_once './backup_check.php'; } elseif ($launch == 'execute') { // バックアップの実行 include_once './backup_execute.php';
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <?php require_once '../../config.php'; //error_reporting(E_ALL); require_once './shared/SharingCart_Backup.php'; require_once './sharing_cart_table.php'; $course_id = required_param('course', PARAM_INT); $section_id = required_param('section', PARAM_INT); $cm_id = required_param('module', PARAM_INT); $return_to = urldecode(required_param('return')); try { // バックアップオブジェクト (※ $preferences は Moodle グローバル変数として予約されているので使用不可) $worker = new SharingCart_Backup($course_id, $section_id); // サイレントモード $worker->setSilent(); // コースオブジェクト取得 $course = $worker->getCourse(); // コースモジュールが存在するかチェック $modinfo = get_fast_modinfo($course) and isset($modinfo->cms[$cm_id]) or print_error('err_module_id', 'block_sharing_cart', $return_to); // コースモジュール取得 $cm = $modinfo->cms[$cm_id]; // モジュールが存在するかチェック $module = get_record('modules', 'name', $cm->modname) or print_error('err_module_id', 'block_sharing_cart', $return_to); // 設定開始 $worker->beginPreferences(); // ZIPファイル名設定 $zipname = sharing_cart_table::gen_zipname($worker->getUnique()); $worker->setZipName($zipname);