Guest User

Untitled

a guest
Jul 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <?php
  2.  
  3. defined('YII_DEBUG') or die('Hello, hacker!');
  4.  
  5. Yii::import('User');
  6.  
  7. class SiteController extends CController {
  8.  
  9. public $sHeader = "<!doctype html>
  10. <html>
  11. <head>
  12. <title>Анкета</title>
  13. </head>
  14. <body>
  15. ";
  16.  
  17. public $sFooter = "</body>
  18. </html>";
  19.  
  20. public $aUserForm = array(
  21. 'title' => 'Заполните анкету',
  22.  
  23. 'elements' => array(
  24. 'name' => array(
  25. 'type' => 'text',
  26. 'maxlength' => '128',
  27. ),
  28. 'email' => array(
  29. 'type' => 'text',
  30. 'maxlength' => '128',
  31. ),
  32. ),
  33.  
  34. 'buttons' => array(
  35. 'save' => array(
  36. 'type' => 'submit',
  37. 'label' => 'Сохранить'
  38. ),
  39. ),
  40. );
  41.  
  42. public function actionIndex() {
  43. echo 'Спасибо за участие!';
  44. }
  45.  
  46. public function actionUser() {
  47. $oUser = new User();
  48. $oForm = new CForm($this->aUserForm, $oUser);
  49.  
  50. if ($oForm->submitted('save') && $oForm->validate()) {
  51. // сохраняем данные
  52. $this->redirect(array('site/index'));
  53. }
  54. else
  55. $this->renderText($this->sHeader . $oForm->render() . $this->sFooter);
  56. }
  57.  
  58. }
Add Comment
Please, Sign In to add comment