Conversie codeigniter 4
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:17
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/Validation.php' );
|
||||
|
||||
use App\Libraries\Validation\Validation;
|
||||
|
||||
class BaseValidation {
|
||||
|
||||
protected $validationField;
|
||||
protected $key;
|
||||
protected $fieldValue;
|
||||
protected $errorMessages = [];
|
||||
protected $validation;
|
||||
protected $fieldname;
|
||||
protected $validationResult;
|
||||
protected $request;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->request = \Config\Services::request();
|
||||
$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->request->getPost($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,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class CustomerValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'name' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'name'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'email',
|
||||
'fieldname' => 'email'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class EmployeeTargetValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'user_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'gebruiker'
|
||||
],
|
||||
'startmonth' => [
|
||||
'validations' => 'integer',
|
||||
'fieldname' => 'startmaand'
|
||||
],
|
||||
'startyear' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'startjaar'
|
||||
],
|
||||
'target' =>[
|
||||
'validations' => 'integer',
|
||||
'fieldname' => 'uren target'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class ExternalValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'contactperson' => [
|
||||
'validations' => 'required|alphaNumericSpaces',
|
||||
'fieldname' => 'contact'
|
||||
],
|
||||
'email' => [
|
||||
'validations' => 'email',
|
||||
'fieldname' => 'email'
|
||||
],
|
||||
'rate' => [
|
||||
'validations' => 'numeric',
|
||||
'fieldname' => 'tarief'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class ForecastValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'project_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'project'
|
||||
],
|
||||
'year' => [
|
||||
'validations' => 'integer',
|
||||
'fieldname' => 'jaar'
|
||||
],
|
||||
'month_id' => [
|
||||
'validations' => 'integer',
|
||||
'fieldname' => 'maand'
|
||||
],
|
||||
'forecastamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'bedrag'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class InvoiceValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'project_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'project'
|
||||
],
|
||||
'invoicedate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'factuurdatum'
|
||||
],
|
||||
'forecastdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'prognosedatum'
|
||||
],
|
||||
'invoiceamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'factuurbedrag'
|
||||
],
|
||||
'forecastamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'prognosebedrag'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: imac-3
|
||||
* Date: 26/06/16
|
||||
* Time: 21:13
|
||||
*/
|
||||
|
||||
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,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class OfferValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'customer_id' => [
|
||||
'validations' => 'required|numeric',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'required|date',
|
||||
'fieldname' => 'offertedatum'
|
||||
],
|
||||
'acceptdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'acceptatiedatum'
|
||||
],
|
||||
'rejectdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'afwijsdatum'
|
||||
],
|
||||
'acceptance_chance' => [
|
||||
'validations' => 'numeric',
|
||||
'fieldname' => 'afwijsdatum|minvalue-0|maxvalue-100'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software
|
||||
* User: Theo Weijmer
|
||||
* Date: 26/06/16
|
||||
* Time: 20:39
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class PaymentValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'invoice_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'factuur'
|
||||
],
|
||||
'paymentdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'betaaldatum'
|
||||
],
|
||||
'paymentamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'bedrag'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjectValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'customer_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'required|date',
|
||||
'fieldname' => 'start project'
|
||||
],
|
||||
'enddate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'eind project'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjectcostValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'project_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'project'
|
||||
],
|
||||
'external_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'externe'
|
||||
],
|
||||
'date' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'datum'
|
||||
],
|
||||
'costs' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'kosten'
|
||||
],
|
||||
'payed' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'betaald'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjectemployeeValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'user_id' => [
|
||||
'validations' => 'integer',
|
||||
'fieldname' => 'klant'
|
||||
],
|
||||
'startdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'start project'
|
||||
],
|
||||
'enddate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'eind project'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->handleSpecificValidations();
|
||||
}
|
||||
|
||||
protected function handleSpecificValidations()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class ProjecthourValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'projectemployee_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'projectmedewerker'
|
||||
],
|
||||
'hourdate' => [
|
||||
'validations' => 'date',
|
||||
'fieldname' => 'datum'
|
||||
],
|
||||
'hours' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'uren'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/07/16
|
||||
* Time: 13:35
|
||||
*/
|
||||
|
||||
require_once( APPPATH . 'Libraries/Validation/InputValidations/BaseValidation.php' );
|
||||
|
||||
class ReservationValidation extends BaseValidation {
|
||||
|
||||
|
||||
protected $validationFields = [
|
||||
'project_id' => [
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'project'
|
||||
],
|
||||
'external_id' =>[
|
||||
'validations' => 'required|integer',
|
||||
'fieldname' => 'onderaannemer'
|
||||
],
|
||||
'reservationamount' => [
|
||||
'validations' => 'number',
|
||||
'fieldname' => 'bedrag'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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'
|
||||
],
|
||||
'hourlyrate' =>[
|
||||
'validations' => 'decimal',
|
||||
'fieldname' => 'uurtarief'
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user