setIcon("EyeOpen.svg"); $ViewSearchResultsButton->setSize(HtmlButton::SIZE_SMALL); $ViewSearchResultsButton->setLink("index.php?P=SearchResults&" . $Item->SearchParameters()->UrlParameterString()); $ViewSearchResultsButton->makeOpenNewTab(); return "

" . $Item->SearchParameters()->TextDescription() . "
" . $ViewSearchResultsButton->getHtml() . "

"; case "Enabled": return $Item->Enabled() ? "Yes" : "No"; case "Frequency": $Frequencies = [ 60 => "Hourly", 240 => "Every 4 Hours", 480 => "Every 8 Hours", 1440 => "Daily", 10080 => "Weekly", 0 => "Continuously", ]; if (isset($Frequencies[$Item->CheckFrequency()])) { return $Frequencies[$Item->CheckFrequency()]; } else { return $Item->CheckFrequency()." minutes"; } default: throw new Exception("Unexpected column in list (\"".$FieldId."\")."); } } # ----- SETUP ---------------------------------------------------------------- # verify that required incoming variables are set if (!isset($H_ListChecksum)) { throw new Exception("Variable \$H_ListChecksum not set."); } if (!isset($H_ItemsPerPage)) { throw new Exception("Variable \$H_ItemsPerPage not set."); } if (!isset($H_ItemCount)) { throw new Exception("Variable \$H_ItemCount not set."); } if (!isset($H_Items)) { throw new Exception("Variable \$H_Items not set."); } if (!isset($H_StartingIndex)) { throw new Exception("Variable \$H_StartingIndex not set."); } $AF = ApplicationFramework::getInstance(); $AF->setPageTitle("Rule List"); # set up links $BaseLink = "index.php?P=P_Rules_ListRules&CK=".$H_ListChecksum; $AddRuleLink = "index.php?P=P_Rules_EditRule&ID=NEW"; $RuleDisplayLink = "index.php?P=P_Rules_DisplayRule&ID=\$ID"; $RuleEditLink = "index.php?P=P_Rules_EditRule&ID=\$ID"; $RuleDeleteLink = "index.php?P=P_Rules_DeleteRule&ID=\$ID"; # set up fields to display $Fields = [ "Name" => [ "MaxLength" => 40, "DefaultSortField" => true, ], "Criteria" => [ "ValueFunction" => "Metavus\\getRuleAttribute", "AllowHTML" => true, ], "Frequency" => ["ValueFunction" => "Metavus\\getRuleAttribute"], "Enabled" => ["ValueFunction" => "Metavus\\getRuleAttribute"], ]; # create and configure list UI $ListUI = new ItemListUI($Fields); $ListUI->heading("Rule List"); $ListUI->itemsPerPage($H_ItemsPerPage); $ListUI->baseLink($BaseLink); $ListUI->addTopButton("Add New Rule", $AddRuleLink, "Plus.svg"); $ListUI->addActionButton("Edit", $RuleEditLink, "Pencil.svg"); $ListUI->addActionButton("Delete", $RuleDeleteLink, "Delete.svg"); # ----- DISPLAY -------------------------------------------------------------- $ListUI->display($H_Items, $H_ItemCount, $H_StartingIndex);