Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('YII_DEBUG') or die('Hello, hacker!');
- Yii::import('User');
- class SiteController extends CController {
- public $sHeader = "<!doctype html>
- <html>
- <head>
- <title>Анкета</title>
- </head>
- <body>
- ";
- public $sFooter = "</body>
- </html>";
- public $aUserForm = array(
- 'title' => 'Заполните анкету',
- 'elements' => array(
- 'name' => array(
- 'type' => 'text',
- 'maxlength' => '128',
- ),
- 'email' => array(
- 'type' => 'text',
- 'maxlength' => '128',
- ),
- ),
- 'buttons' => array(
- 'save' => array(
- 'type' => 'submit',
- 'label' => 'Сохранить'
- ),
- ),
- );
- public function actionIndex() {
- echo 'Спасибо за участие!';
- }
- public function actionUser() {
- $oUser = new User();
- $oForm = new CForm($this->aUserForm, $oUser);
- if ($oForm->submitted('save') && $oForm->validate()) {
- // сохраняем данные
- $this->redirect(array('site/index'));
- }
- else
- $this->renderText($this->sHeader . $oForm->render() . $this->sFooter);
- }
- }
Add Comment
Please, Sign In to add comment