Guest User

Untitled

a guest
Dec 25th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Description of BlogPresenter
  5.  *
  6.  * @author Dave
  7.  */
  8.  
  9.  
  10.  
  11.  
  12. use Nette\Application\UI\Form;
  13. use Nette\Database\Connection;
  14.  
  15. class BlogPresenter extends BasePresenter {
  16.  
  17.     /**
  18.      * (non-phpDoc)
  19.      *
  20.      * @see Nette\Application\Presenter#startup()
  21.      */
  22.    
  23.     protected function startup() {
  24.         parent::startup();
  25.     }
  26.  
  27.     public function actionDefault() {
  28.        
  29.        
  30.     }
  31.    
  32. protected function createComponentSignInForm()
  33. {
  34.     $form = new Form;
  35.     $form->addText('name', 'Jmeno:')
  36.     ->setRequired('Zadejte prosim jmeno');
  37.     $form->addPassword('password', 'Heslo:')
  38.     ->setRequired('Zvolte si heslo')
  39.     ->addRule(Form::MIN_LENGTH,'Heslo musi mit 3 znaky', 3);
  40.     $form->addSubmit('login', 'Login');
  41.     $form->onSuccess[] = callback($this, 'signInFormSubmitted');
  42.     return $form;
  43.    
  44. }
  45.  
  46. public function signInFormSubmitted($form)
  47. {
  48.     // volá se po odeslání formuláře
  49.    
  50.  
  51.     $values = $form->getValues();
  52.     dump($values);
  53.  
  54. }
  55.     function barDump($var, $title = NULL)
  56. {
  57.      Nette\Diagnostics\Debugger::barDump($var, $title);
  58. }
  59.  
  60.     public function renderDefault($id) {
  61.         $this->template->promenna = "blog motherfucking post1 #" . $id;
  62.        
  63.         $dsn = "mysql:host=localhost;dbname=example";
  64.         $user = "root";
  65.         $password = "";
  66.        
  67.   $database = new Connection($dsn, $user, $password);
  68.           $database->table('users');
  69.          
  70.            barDump ($database);
  71.            
  72.    
  73.        
  74. //        $text = $_POST['text'];
  75. //        echo $text;
  76.        
  77.      
  78.     }
  79.  
  80. }
Add Comment
Please, Sign In to add comment