62 lines
1.3 KiB
PHP
62 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Created by Pensare Software.
|
|
* User: Theo Weijmer
|
|
* Date: 31/01/2018
|
|
* Time: 20:08
|
|
*/
|
|
|
|
class EmployeeHoursController extends MY_Controller {
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
|
|
|
|
$models = [];
|
|
$libraries = [];
|
|
|
|
$this->load->model( $models );
|
|
$this->load->library( $libraries );
|
|
}
|
|
|
|
public function getEmployeehours( $month, $year )
|
|
{
|
|
$employeehours = Employeehour::getEmployeehours( $month, $year );
|
|
|
|
$this->json( $employeehours );
|
|
}
|
|
|
|
public function getHourtypes()
|
|
{
|
|
$hourtypes = Hourtype::all();
|
|
|
|
$this->json( $hourtypes );
|
|
}
|
|
|
|
public function saveEmployeehour()
|
|
{
|
|
//TODO: validatie inbouwen
|
|
$data = $this->input->post();
|
|
|
|
$employeehourID = $data['id'];
|
|
unset( $data['id'] );
|
|
|
|
$data['hourdate'] = date2mysql( $data['hourdate'] );
|
|
|
|
$employeehourID = Employeehour::saveEmployeehour( $employeehourID, $data );
|
|
|
|
$this->json( ['employeehourID' => $employeehourID] );
|
|
}
|
|
|
|
public function removeEmployeehour( $employeehourID )
|
|
{
|
|
//TODO:check op delete
|
|
Employeehour::whereId( $employeehourID )->delete();
|
|
|
|
$this->json( ['result' => TRUE] );
|
|
}
|
|
|
|
} |