Get("AdminDirectory"); if(!strlen($admin)) $admin = "admin"; $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); $localURL=$rootURL."kernel/"; $adminURL = $rootURL.$admin; $imagesURL = $adminURL."/images"; //admin only util $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)."
\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\n"; int_header($objListToolBar,NULL, $title,NULL,$h); if ($filter) { ?>
PageLinks = $objListView->PrintPageLinks(); /* call this before we slice! */ $objListView->SliceItems(); print $objListView->PrintList(); ?>