Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  proposed extension for replacing submit buttons with images

phpMyEdit Features     proposed extension for replacing submit buttons with images
Post new topic   Reply to topic    
 
seldon     Joined: 22 Oct 2008   Posts: 1  
Post Posted: 2008-10-22 09:54
Back to top  Reply with quote     

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:

Code:
<?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;
        } /* }}} */


}

?>


 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy