$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
unset($objEditItems);
//$objEditItems = new clsPhraseList();
//$objEditItems->SourceTable = $objSession->GetEditTable("Language");
/* -------------------------------------- Section configuration ------------------------------------------- */
$section = $_GET["section"];
$sec = $objSections->GetSection($section);
$module = $_GET["module"];
$envar = "env=" . BuildEnv()."&module=$module§ion=$section";
//$title = prompt_language("la_Text_Configuration")." - '".$module."' - ".prompt_language("la_tab_EmailEvents");
$SortFieldVar = "Event_LV_SortField";
$SortOrderVar = "Event_LV_SortOrder";
$DefaultSortField = "Description";
$PerPageVar = "Perpage_Event";
$CurrentPageVar = "Page_Event";
$CurrentFilterVar = "EmailEvent_View";
$ListForm = "language";
$CheckClass = "EmailChecks";
//echo $envar."
\n";
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$objListToolBar = new clsToolBar();
$objListToolBar->Set("section",$section);
$objListToolBar->Set("load_menu_func","");
$objListToolBar->Set("CheckClass","EmailChecks");
$objListToolBar->Set("CheckClass",$CheckClass);
$objListToolBar->Set("CheckForm",$ListForm);
$listImages = array();
/*
$objListToolBar->Add("email_edit", "la_ToolTip_Edit","#","if (EmailChecks.itemChecked()) swap('email_edit','toolbar/tool_edit_f2.gif');",
"if (EmailChecks.itemChecked()) swap('email_edit', 'toolbar/tool_edit.gif');",
"EmailChecks.check_submit('email_edit', '');",
"tool_edit.gif");
$listImages[] = "EmailChecks.addImage('email_edit','$imagesURL/toolbar/tool_edit.gif','$imagesURL/toolbar/tool_edit_f3.gif',1); ";
*/
$EditVar = "env=".BuildEnv();
$objListToolBar->Add("email_user", "la_ToolTip_Email_UserSelect","#","if (EmailChecks.itemChecked()) swap('email_user','toolbar/tool_usertogroup_f2.gif');",
"if (EmailChecks.itemChecked()) swap('email_user', 'toolbar/tool_usertogroup.gif');",
"OpenUserSelector('EventId',$CheckClass,'".$EditVar."&Selector=radio&destform=userpopup&destfield=FromUserId&IdField=PortalUserId&dosubmit=1');",
"tool_usertogroup.gif",TRUE,TRUE);
$listImages[] = "EmailChecks.addImage('email_user','$imagesURL/toolbar/tool_usertogroup.gif','$imagesURL/toolbar/tool_usertogroup_f3.gif',1); ";
$objListToolBar->Add("email_enable", "la_ToolTip_Email_Enable","#","if (EmailChecks.itemChecked()) swap('email_enable','toolbar/tool_approve_f2.gif');",
"if (EmailChecks.itemChecked()) swap('email_enable', 'toolbar/tool_approve.gif');",
"EmailChecks.check_submit('module_email', 'm_emailevent_enable');",
"tool_approve.gif",FALSE,TRUE);
$listImages[] = "EmailChecks.addImage('email_enable','$imagesURL/toolbar/tool_approve.gif','$imagesURL/toolbar/tool_approve_f3.gif',1); ";
$objListToolBar->Add("email_disable", "la_ToolTip_Email_Disable","#","if (EmailChecks.itemChecked()) swap('email_disable','toolbar/tool_deny_f2.gif');",
"if (EmailChecks.itemChecked()) swap('email_disable', 'toolbar/tool_deny.gif');",
"EmailChecks.check_submit('module_email', 'm_emailevent_disable');",
"tool_deny.gif",FALSE,TRUE);
$listImages[] = "EmailChecks.addImage('email_disable','$imagesURL/toolbar/tool_deny.gif','$imagesURL/toolbar/tool_deny_f3.gif',1); ";
$objListToolBar->Add("email_front", "la_ToolTip_Email_FrontOnly","#","if (EmailChecks.itemChecked()) swap('email_front','toolbar/tool_frontend_mail_f2.gif');",
"if (EmailChecks.itemChecked()) swap('email_front', 'toolbar/tool_frontend_mail.gif');",
"EmailChecks.check_submit('module_email', 'm_emailevent_frontonly');",
"tool_frontend_mail.gif",FALSE,TRUE);
$listImages[] = "EmailChecks.addImage('email_front','$imagesURL/toolbar/tool_frontend_mail.gif','$imagesURL/toolbar/tool_frontend_mail_f3.gif',1); ";
$objListToolBar->Add("divider");
$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);
$objListToolBar->AddToInitScript("fwLoadMenus();");
$objEvents = new clsEventList();
//$objEvents->SourceTable = $objSession->GetEditTable("Events");
$order = trim($objConfig->Get("Event_LV_SortField")." ".$objConfig->Get("Event_LV_SortOrder"));
$SearchWords = $objSession->GetVariable("EmailEventSearchWord");
$where = "(Module='$module')";
if(strlen($SearchWords))
$where .= ' AND '.$objEvents->AdminSearchWhereClause($SearchWords);
/* ----------------------------------------- Set the View Filter ---------------------------------------- */
$ViewNormal=1;
$Bit_Disabled=2;
$Bit_Enabled=1;
$Bit_FrontOnly=4;
$Bit_All = 7;
$FilterLabels[0] = admin_language("la_Text_Enabled");
$FilterLabels[1] = admin_language("la_Text_Disabled");
$FilterLabels[2] = admin_language("la_Text_FrontOnly");
/* determine current view menu settings */
$MsgView = $objConfig->Get("EmailEvent_View");
$ViewNormal=0;
if(!is_numeric($MsgView))
{
$MsgView = $Bit_All; //Set all bits ON
$MsgFilter = "";
}
unset($Status);
$Status = array();
if($MsgView & $Bit_Disabled)
$Status[] = 0;
if($MsgView & $Bit_Enabled)
$Status[] = 1;
if($MsgView & $Bit_FrontOnly)
$Status[] = 2;
if(count($Status)>0)
{
$MsgFilter = "Enabled IN (".implode(",",$Status).")";
}
else
$MsgFilter = "Enabled = -1";
$UserTable = GetTablePrefix()."PortalUser";
$EventTable = GetTablePrefix()."Events";
$MessageTable = GetTablePrefix()."EmailMessage";
$sql = "SELECT e.Description as Description, e.Module as Module, e.EventId as EventId, ";
$sql .="ELT(e.Enabled+1,'".admin_language("la_Text_Disabled")." ','".admin_language("la_Text_Enabled")."','".admin_language("la_Text_FrontOnly")." ') as EmailStatus, ";
$sql .="ELT(e.Type+1,'".admin_language("la_Text_User")." ','".admin_language("la_Text_Admin")." ') as EventType, ";
$sql .="u.Login as FromUser FROM $EventTable as e LEFT JOIN $UserTable as u ON (e.FromUserId=u.PortalUserId) WHERE $where ";
if(strlen($MsgFilter))
$sql .= "AND $MsgFilter ";
if(strlen(trim($objConfig->Get($SortFieldVar))))
{
$order = " ORDER BY ".$objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar);
}
else
$order = "";
if($objConfig->Get($CurrentPageVar)>0)
{
$objEvents->Page = $objConfig->Get($CurrentPageVar);
}
if($objConfig->Get($PerPageVar)>0)
{
$objListView->PerPage = $objConfig->Get($PerPageVar);
}
$sql .= $order." ";
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."
\n";
$objListView = new clsListView($objListToolBar);
$objListView->CurrentPageVar = $CurrentPageVar;
$objListView->PerPageVar = $PerPageVar;
$objListView->extra_env = '&module='.GetVar('module').'§ion='.GetVar('section');
$objEvents->Query_Item($sql, $objListView->GetLimitSQL() );
//$itemcount = TableCount($objEvents->SourceTable, $where, 0);
$itemcount = QueryCount($sql);
$objListView->SetListItems($objEvents);
$objListView->IdField = "EventId";
$order = $objConfig->Get($PerPageVar);
$objListView->ColumnHeaders->Add("Description",admin_language("la_prompt_Description"),1,0,$order,"width=\"50%\"",$SortFieldVar,$SortOrderVar,"Description");
//$objListView->ColumnHeaders->Add("Module",admin_language("la_prompt_Module"),1,0,$order,"width=\"10%\"","Email_LV_SortField","Email_LV_SortOrder","Module");
$objListView->ColumnHeaders->Add("EventType",admin_language("la_prompt_Type"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"EventType");
$objListView->ColumnHeaders->Add("EmailStatus",admin_language("la_prompt_Status"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"EmailStatus");
$objListView->ColumnHeaders->Add("FromUser",admin_language("la_prompt_FromUser"),1,0,$order,"width=\"15%\"",$SortFieldVar,$SortOrderVar,"FromUser");
$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar));
$objListView->PrintToolBar = FALSE;
$objListView->checkboxes = TRUE;
$objListView->CheckboxName = "itemlist[]";
$objListView->SearchBar = TRUE;
$objListView->SearchKeywords = $SearchWords;
$objListView->SearchAction="m_emailevent_search";
$objListView->TotalItemCount = 20; // $itemcount;
$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
$CurrentFilterVar,$MsgView,$Bit_All);
foreach($FilterLabels as $Bit=>$Label)
{
$objListView->AddViewMenuFilter($Label,$Bit);
}
for($i=0;$iItems);$i++)
{
$e =& $objEvents->GetItemRefByIndex($i);
$e->Set("Description",prompt_language($e->Get("Description")));
}
$filter = false; // always initialize variables before use
if($objSession->GetVariable("EmailEventSearchWord") != '') {
$filter = true;
}
else {
if ($MsgView != $Bit_All) {
$filter = true;
}
}
$h = "\n\n\n";
if( !isset($title) ) $title = '';
int_header($objListToolBar,NULL, $title,NULL,$h);
if ($filter) { ?>