Commit 535f1d54 authored by Georgios Tsakalos's avatar Georgios Tsakalos

add software filtering

bootstrap needs update
parent 8cd87b07
<?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\Schools\InputFilter;
use Zend\Filter;
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;
use Zend\Validator;
class Software
{
use InputFilterTrait;
public function __construct()
{
$id = new Input('id');
$id->setRequired(false)
->getValidatorChain()
->attach(new Validator\Digits());
$softwarecategory_id = new Input('softwarecategory_id');
$softwarecategory_id->setRequired(true)
->getValidatorChain()
->attach(new Validator\Digits());
$title = new Input('title');
$title->setRequired(true)
->getFilterChain()
->attach(new Filter\StringTrim());
$title->getValidatorChain()
->attach(new Validator\NotEmpty())
->attach(new Validator\StringLength(['min' => 3]));
$school_id = new Input('school_id');
$school_id->setRequired(true)
->getValidatorChain()
->attach(new Validator\Digits());
$lab_id = new Input('lab_id');
$lab_id->setRequired(false)
->getValidatorChain()
->attach(new Validator\Digits());
$vendor = new Input('vendor');
$vendor->setRequired(false)
->getFilterChain()
->attach(new Filter\StringTrim());
$url = new Input('url');
$url->setRequired(false)
->getValidatorChain()
->attach(new Validator\Hostname());
$this->inputFilter = new InputFilter();
$this->inputFilter
->add($id)
->add($softwarecategory_id)
->add($school_id)
->add($lab_id)
->add($title)
->add($vendor)
->add($url);
}
}
<?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\Schools\Middleware;
class InputFilterSoftware
{
use InputFilterTrait;
public function __construct(callable $inputFilter)
{
$this->inputFilter = $inputFilter;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment