PMA\libraries\SavedSearches::setUsername PHP Method

setUsername() public method

Setter for username
public setUsername ( string $username ) : static
$username string Username
return static
    public function setUsername($username)
    {
        $this->_username = $username;
        return $this;
    }

Usage Example

コード例 #1
0
ファイル: db_qbe.php プロジェクト: poush/phpmyadmin
        $savedSearch->setSearchName($_REQUEST['searchName']);
        if ('create' === $_REQUEST['action']) {
            $saveResult = $savedSearch->setId(null)->setCriterias($_REQUEST)->save();
        } elseif ('update' === $_REQUEST['action']) {
            $saveResult = $savedSearch->setCriterias($_REQUEST)->save();
        } elseif ('delete' === $_REQUEST['action']) {
            $deleteResult = $savedSearch->delete();
            //After deletion, reset search.
            $savedSearch = new SavedSearches($GLOBALS);
            $savedSearch->setUsername($GLOBALS['cfg']['Server']['user'])->setDbname($_REQUEST['db']);
            $_REQUEST = array();
        } elseif ('load' === $_REQUEST['action']) {
            if (empty($_REQUEST['searchId'])) {
                //when not loading a search, reset the object.
                $savedSearch = new SavedSearches($GLOBALS);
                $savedSearch->setUsername($GLOBALS['cfg']['Server']['user'])->setDbname($_REQUEST['db']);
                $_REQUEST = array();
            } else {
                $loadResult = $savedSearch->load();
            }
        }
        //Else, it's an "update query"
    }
    $savedSearchList = $savedSearch->getList();
    $currentSearchId = $savedSearch->getId();
}
/**
 * A query has been submitted -> (maybe) execute it
 */
$message_to_display = false;
if (isset($_REQUEST['submit_sql']) && !empty($sql_query)) {