Re: Star Rating Help

2009-05-28 Thread Henrique Machado
Great work!

Henrique Machado



2009/5/27 schneimi 

>
> I read about some bakery criterias the plugin doesn't match (like
> styles and tests), but you are right, I could give it a try anyway.
>
> You're welcome to use it. Btw I just put up a new version that also
> supports jQuery.
>
> Regards,
> Michael
>
> Dardo Sordi Bogado schrieb:
> > > Because I am not sure about the requirements for the bakery, I just
> > > put it on my blog:
> >
> > I couldn't see anything that can prevent your blog post from being a
> > good Bakery article, why don't just give it a try?
> >
> > > Let me know what you think about it.
> >
> > I'm testing it now, I think it could be useful for me in my current
> > project, thanks!
> >
> > Regards,
> > - Dardo.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Star Rating Help

2009-05-27 Thread schneimi

I read about some bakery criterias the plugin doesn't match (like
styles and tests), but you are right, I could give it a try anyway.

You're welcome to use it. Btw I just put up a new version that also
supports jQuery.

Regards,
Michael

Dardo Sordi Bogado schrieb:
> > Because I am not sure about the requirements for the bakery, I just
> > put it on my blog:
>
> I couldn't see anything that can prevent your blog post from being a
> good Bakery article, why don't just give it a try?
>
> > Let me know what you think about it.
>
> I'm testing it now, I think it could be useful for me in my current
> project, thanks!
>
> Regards,
> - Dardo.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Star Rating Help

2009-05-27 Thread Dardo Sordi Bogado

> Because I am not sure about the requirements for the bakery, I just
> put it on my blog:

I couldn't see anything that can prevent your blog post from being a
good Bakery article, why don't just give it a try?

> Let me know what you think about it.

I'm testing it now, I think it could be useful for me in my current
project, thanks!

Regards,
- Dardo.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Star Rating Help

2009-05-26 Thread schneimi

Hi all,

this topic brought me to create a plugin for CakePHP out of my ajax
rating system to hopefully help some bakers.

Because I am not sure about the requirements for the bakery, I just
put it on my blog:

http://schneimi.wordpress.com/2009/05/25/star-rating-plugin-for-cakephp/

Let me know what you think about it.

Greetings,

Michael

On 21 Mai, 23:31, cake_baker  wrote:
> Your are Right Henrique Machado i searched the whole google i couldnt
> find any good one.
>
> well this is the problem i'm new to cake  this is what i did to this
> code
>
> i create the database table then MVC then linked the java files and
> css what i dont know is how to the database instert /selects  ajax
> calls in cakephp  is this something you put in model or controller
> never done it before
>
> this is the link to the 
> filehttp://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rat...
> if some one wanna help me with that i think there is alot of people
> looking for star rating for cakephp .
>
> there is alot of star rating  helpers for Ruby on Rails all other
> framework but not cakephp
>
> thank you all
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Star Rating Help

2009-05-21 Thread cake_baker

Your are Right Henrique Machado i searched the whole google i couldnt
find any good one.

well this is the problem i'm new to cake  this is what i did to this
code

i create the database table then MVC then linked the java files and
css what i dont know is how to the database instert /selects  ajax
calls in cakephp  is this something you put in model or controller
never done it before

this is the link to the file 
http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/
if some one wanna help me with that i think there is alot of people
looking for star rating for cakephp .


there is alot of star rating  helpers for Ruby on Rails all other
framework but not cakephp


thank you all

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Star Rating Help

2009-05-21 Thread Henrique Machado
I never saw a decent solution to the cake when it comes to star rating

Henrique Machado



2009/5/21 Faza 

