2017 © Pedro Peláez
 

yii2-extension yii2-feedback-widget

This Yii2 extension is intended to enable live feedback from users on a Yii2 web app by acting as a wrapper for the ivoviz/feedback plugin.

image

dilden/yii2-feedback-widget

This Yii2 extension is intended to enable live feedback from users on a Yii2 web app by acting as a wrapper for the ivoviz/feedback plugin.

  • Thursday, August 25, 2016
  • by Dilden
  • Repository
  • 2 Watchers
  • 2 Stars
  • 424 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

Yii2 Feedback Widget

This Yii2 extension is intended to enable live feedback from users on a Yii2 web app by acting as a wrapper for the ivoviz/feedback js plugin., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Install

Either run, (*3)

$ php composer.phar require dilden/yii2-feedback-widget "dev-master"

or add, (*4)

"dilden/yii2-feedback-widget": "dev-master"

to the require section of your composer.json file., (*5)

Alternative Install

Add, (*6)

{
    "type": "git",
    "url": "https://github.com/Dilden/Yii2-Feedback-Widget"
}

to the repositories section of your composer.json file., (*7)

Then add, (*8)

"dilden/yii2-feedback-widget": "dev-master"

to the require section of your composer.json file., (*9)

Usage

Once the extension is installed, simply use it in your code by :, (*10)

<?= \dilden\feedbackwidget\DildenFeedback::widget(['ajaxURL' => 'pinneapple/feedback', 'highlightElement' => 0,]); ?>
 ```

Configurable options can be found at the original project [Ivoviz/Feedback](https://github.com/ivoviz/feedback).

Controller
----------

Setting up your controller to handle the AJAX response is simple enough. Simply set the ajaxURL parameter when declaring your widget (it is required for this widget to work). Create an action in your controller to accept the request. It could look something like this if you wanted to send an email.

```php
namespace app\controllers;

use yii\web\Response;

class PinneappleController extends Controller
{

    public function actionFeedback()
    {
        // ajax validation
        if (Yii::$app->request->isAjax) {

            $data = json_decode($_POST['feedback']);

            $htmlMail = '<h3>User Information </h3> Browser Version: ' . $data->browser->appVersion 
                    . '<p>User Agent: ' . $data->browser->userAgent.'</p>'
                    . '<p>Platform: ' . $data->browser->platform.'</p><hr>'
                    . '<p>URL: ' . $data->url .'</p>'
                    . '<p>Note: ' . $data->note .'</p>';

            // Send email with image attached as HTML file
            Yii::$app->mailer->compose()
                ->setFrom('EMAIL_ADDRESS_HERE@gmail.com')
                ->setTo('SEND_TO_ADDRESS_HERE@gmail.com')
                ->setSubject('SUBJECT_GOES_HERE')
                ->setHtmlBody($htmlMail)
                ->attachContent('<!DOCTYPE html><html><body><img src="' . $data->img .'" /></body></html>', ['fileName' => 'screengrab.html', 'contentType' => 'text/html'])
                ->send();
            Yii::$app->response->format = Response::FORMAT_JSON;
            return $data;
        }
        return false;
    }
}

The Versions

25/08 2016

dev-development

dev-development

This Yii2 extension is intended to enable live feedback from users on a Yii2 web app by acting as a wrapper for the ivoviz/feedback plugin.

  Sources   Download

GPL-3.0+

The Requires

 

by Dylan Hildenbrand

extension yii2 wrapper widget feedback

18/01 2016

dev-master

9999999-dev

This Yii2 extension is intended to enable live feedback from users on a Yii2 web app by acting as a wrapper for the ivoviz/feedback plugin.

  Sources   Download

GPL-3.0+

The Requires

 

by Dylan Hildenbrand

extension yii2 wrapper widget feedback

18/11 2015

dev-widget

dev-widget

This Yii2 extension is intended to enable live feedback from users on a Yii2 web app by automatically submitting feedback to Github or Bitbucket repo issues

  Sources   Download

GPL-3.0+

The Requires

 

by Dylan Hildenbrand

extension yii2 widget feedback