69 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
70 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
71 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
72 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
102 private function get_templates( &$Options )
106 $DirPath = dirname( __FILE__ ).
"/res/templates/";
108 $FileName = $Options->get_setting(
'header' ,
'top_header' );
109 $Header = $this->CachedMultyFS->file_get_contents(
"$DirPath$FileName.tpl" );
111 $FileName = $Options->get_setting(
'item' ,
'top_item' );
112 $Item = $this->CachedMultyFS->file_get_contents(
"$DirPath$FileName.tpl" );
114 $FileName = $Options->get_setting(
'footer' ,
'top_footer' );
115 $Footer = $this->CachedMultyFS->file_get_contents(
"$DirPath$FileName.tpl" );
117 return( array( $Header , $Item , $Footer ) );
119 catch( Exception $e )
147 private function compile_records( &$Options , $Item )
151 $Query = $Options->get_setting(
'query' );
152 $Records = $this->Database->query( $Query );
153 $Records = $this->Database->fetch_results( $Records );
154 foreach( $Records as $i => $Record )
156 set_field( $Record ,
'row_number' , $i + 1 );
157 $this->Output .= $this->String->print_record( $Item , $Record );
160 catch( Exception $e )
191 $TopName = $this->Security->get_gp(
192 'top_name' ,
'command' , $Options->get_setting(
'top_name' ,
false )
194 if( $TopName ===
false )
199 $Options->append_file( dirname( __FILE__ ).
"/conf/cf_$TopName" );
201 $Title = $Options->get_setting(
'title' ,
false );
202 list( $Header , $Item , $Footer ) = $this->get_templates( $Options );
204 $this->compile_records( $Options , $Item );
206 $this->Output = $Header.$this->Output.$Footer;
207 if( $Title !==
false )
209 $this->Output =
"<h3>{lang:$Title}</h3>".$this->Output;
212 catch( Exception $e )
244 $ContextSet =
get_package(
'gui::context_set' ,
'last' , __FILE__ );
246 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_top' );
248 if( $ContextSet->execute( $Options , $this , __FILE__ ) )
250 return( $this->Output );
253 catch( Exception $e )