Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F2111322
user_groups.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 18, 11:39 AM
Size
9 KB
Mime Type
text/x-php
Expires
Fri, Nov 20, 11:39 AM (1 h, 21 m)
Engine
blob
Format
Raw Data
Handle
992053
Attached To
rINP In-Portal
user_groups.php
View Options
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
// new startup: begin
define
(
'REL_PATH'
,
'admin/users'
);
$relation_level
=
count
(
explode
(
'/'
,
REL_PATH
)
);
define
(
'FULL_PATH'
,
realpath
(
dirname
(
__FILE__
)
.
str_repeat
(
'/..'
,
$relation_level
)
)
);
require_once
FULL_PATH
.
'/kernel/startup.php'
;
// new startup: end
$pathtolocal
=
$pathtoroot
.
"kernel/"
;
require_once
(
$pathtoroot
.
$admin
.
"/include/elements.php"
);
require_once
(
$pathtoroot
.
"kernel/admin/include/navmenu.php"
);
require_once
(
$pathtolocal
.
"admin/include/navmenu.php"
);
require_once
(
$pathtoroot
.
$admin
.
"/toolbar.php"
);
require_once
(
$pathtoroot
.
$admin
.
"/listview/listview.php"
);
$pathtolocal
=
$pathtoroot
;
/* -------------------------------------- Section configuration ------------------------------------------- */
$section
=
'in-portal:user_groups'
;
$envar
=
"env="
.
BuildEnv
();
$SortFieldVar
=
"Group_SortField"
;
$SortOrderVar
=
"Group_SortOrder"
;
$DefaultSortField
=
"Name"
;
$PerPageVar
=
"Perpage_Groups"
;
$CurrentPageVar
=
"Page_Groups"
;
$CurrentFilterVar
=
"Group_View"
;
$ListForm
=
"grouplistform"
;
$CheckClass
=
"GroupChecks"
;
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$objListToolBar
=
new
clsToolBar
();
$objListToolBar
->
Set
(
"section"
,
$section
);
$objListToolBar
->
Set
(
"load_menu_func"
,
""
);
$objListToolBar
->
Set
(
"CheckClass"
,
$CheckClass
);
$objListToolBar
->
Set
(
"CheckForm"
,
$ListForm
);
$listImages
=
array
();
//$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick
$objListToolBar
->
Add
(
"new_group"
,
"la_ToolTip_NewGroup"
,
$adminURL
.
"/users/addgroup.php?"
.
$envar
.
"&new=1"
,
"swap('new_group','toolbar/tool_new_group_f2.gif');"
,
"swap('new_group', 'toolbar/tool_new_group.gif');"
,
""
,
"tool_new_group.gif"
);
$objListToolBar
->
Add
(
"group_edit"
,
"la_ToolTip_Edit"
,
"#"
,
"if (GroupChecks.itemChecked()) swap('group_edit','toolbar/tool_edit_f2.gif');"
,
"if (GroupChecks.itemChecked()) swap('group_edit', 'toolbar/tool_edit.gif');"
,
"if (GroupChecks.itemChecked()) GroupChecks.check_submit('addgroup', '');"
,
"tool_edit.gif"
,
TRUE
,
TRUE
);
$listImages
[]
=
"GroupChecks.addImage('group_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); "
;
$objListToolBar
->
Add
(
"group_del"
,
"la_ToolTip_Delete"
,
"#"
,
"if (GroupChecks.itemChecked()) swap('group_del','toolbar/tool_delete_f2.gif');"
,
"if (GroupChecks.itemChecked()) swap('group_del', 'toolbar/tool_delete.gif');"
,
"if (GroupChecks.itemChecked()) GroupChecks.check_submit('user_groups', 'm_delete_group');"
,
"tool_delete.gif"
,
FALSE
,
TRUE
);
$listImages
[]
=
"GroupChecks.addImage('group_del','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1); "
;
$objListToolBar
->
Add
(
"divider"
);
$objListToolBar
->
Add
(
"group_mail"
,
"la_ToolTip_SendMail"
,
"#"
,
"if (GroupChecks.itemChecked()) swap('group_mail','toolbar/tool_e-mail_f2.gif');"
,
"if (GroupChecks.itemChecked()) swap('group_mail', 'toolbar/tool_e-mail.gif');"
,
"if (GroupChecks.itemChecked()) openEmailPopup('','sendmail',$CheckClass);"
,
"tool_e-mail.gif"
,
FALSE
,
TRUE
);
$listImages
[]
=
"GroupChecks.addImage('group_mail','$imagesURL/toolbar/tool_e-mail.gif','$imagesURL/toolbar/tool_e-mail_f3.gif',1); "
;
$objListToolBar
->
Add
(
"user_print"
,
"la_ToolTip_Print"
,
"#"
,
"swap('user_print','toolbar/tool_print_f2.gif');"
,
"swap('user_print', 'toolbar/tool_print.gif');"
,
"window.print();"
,
"tool_print.gif"
);
$objListToolBar
->
Add
(
"viewmenubutton"
,
"la_ToolTip_View"
,
"#"
,
"swap('viewmenubutton','toolbar/tool_view_f2.gif'); "
,
"swap('viewmenubutton', 'toolbar/tool_view.gif');"
,
"ShowViewMenu();"
,
"tool_view.gif"
);
$objListToolBar
->
AddToInitScript
(
$listImages
);
/* ----------------------------------------- Set the View Filter ---------------------------------------- */
/* bit place holders for category view menu */
//$Bit_Pending=4;
$Bit_Disabled
=
2
;
$Bit_Valid
=
1
;
$Bit_All
=
3
;
//7;
$FilterLabels
=
array
();
$FilterLabels
[
0
]
=
admin_language
(
"la_Text_Enabled"
);
$FilterLabels
[
1
]
=
admin_language
(
"la_Text_Disabled"
);
//$FilterLabels[2] = admin_language("la_Text_Pending");
/* determine current view menu settings */
$GroupView
=
$objConfig
->
Get
(
"Group_View"
);
$Status
=
Array
();
if
(!
is_numeric
(
$GroupView
))
{
$GroupView
=
$Bit_All
;
//Set all bits ON
$GroupFilter
=
""
;
}
else
{
if
(
$GroupView
&
$Bit_Valid
)
$Status
[]
=
1
;
if
(
$GroupView
&
$Bit_Disabled
)
$Status
[]
=
0
;
/* if($GroupView & $Bit_Pending)
$Status[] = 2;*/
if
(
count
(
$Status
)>
0
)
{
$GroupFilter
=
"Enabled IN ("
.
implode
(
","
,
$Status
).
")"
;
}
else
$GroupFilter
=
"Enabled = -1"
;
}
$order
=
$objConfig
->
Get
(
$SortOrderVar
);
$SearchWords
=
$objSession
->
GetVariable
(
"GroupSearchWord"
);
if
(
strlen
(
$SearchWords
))
{
$where
=
" Personal=0 AND "
.
$objGroups
->
AdminSearchWhereClause
(
$SearchWords
);
}
else
$where
=
" Personal=0 "
;
if
(
strlen
(
$GroupFilter
))
$where
.=
" AND $GroupFilter "
;
/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/
$orderBy
=
trim
(
$objConfig
->
Get
(
$SortFieldVar
).
" "
.
$order
);
if
(
strlen
(
$orderBy
))
$orderBy
=
" ORDER BY "
.
$orderBy
;
$prefix
=
GetTablePrefix
();
$sql
=
'SELECT g.GroupId AS GroupId, g.name AS GroupName, g.name AS name, count(u.PortalUserId) AS UserCount
FROM '
.
$prefix
.
'PortalGroup AS g
LEFT JOIN '
.
$prefix
.
'UserGroup u ON u.GroupId = g.GroupId
WHERE '
.
$where
.
'GROUP BY g.name'
.
$orderBy
;
if
(
$objSession
->
HasSystemPermission
(
"DEBUG.LIST"
))
echo
htmlentities
(
$sql
,
ENT_NOQUOTES
).
"<br>
\n
"
;
$GroupList
=
new
clsGroupList
();
$GroupList
->
Clear
();
$GroupList
->
Query_Item
(
$sql
);
$itemcount
=
TableCount
(
GetTablePrefix
().
"PortalGroup"
,
$where
,
0
);
if
(
strlen
(
$SearchWords
))
{
$title
=
prompt_language
(
"la_Text_Search_Results"
).
" ("
.
$itemcount
.
")"
;
}
else
$title
=
prompt_language
(
"la_Text_ShowingGroups"
).
" ("
.
$itemcount
.
")"
;
/* ---------------------------------------- Configure the list view ---------------------------------------- */
$objListView
=
new
clsListView
(
$objListToolBar
,
$GroupList
);
$objListView
->
IdField
=
"GroupId"
;
$objListView
->
ColumnHeaders
->
Add
(
"GroupName"
,
admin_language
(
"la_prompt_GroupName"
),
1
,
0
,
$order
,
"width=
\"
50%
\"
"
,
$SortFieldVar
,
$SortOrderVar
,
"GroupName"
);
$objListView
->
ColumnHeaders
->
Add
(
"UserCount"
,
admin_language
(
"la_prompt_UserCount"
),
1
,
0
,
$order
,
"width=
\"
50%
\"
"
,
$SortFieldVar
,
$SortOrderVar
,
"UserCount"
);
$objListView
->
ColumnHeaders
->
SetSort
(
$objConfig
->
Get
(
"Group_SortField"
),
$order
);
$objListView
->
PrintToolBar
=
FALSE
;
$objListView
->
SearchBar
=
TRUE
;
$objListView
->
SearchKeywords
=
$SearchWords
;
$objListView
->
SearchAction
=
"m_group_search"
;
$objListView
->
CurrentPageVar
=
$CurrentPageVar
;
$objListView
->
PerPageVar
=
$PerPageVar
;
$objListView
->
CheckboxName
=
"itemlist[]"
;
$objListView
->
TotalItemCount
=
$itemcount
;
$objListView
->
ConfigureViewMenu
(
$SortFieldVar
,
$SortOrderVar
,
$DefaultSortField
,
$CurrentFilterVar
,
$GroupView
,
$Bit_All
);
/* foreach($FilterLabels as $Bit=>$Label)
{
$objListView->AddViewMenuFilter($Label,$Bit);
} */
$objListToolBar
->
AddToInitScript
(
"fwLoadMenus();"
);
$objSession
->
SetVariable
(
"HasChanges"
,
0
);
$filter
=
false
;
// always initialize variables before use
if
(
$objSession
->
GetVariable
(
"GroupSearchWord"
)
!=
''
)
{
$filter
=
true
;
}
else
{
if
(
$GroupView
!=
$Bit_All
)
{
$filter
=
true
;
}
}
$h
=
"
\n\n
<SCRIPT Language=
\"
JavaScript1.2
\"
>
\n
"
.
$objListView
->
GetViewMenu
(
$imagesURL
).
"
\n
</SCRIPT>
\n
"
;
int_header
(
$objListToolBar
,
NULL
,
$title
,
NULL
,
$h
);
if
(
$filter
)
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php
int_hint_red
(
admin_language
(
"la_Warning_Filter"
));
?>
</td>
</tr>
</table>
<?php
}
?>
<FORM method="POST" ACTION="" NAME="grouplistform" ID="grouplistform">
<?php
$objListView
->
PageLinks
=
$objListView
->
PrintPageLinks
();
/* call this before we slice! */
$objListView
->
SliceItems
();
print
$objListView
->
PrintList
();
?>
<input type="hidden" name="Action" value="">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="
<?php
echo
$_SERVER
[
"PHP_SELF"
].
"?env="
.
BuildEnv
();
?>
" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<FORM method=POST NAME="sendmail" ID="sendmail" TARGET="sendmail" ACTION="
<?php
echo
$adminURL
.
"/email/sendmail.php?env="
.
BuildEnv
();
?>
">
<INPUT TYPE="HIDDEN" NAME="idlist" ID="idlist" VALUE="">
<INPUT TYPE="hidden" NAME="idtype" ID="idtype" VALUE="group">
</FORM>
<FORM ID="ListSearchForm" NAME="ListSearchForm" method="POST" action="
<?php
echo
$_SERVER
[
"PHP_SELF"
].
"?env="
.
BuildEnv
();
?>
">
<INPUT TYPE="HIDDEN" NAME="Action" VALUE="">
<INPUT TYPE="HIDDEN" NAME="list_search">
</FORM>
<script src="
<?php
echo
$adminURL
;
?>
/listview/listview.js"></script>
<script>
initSelectiorContainers();
<?php
echo
$objListToolBar
->
Get
(
"CheckClass"
).
".setImages();"
;
?>
</script>
<!-- END CODE-->
<?php
int_footer
();
?>
Event Timeline
Log In to Comment