ultimix
permit_access_utilities.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 
28  var $Link = false;
29 
44  function __construct()
45  {
46  try
47  {
48  $this->Link = get_package( 'link' , 'last' , __FILE__ );
49  }
50  catch( Exception $e )
51  {
52  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
53  }
54  }
55 
82  private function toggle_permits( $Permit , $Object , $ObjectType )
83  {
84  try
85  {
86  foreach( $Object as $i => $id )
87  {
88  if( $this->Link->link_exists( $id , get_field( $Permit , 'id' ) , $ObjectType , 'permit' ) )
89  {
90  $this->Link->delete_link( $id , get_field( $Permit , 'id' ) , $ObjectType , 'permit' );
91  }
92  else
93  {
94  $this->Link->create_link( $id , get_field( $Permit , 'id' ) , $ObjectType , 'permit' , true );
95  }
96  }
97  }
98  catch( Exception $e )
99  {
100  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
101  }
102  }
103  }
104 
105 ?>