>
> I'd start with removing DB connection related settings and replace all
> querying to Cake functions - they all look like basic selects/inserts.
>
> Also you could divide whole this code into some controller functions to
> tidy it up.
>
> Or read the code, understand it, and make a helper from scratch in
> proper cake way :P
>
> cake_baker pisze:
> > hey guys i searched the whole google i coudnt find any star rating
> > helper for cakephp i found two they are oudated
> >
> > i found a star rating called ajaxstarrater_v122 its php and it stores
> > it in database and i have no idea how to implement it to cakephp if
> > some help here thank you in advance
> >
> > these are some code give u ideas
> >
> >
> > this is the databse file
> >
> >  > /*
> > Page:   _config-rating.php
> > Created:Aug 2006
> > Last Mod:   Mar 18 2007
> > Holds info for connecting to the db, and some other vars
> > -
> > ryan masuga, masugadesign.com
> > r...@masugadesign.com
> > Licensed under a Creative Commons Attribution 3.0 License.
> > http://creativecommons.org/licenses/by/3.0/
> > See readme.txt for full credit details.
> > - */
> >
> >   //Connect to  your rating database
> >   $rating_dbhost= 'localhost';
> >   $rating_dbuser= 'root';
> >   $rating_dbpass= 'root';
> >   $rating_dbname= 'rating';
> >   $rating_tableName = 'ratings';
> >   $rating_path_db   = ''; // the path to your db.php file (not
> used
> > yet!)
> >   $rating_path_rpc  = ''; // the path to your rpc.php file (not
> > used yet!)
> >
> >   $rating_unitwidth = 30; // the width (in pixels) of each rating
> > unit (star, etc.)
> >   // if you changed your graphic to be 50 pixels wide, you should
> > change the value above
> >
> > $rating_conn = mysql_connect($rating_dbhost, $rating_dbuser,
> > $rating_dbpass) or die  ('Error connecting to mysql');
> >   //mysql_select_db($rating_dbname);
> >
> > ?>
> >
> >
> >
> > this _drawrating.php
> >
> >
> >  > /*
> > Page:   _drawrating.php
> > Created:Aug 2006
> > Last Mod:   Mar 18 2007
> > The function that draws the rating bar.
> > -
> > ryan masuga, masugadesign.com
> > r...@masugadesign.com
> > Licensed under a Creative Commons Attribution 3.0 License.
> > http://creativecommons.org/licenses/by/3.0/
> > See readme.txt for full credit details.
> > - */
> > function rating_bar($id,$units='',$static='') {
> >
> > require('_config-rating.php'); // get the db connection info
> >
> > //set some variables
> > $ip = $_SERVER['REMOTE_ADDR'];
> > if (!$units) {$units = 10;}
> > if (!$static) {$static = FALSE;}
> >
> > // get votes, values, ips for the current rating bar
> > $query=mysql_query("SELECT total_votes, total_value, used_ips FROM
> > $rating_dbname.$rating_tableName WHERE id='$id' ")or die(" Error:
> > ".mysql_error());
> >
> >
> > // insert the id in the DB if it doesn't exist already
> > // see:
> http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/#comment-121
> > if (mysql_num_rows($query) == 0) {
> > $sql = "INSERT INTO $rating_dbname.$rating_tableName
> > (`id`,`total_votes`, `total_value`, `used_ips`) VALUES ('$id', '0',
> > '0', '')";
> > $result = mysql_query($sql);
> > }
> >
> > $numbers=mysql_fetch_assoc($query);
> >
> >
> > if ($numbers['total_votes'] < 1) {
> >   $count = 0;
> > } else {
> >   $count=$numbers['total_votes']; //how many votes total
> > }
> > $current_rating=$numbers['total_value']; //total number of rating
> > added together and stored
> > $tense=($count==1) ? "vote" : "votes"; //plural form votes/vote
> >
> > // determine whether the user has voted, so we know how to draw the ul/
> > li
> > $voted=mysql_num_rows(mysql_query("SELECT used_ips FROM $rating_dbname.
> > $rating_tableName WHERE used_ips LIKE '%".$ip."%' AND id='".$id."'
> > "));
> >
> > // now draw the rating bar
> > $rating_width = @number_format($current_rating/$count,2)*
> > $rating_unitwidth;
> > $rating1 = @number_format($current_rating/$count,1);
> > $rating2 = @number_format($current_rating/$count,2);
> >
> >
> > if ($static == 'static') {
> >
> >   $static_rater = array();
> >   $static_rater[] .= "\n".'';
> >   $static_rater[] .= '';
> >   $static_rater[] .= ' class="unit-rating"
> > style="width:'.$rating_unitwidth*$units.'px;">';
> >   $static_rater[] .= ' style="width:'.
> > $rating_width.'px;">Currently '.$rating2.'/'.$units.'';
> >   $static_rater[] .= '';
> >   $static_rater[] .= ''.$id.'. Rating:
>  '.
> > $rating1.'/'.$units.' ('.$count.

Re: Star Rating Help

2009-05-21 Thread Faza

I'd start with removing DB connection related settings and replace all 
querying to Cake functions - they all look like basic selects/inserts.

Also you could divide whole this code into some controller functions to 
tidy it up.

Or read the code, understand it, and make a helper from scratch in 
proper cake way :P

cake_baker pisze:
> hey guys i searched the whole google i coudnt find any star rating
> helper for cakephp i found two they are oudated
>
> i found a star rating called ajaxstarrater_v122 its php and it stores
> it in database and i have no idea how to implement it to cakephp if
> some help here thank you in advance
>
> these are some code give u ideas
>
>
> this is the databse file
>
>  /*
> Page:   _config-rating.php
> Created:Aug 2006
> Last Mod:   Mar 18 2007
> Holds info for connecting to the db, and some other vars
> -
> ryan masuga, masugadesign.com
> r...@masugadesign.com
> Licensed under a Creative Commons Attribution 3.0 License.
> http://creativecommons.org/licenses/by/3.0/
> See readme.txt for full credit details.
> - */
>
>   //Connect to  your rating database
>   $rating_dbhost= 'localhost';
>   $rating_dbuser= 'root';
>   $rating_dbpass= 'root';
>   $rating_dbname= 'rating';
>   $rating_tableName = 'ratings';
>   $rating_path_db   = ''; // the path to your db.php file (not used
> yet!)
>   $rating_path_rpc  = ''; // the path to your rpc.php file (not
> used yet!)
>
>   $rating_unitwidth = 30; // the width (in pixels) of each rating
> unit (star, etc.)
>   // if you changed your graphic to be 50 pixels wide, you should
> change the value above
>
> $rating_conn = mysql_connect($rating_dbhost, $rating_dbuser,
> $rating_dbpass) or die  ('Error connecting to mysql');
>   //mysql_select_db($rating_dbname);
>
> ?>
>
>
>
> this _drawrating.php
>
>
>  /*
> Page:   _drawrating.php
> Created:Aug 2006
> Last Mod:   Mar 18 2007
> The function that draws the rating bar.
> -
> ryan masuga, masugadesign.com
> r...@masugadesign.com
> Licensed under a Creative Commons Attribution 3.0 License.
> http://creativecommons.org/licenses/by/3.0/
> See readme.txt for full credit details.
> - */
> function rating_bar($id,$units='',$static='') {
>
> require('_config-rating.php'); // get the db connection info
>
> //set some variables
> $ip = $_SERVER['REMOTE_ADDR'];
> if (!$units) {$units = 10;}
> if (!$static) {$static = FALSE;}
>
> // get votes, values, ips for the current rating bar
> $query=mysql_query("SELECT total_votes, total_value, used_ips FROM
> $rating_dbname.$rating_tableName WHERE id='$id' ")or die(" Error:
> ".mysql_error());
>
>
> // insert the id in the DB if it doesn't exist already
> // see: 
> http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/#comment-121
> if (mysql_num_rows($query) == 0) {
> $sql = "INSERT INTO $rating_dbname.$rating_tableName
> (`id`,`total_votes`, `total_value`, `used_ips`) VALUES ('$id', '0',
> '0', '')";
> $result = mysql_query($sql);
> }
>
> $numbers=mysql_fetch_assoc($query);
>
>
> if ($numbers['total_votes'] < 1) {
>   $count = 0;
> } else {
>   $count=$numbers['total_votes']; //how many votes total
> }
> $current_rating=$numbers['total_value']; //total number of rating
> added together and stored
> $tense=($count==1) ? "vote" : "votes"; //plural form votes/vote
>
> // determine whether the user has voted, so we know how to draw the ul/
> li
> $voted=mysql_num_rows(mysql_query("SELECT used_ips FROM $rating_dbname.
> $rating_tableName WHERE used_ips LIKE '%".$ip."%' AND id='".$id."'
> "));
>
> // now draw the rating bar
> $rating_width = @number_format($current_rating/$count,2)*
> $rating_unitwidth;
> $rating1 = @number_format($current_rating/$count,1);
> $rating2 = @number_format($current_rating/$count,2);
>
>
> if ($static == 'static') {
>
>   $static_rater = array();
>   $static_rater[] .= "\n".'';
>   $static_rater[] .= '';
>   $static_rater[] .= ' style="width:'.$rating_unitwidth*$units.'px;">';
>   $static_rater[] .= 'Currently '.$rating2.'/'.$units.'';
>   $static_rater[] .= '';
>   $static_rater[] .= ''.$id.'. Rating:  
> '.
> $rating1.'/'.$units.' ('.$count.' '.$tense.' cast) This
> is \'static\'.';
>   $static_rater[] .= '';
>   $static_rater[] .= ''."\n\n";
>
>   return join("\n", $static_rater);
>
>
> } else {
>
>   $rater ='';
>   $rater.='';
>
>   $rater.='';
>   $rater.='   style="width:'.$rating_unitwidth*$units.'px;">';
>   $rater.=' Currently '.$rating2.'/'.$units.'';
>
>   for ($ncount = 1; $ncount <= $units; $ncoun