57 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
58 $this->DatabaseAlgorithms =
get_package(
'database::database_algorithms' ,
'last' , __FILE__ );
59 $this->LinkUtilities =
get_package(
'link::link_utilities' ,
'last' , __FILE__ );
60 $this->RatingAccess =
get_package(
'rating::rating_access' ,
'last' , __FILE__ );
94 $Rating = $this->LinkUtilities->get_dependent_objects(
95 $MasterId , $MasterType , $this->RatingAccess
134 list( $MasterId , $MasterType ) = $this->LinkUtilities->trasform_master_parameters(
135 $MasterId , $MasterType
138 if( $this->LinkUtilities->dependent_objects_exist( $MasterId , $MasterType ,
'rating' ) )
140 $Records = $this->LinkUtilities->get_dependent_objects(
141 $MasterId , $MasterType ,
'rating' , $this->RatingAccess
146 $id = $this->RatingAccess->create(
147 array(
'master_id' => $MasterId ,
'master_type' => $MasterType )
149 $Records = $this->RatingAccess->select_list( $id );
152 return( $Records[ 0 ] );
154 catch( Exception $e )
186 function get_rating( $MasterId =
false , $MasterType =
'user' )
192 return(
get_field( $Record ,
'value' ) );
194 catch( Exception $e )
226 function set_rating( $Value , $MasterId =
false , $MasterType =
'user' )
230 $Value = $this->Security->get( $Value ,
'float' );
235 $this->RatingAcces->update(
get_field( $Rating ,
'id' ) , array(
'value' => $Value ) );
237 catch( Exception $e )
273 $this->Database->lock( array(
'umx_rating' ) , array(
'WRITE' ) );
275 $Delta = $this->Security->get( $Delta ,
'float' );
282 $this->RatingAcces->update(
get_field( $Rating ,
'id' ) , array(
'value' => $Value + $Delta ) );
284 $this->Database->unlock();
286 catch( Exception $e )