onmotion / yii2-survey
为 Yii2 应用程序设计的调查模块
v0.1.4
2019-09-19 09:28 UTC
Requires
- php: >=5.5.0
- cenotia/yii2-remote-modal: ^1.0
- kartik-v/yii2-dialog: ^1.0
- kartik-v/yii2-editable: ^1.7
- kartik-v/yii2-helpers: ^1.3
- kartik-v/yii2-slider: ^1.3
- kartik-v/yii2-widget-datepicker: ^1.4
- kartik-v/yii2-widget-datetimepicker: ^1.4
- kartik-v/yii2-widget-select2: ^2.1
- onmotion/yii2-widget-upload-crop: >=0.5
- vova07/yii2-imperavi-widget: ^2.0
- yiisoft/yii2: >=2.0.1
- yiisoft/yii2-imagine: ^2.1
This package is auto-updated.
Last update: 2024-08-29 05:06:16 UTC
README
! 注意:该模块处于积极开发中,因此可能存在各种错误和不稳定的工作。非常欢迎您的 PR。
安装
-
只需运行
composer require onmotion/yii2-survey
或者在您的 composer.json 文件的 require 部分
"onmotion/yii2-survey": "*"
添加
- 应用迁移
php yii migrate --migrationPath=@vendor/onmotion/yii2-survey/migrations
- 将模块定义到您的配置中
'modules' => [ //... 'survey' => [ 'class' => '\onmotion\survey\Module', 'params' => [ 'uploadsUrl' => 'http://advanced-frontend.lh/uploads/survey/', // full URL of the folder where the images will be uploaded. // 'uploadsUrl' => '/uploads/survey/', // or for basic 'uploadsPath' => '@frontend/web/uploads/survey/', // absolute path to the folder where images will be saved. ], // 'as access' => [ // 'class' => AccessControl::class, // 'except' => ['default/done'], // 'only' => ['default*'], // 'rules' => [ // [ // 'allow' => true, // 'roles' => ['survey'], // ], // ], // ], ], //... ]
别忘了更改您自己的参数。
使用方法
如果您使用的是 Yii 基本模板,则必须手动为模块定义 $controllerNamespace
。
onmotion\survey\controllers - 后端 (admin 创建/编辑调查)
onmotion\survey\widgetControllers - 默认 (用于小部件)
现在转到您的后端中的 /survey
并创建一个调查。
之后,您可以选择调查实体并将其显示给用户,例如
echo \onmotion\survey\Survey::widget([ 'surveyId' => 1 ]);
管理员