ExtendedLabel.php 2.48 KB
<?php
/**
 * @package  anc_album
 * @category magento
 * @mailto	code [at] netz.coop
 * @author	netz.coop eG* 
 * @copyright (c) 2014, netz.coop eG
 * 
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */ 

/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * Diese Klasse Existiert in Mehreren Extensions von uns und Muss im Zweifel leider in allen geändert werden!
 * 
 * Dies geschah aus Faulheit und unwissenheit wie auf die Lib eioner anderen Extension zugegriffen werden kann!
 * 
 * !!!!
 */

class Anc_Album_Lib_Varien_Data_Form_Element_ExtendedLabel extends Varien_Data_Form_Element_Abstract
{
    public function __construct($attributes=array())
    {
        parent::__construct($attributes);
        $this->setType('label');
    }

    public function getElementHtml()
    {
		
		
		//'<button type="button" value="Open Window" onclick="window.open(\'' . $varurlimages . '\')">Bilder des Albums verwalten</button>';
//
        
		$var_url= $this->getEscapedValue();
		$var_label= $this->getLabel();
		$var_getNctype = $this->getNctype();
//		D::s($var_name,'$var_name',5,1,1);
		if($var_getNctype=='button'){
			$html = '<button  title="'.$var_label.'" onclick="window.open(\''.$var_url . '\')"><span>'.$var_label.'</span></button>';
		}else if($var_getNctype=='text'){
			$html = ''.$var_label.'';
		}else{
			$html = '<button  title="'.$var_label.'" onclick="window.open(\''.$var_url . '\')"><span>'.$var_label.'</span></button>';
		}
		
        $html.= $this->getAfterElementHtml();
        return $html;
    }

    public function getLabelHtml($idSuffix = ''){
        if (!is_null($this->getLabel())) {
            $html = '<label for="'.$this->getHtmlId() . $idSuffix . '" style="'.$this->getLabelStyle().'">'.$this->getMylabel()
                . ( $this->getRequired() ? ' <span class="required">*</span>' : '' ).'</label>'."\n";
        }
        else {
            $html = '';
        }
        return $html;
    }
}