ultimix
category_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 update_category_title( $Options )
47  {
48  try
49  {
50  $Security = get_package( 'security' , 'last' , __FILE__ );
51  $CategoryAlgorithms = get_package( 'category::category_algorithms' , 'last' , __FILE__ );
52  $CategoryAlgorithms->update_category_title(
53  $Security->get_p( 'category_id' , 'integer' , 0 ) , $Security->get_p( 'title' , 'string' , '' )
54  );
55  }
56  catch( Exception $e )
57  {
58  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
59  }
60  }
61 
80  function category_list( $Options )
81  {
82  try
83  {
84  $Link = get_package( 'link' , 'last' , __FILE__ );
85  $MasterId = $Options->get_setting( 'master_id' );
86  $MasterType = $Options->get_setting( 'master_type' );
87  $Link->delete_link( $MasterId , false , $MasterType , 'category' );
88 
89  $SecurityUtilities = get_package( 'security::security_utilities' , 'last' , __FILE__ );
90  $Ids = $SesurityUtilities->get_global( '_id_' , 'integer' , CHECKBOX_IDS );
91 
92  $Link->create_link( $MasterId , $Ids , $MasterType , 'category' , true );
93  }
94  catch( Exception $e )
95  {
96  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
97  }
98  }
99 
118  function on_before_delete_category( $Parameters )
119  {
120  try
121  {
122  /* allways called for the single category */
123  $cid = get_field( $Parameters , 'id' );
124 
125  $CategoryAccess = get_package( 'category::category_access' , 'last' , __FILE__ );
126 
127  $Categories = $CategoryAccess->select_list( $cid );
128 
129  $CategoryAccess->move_up_children_categories( $cid , get_field( $Categories[ 0 ] , 'root_id' ) );
130  }
131  catch( Exception $e )
132  {
133  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
134  }
135  }
136 
155  function controller( $Options )
156  {
157  try
158  {
159  $ContextSet = get_package( 'gui::context_set' , 'last' , __FILE__ );
160 
161  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_update_category_title' );
162 
163  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_category_list' );
164 
165  $ContextSet->execute( $Options , $this , __FILE__ );
166  }
167  catch( Exception $e )
168  {
169  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
170  }
171  }
172  }
173 ?>