ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

json_view.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 json_view_1_0_0{
27
38 var $Output = false;
39
50 var $Security = false;
51 var $Settings = false;
52 var $Utilities = false;
53
64 function __construct()
65 {
66 try
67 {
68 $this->Security = get_package( 'security' , 'last' , __FILE__ );
69 $this->Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
70 $this->Utilities = get_package_object( 'utilities' , 'last' , __FILE__ );
71 }
72 catch( Exception $e )
73 {
74 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
75 }
76 }
77
104 private function fetch_records( $Provider , $FunctionName )
105 {
106 try
107 {
108 return(
109 call_user_func(
110 array( $Provider , $FunctionName ) ,
111 $this->Security->get_gp( 'start' , 'integer' , false ) ,
112 $this->Security->get_gp( 'limit' , 'integer' , 21 ) ,
113 $this->Security->get_gp( 'field' , 'command' , false ) ,
114 $this->Security->get_gp( 'order' , 'command' , false )
115 )
116 );
117 }
118 catch( Exception $e )
119 {
120 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
121 }
122 }
123
142 function fetch_data( $Options )
143 {
144 try
145 {
146 $FileName = $this->Security->get_gp( 'data' , 'command' , false );
147
148 if( $FileName === false )
149 {
150 return;
151 }
152
153 $this->Settings->load_file( dirname( __FILE__ )."/conf/cf_$FileName" );
154
155 $Provider = $this->Utilities->get_package( $this->Settings , __FILE__ , 'access_' );
156
157 $FunctionName = $this->Settings->get_setting( 'select_func' , 'select' );
158
159 $Records = $this->fetch_records( $Provider , $FunctionName );
160
161 $JSON = get_package( 'json' , 'last' , __FILE__ );
162
163 $this->Output = $JSON->encode( $Records );
164 }
165 catch( Exception $e )
166 {
167 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
168 }
169 }
170
193 function view( $Options )
194 {
195 try
196 {
197 $this->fetch_data( $Options );
198
199 return( $this->Output );
200 }
201 catch( Exception $e )
202 {
203 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
204 }
205 }
206 }
207
208 ?>