Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • NButton
  • NCheckbox
  • NFormControl
  • NHiddenField
  • NImageButton
  • NMultiSelectBox
  • NRadioList
  • NSelectBox
  • NSubmitButton
  • NTextArea
  • NTextBase
  • NTextInput
  • NUploadControl
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  * @package Nette\Forms\Controls
11:  */
12: 
13: 
14: 
15: /**
16:  * Submittable image button form control.
17:  *
18:  * @author     David Grudl
19:  * @package Nette\Forms\Controls
20:  */
21: class NImageButton extends NSubmitButton
22: {
23: 
24:     /**
25:      * @param  string  URI of the image
26:      * @param  string  alternate text for the image
27:      */
28:     public function __construct($src = NULL, $alt = NULL)
29:     {
30:         parent::__construct();
31:         $this->control->type = 'image';
32:         $this->control->src = $src;
33:         $this->control->alt = $alt;
34:     }
35: 
36: 
37: 
38:     /**
39:      * Returns HTML name of control.
40:      * @return string
41:      */
42:     public function getHtmlName()
43:     {
44:         $name = parent::getHtmlName();
45:         return strpos($name, '[') === FALSE ? $name : $name . '[]';
46:     }
47: 
48: 
49: 
50:     /**
51:      * Loads HTTP data.
52:      * @return void
53:      */
54:     public function loadHttpData()
55:     {
56:         $path = $this->getHtmlName(); // img_x or img['x']
57:         $path = explode('[', strtr(str_replace(']', '', strpos($path, '[') === FALSE ? $path . '.x' : substr($path, 0, -2)), '.', '_'));
58:         $this->setValue(NArrays::get($this->getForm()->getHttpData(), $path, NULL) !== NULL);
59:     }
60: 
61: }
62: 
Nette Framework 2.0.1 (for PHP 5.2, prefixed) API API documentation generated by ApiGen 2.7.0