ultimix
gallery_controller.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 
46  function attach_file( $Options )
47  {
48  try
49  {
50  $FileInputController = get_package( 'file_input::file_input_controller' , 'last' , __FILE__ );
51 
52  if( $FileInputController->UploadedFile )
53  {
54  $Security = get_package( 'security' , 'last' , __FILE__ );
55  $GalleryAlgorithms = get_package( 'gallery::gallery_algorithms' , 'last' , __FILE__ );
56 
57  $GalleryId = $Security->get_gp( 'gallery_id' , 'integer' );
58  $FileId = get_field( $FileInputController->UploadedFile , 'id' );
59 
60  $GalleryAlgorithms->attach_file( $GalleryId , $FileId );
61  }
62  }
63  catch( Exception $e )
64  {
65  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
66  }
67  }
68 
87  function detach_file( $Options )
88  {
89  try
90  {
91  $Security = get_package( 'security' , 'last' , __FILE__ );
92 
93  $GalleryId = $Security->get_gp( 'gallery_id' , 'integer' );
94  $FileId = $Security->get_gp( 'file_id' , 'integer' );
95 
96  $GalleryAlgorithms = get_package( 'gallery::gallery_algorithms' , 'last' , __FILE__ );
97  $GalleryAlgorithms->detach_file( $GalleryId , $FileId );
98  }
99  catch( Exception $e )
100  {
101  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
102  }
103  }
104 
123  function controller( $Options )
124  {
125  try
126  {
127  $ContextSet = get_package( 'gui::context_set' , 'last' , __FILE__ );
128 
129  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_gallery_attach_file' );
130 
131  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_gallery_detach_file' );
132 
133  $ContextSet->execute( $Options , $this , __FILE__ );
134  }
135  catch( Exception $e )
136  {
137  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
138  }
139  }
140  }
141 
142 ?>