<?php

defined('_JEXEC') or die('Restricted access');


class plgButtonAllArticleAnnounce_Button extends JPlugin {

    /**
     * Constructor
     *
     * For php4 compatability we must not use the __constructor as a constructor for plugins
     * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
     * This causes problems with cross-referencing necessary for the observer design pattern.
     *
     * @param   object $subject The object to observe
     * @param   array  $config  An array that holds the plugin configuration
     * @since 1.5
     */
    function plgButtonAllArticleAnnounce_Button(& $subject, $config) {
        parent::__construct($subject, $config);
    }

    /**
     * Display the button
     */
    function onDisplay($name){
        global $mainframe;

        $doc            =& JFactory::getDocument();
        $doclink_url    = JURI::root()."plugins/editors-xtd/allArticleAnnounce_Button";
        $docman_url     = JURI::root()."components/com_allarticleannounce/";
		$style = ".button2-left .AllArticleAnnounce_Button {
				background:transparent url($doclink_url/images/AllArticleAnnounce_Button.png) no-repeat scroll 100% 0pt;
				}";
        $doc->addStyleDeclaration($style);
        $button = new JObject();
        $button->set('modal', true);
        $button->set('text', JText::_('AllArticleAnnounce'));
        $button->set('name', 'AllArticleAnnounce_Button');
        $button->set('link', 'index.php?option=com_allarticleannounce&tmpl=component&task=on_switch&e_name='.$name);
        $button->set('options', "{handler: 'iframe', size: {x: 300, y: 180}}");
        return $button;
    }
}