$value)
{
$path = $pathtoroot. $value."admin/include/parser.php";
if(file_exists($path))
{
include_once($path);
}
}
$action = "m_item_image";
/* -------------------------------------- Section configuration ------------------------------------------- */
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-link:validation_list';
$sec = $objSections->GetSection($section);
$title = admin_language("la_Text_Link_Validation");
$SortFieldVar = "LinksValidation_LV_Sortfield";
$SortOrderVar = "LinksValidation_LV_Sortorder";
$DefaultSortField = "ValidationTime";
$PerPageVar = "Perpage_Validation";
$CurrentPageVar = "Page_ValidationList";
$CurrentFilterVar = "LinkValidation_View";
$ListForm = "validationlistform";
$CheckClass = "LinkChecks";
/* ------------------------------------- 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();
$script_name = $objSession->HasSystemPermission("SYSTEM_ACCESS.READONLY") ? 'validation' : 'run_validation';
$objListToolBar->Add("continue_val", "la_ToolTip_ContinueValidation", $rootURL."in-link/admin/".$script_name.".php?".$envar,"swap('continue_val','toolbar/tool_validate_continue_f2.gif');",
"swap('continue_val', 'toolbar/tool_validate_continue.gif');",
"","tool_validate_continue.gif");
$objListToolBar->Add("refresh_val", "la_ToolTip_NewValidation",$rootURL."in-link/admin/".$script_name.".php?".$envar."&refresh=1","swap('refresh_val','toolbar/tool_validate_restart_f2.gif');",
"swap('refresh_val', 'toolbar/tool_validate_restart.gif');",
"","tool_validate_restart.gif");
$objListToolBar->Add("divider");
$objListToolBar->Add("check_val","la_ToolTip_ValidateSelected","#", "if ($CheckClass.itemChecked()) swap('check_val','toolbar/tool_validate_f2.gif');",
"if ($CheckClass.itemChecked()) swap('check_val', 'toolbar/tool_validate.gif');","if ($CheckClass.itemChecked()) $CheckClass.check_submit('run_validation', '');",
"tool_validate.gif",TRUE,TRUE);
$listImages[] = "$CheckClass.addImage('check_val','$imagesURL/toolbar/tool_validate.gif','$imagesURL/toolbar/tool_validate_f3.gif',1);\n";
$objListToolBar->Add("reset_val_status","la_ToolTip_ResetValidationStatus","#", "if ($CheckClass.itemChecked()) swap('reset_val_status','toolbar/tool_validate_reset_f2.gif');",
"if ($CheckClass.itemChecked()) swap('reset_val_status', 'toolbar/tool_validate_reset.gif');","if ($CheckClass.itemChecked()) $CheckClass.check_submit('validation', 'l_reset_val_status_sel');", "tool_validate_reset.gif",TRUE,TRUE);
$listImages[] = "$CheckClass.addImage('reset_val_status','$imagesURL/toolbar/tool_validate_reset.gif','$imagesURL/toolbar/tool_validate_reset_f3.gif',1);\n";
$objListToolBar->Add("app_sel_link_val","la_ToolTip_Enable","#","if ($CheckClass.itemChecked()) swap('app_sel_link_val','toolbar/tool_approve_f2.gif');",
"if ($CheckClass.itemChecked()) swap('app_sel_link_val', 'toolbar/tool_approve.gif');","if ($CheckClass.itemChecked()) $CheckClass.check_submit('validation', 'l_approve_val_link');",
"tool_approve.gif",FALSE,TRUE);
$listImages[] = "$CheckClass.addImage('app_sel_link_val','$imagesURL/toolbar/tool_approve.gif','$imagesURL/toolbar/tool_approve_f3.gif',1); ";
$objListToolBar->Add("deny_sel_link_val","la_ToolTip_Deny","#","if ($CheckClass.itemChecked()) swap('deny_sel_link_val','toolbar/tool_decline_f2.gif');",
"if ($CheckClass.itemChecked()) swap('deny_sel_link_val', 'toolbar/tool_decline.gif');","if ($CheckClass.itemChecked()) $CheckClass.check_submit('validation', 'l_deny_val_link');",
"tool_deny.gif",FALSE,TRUE);
$listImages[] = "$CheckClass.addImage('deny_sel_link_val','$imagesURL/toolbar/tool_decline.gif','$imagesURL/toolbar/tool_decline_f3.gif',1); ";
$objListToolBar->Add("del_sel_link_val","la_ToolTip_Delete","#", "if ($CheckClass.itemChecked()) swap('del_sel_link_val','toolbar/tool_delete_f2.gif');",
"if ($CheckClass.itemChecked()) swap('del_sel_link_val', 'toolbar/tool_delete.gif');","if ($CheckClass.itemChecked()) $CheckClass.check_submit('validation', 'l_delete_val_link');",
"tool_delete.gif",TRUE,FALSE);
$listImages[] = "$CheckClass.addImage('del_sel_link_val','$imagesURL/toolbar/tool_delete.gif','$imagesURL/toolbar/tool_delete_f3.gif',1);\n ";
$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);
/* ----------------------------------------- Set the View Filter ---------------------------------------- */
$Img_AllValue = 7;
$Bit_Valid=1;
$Bit_Invalid=2;
$Bit_New=4;
$FilterLabels = array();
$FilterLabels[0] = admin_language("la_Text_Valid");
$FilterLabels[1] = admin_language("la_Text_Invalid");
$FilterLabels[2] = admin_language("la_Text_Not_Validated");
$ValView = $objConfig->Get($CurrentFilterVar);
if(!is_numeric($ValView))
{
$ValView = $Img_AllValue;
$imgFilter = '';
}
else
{
if($ValView & $Bit_Valid)
$Filters[] = "val.ValidationStatus=1";
if($ValView & $Bit_Invalid)
$Filters[] = "val.ValidationStatus=2";
if($ValView & $Bit_New)
$Filters[] = "(val.ValidationStatus=0 OR val.ValidationStatus IS NULL)";
if(count($Filters))
{
$imgFilter = implode(" OR ",$Filters);
}
else
$imgFilter = "LinkValidationId = -1";
}
/* ------------------------------------ Build the SQL statement to populate the list ---------------------------*/
$sql = "SELECT (CASE WHEN (val.ValidationStatus IS NULL) THEN '".admin_language("la_Text_Not_Validated")."' ELSE ( ELT(val.ValidationStatus+1,'".admin_language("la_Text_Not_Validated")." ','".admin_language("la_Text_Valid")."', '".admin_language("la_Text_Invalid")." ')) END) as ValStatus, ";
$sql .="FROM_UNIXTIME(val.ValidationTime,'%m-%d-%Y') as ValidationTime, val.ValidationStatus as intValStatus, ";
$sql .="val.LinkValidationId as LinkValidationId, val.ValidationCode as ValidationCode, SUBSTRING(link.Name, 1, 30) as LinkName, ";
$sql .="CONCAT('', SUBSTRING(link.Url, 1, 30), '') as LinkUrl, ";
$sql .="FROM_UNIXTIME(link.CreatedOn,'%m-%d-%Y') as LinkCreatedOn, link.LinkId, link.Status ";
$sql .="FROM ".$objLinkList->SourceTable." as link LEFT JOIN ".GetTablePrefix()."LinkValidation as val ON (link.LinkId=val.LinkId)";
$order = trim($objConfig->Get($SortFieldVar)." ".$objConfig->Get($SortOrderVar));
if (strlen($imgFilter))
$sql.= " WHERE (".$imgFilter.")";
/* Search */
$objLinkList->AdminSearchFields = array('Name', 'Url', 'Description');
$SearchWords = $objSession->GetVariable("ValiLinkSearchWord");
if(strlen($SearchWords))
{
$where = $objLinkList->AdminSearchWhereClause($SearchWords);
}
else
$where = "";
if(strlen($where))
{
$sql .= strlen($imgFilter)? " AND (".$where.") ": "WHERE (".$where.")";
}
/* End Search */
if(strlen($order))
$sql .=" ORDER BY ".$order." ";
/* Page navigation */
if( (int)GetVar('lpn') )
{
$objSession->SetVariable($CurrentPageVar, (int)$_GET["lpn"]);
$page = (int)$_GET["lpn"];
}
else
{
$page = $objSession->GetVariable($CurrentPageVar);
}
$sql .= GetLimitSQL($page, (int)$objConfig->Get($PerPageVar));
//echo $sql;
$itemcount = QueryCount($sql);
$objLinkList->Query_Item($sql," ");
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."
\n";
for($i=0;$iItems);$i++)
{
$image_file = "";
$img = &$objLinkList->GetItemRefByIndex($i);
if(is_numeric($img->Get("intValStatus")))
{
switch($img->Get("intValStatus"))
{
case 0:
if ($img->Get("Status") == 0)
$image_file = "icon16_not_validated_disabled.gif";
elseif ($img->Get("Status") == 1)
$image_file = "icon16_not_validated.gif";
elseif ($img->Get("Status") == 2)
$image_file = "icon16_not_validated_pend.gif";
break;
case 1:
if ($img->Get("Status") == 0)
$image_file = "icon16_valid_disabled.gif";
elseif ($img->Get("Status") == 1)
$image_file = "icon16_valid.gif";
elseif ($img->Get("Status") == 2)
$image_file = "icon16_valid_pend.gif";
break;
case 2:
if ($img->Get("Status") == 0)
$image_file = "icon16_invalid_disabled.gif";
elseif ($img->Get("Status") == 1)
$image_file = "icon16_invalid.gif";
elseif ($img->Get("Status") == 2)
$image_file = "icon16_invalid_pend.gif";
break;
}
}
else
{
if ($img->Get("Status") == 0)
$image_file = "icon16_not_validated_disabled.gif";
elseif ($img->Get("Status") == 1)
$image_file = "icon16_not_validated.gif";
elseif ($img->Get("Status") == 2)
$image_file = "icon16_not_validated_pend.gif";
}
if (strlen($image_file))
$img->Set("Icon", $rootURL."in-link/admin/images/".$image_file);
}
/* ---------------------------------------- Configure the list view ---------------------------------------- */
$objListView = new clsListView($objListToolBar, $objLinkList);
$SortOrder=0;
if($objConfig->Get($SortOrderVar)=="asc")
$SortOrder=1;
$objListView->ColumnHeaders->Add("LinkName",language("la_ColHeader_Name"),1,0,$order,"width=\"30%\" nowrap",$SortFieldVar,$SortOrderVar,"LinkName");
$objListView->ColumnHeaders->Add("LinkUrl",language("la_ColHeader_Url"),1,0,$order,"width=\"35%\" nowrap",$SortFieldVar,$SortOrderVar,"LinkUrl");
$objListView->ColumnHeaders->Add("ValStatus",language("la_ColHeader_ValidationStatus"),1,0,$order,"width=\"15%\" nowrap",$SortFieldVar,$SortOrderVar,"ValStatus");
$objListView->ColumnHeaders->Add("ValidationTime",language("la_ColHeader_ValidationTime"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"val.ValidationTime");
$objListView->ColumnHeaders->Add("LinkCreatedOn",language("la_ColHeader_CreatedOn"),1,0,$order,"width=\"10%\"",$SortFieldVar,$SortOrderVar,"CreatedOn");
$objListView->ColumnHeaders->SetSort($objConfig->Get($SortFieldVar), $objConfig->Get($SortOrderVar));
$objListView->PrintToolBar = FALSE;
$objListView->SearchBar = TRUE;
$objListView->SearchKeywords = $SearchWords;
$objListView->SearchAction="l_vallist_search";
$objListView->CurrentPageVar = $CurrentPageVar;
$objListView->PerPageVar = $PerPageVar;
$objListView->CheckboxName = "itemlist[]";
$objListView->IdField = "LinkId";
$objListView->TotalItemCount = $itemcount;
$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
$CurrentFilterVar,$ValView,$Img_AllValue);
foreach($FilterLabels as $Bit=>$Label)
{
$objListView->AddViewMenuFilter($Label,$Bit);
}
for($i=0;$iItems);$i++)
{
$img =& $objLinkList->GetItemRefByIndex($i);
$objListView->RowIcons[] = $img->Get("Icon");
}
$objListToolBar->AddToInitScript("fwLoadMenus();\n");
$filter = false; // always initialize variables before use
if($SearchWords != '') {
$filter = true;
}
else {
if ($ValView != $Img_AllValue) {
$filter = true;
}
}
if(strlen($SearchWords))
$title = prompt_language("la_Text_Search_Results")." (".$itemcount.")";
else
$title .= " ($itemcount)";
$h = "\n\n\n";
int_header($objListToolBar,NULL, $title,NULL,$h);
if ($filter) { ?>