|
|
|
@ -82,28 +82,28 @@ $errorMsg = ''; |
|
|
|
|
$sessions=array(); |
|
|
|
|
$usergroup = new UserGroup(); |
|
|
|
|
$id = intval($_GET['id']); |
|
|
|
|
if($_POST['form_sent']) { |
|
|
|
|
$form_sent = $_POST['form_sent']; |
|
|
|
|
$elements_posted = $_POST['elements_in_name']; |
|
|
|
|
if ($_POST['form_sent']) { |
|
|
|
|
$form_sent = $_POST['form_sent']; |
|
|
|
|
$elements_posted = $_POST['elements_in_name']; |
|
|
|
|
if (!is_array($elements_posted)) { |
|
|
|
|
$elements_posted=array(); |
|
|
|
|
} |
|
|
|
|
if ($form_sent == 1) { |
|
|
|
|
$usergroup->subscribe_courses_to_usergroup($id, $elements_posted); |
|
|
|
|
header('Location: usergroups.php'); |
|
|
|
|
exit; |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$data = $usergroup->get($id); |
|
|
|
|
$course_list_in = $usergroup->get_courses_by_usergroup($id); |
|
|
|
|
$course_list = CourseManager::get_courses_list(0,0,'title'); |
|
|
|
|
$course_list = CourseManager::get_courses_list(0, 0, 'title'); |
|
|
|
|
|
|
|
|
|
//api_display_tool_title($tool_name.' ('.$session_info['name'].')'); |
|
|
|
|
$elements_not_in = $elements_in= array(); |
|
|
|
|
|
|
|
|
|
if (!empty($course_list)) { |
|
|
|
|
foreach($course_list as $item) { |
|
|
|
|
if (in_array($item['id'], $course_list_in)) { |
|
|
|
|
foreach ($course_list as $item) { |
|
|
|
|
if (in_array($item['id'], $course_list_in)) { |
|
|
|
|
$elements_in[$item['id']] = $item['title']." (".$item['visual_code'].")"; |
|
|
|
|
} else { |
|
|
|
|
$elements_not_in[$item['id']] = $item['title']." (".$item['visual_code'].")"; |
|
|
|
@ -114,8 +114,9 @@ $ajax_search = $add_type == 'unique' ? true : false; |
|
|
|
|
|
|
|
|
|
//checking for extra field with filter on |
|
|
|
|
|
|
|
|
|
function search($needle,$type) { |
|
|
|
|
global $tbl_user,$elements_in; |
|
|
|
|
function search($needle,$type) |
|
|
|
|
{ |
|
|
|
|
global $elements_in; |
|
|
|
|
$xajax_response = new XajaxResponse(); |
|
|
|
|
$return = ''; |
|
|
|
|
if (!empty($needle) && !empty($type)) { |
|
|
|
@ -135,8 +136,7 @@ function search($needle,$type) { |
|
|
|
|
' LIMIT 11';*/ |
|
|
|
|
} else { |
|
|
|
|
$list = CourseManager::get_courses_list(0, 0, 2, 'ASC', -1, $needle); |
|
|
|
|
} |
|
|
|
|
$i=0; |
|
|
|
|
} |
|
|
|
|
if ($type=='single') { |
|
|
|
|
/* |
|
|
|
|
while ($user = Database :: fetch_array($rs)) { |
|
|
|
@ -151,42 +151,45 @@ function search($needle,$type) { |
|
|
|
|
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));*/ |
|
|
|
|
} else { |
|
|
|
|
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">'; |
|
|
|
|
|
|
|
|
|
foreach ($list as $row ) { |
|
|
|
|
if (!in_array($row['id'], array_keys($elements_in))) { |
|
|
|
|
|
|
|
|
|
foreach ($list as $row) { |
|
|
|
|
if (!in_array($row['id'], array_keys($elements_in))) { |
|
|
|
|
$return .= '<option value="'.$row['id'].'">'.$row['title'].' ('.$row['visual_code'].')</option>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$return .= '</select>'; |
|
|
|
|
$xajax_response -> addAssign('ajax_list_multiple','innerHTML',api_utf8_encode($return)); |
|
|
|
|
$xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $xajax_response; |
|
|
|
|
} |
|
|
|
|
$xajax -> processRequests(); |
|
|
|
|
|
|
|
|
|
$xajax->processRequests(); |
|
|
|
|
|
|
|
|
|
Display::display_header($tool_name); |
|
|
|
|
|
|
|
|
|
if ($add_type == 'multiple') { |
|
|
|
|
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
|
|
|
|
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'. |
|
|
|
|
Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
|
|
|
|
$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); |
|
|
|
|
} else { |
|
|
|
|
$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); |
|
|
|
|
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
|
|
|
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'. |
|
|
|
|
Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
echo '<div class="actions">'; |
|
|
|
|
echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>'; |
|
|
|
|
echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
|
|
|
|
|
|
|
|
|
|
<?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
|
|
|
|
|
<?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; |
|
|
|
|
|
|
|
|
|
if ($add_type=='multiple') { |
|
|
|
|
if (is_array($extra_field_list)) { |
|
|
|
|
if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
|
|
|
if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
|
|
|
echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
|
|
|
foreach ($new_field_list as $new_field) { |
|
|
|
|
echo $new_field['name']; |
|
|
|
@ -210,10 +213,10 @@ if ($add_type=='multiple') { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
echo Display::input('hidden','id',$id); |
|
|
|
|
echo Display::input('hidden','form_sent','1'); |
|
|
|
|
echo Display::input('hidden','add_type',null); |
|
|
|
|
if(!empty($errorMsg)) { |
|
|
|
|
echo Display::input('hidden', 'id', $id); |
|
|
|
|
echo Display::input('hidden', 'form_sent', '1'); |
|
|
|
|
echo Display::input('hidden', 'add_type', null); |
|
|
|
|
if (!empty($errorMsg)) { |
|
|
|
|
Display::display_normal_message($errorMsg); //main API |
|
|
|
|
} |
|
|
|
|
?> |
|
|
|
@ -230,12 +233,12 @@ if(!empty($errorMsg)) { |
|
|
|
|
<tr> |
|
|
|
|
<td align="center"> |
|
|
|
|
<?php echo get_lang('FirstLetterCourseTitle'); ?> :
|
|
|
|
|
<select name="firstLetterUser" onchange = "xajax_search(this.value,'multiple')" > |
|
|
|
|
<option value = "%">--</option> |
|
|
|
|
<?php |
|
|
|
|
echo Display :: get_alphabet_options(); |
|
|
|
|
?> |
|
|
|
|
</select> |
|
|
|
|
<select name="firstLetterUser" onchange = "xajax_search(this.value,'multiple')" > |
|
|
|
|
<option value = "%">--</option> |
|
|
|
|
<?php |
|
|
|
|
echo Display :: get_alphabet_options(); |
|
|
|
|
?> |
|
|
|
|
</select> |
|
|
|
|
</td> |
|
|
|
|
<td align="center"> </td> |
|
|
|
|
</tr> |
|
|
|
@ -243,16 +246,16 @@ if(!empty($errorMsg)) { |
|
|
|
|
<tr> |
|
|
|
|
<td align="center"> |
|
|
|
|
<div id="content_source"> |
|
|
|
|
<?php
|
|
|
|
|
if (!($add_type=='multiple')) { |
|
|
|
|
<?php |
|
|
|
|
if (!($add_type=='multiple')) { |
|
|
|
|
?> |
|
|
|
|
<input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
|
|
|
|
<div id="ajax_list_users_single"></div> |
|
|
|
|
<?php |
|
|
|
|
} else { |
|
|
|
|
} else { |
|
|
|
|
?> |
|
|
|
|
<div id="ajax_list_multiple"> |
|
|
|
|
<?php echo Display::select('elements_not_in_name',$elements_not_in, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?>
|
|
|
|
|
<?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?> |
|
|
|
|
</div> |
|
|
|
|
<?php |
|
|
|
|
} |
|
|
|
@ -294,8 +297,7 @@ if(!empty($errorMsg)) { |
|
|
|
|
</form> |
|
|
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
<!-- |
|
|
|
|
function moveItem(origin , destination){ |
|
|
|
|
function moveItem(origin , destination) { |
|
|
|
|
|
|
|
|
|
for(var i = 0 ; i<origin.options.length ; i++) { |
|
|
|
|
if(origin.options[i].selected) { |
|
|
|
@ -339,9 +341,7 @@ function valide(){ |
|
|
|
|
document.forms.formulaire.submit(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadUsersInSelect(select){ |
|
|
|
|
|
|
|
|
|
function loadUsersInSelect(select) { |
|
|
|
|
var xhr_object = null; |
|
|
|
|
|
|
|
|
|
if(window.XMLHttpRequest) // Firefox |
|
|
|
@ -351,12 +351,9 @@ function loadUsersInSelect(select){ |
|
|
|
|
else // XMLHttpRequest non supporté par le navigateur |
|
|
|
|
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); |
|
|
|
|
|
|
|
|
|
//xhr_object.open("GET", "loadUsersInSelect.ajax.php?id_session=<?php echo $id_session ?>&letter="+select.options[select.selectedIndex].text, false);
|
|
|
|
|
xhr_object.open("POST", "loadUsersInSelect.ajax.php"); |
|
|
|
|
|
|
|
|
|
xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nosessionUsers = makepost(document.getElementById('elements_not_in')); |
|
|
|
|
sessionUsers = makepost(document.getElementById('elements_in')); |
|
|
|
|
nosessionClasses = makepost(document.getElementById('origin_classes')); |
|
|
|
@ -366,7 +363,6 @@ function loadUsersInSelect(select){ |
|
|
|
|
xhr_object.onreadystatechange = function() { |
|
|
|
|
if(xhr_object.readyState == 4) { |
|
|
|
|
document.getElementById('content_source').innerHTML = result = xhr_object.responseText; |
|
|
|
|
//alert(xhr_object.responseText); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -376,10 +372,8 @@ function makepost(select){ |
|
|
|
|
var ret = ""; |
|
|
|
|
for (i = 0 ; i<options.length ; i++) |
|
|
|
|
ret = ret + options[i].value +'::'+options[i].text+";;"; |
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
--> |
|
|
|
|
</script> |
|
|
|
|
<?php |
|
|
|
|
Display::display_footer(); |
|
|
|
|