ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

date_picker.php
Go to the documentation of this file.
1 <?php
2
3 /*
4 * This source code is a part of the Ultimix Project.
5 * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6 * it's own license wich could be found from the corresponding files or sources.
7 * This source code is provided "as is" without any warranties or garanties.
8 *
9 * Have a nice day!
10 *
11 * @url http://ultimix.sorceforge.net
12 *
13 * @author Alexey "gdever" Dodonov
14 */
15
26 class date_picker_1_0_0
27 {
28
39 var $CachedMultyFS = false;
40 var $Database = false;
41 var $Security = false;
42 var $String = false;
43
54 function __construct()
55 {
56 try
57 {
58 $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
59 $this->Database = get_package( 'database' , 'last' , __FILE__ );
60 $this->Security = get_package( 'security' , 'last' , __FILE__ );
61 $this->String = get_package( 'string' , 'last' , __FILE__ );
62 }
63 catch( Exception $e )
64 {
65 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
66 }
67 }
68
99 private function set_date_picker_parameters( $Name , $Value , $SetFormat )
100 {
101 try
102 {
103 $Code = $this->CachedMultyFS->get_template( __FILE__ , 'date_picker.tpl' );
104
105 $Code = str_replace(
106 array( '{name}' , '{value}' , '{set_format}' ) , array( $Name , $Value , $SetFormat ) , $Code
107 );
108
109 return( $Code );
110 }
111 catch( Exception $e )
112 {
113 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
114 }
115 }
116
139 function compile_date_picker( &$Settings )
140 {
141 try
142 {
143 $Name = $Settings->get_setting( 'name' );
144 $Format = $Settings->get_setting( 'display_date_format' , 'Y-m-d' );
145 $SetFormat = str_replace( array( 'Y' , 'm' , 'd' ) , array( 'yy' , 'mm' , 'dd' ) , $Format );
146
147 if( $this->Security->get_gp( $Name , 'set' ) )
148 {
149 $Value = $this->Security->get_gp( $Name , 'string' );
150 }
151 else
152 {
153 $Default = date( $Format , strtotime( $Settings->get_setting( 'default' , 'now' ) ) );
154 $Value = $Settings->get_setting( 'value' , $Default );
155 }
156
157 return( $this->set_date_picker_parameters( $Name , $Value , $SetFormat ) );
158 }
159 catch( Exception $e )
160 {
161 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
162 }
163 }
164 }
165
166 ?>