Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 13. október 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  proposed extension for replacing submit buttons with images

phpMyEdit Features     proposed extension for replacing submit buttons with images
Odoslať novú tému   Odpovedať na tému    
 
seldon     Založený: 22.10.2008   Príspevky: 1  
Príspevok Zaslal: 2008-10-22 09:54
Návrat hore  Odpovedať s citátom     

i wanted to replace the submit type buttons in different views with image type ones.

i know its possible to switch to graphical mode but this only replaces the 'edit,change,delete,copy' things for each row.

what i wanted was to replace the '<<,<,add,goto,...' and the like with images.

since i didn't want to fiddle around in the core class (since i'm also using the mce-cal class extension) i wrote a quick and dirty extension which is based on the mce-cal class but applies also with no problems to the base class.

here it is:

Kód:
<?php

require_once dirname(__FILE__).'/phpMyEdit-mce-cal.class.php';

class phpMyEdit_mce_cal_graphbuttons extends phpMyEdit_mce_cal
{
        /**
         * Creates HTML submit input element
         *
         * @param       name                    element name
         * @param       label                   key in the language hash used as label
         * @param       css_class_name  CSS class name
         * @param       js_validation   if add JavaScript validation subroutine to button
         * @param       disabled                if mark the button as disabled
         * @param       js              any extra text in tags
         */
        function htmlSubmit($name, $label, $css_class_name, $js_validation = true, $disabled = false, $js = NULL) /* {{{ */
        {
                $ret=parent::htmlSubmit($name, $label, $css_class_name, $js_validation, $disabled, $js);
                if (isset($ret)) {
                        $img_file=dirname(__FILE__).'/../'.$this->url['images'].'/'.$css_class_name.'.png';
                        $img_url=$this->url['images'].'/'.$css_class_name.'.png';
                        if (file_exists($img_file)) {
                                $lab=htmlspecialchars(isset($this->labels[$label]) ? $this->labels[$label] : $label);
                                $rep=' type="image" src="'.$img_url.'" title="'.$lab.'" alt="'.$lab.'" ';
                                $ret=str_replace('type="submit"',$rep,$ret);
                        }
                } else {
                        return;
                }
                return $ret;
        } /* }}} */


}

?>


 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov