You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
6.0 KiB
186 lines
6.0 KiB
11 years ago
|
<?php
|
||
|
/* For licensing terms, see /license.txt */
|
||
|
/**
|
||
|
* @package chamilo.admin
|
||
|
*/
|
||
|
// resetting the course id
|
||
|
$cidReset = true;
|
||
|
|
||
|
// including some necessary files
|
||
|
require_once '../inc/global.inc.php';
|
||
|
|
||
|
// setting the section (for the tabs)
|
||
|
$this_section = SECTION_PLATFORM_ADMIN;
|
||
|
|
||
|
// Access restrictions
|
||
|
api_protect_admin_script(true);
|
||
|
|
||
|
// setting breadcrumbs
|
||
|
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
|
||
11 years ago
|
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
|
||
11 years ago
|
|
||
|
// Setting the name of the tool
|
||
11 years ago
|
$tool_name = get_lang('EnrollTrainersFromExistingSessions');
|
||
11 years ago
|
$add_type = 'multiple';
|
||
|
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
|
||
|
$add_type = Security::remove_XSS($_REQUEST['add_type']);
|
||
|
}
|
||
|
$form_sent = 0;
|
||
|
$errorMsg = '';
|
||
|
$users = $sessions = array();
|
||
|
|
||
|
$id = intval($_GET['id']);
|
||
|
$htmlResult = null;
|
||
|
|
||
|
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
|
||
|
$form_sent = $_POST['form_sent'];
|
||
|
if ($form_sent == 1) {
|
||
|
$sessions = $_POST['sessions'];
|
||
|
$courses = $_POST['courses'];
|
||
|
|
||
11 years ago
|
$htmlResult = SessionManager::copyCoachesFromSessionToCourse($sessions, $courses);
|
||
11 years ago
|
}
|
||
|
}
|
||
|
|
||
|
$session_list = SessionManager::get_sessions_list(array(), array('name'));
|
||
|
$sessionList = array();
|
||
|
foreach ($session_list as $session) {
|
||
|
$sessionList[$session['id']] = $session['name'];
|
||
|
}
|
||
|
|
||
11 years ago
|
$courseList = CourseManager::get_courses_list(0, 0, 'title');
|
||
11 years ago
|
$courseOptions = array();
|
||
|
foreach ($courseList as $course) {
|
||
|
$courseOptions[$course['id']] = $course['title'];
|
||
|
}
|
||
|
Display::display_header($tool_name);
|
||
|
?>
|
||
|
|
||
|
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" >
|
||
|
<?php echo '<legend>'.$tool_name.' </legend>';
|
||
|
echo $htmlResult;
|
||
|
echo Display::input('hidden', 'form_sent', '1');
|
||
|
?>
|
||
|
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
||
|
<tr>
|
||
|
<td align="center">
|
||
|
<b><?php echo get_lang('Sessions') ?> :</b>
|
||
|
</td>
|
||
|
<td></td>
|
||
|
<td align="center">
|
||
|
<b><?php echo get_lang('Courses') ?> :</b>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="center">
|
||
|
<?php
|
||
|
echo Display::select(
|
||
|
'sessions[]',
|
||
|
$sessionList,
|
||
|
'',
|
||
|
array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'sessions', 'size'=>'15px'),
|
||
|
false
|
||
|
);
|
||
|
?>
|
||
|
</td>
|
||
|
<td align="center">
|
||
|
</td>
|
||
|
<td align="center">
|
||
|
<?php
|
||
|
echo Display::select(
|
||
|
'courses[]',
|
||
|
$courseOptions,
|
||
|
'',
|
||
|
array('style'=>'width:360px', 'id'=>'courses', 'size'=>'15px'),
|
||
|
false
|
||
|
);
|
||
|
?>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan="3" align="center">
|
||
|
<br />
|
||
|
<?php
|
||
10 years ago
|
echo '<button class="btn btn-success" type="submit"" >'.
|
||
11 years ago
|
get_lang('SubscribeTeachersToSession').'</button>';
|
||
|
?>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</form>
|
||
|
<script>
|
||
|
function moveItem(origin , destination) {
|
||
|
for(var i = 0 ; i<origin.options.length ; i++) {
|
||
|
if(origin.options[i].selected) {
|
||
|
destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
|
||
|
origin.options[i]=null;
|
||
|
i = i-1;
|
||
|
}
|
||
|
}
|
||
|
destination.selectedIndex = -1;
|
||
|
sortOptions(destination.options);
|
||
|
}
|
||
|
|
||
|
function sortOptions(options) {
|
||
|
newOptions = new Array();
|
||
|
for (i = 0 ; i<options.length ; i++)
|
||
|
newOptions[i] = options[i];
|
||
|
|
||
|
newOptions = newOptions.sort(mysort);
|
||
|
options.length = 0;
|
||
|
for(i = 0 ; i < newOptions.length ; i++)
|
||
|
options[i] = newOptions[i];
|
||
|
}
|
||
|
|
||
|
function mysort(a, b){
|
||
|
if (a.text.toLowerCase() > b.text.toLowerCase()){
|
||
|
return 1;
|
||
|
}
|
||
|
if (a.text.toLowerCase() < b.text.toLowerCase()){
|
||
|
return -1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
function valide(){
|
||
|
var options = document.getElementById('session_in_promotion').options;
|
||
|
for (i = 0 ; i<options.length ; i++)
|
||
|
options[i].selected = true;
|
||
|
document.forms.formulaire.submit();
|
||
|
}
|
||
|
|
||
|
function loadUsersInSelect(select) {
|
||
|
var xhr_object = null;
|
||
|
if(window.XMLHttpRequest) // Firefox
|
||
|
xhr_object = new XMLHttpRequest();
|
||
|
else if(window.ActiveXObject) // Internet Explorer
|
||
|
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
|
||
|
else // XMLHttpRequest non supporté par le navigateur
|
||
|
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
|
||
|
|
||
|
xhr_object.open("POST", "loadUsersInSelect.ajax.php");
|
||
|
xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||
|
nosessionUsers = makepost(document.getElementById('session_not_in_promotion'));
|
||
|
sessionUsers = makepost(document.getElementById('session_in_promotion'));
|
||
|
nosessionClasses = makepost(document.getElementById('origin_classes'));
|
||
|
sessionClasses = makepost(document.getElementById('destination_classes'));
|
||
|
xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
|
||
|
|
||
|
xhr_object.onreadystatechange = function() {
|
||
|
if(xhr_object.readyState == 4) {
|
||
|
document.getElementById('content_source').innerHTML = result = xhr_object.responseText;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function makepost(select) {
|
||
|
var options = select.options;
|
||
|
var ret = "";
|
||
|
for (i = 0 ; i<options.length ; i++)
|
||
|
ret = ret + options[i].value +'::'+options[i].text+";;";
|
||
|
return ret;
|
||
|
}
|
||
|
</script>
|
||
|
<?php
|
||
|
Display::display_footer();
|