Adding title, fixing query order when adding/editing HHRR courses/sessions/users

skala
Julio Montoya 13 years ago
parent 79fcfced52
commit a76fdf0ef0
  1. 21
      main/admin/dashboard_add_courses_to_user.php
  2. 25
      main/admin/dashboard_add_sessions_to_user.php
  3. 23
      main/admin/dashboard_add_users_to_user.php
  4. 8
      main/inc/lib/usermanager.lib.php

@ -2,10 +2,8 @@
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Interface for assigning courses to Human Resources Manager
* @package chamilo.admin
==============================================================================
*/
// name of the language file that needs to be included
@ -183,9 +181,9 @@ echo '<div class="actions">
<span style="float: right;margin:0px;padding:0px;">
<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignUsers').'</a>
<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignSessions').'</a></span>
<span style="vertical-align:middle">'.sprintf(get_lang('AssignCoursesToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])).'</span></div>';
</div>';
// *******************
echo Display::page_header(sprintf(get_lang('AssignCoursesToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])));
$assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm);
@ -206,11 +204,13 @@ if (isset($_POST['firstLetterCourse'])) {
if ($_configuration['multiple_access_urls']) {
$sql = " SELECT c.code, c.title FROM $tbl_course c LEFT JOIN $tbl_course_rel_access_url a ON (a.course_code = c.code)
WHERE c.code LIKE '$needle' $without_assigned_courses AND access_url_id = ".api_get_current_access_url_id()."";
WHERE c.code LIKE '$needle' $without_assigned_courses AND access_url_id = ".api_get_current_access_url_id()."
ORDER BY c.title";
} else {
$sql = " SELECT c.code, c.title FROM $tbl_course c
WHERE c.code LIKE '$needle' $without_assigned_courses ";
WHERE c.code LIKE '$needle' $without_assigned_courses
ORDER BY c.title";
}
@ -305,12 +305,5 @@ if(!empty($msg)) {
</table>
</form>
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>
Display::display_footer();

@ -2,10 +2,8 @@
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Interface for assigning sessions to Human Resources Manager
* @package chamilo.admin
==============================================================================
*/
// name of the language file that needs to be included
@ -179,14 +177,10 @@ if ($user_info['status'] != SESSIONADMIN) {
echo '<span style="float: right;margin:0px;padding:0px;">
<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignUsers').'</a>
<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.Display::return_icon('course_add.gif', get_lang('AssignCourses'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignCourses').'</a>
</span>
<span style="vertical-align:middle">'.sprintf(get_lang('AssignSessionsToX'),api_get_person_name($user_info['firstname'], $user_info['lastname'])).'</span>';
} else {
echo '<span>'.sprintf(get_lang('AssignSessionsToX'),api_get_person_name($user_info['firstname'], $user_info['lastname'])).'</span>';
</span>';
}
echo '</div>';
// *******************
echo Display::page_header(sprintf(get_lang('AssignSessionsToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])));
$assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
$assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
@ -203,10 +197,13 @@ if (isset($_POST['firstLetterSession'])) {
if ($_configuration['multiple_access_urls']) {
$sql = " SELECT s.id, s.name FROM $tbl_session s LEFT JOIN $tbl_session_rel_access_url a ON (s.id = a.session_id)
WHERE s.name LIKE '$needle%' $without_assigned_sessions AND access_url_id = ".api_get_current_access_url_id()."";
WHERE s.name LIKE '$needle%' $without_assigned_sessions AND access_url_id = ".api_get_current_access_url_id()."
ORDER BY s.name";
} else {
$sql = " SELECT s.id, s.name FROM $tbl_session s
WHERE s.name LIKE '$needle%' $without_assigned_sessions ";
WHERE s.name LIKE '$needle%' $without_assigned_sessions
ORDER BY s.name
";
}
$result = Database::query($sql);
@ -301,10 +298,4 @@ if(!empty($msg)) {
</form>
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>
Display::display_footer();

@ -2,10 +2,8 @@
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Interface for assigning users to Human Resources Manager
* @package chamilo.admin
==============================================================================
*/
// name of the language file that needs to be included
@ -79,7 +77,7 @@ function search_users($needle,$type) {
$without_assigned_users = '';
if (count($assigned_users_id) > 0) {
$without_assigned_users = " AND user_id NOT IN(".implode(',',$assigned_users_id).")";
$without_assigned_users = " AND user.user_id NOT IN(".implode(',',$assigned_users_id).")";
}
if ($_configuration['multiple_access_urls']) {
@ -91,7 +89,6 @@ function search_users($needle,$type) {
WHERE ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND status NOT IN(".DRH.", ".SESSIONADMIN.") AND user_id NOT IN ($user_anonymous, $current_user_id, $user_id) $without_assigned_users";
}
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedUsersList[]" multiple="multiple" size="20" style="width:340px;">';
@ -181,9 +178,9 @@ echo '<div class="actions">
<span style="float: right;margin:0px;padding:0px;">
<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.Display::return_icon('course_add.gif', get_lang('AssignCourses'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignCourses').'</a>
<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions'), array('style'=>'vertical-align:middle')).' '.get_lang('AssignSessions').'</a></span>
<span style="vertical-align:middle">'.sprintf(get_lang('AssignUsersToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])).'</span></div>';
</div>';
// *******************
echo Display::page_header(sprintf(get_lang('AssignUsersToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])));
$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
$assigned_users_id = array_keys($assigned_users_to_hrm);
@ -201,10 +198,12 @@ if (isset($_POST['firstLetterUser'])) {
if ($_configuration['multiple_access_urls']) {
$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 access_url_id = ".api_get_current_access_url_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 access_url_id = ".api_get_current_access_url_id()."
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 ";
WHERE $without_assigned_users user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND status NOT IN(".DRH.", ".SESSIONADMIN.") $search_user
ORDER BY firstname ";
}
$result = Database::query($sql);
@ -302,10 +301,4 @@ if(!empty($msg)) {
</form>
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>
Display::display_footer();

@ -3104,10 +3104,14 @@ class UserManager {
}
if (api_get_multiple_access_url()) {
$sql = "SELECT u.user_id, u.username, u.lastname, u.firstname, u.email FROM $tbl_user u
INNER JOIN $tbl_user_rel_user uru ON (uru.user_id = u.user_id) LEFT JOIN $tbl_user_rel_access_url a ON (a.user_id = u.user_id) WHERE friend_user_id = '$hr_dept_id' AND relation_type = '".USER_RELATION_TYPE_RRHH."' $condition_status AND access_url_id = ".api_get_current_access_url_id()."";
INNER JOIN $tbl_user_rel_user uru ON (uru.user_id = u.user_id) LEFT JOIN $tbl_user_rel_access_url a
ON (a.user_id = u.user_id)
WHERE friend_user_id = '$hr_dept_id' AND relation_type = '".USER_RELATION_TYPE_RRHH."' $condition_status AND access_url_id = ".api_get_current_access_url_id()."
";
} else {
$sql = "SELECT u.user_id, u.username, u.lastname, u.firstname, u.email FROM $tbl_user u
INNER JOIN $tbl_user_rel_user uru ON uru.user_id = u.user_id AND friend_user_id = '$hr_dept_id' AND relation_type = '".USER_RELATION_TYPE_RRHH."' $condition_status";
INNER JOIN $tbl_user_rel_user uru ON uru.user_id = u.user_id AND friend_user_id = '$hr_dept_id' AND relation_type = '".USER_RELATION_TYPE_RRHH."' $condition_status
";
}
$rs_assigned_users = Database::query($sql);

Loading…
Cancel
Save