* @copyright 2016 Denis Chenu * @license LPRAB (WTFPL) * @version 0.0.1 * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * Do What The Fuck You Want to Public License for more details. */ class testToken extends \ls\pluginmanager\PluginBase { static protected $description = 'Bug report plugin'; static protected $name = 'testToken'; /** * Add function to be used in cron event */ public function init() { $this->subscribe('cron','countToken'); } public function countToken() { $oSurveys=Survey::model()->findAll( "active = 'Y'" ); Yii::import('application.helpers.common_helper', true); if($oSurveys) { foreach ($oSurveys as $oSurvey) { $nbResponse=SurveyDynamic::model($oSurvey->sid)->count(); echo "Survey {$oSurvey->sid} have {$nbResponse} responses\n"; } } } }