Source for file copy_course.php
Documentation is available at copy_course.php
// $Id: copy_course.php 15281 2008-05-13 23:10:40Z yannoo $
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Bart Mollet (bart.mollet@hogent.be)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
==============================================================================
* ==============================================================================
* Copy resources from one course to another one.
* @author Bart Mollet <bart.mollet@hogent.be>
* ==============================================================================
==============================================================================
==============================================================================
// name of the language file that needs to be included
$language_file = array('coursebackup','admin');
include ('../inc/global.inc.php');
include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php');
require_once ('classes/CourseBuilder.class.php');
require_once ('classes/CourseRestorer.class.php');
require_once ('classes/CourseSelectForm.class.php');
//remove memory and time limits as much as possible as this might be a long process...
ini_set('max_execution_time',1800);
$interbreadcrumb[] = array ("url" => "../course_info/maintenance.php", "name" => get_lang('Maintenance'));
//api_display_tool_title($nameTools);
==============================================================================
==============================================================================
// If a CourseSelectForm is posted or we should copy all resources, then copy them
if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset ($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy'))
if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form')
$cr->set_file_option($_POST['same_file_name_option']);
$cr->restore($_POST['destination_course']);
// Else, if a CourseSelectForm is requested, show it
elseif (isset ($_POST['copy_option']) && $_POST['copy_option'] == 'select_items')
//echo get_lang('SelectItemsToCopy');
$hidden_fields['same_file_name_option'] = $_POST['same_file_name_option'];
$hidden_fields['destination_course'] = $_POST['destination_course'];
// Else, show the default page
$sql = 'SELECT * FROM '. $table_c. ' c, '. $table_cu. ' cu WHERE cu.course_code = c.code';
$sql .= ' AND cu.status=1 ';
$sql .= ' AND target_course_code IS NULL AND cu.user_id = '. $user_info['user_id']. ' AND c.code != '. "'". $course_info['sysCode']. "'". ' ';
<form method="post" action="copy_course.php">
echo get_lang('SelectDestinationCourse');
echo ' <select name="destination_course"/>';
echo '<option value="'. $obj->code. '">'. $obj->title. '</option>';
<input type="radio" class="checkbox" id="copy_option_1" name="copy_option" value="full_copy"/>
<label for="copy_option_1"> <?php echo get_lang('FullCopy') ?></label>
<input type="radio" class="checkbox" id="copy_option_2" name="copy_option" value="select_items" checked="checked"/>
<label for="copy_option_2"> <?php echo get_lang('LetMeSelectItems') ?></label>
<input type="radio" class="checkbox" id="same_file_name_option_1" name="same_file_name_option" value=" <?php echo FILE_SKIP ?>"/>
<label for="same_file_name_option_1"> <?php echo get_lang('SameFilenameSkip') ?></label>
<input type="radio" class="checkbox" id="same_file_name_option_2" name="same_file_name_option" value=" <?php echo FILE_RENAME ?>"/>
<label for="same_file_name_option_2"> <?php echo get_lang('SameFilenameRename') ?></label>
<input type="radio" class="checkbox" id="same_file_name_option_3" name="same_file_name_option" value=" <?php echo FILE_OVERWRITE ?>" checked="checked"/>
<label for="same_file_name_option_3"> <?php echo get_lang('SameFilenameOverwrite') ?></label>
<input type="submit" value=" <?php echo get_lang('CopyCourse') ?>"/>
==============================================================================
==============================================================================
|