2017 © Pedro Peláez
 

yii2-extension eg-star-rating

Yii2 star rating module

image

elephantsgroup/eg-star-rating

Yii2 star rating module

  • Friday, June 8, 2018
  • by ElephantsGroup
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 100 % Grown

The README.md

To use Elephants Group star-rating module first you must install module, then you can use star-rating widget anywhere in your website., (*1)

Installation Steps:

1) run, (*2)

php composer.phar require elephantsgroup/eg-star-rating "*", (*3)

or add "elephantsgroup/eg-star-rating": "~1" to the require section of your composer.json file., (*4)

2) migrate database, (*5)

yii migrate --migrationPath=vendor/elephantsgroup/eg-star-rating/migrations, (*6)

3) add star-rating module to common configuration (common/config.php file), (*7)

'modules' => [ ... 'star-rating' => [ 'class' => 'elephantsGroup\starRating\Module', ], ... ], (*8)

4) open access to module in common configuration, (*9)

'as access' => [ 'class' => 'mdm\admin\components\AccessControl', 'allowActions' => [ ... 'star-rating/ajax/*', ... ] ], (*10)

5) filter admin controller in frontend configuration (frontend/config.php file), (*11)

'modules' => [ ... 'star-rating' => [ 'as frontend' => 'elephantsGroup\starRating\filters\FrontendFilter', ], ... ], (*12)

5) filter ajax controller in backend configuration (backend/config.php file), (*13)

'modules' => [ ... 'star-rating' => [ 'as backend' => 'elephantsGroup\starRating\filters\BackendFilter', ], ... ], (*14)

Using star-rating widget

Anywhere in your code you can use star-rating widget as follows: <?= Rate::widget() ?>, (*15)

You need to use Rate widget header in your page: use elephantsGroup\starRating\components\Rate;, (*16)

Rate widget parameters

  • item (integer): to separate Rate between different items. <?= Rate::widget(['item' => 1]) ?> <?= Rate::widget(['item' => $model->id]) ?>

default value for item is 0 - service (integer): to separate star-rating between various item types. <?= Rate::widget(['service' => 1, 'item' => $model->id]) ?>, (*17)

for example you can use different values for different modules in your app, and then use star-rating widget separately in modules. default value for service is 0 - min_num (integer): minimum possible rate vote <?= Rate::widget(['service' => 1, ''item' => $model->id, 'min_num' => 1]) ?>, (*18)

  • max_num (integer): maximum possible rate vote <?= Rate::widget(['service' => 1, ''item' => $model->id, 'min_num' => 1, 'max_num' => 5]) ?>, (*19)

  • view_file (string): the view file path for rendering, (*20)

<?= Rate::widget([ 'service' => 1, 'item' => $model->id, 'color' => 'yellow', 'view_file' => Yii::getAlias('@frontend') . '/views/star-rating/widget.php' ]) ?>, (*21)

you can use these variables in your customized view: * service * item * min_num * max_num * rate_num, (*22)

The Versions

08/06 2018

dev-master

9999999-dev

Yii2 star rating module

  Sources   Download

MIT

The Requires

 

by Jalal Jaberi
by Arezou Zahedi Majd

extension yii2 yii elephantsgroup satr-rating

20/05 2018

1.0.0

1.0.0.0

Yii2 star rating module

  Sources   Download

MIT

The Requires

 

by Jalal Jaberi
by Arezou Zahedi Majd

extension yii2 yii elephantsgroup satr-rating