Development

Changeset 18417

You must first sign up to be able to contribute.

Changeset 18417

Show
Ignore:
Timestamp:
05/18/09 21:55:15 (4 years ago)
Author:
Mickael.Kurmann
Message:

ignore netbeans project files, readme update, start of rattable template and plugin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfDoctrineActAsRattablePlugin/trunk

    • Property svn:ignore set to
      nbproject
  • plugins/sfDoctrineActAsRattablePlugin/trunk/README

    r18390 r18417  
    1 {{{ 
    2 #!WikiMarkdown 
    3  
    41# sfDoctrineActAsRattablePlugin # 
    52 
     
    129 
    1310### Features ### 
    14  * add remove ratings 
     11 
     12 * add/remove ratings 
    1513 * manage multiple ratings 
    1614 * get average rating 
    17  * get user rating (base on the object they are associated to) 
    18   
     15 * get commented ratings 
     16 * be notified when an object is rated 
    1917  
    2018### How it works ### 
    2119 
    22 Giving Rattable behavior to an object do quite the same as [Doctrine I18n](http://www.doctrine-project.org/documentation/manual/1_1/en/behaviors#core-behaviors:i18n) 
     20Giving Rattable behavior to an object the same as [Doctrine I18n](http://www.doctrine-project.org/documentation/manual/1_1/en/behaviors#core-behaviors:i18n) 
    2321 
    2422It create an object_rate table with how many column as criterias OR default one : rate 
     23 
     24Example : 
     25 
     26    hotel_room: 
     27      actAs:  
     28        Rattable: 
     29          criterias: [clean_state, receptionist, equipment] 
     30          max_rate: 5 
     31          rounding_rate: 1 
     32           
     33Will create 2 tables: 
     34 
     35     1 hotel_room 
     36     1 hotel_room_rate, with columns: 
     37         clean_state 
     38         reception 
     39         equipment 
     40         comment 
     41         user_id # foreignKey to sfGuardUser if exists 
    2542 
    2643## Installation ## 
     
    3249         
    3350        ./symfony plugin-install http://svn.symfony-project.com/plugins/sfDoctrineActAsRattblePlugin/branches/1.2 
    34   
    35  * edit your schema.yml and add  
    36   
    37         actAs: [Rattable] to model you want to be rattable 
    38   
    39  * rebuild the model:  
    40   
    41         ./symfony doctrine-build-all 
    42   
    43  * clear cache: 
    44   
    45         ./symfony cc 
    4651 
    4752### SVN way ### 
    4853 
    49  * go to your plugin directory: 
     54 * from the terminal, go to your plugin directory: 
     55 * enter 
     56  
     57        svn pe svn:externals . 
     58  
     59 * write add a line 
     60  
     61        sfDoctrineActAsRattblePlugin http://svn.symfony-project.com/plugins/sfDoctrineActAsRattblePlugin/branches/1.2 
     62  
     63 * close the editor 
     64 * do a ``svn update`` an that's all 
    5065 
    5166## Configuration ## 
    5267 
    53     my_object: 
    54       actAs: 
    55         Rattable: 
    56           criterias: [clean_state, receptionist, equipment] # optional, only if you wanna rate specifics parts 
    57           max_rate: 5 # 2,10 etc. any integer number you want (more than 100 is a bad idea, work with rounding) 
    58           rounding_rate: 1 # default is 1, but you cant set 0.1, 0.2 etc. 
     68 * configure your object : 
     69 
     70        my_object: 
     71          actAs: 
     72            Rattable: 
     73              criterias:     rate # or [clean_state, receptionist, equipment] only if you wanna rate specifics parts 
     74              max_rate:      5    # 2,10 etc. any integer number you want (more than 20 is a bad idea, work with rounding instead) 
     75              rounding_rate: 1    # or 0.1, 0.2 etc. 
     76              with_comment:  true # false 
     77 
     78 * rebuild the model:  
     79 
     80        ./symfony doctrine-build-all 
     81 
     82 * clear cache: 
     83 
     84        ./symfony cc 
    5985 
    6086## API ## 
     87 
    6188The plugin implements the following methods to the object: 
    6289 
    63  *  
     90 * getRatingsDetails() 
     91 * getAvgRatings() 
     92 * addRate(RategObject $rateObject) 
     93 * removeRatings() 
     94 
     95## Events notifications types ## 
     96 
     97 * rate.add     notify 
     98 * rate.remove  notify 
    6499 
    65100## Helpers ## 
     
    68103 
    69104## Todo ## 
    70  * add comment to rates 
     105 * notification management 
     106 * give examples 
     107 * create helpers 
     108 * create components to show ratings 
     109 * add icons possibility for ratings types 
    71110 
    72111## Unit testing ## 
    73 The plugin has been unit-tested, if not fully. The tests are located in http://svn.symfony-project.com/plugins/sfDoctrineActAsRattablePlugin/branches/developpment_env/test/unit/sfDoctrineActAsRattableTest.php
     112The plugin has been unit-tested, perhaps not fully (I'm a newbie in unit tests). The tests are located in [developpment branch](http://svn.symfony-project.com/plugins/sfDoctrineActAsRattablePlugin/branches/developpment_env/test/unit/sfDoctrineActAsRattableTest.php)
    74113 
    75114## Side notes ## 
     
    78117## License and credits ## 
    79118This plugin has been created by [Mickael Kurmann](http://www.vieuxsteak.ch/) and is licensed under the MIT license. 
     119 
    80120I took my inspiration from : 
    81121 
     
    83123 * [Unobtrusive AJAX Star Rating bar from Masuga](http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/) 
    84124 * [jQuery Star Rating plugin](http://www.fyneworks.com/jquery/star-rating/#tab-Overview) 
    85   
    86 }}} 
  • plugins/sfDoctrineActAsRattablePlugin/trunk/lib/RattableTemplate.class.php

    r18389 r18417  
    11<?php 
    22  
    3 class RattableListener extends Doctrine_Record_Listener 
    4 { 
    5 } 
    6  
    73class Rattable extends Doctrine_Template 
    84{ 
     5    /** 
     6     * __construct 
     7     * 
     8     * @param string $array  
     9     * @return void 
     10     */ 
     11    public function __construct(array $options = array()) 
     12    { 
     13      parent::__construct($options); 
     14        $this->_plugin = new Doctrine_Rattable($this->_options); 
     15    } 
     16 
     17    /** 
     18     * Initialize the Rattable plugin for the template 
     19     * 
     20     * @return void 
     21     */ 
     22    public function setUp() 
     23    { 
     24        $this->_plugin->initialize($this->_table);  
     25    } 
     26 
     27    /** 
     28     * Get the plugin instance for the Rattable template 
     29     * 
     30     * @return void 
     31     */ 
     32    public function getRattable() 
     33    { 
     34        return $this->_plugin; 
     35    } 
    936}