Name = 'Search'; $this->Version = '1.0'; $this->Creator = 'Chronos'; $this->License = 'GNU/GPL'; $this->Description = 'Allow test search in other modules content.'; $this->Dependencies = array(); $this->SearchItems = array(); } function DoStart(): void { $this->System->RegisterPage(['search'], 'PageSearch'); Core::Cast($this->System)->RegisterPageBarItem('Left', 'Search', array($this, 'ShowSearchBox')); } function RegisterSearch($Name, $Title, $Columns, $Query, $Link) { // Query can be table name or subselect query $this->SearchItems[$Name] = array('Name' => $Title, 'Columns' => $Columns, 'Query' => $Query, 'Link' => $Link); } function UnregisterSearch($Name) { unset($this->SearchItems[$Name]); } function ShowSearchBox() { $Output = ''.T('Search').':'. '
'; return $Output; } } class PageSearch extends Page { function Show(): string { $this->Title = T('Search'); if (array_key_exists('text', $_GET)) $Search = $_GET['text']; else if (array_key_exists('text', $_POST)) $Search = $_POST['text']; else $Search = ''; $SearchHTML = urlencode($Search); $Output = ''.T('Section').' | '.T('Found count').' |
---|---|
'.$SearchItem['Name'].' | '.$Line.' |