<commit_before><?php
/**
* @version      $Id$
* @category		Koowa
* @package		Koowa_Toolbar
* @subpackage	Button
* @copyright    Copyright (C) 2007 - 2010 <NAME>. All rights reserved.
* @license      GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
*/

/**
 * Export to CSV button for a toolbar
 * 
 * @author      <NAME> <<EMAIL>>
 * @category    Koowa
 * @package     Koowa_Toolbar
 * @subpackage  Button
 */
class ComDefaultToolbarButtonCsv extends KToolbarButtonGet
{
 	/**
     * Initializes the config for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param   object  An optional KConfig object with configuration options
     * @return  void
     */
    protected function _initialize(KConfig $config)
    {
        $config->append(array(
            'icon' => 'icon-32-export'
        ));
        
        parent::_initialize($config);
    }
    
    public function getLink()
    {
        // Unset limit and offset
        $url = clone KRequest::url();
        $query = parse_str($url->getQuery(), $vars);
        
        unset($vars['limit']);
        unset($vars['offset']);
        
        $vars['format'] = 'csv';
        $url->setQuery(http_build_query($vars));
        
        return (string) $url;
    }
}<commit_msg>re #99 : Set the href attribute through the initialize function.<commit_after><?php
/**
* @version      $Id$
* @category		Koowa
* @package		Koowa_Toolbar
* @subpackage	Button
* @copyright    Copyright (C) 2007 - 2010 <NAME>. All rights reserved.
* @license      GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
*/

/**
 * Export to CSV button for a toolbar
 * 
 * @author      <NAME> <<EMAIL>>
 * @category    Koowa
 * @package     Koowa_Toolbar
 * @subpackage  Button
 */
class ComDefaultToolbarButtonCsv extends KToolbarButtonGet
{
 	/**
     * Initializes the config for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param   object  An optional KConfig object with configuration options
     * @return  void
     */
    protected function _initialize(KConfig $config)
    {
        $config->append(array(
            'attribs' => array(
                'href' => $this->getLink()
            )
        ));
        
        parent::_initialize($config);
    }
    
    public function getLink()
    {
        // Unset limit and offset
        $url = clone KRequest::url();
        $query = parse_str($url->getQuery(), $vars);
        
        unset($vars['limit']);
        unset($vars['offset']);
        
        $vars['format'] = 'csv';
        $url->setQuery(http_build_query($vars));
        
        return (string) $url;
    }
}
{'fraction_non_alphanumeric': 0.13131685724824788, 'fraction_numerical': 0.008115086683880487, 'mean_word_length': 2.2018890200708383, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6889301', 'n_tokens_mistral': 829, 'n_tokens_neox': 808, 'n_words': 209}