diversen
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:17
|
||||
*/
|
||||
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/Validation.php' );
|
||||
|
||||
|
||||
class BaseValidation {
|
||||
|
||||
protected $validationField;
|
||||
protected $key;
|
||||
protected $fieldValue;
|
||||
protected $errorMessages = [];
|
||||
protected $validation;
|
||||
protected $fieldname;
|
||||
protected $ci;
|
||||
protected $validationResult;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->validateInput();
|
||||
}
|
||||
|
||||
public function getValidationResult()
|
||||
{
|
||||
return $this->validationResult;
|
||||
}
|
||||
|
||||
public function validateInput()
|
||||
{
|
||||
$this->loopFields();
|
||||
}
|
||||
|
||||
public function getErrorMessages( )
|
||||
{
|
||||
return $this->errorMessages;
|
||||
}
|
||||
|
||||
private function loopFields()
|
||||
{
|
||||
foreach ( $this->validationFields as $this->key => $this->validationField )
|
||||
{
|
||||
$this->validation = new Validation();
|
||||
|
||||
$this->setInputfield();
|
||||
|
||||
$this->validateFieldvalue();
|
||||
|
||||
$this->setFieldname();
|
||||
|
||||
$this->setValidationResult();
|
||||
|
||||
$this->setErrorMesagges();
|
||||
}
|
||||
}
|
||||
|
||||
private function setInputfield()
|
||||
{
|
||||
$this->fieldValue = $this->ci->input->post( $this->key );
|
||||
}
|
||||
|
||||
private function validateFieldvalue()
|
||||
{
|
||||
$this->validation->validate( $this->fieldValue, $this->validationField );
|
||||
}
|
||||
|
||||
private function setFieldname()
|
||||
{
|
||||
$this->fieldname = $this->validationField['fieldname'];
|
||||
}
|
||||
|
||||
private function setErrorMesagges()
|
||||
{
|
||||
$this->errorMessages[ $this->fieldname ] = $this->validation->getErrorMessages();
|
||||
}
|
||||
|
||||
private function setValidationResult()
|
||||
{
|
||||
if( $this->validationResult === FALSE ) return;
|
||||
|
||||
$this->validationResult = $this->validation->getValidationResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:13
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class LoginValidation extends BaseValidation {
|
||||
|
||||
protected $validationFields = [
|
||||
'username' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'gebruikersnaam'
|
||||
],
|
||||
'password' => [
|
||||
'validations' => 'required',
|
||||
'fieldname' => 'wachtwoord'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software
|
||||
* User: Theo Weijmer
|
||||
* Date: 26/06/16
|
||||
* Time: 20:39
|
||||
*/
|
||||
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class OrganisationValidation extends BaseValidation {
|
||||
|
||||
protected $validationFields = [
|
||||
'brin' => [
|
||||
'validations' => 'required|alphaNumeric',
|
||||
'fieldname' => 'brinnummer'
|
||||
],
|
||||
'naam' => [
|
||||
'validations' => 'required',
|
||||
'fieldname' => 'Organisatienaam'
|
||||
],
|
||||
'naamkort' => [
|
||||
'validations' => 'required',
|
||||
'fieldname' => 'Organisatienaam (kort)'
|
||||
],
|
||||
'vestiging' => [
|
||||
'validations' => 'required|alphaNumeric|unique',
|
||||
'fieldname' => 'vestigingsnummer',
|
||||
'model' => 'organisations_model',
|
||||
'field' => 'vestiging'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'email',
|
||||
'fieldname' => 'email'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:13
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class PasswordRequestValidation extends BaseValidation {
|
||||
|
||||
protected $validationFields = [
|
||||
'username' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'gebruikersnaam'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'required|email',
|
||||
'fieldname' => 'email'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
|
||||
|
||||
class UserValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'firstname' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'firstname'
|
||||
],
|
||||
'lastname' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'lastname'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'required|email|unique',
|
||||
'fieldname' => 'email',
|
||||
'model' => 'User_model',
|
||||
'field' => 'email'
|
||||
],
|
||||
'username' => [
|
||||
'validations' => 'required|alphanumeric|minlength-4|unique',
|
||||
'fieldname' => 'username',
|
||||
'model' => 'User_model',
|
||||
'field' => 'username'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user