UniversityForm.php 3.26 KB
Newer Older
Aspasia Katsi's avatar
Aspasia Katsi committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php
/**
 * gredu_labs
 * 
 * @link https://github.com/eellak/gredu_labs for the canonical source repository
 * @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
 * @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
 */

namespace GrEduLabs\UniversityForm\InputFilter;

use GrEduLabs\UniversityForm\Service;
use Zend\Filter;
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;
use Zend\Validator;

class UniversityForm extends InputFilter 
{
 
    public function __construct()
    {
Aspasia Katsi's avatar
Aspasia Katsi committed
23 24 25 26 27 28 29 30 31 32 33

           $newselect = new Input('newselect');
           $newselect->setRequired(false)
                        ->getFilterChain();



           $ereunitiko = new Input('ereunitiko');
           $ereunitiko->setRequired(true)
                        ->getFilterChain();

Aspasia Katsi's avatar
Aspasia Katsi committed
34
 
Aspasia Katsi's avatar
Aspasia Katsi committed
35 36 37
           $institute = new Input('institute');
           $institute->setRequired(false)
                        ->getFilterChain();
Aspasia Katsi's avatar
Aspasia Katsi committed
38

Aspasia Katsi's avatar
Aspasia Katsi committed
39 40 41
           $other = new Input('other');
           $other->setRequired(false)
                        ->getFilterChain();
Aspasia Katsi's avatar
Aspasia Katsi committed
42 43


Aspasia Katsi's avatar
Aspasia Katsi committed
44 45 46 47 48 49 50 51 52
 
           $idrima = new Input('idrima');
           $idrima->setRequired(false)
                        ->getFilterChain();

           
           $sxolh = new Input('sxolh');
           $sxolh->setRequired(false)
                        ->getFilterChain();
Aspasia Katsi's avatar
Aspasia Katsi committed
53

Aspasia Katsi's avatar
Aspasia Katsi committed
54 55 56 57 58 59

         $tmhma = new Input('tmhma');
         $tmhma->setRequired(false)
                        ->getFilterChain();
   
        
Aspasia Katsi's avatar
Aspasia Katsi committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
        $erga = new Input('erga');
        $erga->setRequired(false)
            ->getFilterChain()
            ->attach(new Filter\StringTrim());

        $person = new Input('person');
        $person->setRequired(true)
            ->getFilterChain()
            ->attach(new Filter\StringTrim());
        $person->getValidatorChain()
            ->attach(new Validator\NotEmpty())
            ->attach(new Validator\StringLength(['min' => 3]));


        $email = new Input('email');
        $email->setRequired(true)
            ->getValidatorChain()
            ->attach(new Validator\NotEmpty())
            ->attach(new Validator\EmailAddress([
                'useDomainCheck' => false,
            ]));

       $telef = new Input('telef');
       $telef->setRequired(true)
            ->getFilterChain()
            ->attach(new Filter\Digits());
       $telef->getValidatorChain()
            ->attach(new Validator\NotEmpty())
            ->attach(new Validator\StringLength(['min' => 10]))
            ->attach(new Validator\StringLength(['max' => 13]));


       $projectdescription = new Input('projectdescription');
                $projectdescription->setRequired(false)
                    ->getFilterChain()
                    ->attach(new Filter\StringTrim());

      

       $comments = new Input('comments');
       $comments->setRequired(false)
                    ->getFilterChain()
                    ->attach(new Filter\StringTrim());


Aspasia Katsi's avatar
Aspasia Katsi committed
105 106 107 108 109
        $this->add($newselect)
            ->add($ereunitiko) 
            ->add($institute)
            ->add($other)
            ->add($idrima)
Aspasia Katsi's avatar
Aspasia Katsi committed
110 111 112 113 114 115 116 117 118 119
            ->add($sxolh)
            ->add($tmhma)
            ->add($erga)
            ->add($person)
            ->add($telef)
            ->add($email)
            ->add($projectdescription)
            ->add($comments);
    }
}