Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
itminedu
gredu_labs
Commits
535f1d54
Commit
535f1d54
authored
Feb 23, 2016
by
Georgios Tsakalos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add software filtering
bootstrap needs update
parent
8cd87b07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
module/schools/src/InputFilter/Software.php
module/schools/src/InputFilter/Software.php
+73
-0
module/schools/src/Middleware/InputFilterSoftware.php
module/schools/src/Middleware/InputFilterSoftware.php
+21
-0
No files found.
module/schools/src/InputFilter/Software.php
0 → 100644
View file @
535f1d54
<?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
);
}
}
module/schools/src/Middleware/InputFilterSoftware.php
0 → 100644
View file @
535f1d54
<?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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment