Skip to content

AudiologyHoldings/survey-plugin

Repository files navigation

INSTALL:
1) Copy plugin into app/plugins/survey
2) Run: $ cake schema create -plugin survey -name survey
3) Add the following to your config/routes.php

# -- survey plugin
Router::parseExtensions('vcf','csv');
Router::connect('/survey', array('plugin' => 'survey', 'controller' => 'surveys', 'action' => 'first'));
Router::connect('/final_survey/:email', array('plugin' => 'survey', 'controller' => 'surveys', 'action' => 'second'), array('pass' => array('email')));
Router::connect('/resend_survey/:email', array('plugin' => 'survey', 'controller' => 'surveys', 'action' => 'resend'), array('pass' => array('email')));
Router::connect('/admin/surveys/report', array('prefix' => 'admin', 'plugin' => 'survey', 'controller' => 'surveys', 'action' => 'report'));
Router::connect('/survey/send_follow/*', array('plugin' => 'survey', 'controller' => 'surveys', 'action' => 'send_follow'));
Router::connect('/survey/export/*', array('plugin' => 'survey', 'controller' => 'surveys', 'action' => 'export', 'ext' => 'csv'));
	
4) Copy app/plugins/survey/config/survey.php.example to config/survey.php

CONFIGURE:
There are three configurations you can set on the survey
------------------------
1) table: custom table. 
   
   If you have a contact table you'd like to use instead of the default survey_contacts you may
   configure the plugin to use an already defined table.  If you do so, you will need to make
   sure you have the required fields:
   
   - first_name (STRING)
	 - last_name (STRING)
	 - email (STRING)
	 - phone (STRING)
	 - is_18 (BOOLEAN)
	 - entered_give_away (BOOLEAN)
	 - finished_survey (BOOLEAN)
	 - final_email_sent_date (DATETIME)
	 - created (DATETIME)
	 
2) email: from email address when sending out survey thanks and survey final prompt

3) name: full name to be used in the generated vcard

USAGE:
To prompt the popup, use the helper.  The popup will only show once, after that a cookie is
written and the popup will no longer appear.

//app_controller.php
var $helpers = array('Survey.Survey');

//some_view.ctp
<?= $survey->showPopup(); ?>