<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/** @var $this Mage_Adminhtml_Block_Page_Header */
?>
<div class="header-top">
    <a href="<?php echo $this->getHomeLink() ?>"><img src="<?php echo $this->getSkinUrl('images/logo.png') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Magento Logo')) ?>" class="logo"/></a>
    <div class="header-right">
        <p class="super">
            <?php echo $this->__("Logged in as %s", $this->escapeHtml($this->getUser()->getUsername())) ?><span class="separator">|</span><?php echo $this->formatDate(null, 'full') ?><span class="separator">|</span><a href="<?php echo $this->getLogoutLink() ?>" class="link-logout"><?php echo $this->__('Log Out') ?></a>
        </p>
        <?php if (Mage::getStoreConfigFlag('admin/global_search/enable') && Mage::getSingleton('admin/session')->isAllowed('admin/global_search')): ?>
        <fieldset>
            <legend>Search</legend>
            <span id="global_search_indicator" class="autocomplete-indicator" style="display: none">
                <img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Loading...')) ?>" class="v-middle"/>
            </span>
            <?php $defSearch = $this->__('Global Record Search') ?>
            <input id="global_search" name="query" type="text" class="input-text" value="<?php if(!empty($query)): ?><?php echo $query ?><?php else: ?><?php echo Mage::helper('core')->quoteEscape($defSearch) ?><?php endif ?>" onfocus="if(this.value=='<?php echo Mage::helper('core')->quoteEscape($defSearch, true) ?>')this.value=''; " onblur="if(this.value=='')this.value='<?php echo $defSearch ?>';" />
            <div id="global_search_autocomplete" class="autocomplete"></div>
            <script type="text/javascript">
                new Ajax.Autocompleter(
                    'global_search',
                    'global_search_autocomplete',
                    '<?php echo $this->getUrl('adminhtml/index/globalSearch') ?>',
                    {
                        paramName:"query",
                        minChars:2,
                        indicator:"global_search_indicator",
                        updateElement:getSelectionId,
                        evalJSON:'force'
                    }
                );
                function getSelectionId(li) {
                    location.href = li.getAttribute('url');
                }
            </script>
        </fieldset>
        <?php endif ?>
    </div>
</div>
