ezstarrating: creating contentobject with ezstarrating attribute via PHP

Author Message

Benjamin Kroll

Wednesday 22 December 2010 11:05:29 am

Hi everyone,
I'm curious to find out if someone has created a contentobject with an ezstarrating attribute from PHP before. I've been looking through the forums as well as the ezstarrating extension classes for a little bit now, but wanted to make sure I'm not reinventing the wheel here.
I'm going the usual route of:
- create object (return new object)
- update via $data_map[ $key ]->fromString( $value );
- store via $data_map[ $key ]->store();
- execute content publish
I've tried simply passing in an integer of the star rating (0-5) as well as a few other combinations, but so far, no dice.
If anyone has done this before or has a hunch as to what kind of format in need to pass this in with I'd much appreciate a quick reply.
Thanks,
Ben

Carlos Revillo

Wednesday 22 December 2010 1:08:17 pm

Thing here is ezstarrating datatype has no fromString method yet. can be a enchancement...

Benjamin Kroll

Wednesday 22 December 2010 2:59:16 pm

Thanks for the reply Carlos I didn't see that (obviously didn't look very closely either). Are you aware of any plans for this to be added to the extension in the future?

Marco Rogers

Wednesday 22 December 2010 6:22:38 pm

Benjamin, check out the rating is saved in the ajax function when you click the stars. You can use this method.

https://github.com/ezsystems/ezstarrating/blob/master/packages/ezstarrating_extension/ezextension/ezstarrating/classes/ezsrserverfunctions.php#L75

Benjamin Kroll

Thursday 23 December 2010 12:30:28 pm

I was thinking of using that but was hoping to be able to do it the ez standard way.
Should be the same outcome so that's fine.
Appreciate the feedback.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:04:17
Script start
Timing: Jan 18 2025 02:04:17
Module start 'layout'
Timing: Jan 18 2025 02:04:17
Module start 'content'
Timing: Jan 18 2025 02:04:18
Module end 'content'
Timing: Jan 18 2025 02:04:18
Script end

Main resources:

Total runtime0.6488 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 589.5078152.6875
Module start 'layout' 0.00530.0031 742.195339.5313
Module start 'content' 0.00840.6390 781.7266522.9766
Module end 'content' 0.64740.0014 1,304.703112.0625
Script end 0.6487  1,316.7656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.4517160.0002
Check MTime0.00130.2024160.0001
Mysql Total
Database connection0.00060.099410.0006
Mysqli_queries0.600692.5714650.0092
Looping result0.00070.1061630.0000
Template Total0.614994.820.3074
Template load0.00210.329520.0011
Template processing0.612794.439220.3064
Template load and register function0.00010.022310.0001
states
state_id_array0.00080.125310.0008
state_identifier_array0.00130.207320.0007
Override
Cache load0.00180.2746250.0001
Sytem overhead
Fetch class attribute can translate value0.00110.170330.0004
Fetch class attribute name0.00160.251150.0003
XML
Image XML parsing0.00070.106830.0002
class_abstraction
Instantiating content class attribute0.00000.002750.0000
General
dbfile0.00170.2634100.0002
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs