Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

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