{def $rating = $attribute.content} {'Rating: %current_rating/5'|i18n('extension/ezstarrating/datatype', '', hash( '%current_rating', concat('', $rating.rating_average|wash, '') ))} ({'%rating_count votes cast'|i18n('extension/ezstarrating/datatype', '', hash( '%rating_count', concat('', $rating.rating_count|wash, '') ))}) {if $attribute.data_int} {'disabled'|i18n('extension/ezstarrating/datatype')}.{/if}

{'Thank you for rating!'|i18n('extension/ezstarrating/datatype', 'When rating')}

{'You have already rated this page, you can only rate it once!'|i18n('extension/ezstarrating/datatype', 'When rating')}

{'Your rating has been changed, thanks for rating!'|i18n('extension/ezstarrating/datatype', 'When rating')}

{run-once} {ezcss_require( 'star_rating.css' )} {* Enable rating code if not disabled on attribute and user has access to rate! *} {if and( $attribute.data_int|not, has_access_to_limitation( 'ezjscore', 'call', hash( 'FunctionList', 'ezstarrating_rate' ) ))} {* eZStarRating supports both yui3.0 and jQuery as decided by ezjscore.ini[eZJSCore]PreferredLibrary For the JavaScript code look in: design/standard/javascript/ezstarrating_*.js (This dual approach is not something you need to do in your extensions, but currently a service done on official extensions for now!) *} {def $preferred_lib = ezini('eZJSCore', 'PreferredLibrary', 'ezjscore.ini')} {if array( 'yui3', 'jquery' )|contains( $preferred_lib )|not()} {* Prefer jQuery if something else is used globally, since it's smaller then yui3. *} {set $preferred_lib = 'jquery'} {/if} {ezscript_require( array( concat( 'ezjsc::', $preferred_lib ), concat( 'ezjsc::', $preferred_lib, 'io' ), concat( 'ezstarrating_', $preferred_lib, '.js' ) ) )} {else} {if fetch( 'user', 'current_user' ).is_logged_in}

{"You don't have access to rate this page."|i18n( 'extension/ezstarrating/datatype' )}

{else} {if ezmodule( 'user/register' )}

{'%login_link_startLog in%login_link_end or %create_link_startcreate a user account%create_link_end to rate this page.'|i18n( 'extension/ezstarrating/datatype', , hash( '%login_link_start', concat( '' ), '%login_link_end', '', '%create_link_start', concat( '' ), '%create_link_end', '' ) )}

{else}

{'%login_link_startLog in%login_link_end to rate this page.'|i18n( 'extension/ezstarrating/datatype', , hash( '%login_link_start', concat( '' ), '%login_link_end', '' ) )}

{/if} {/if} {/if} {/run-once} {undef $rating}