Esempio n. 1
0
 protected function _testValidator()
 {
     $salutations = array('Anreden' => array('herr' => 'Herr', 'frau' => 'Frau'), 'foo' => 'bar', 'Weiteres' => array('test1' => 'Test 1', 'test2' => 'Test 2'));
     $this->view->setContent('salutations', $salutations);
     $this->validator->addComposition('username', array('regex' => '/[a-z0-9_-]{8,}/i'));
     $rules = array('salutation' => array('required', 'array' => array('in_keys' => $salutations)), 'text' => array('minlength' => 5), 'username' => array('required', 'composition' => 'username'), 'file' => array('upload'), 'file.tmp_name' => array('image' => array('jpg'), 'invalidates' => 'file'), 'file.size' => array('number', 'max' => 1024 * 2000, 'invalidates' => 'file'), 'multi' => array('required', 'array' => array('in' => array('mutter', 'vater'))), 'simplecheckbox' => array('required', 'equal' => 'vater'), 'date' => array('date' => 'd.m.Y'));
     $input = $this->input->get();
     $errors = array();
     if (isset($input['sent'])) {
         if ($data = $this->validator->filter($input, $rules, $errors, true)) {
             Debug::dump($data);
         } else {
             Debug::dump($errors);
         }
     } else {
         // set defaults
         $input['salutation'] = 'frau';
     }
     $this->view->setContent('form', $this->load('Form', $input, $errors));
     // $input = $this->validator->filter($input, $rules);
     // Debug::dump($input);
 }
Esempio n. 2
0
 public function __construct()
 {
     Debug::dump('Model "Test" found.');
 }