Overview

Namespaces

  • None
  • PHP
  • Pry
    • Auth
      • Interfaces
    • Config
    • Controller
    • Date
    • Db
    • Feed
      • Abstracts
      • Writers
    • File
      • Decorator
    • Form
      • Element
    • Image
    • Log
      • Writer
    • Net
      • Exception
    • Session
    • Util
    • Validate
      • Validator
    • View

Classes

  • AutoCompleter
  • Checkbox
  • Colorpicker
  • Date
  • DatePicker
  • Email
  • File
  • Hidden
  • Html
  • Ip
  • Mac
  • Multi
  • NumericStepper
  • Password
  • Radio
  • Select
  • Slider
  • Submit
  • Text
  • Textarea
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * Pry Framework
  5:  *
  6:  * LICENSE
  7:  *
  8:  * This source file is subject to the new BSD license that is bundled
  9:  * with this package in the file LICENSE.txt.
 10:  * 
 11:  */
 12: 
 13: namespace Pry\Form\Element;
 14: 
 15: /**
 16:  * Element DatePicker. Champs date avec selection JS de la date.
 17:  * 
 18:  * @category Pry
 19:  * @package Form
 20:  * @subpackage Form_Element
 21:  * @version 1.5.0 
 22:  * @author Olivier ROGER <oroger.fr>
 23:  */
 24: class DatePicker extends Date
 25: {
 26: 
 27:     private $icon;
 28:     private $timepicker;
 29: 
 30:     /**
 31:      * Constructeur. Par défaut pub/struct/picto/clock.png et pas de séléction de l'heure
 32:      *
 33:      * @param string $nom
 34:      * @param Form_Form $form
 35:      * @access public
 36:      */
 37:     public function __construct($nom, $form)
 38:     {
 39:         parent::__construct($nom, $form);
 40:         $this->attrs['id'] = $nom;
 41:         $this->icon        = 'pub/struct/picto/clock.png';
 42:         $this->timePicker  = false;
 43:     }
 44: 
 45:     /**
 46:      * Défini l'icone illustrant la date
 47:      *
 48:      * @param string $icon Chemin vers l'icone
 49:      * @access public
 50:      * @return Form_Element_DatePicker
 51:      */
 52:     public function icon($icon)
 53:     {
 54:         $this->icon = $icon;
 55:         return $this;
 56:     }
 57: 
 58:     public function setTimepicker($bool)
 59:     {
 60:         $this->timepicker = $bool;
 61:         return $this;
 62:     }
 63: 
 64:     /**
 65:      * Ecriture de l'objet
 66:      *
 67:      * @access public
 68:      * @return string
 69:      */
 70:     public function __toString()
 71:     {
 72: 
 73:         $field            = parent::__toString();
 74:         $timepickerOption = '';
 75:         if ($this->timepicker)
 76:             $timepickerOption = 'showTime:true,
 77:             constrainInput:true,
 78:             time24h:true';
 79: 
 80:         $this->form->javascript .= '$(function() {
 81:         $.datepicker.setDefaults($.extend({
 82:             showMonthAfterYear: false,
 83:             showOn:\'both\',
 84:             duration:\'\',
 85:             buttonImage:\'' . $this->icon . '\',
 86:             buttonImageOnly:true}';
 87:         if ($this->format == 'fr')
 88:             $this->form->javascript.=',$.datepicker.regional[\'fr\']';
 89:         $this->form->javascript.='
 90:         ));
 91:         $("#' . $this->attrs['id'] . '").datepicker({' . $timepickerOption . '});
 92:         });
 93:         ';
 94:         $error = '';
 95:         return $field;
 96:     }
 97: 
 98: }
 99: 
100: ?>
Pry API documentation generated by ApiGen 2.8.0