ultimix
change_history_markup.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 
27 
38  var $MacroParameters = false;
39  var $CachedMultyFS = false;
40  var $ChangeHistoryView = false;
41  var $PageComposer = false;
42  var $String = false;
43 
58  function __construct()
59  {
60  try
61  {
62  $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
63  $this->ChangeHistoryView = get_package(
64  'database::change_history::change_history_view' , 'last' , __FILE__
65  );
66  $this->PageComposer = get_package( 'page::page_composer' , 'last' , __FILE__ );
67  $this->String = get_package( 'string' , 'last' , __FILE__ );
68  }
69  catch( Exception $e )
70  {
71  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
72  }
73  }
74 
97  function get_button_template( &$BlockSettings )
98  {
99  try
100  {
101  switch( $BlockSettings->get_setting( 'type' , '' ) )
102  {
103  case( 'href' ):$FileName = 'href_history_button.tpl';break;
104 
105  default:$FileName = 'image_history_button_48.tpl';break;
106  }
107 
108  return( $this->CachedMultyFS->get_template( __FILE__ , $FileName ) );
109  }
110  catch( Exception $e )
111  {
112  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
113  }
114  }
115 
138  function compile_history_button( &$BlockSettings )
139  {
140  try
141  {
142  $id = $BlockSettings->get_setting( 'id' );
143  $ObjectType = $BlockSettings->get_setting( 'object_type' );
144 
145  $Code = $this->ChangeHistoryView->get_changes_grid( $id , $ObjectType );
146  $Code = $this->get_button_template( $BlockSettings ).$Code;
147 
148  $Code = str_replace( '{id}' , $id , $Code );
149 
150  return( $Code );
151  }
152  catch( Exception $e )
153  {
154  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
155  }
156  }
157  }
158 
159 ?>