|
|
|
@ -55,7 +55,7 @@ if ($isAdmin) { |
|
|
|
|
|
|
|
|
|
$add_type = 'multiple'; |
|
|
|
|
if (isset($_GET['add_type']) && $_GET['add_type'] != '') { |
|
|
|
|
$add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
|
|
|
$add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!api_is_platform_admin()) { |
|
|
|
@ -160,7 +160,11 @@ function search_users($needle, $type) |
|
|
|
|
$return .= '...<br />'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$xajax_response->addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return)); |
|
|
|
|
$xajax_response->addAssign( |
|
|
|
|
'ajax_list_users_single', |
|
|
|
|
'innerHTML', |
|
|
|
|
api_utf8_encode($return) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$return .= '<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15" ">'; |
|
|
|
|
while ($user = Database :: fetch_array($rs)) { |
|
|
|
@ -172,73 +176,73 @@ function search_users($needle, $type) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $xajax_response; |
|
|
|
|
return $xajax_response; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$xajax->processRequests(); |
|
|
|
|
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); |
|
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
|
function add_user_to_user (code, content) { |
|
|
|
|
document.getElementById("user_to_add").value = ""; |
|
|
|
|
document.getElementById("ajax_list_users_single").innerHTML = ""; |
|
|
|
|
|
|
|
|
|
destination = document.getElementById("destination"); |
|
|
|
|
|
|
|
|
|
for (i=0;i<destination.length;i++) { |
|
|
|
|
if(destination.options[i].text == content) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
destination.options[destination.length] = new Option(content,code); |
|
|
|
|
destination.selectedIndex = -1; |
|
|
|
|
sortOptions(destination.options); |
|
|
|
|
document.getElementById("user_to_add").value = ""; |
|
|
|
|
document.getElementById("ajax_list_users_single").innerHTML = ""; |
|
|
|
|
|
|
|
|
|
destination = document.getElementById("destination"); |
|
|
|
|
|
|
|
|
|
for (i=0;i<destination.length;i++) { |
|
|
|
|
if(destination.options[i].text == content) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
destination.options[destination.length] = new Option(content,code); |
|
|
|
|
destination.selectedIndex = -1; |
|
|
|
|
sortOptions(destination.options); |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
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) { |
|
|
|
|
var 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]; |
|
|
|
|
} |
|
|
|
|
var 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; |
|
|
|
|
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("destination").options; |
|
|
|
|
for (i = 0 ; i<options.length ; i++) { |
|
|
|
|
options[i].selected = true; |
|
|
|
|
} |
|
|
|
|
document.forms.formulaire.submit(); |
|
|
|
|
var options = document.getElementById("destination").options; |
|
|
|
|
for (i = 0 ; i<options.length ; i++) { |
|
|
|
|
options[i].selected = true; |
|
|
|
|
} |
|
|
|
|
document.forms.formulaire.submit(); |
|
|
|
|
} |
|
|
|
|
function remove_item(origin) { |
|
|
|
|
for(var i = 0 ; i<origin.options.length ; i++) { |
|
|
|
|
if(origin.options[i].selected) { |
|
|
|
|
origin.options[i]=null; |
|
|
|
|
i = i-1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(var i = 0 ; i<origin.options.length ; i++) { |
|
|
|
|
if(origin.options[i].selected) { |
|
|
|
|
origin.options[i]=null; |
|
|
|
|
i = i-1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
@ -285,7 +289,6 @@ if (!empty($filters) && !empty($filterData)) { |
|
|
|
|
$msg = ''; |
|
|
|
|
if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) { |
|
|
|
|
$user_list = $_POST['UsersList']; |
|
|
|
|
|
|
|
|
|
switch ($userStatus) { |
|
|
|
|
case DRH: |
|
|
|
|
//no break; |
|
|
|
@ -359,13 +362,13 @@ switch ($userStatus) { |
|
|
|
|
$assigned_users_id = array_keys($assigned_users_to_hrm); |
|
|
|
|
$without_assigned_users = ''; |
|
|
|
|
if (count($assigned_users_id) > 0) { |
|
|
|
|
$without_assigned_users = " user.user_id NOT IN(".implode(',', $assigned_users_id).") AND "; |
|
|
|
|
$without_assigned_users = " user.user_id NOT IN(".implode(',', $assigned_users_id).") AND "; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$search_user = ''; |
|
|
|
|
if (!empty($firstLetterUser)) { |
|
|
|
|
$needle = Database::escape_string($firstLetterUser); |
|
|
|
|
$search_user = "AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
|
|
|
$needle = Database::escape_string($firstLetterUser); |
|
|
|
|
$search_user = "AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sqlConditions = null; |
|
|
|
@ -385,10 +388,10 @@ if (!empty($conditions)) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$sql = "SELECT user.user_id, username, lastname, firstname |
|
|
|
|
FROM $tbl_user user LEFT JOIN $tbl_access_url_rel_user au |
|
|
|
|
ON (au.user_id = user.user_id) |
|
|
|
|
WHERE |
|
|
|
|
$sql = "SELECT user.user_id, username, lastname, firstname |
|
|
|
|
FROM $tbl_user user LEFT JOIN $tbl_access_url_rel_user au |
|
|
|
|
ON (au.user_id = user.user_id) |
|
|
|
|
WHERE |
|
|
|
|
$without_assigned_users |
|
|
|
|
user.user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND |
|
|
|
|
status NOT IN(".DRH.", ".SESSIONADMIN.") $search_user AND |
|
|
|
@ -396,14 +399,14 @@ if (api_is_multiple_url_enabled()) { |
|
|
|
|
$sqlConditions |
|
|
|
|
ORDER BY firstname"; |
|
|
|
|
} else { |
|
|
|
|
$sql = "SELECT user_id, username, lastname, firstname |
|
|
|
|
FROM $tbl_user user |
|
|
|
|
WHERE |
|
|
|
|
$without_assigned_users |
|
|
|
|
user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND |
|
|
|
|
status NOT IN(".DRH.", ".SESSIONADMIN.") |
|
|
|
|
$search_user |
|
|
|
|
$sqlConditions |
|
|
|
|
$sql = "SELECT user_id, username, lastname, firstname |
|
|
|
|
FROM $tbl_user user |
|
|
|
|
WHERE |
|
|
|
|
$without_assigned_users |
|
|
|
|
user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND |
|
|
|
|
status NOT IN(".DRH.", ".SESSIONADMIN.") |
|
|
|
|
$search_user |
|
|
|
|
$sqlConditions |
|
|
|
|
ORDER BY firstname "; |
|
|
|
|
} |
|
|
|
|
$result = Database::query($sql); |
|
|
|
@ -412,14 +415,13 @@ $result = Database::query($sql); |
|
|
|
|
<input type="hidden" name="formSent" value="1" /> |
|
|
|
|
<?php |
|
|
|
|
if (!empty($msg)) { |
|
|
|
|
Display::addFlash(Display::return_message($msg, 'normal')); //main API |
|
|
|
|
Display::addFlash(Display::return_message($msg, 'normal')); //main API |
|
|
|
|
} |
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
<?php echo get_lang('UserListInPlatform') ?> |
|
|
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
<div class="col-sm-12"> |
|
|
|
|
<div id="ajax_list_users_multiple"> |
|
|
|
@ -435,8 +437,6 @@ if (!empty($msg)) { |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
<div class="code-course"> |
|
|
|
@ -453,7 +453,7 @@ if (!empty($msg)) { |
|
|
|
|
<div class="separate-action"> |
|
|
|
|
<button class="btn btn-primary" type="button" onclick="remove_item(document.getElementById('destination'))"></button> |
|
|
|
|
</div> |
|
|
|
|
<?php } else { ?> |
|
|
|
|
<?php } else { ?> |
|
|
|
|
<div class="separate-action"> |
|
|
|
|
<button class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))"> |
|
|
|
|
<em class="fa fa-chevron-right"></em> |
|
|
|
@ -464,28 +464,30 @@ if (!empty($msg)) { |
|
|
|
|
<em class="fa fa-chevron-left"></em> |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
<?php |
|
|
|
|
} |
|
|
|
|
?> |
|
|
|
|
<?php } ?> |
|
|
|
|
<div class="separate-action"> |
|
|
|
|
<?php |
|
|
|
|
echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
|
|
|
?> |
|
|
|
|
<?php |
|
|
|
|
echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>'; |
|
|
|
|
?> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
<?php |
|
|
|
|
if (UserManager::is_admin($user_id)) { |
|
|
|
|
echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
|
|
|
} else if ($user_info['status'] == SESSIONADMIN) { |
|
|
|
|
echo get_lang('AssignedUsersListToSessionsAdministrator'); |
|
|
|
|
} else if ($user_info['status'] == STUDENT_BOSS) { |
|
|
|
|
echo get_lang('AssignedUsersListToStudentBoss'); |
|
|
|
|
<?php |
|
|
|
|
if (UserManager::is_admin($user_id)) { |
|
|
|
|
echo get_lang('AssignedUsersListToPlatformAdministrator'); |
|
|
|
|
} else { |
|
|
|
|
if ($user_info['status'] == SESSIONADMIN) { |
|
|
|
|
echo get_lang('AssignedUsersListToSessionsAdministrator'); |
|
|
|
|
} else { |
|
|
|
|
if ($user_info['status'] == STUDENT_BOSS) { |
|
|
|
|
echo get_lang('AssignedUsersListToStudentBoss'); |
|
|
|
|
} else { |
|
|
|
|
echo get_lang('AssignedUsersListToHumanResourcesManager'); |
|
|
|
|
} |
|
|
|
|
?> |
|
|
|
|
echo get_lang('AssignedUsersListToHumanResourcesManager'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
?> |
|
|
|
|
<div class="form-group"> |
|
|
|
|
<div class="col-sm-12"> |
|
|
|
|
<br> |
|
|
|
|