Contao\BackendSwitch::getDatalistOptions PHP Метод

getDatalistOptions() защищенный Метод

Find ten matching usernames and return them as JSON
protected getDatalistOptions ( )
    protected function getDatalistOptions()
    {
        if (!$this->User->isAdmin) {
            header('HTTP/1.1 400 Bad Request');
            die('You must be an administrator to use the script');
        }
        $arrUsers = array();
        $time = \Date::floorToMinute();
        // Get the active front end users
        $objUsers = $this->Database->prepare("SELECT username FROM tl_member WHERE username LIKE ? AND login='1' AND disable!='1' AND (start='' OR start<='{$time}') AND (stop='' OR stop>'" . ($time + 60) . "') ORDER BY username")->limit(10)->execute(str_replace('%', '', \Input::post('value')) . '%');
        if ($objUsers->numRows) {
            $arrUsers = $objUsers->fetchEach('username');
        }
        header('Content-type: application/json');
        die(json_encode($arrUsers));
    }