Diyform.php
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace app\index\controller\cms;
use app\common\controller\Frontend;
use addons\cms\model\Diyform as DiyformModel;
/**
* 会员中心
*/
class Diyform extends Frontend
{
protected $layout = 'default';
protected $noNeedLogin = [];
protected $noNeedRight = ['*'];
public function _initialize()
{
parent::_initialize();
}
/**
* 表单
*/
public function index()
{
$diyname = $this->request->param('diyname');
if ($diyname && !is_numeric($diyname)) {
$diyform = DiyformModel::getByDiyname($diyname);
} else {
$id = $diyname ? $diyname : $this->request->get('id', '');
$diyform = DiyformModel::get($id);
}
if (!$diyform || $diyform['status'] == 'hidden') {
$this->error(__('表单未找到'));
}
$fields = DiyformModel::getDiyformFields($diyform['id']);
$this->view->assign('diyform', $diyform);
$this->view->assign('fields', $fields);
return $this->view->fetch();
}
}