onmotion/yii2-survey

为 Yii2 应用程序设计的调查模块

安装: 921

依赖: 0

建议者: 0

安全性: 0

星标: 14

关注者: 8

分支: 20

开放问题: 7

类型:yii2-extension

v0.1.4 2019-09-19 09:28 UTC

This package is auto-updated.

Last update: 2024-08-29 05:06:16 UTC


README

Latest Stable Version Total Downloads Monthly Downloads License

! 注意:该模块处于积极开发中,因此可能存在各种错误和不稳定的工作。非常欢迎您的 PR。

fluent

安装

  • 只需运行

    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 并创建一个调查。

fluent

之后,您可以选择调查实体并将其显示给用户,例如

echo \onmotion\survey\Survey::widget([
   'surveyId' => 1
]);

fluent

管理员

fluent

fluent