\n";
return $sToRender;
}
// page that comes up when there is nothing selected
function getPageNotSelected($sQueryString) {
global $default;
$sToRender .= renderHeading("Add User to Group");
$sToRender .= "
\n";
return $sToRender;
}
// display the listbox initially ..then just display the text
function getUserDisplay($oUser) {
global $default;
if (!isset($oUser)) {
$oPatternListBox = & new PatternListBox($default->users_table, "username", "id", "fUserID");
if (Permission::userIsUnitAdministrator() && !Permission::userIsSystemAdministrator()) {
$oPatternListBox->setFromClause("INNER JOIN $default->users_groups_table UGL ON ST.id=UGL.user_id " .
"INNER JOIN $default->groups_units_table GUL ON UGL.group_id=GUL.group_id");
$oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
$oUnassignedUsersLB = & new PatternListBox($default->users_table, "username", "id", "fUserID");
$oUnassignedUsersLB->setFromClause("LEFT OUTER JOIN $default->users_groups_table UGL ON ST.id=UGL.user_id");
$oUnassignedUsersLB->setWhereClause("ISNULL(UGL.group_id)");
$oPatternListBox->setAdditionalEntries($oUnassignedUsersLB->getEntries());
}
return $oPatternListBox->render();
} else {
return "iId . "\">\n" .
$oUser->getUserName();
}
}
// display the listbox initially ..then just display the text
function getGroupDisplay($oGroup) {
global $default;
if (!isset($oGroup)) {
if (Permission::userIsSystemAdministrator()) {
// if this is the system administrator, prepend group names with unit name
$oPatternListBox = & new PatternListBox($default->groups_table, "name", "id", "fGroupID");
$oPatternListBox->setFromClause("LEFT OUTER JOIN groups_units_link GUL on ST.id=GUL.group_id " .
"LEFT OUTER JOIN units_lookup UL on GUL.unit_id=UL.id");
$oPatternListBox->setCompositeDisplayName("DISTINCT COALESCE(CONCAT(CONCAT(UL.name, '-'),ST.name),ST.name)");
} else if (Permission::userIsUnitAdministrator()) {
// else if this is a unit administrator, only display the groups in your unit
$oPatternListBox = & new PatternListBox($default->groups_table, "name", "id", "fGroupID");
$oPatternListBox->setFromClause("INNER JOIN $default->groups_units_table GUL on ST.id=GUL.group_id");
$oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
}
return $oPatternListBox->render();
} else {
return "iId . "\">\n" .
$oGroup->getName();
}
}
// show button after User selected
function getAssignButton($oUser) {
global $default;
if (!isset($oUser)) {
return "