Initial Code commit
This commit is contained in:
parent
1d5910fbad
commit
6b95ce5845
38
app/Model/Date.php
Normal file
38
app/Model/Date.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Nischcodes\Shiftcalc\App\Model;
|
||||
|
||||
/**
|
||||
* Date
|
||||
*
|
||||
* date model for this application
|
||||
*
|
||||
* PHP version 8.4 or higher
|
||||
*
|
||||
* LICENSE: GPL-3
|
||||
*
|
||||
* @package ShiftCalc
|
||||
* @author nisch.codes <nischcodes@noreply.projects.nisch.codes>
|
||||
* @copyright 2021 nisch.codes
|
||||
* @license https://projects.nisch.codes/nischcodes/shiftcalc/src/branch/main/LICENSE GPL-3
|
||||
* @version 1.0.0
|
||||
* @link https://projects.nisch.codes/nischcodes/shiftcalc
|
||||
*/
|
||||
|
||||
use Nischcodes\Shiftcalc\MVC\BaseModel;
|
||||
|
||||
class HomeModel extends BaseModel {
|
||||
|
||||
// implement the init function
|
||||
public function init() {
|
||||
echo "HomeModel init";
|
||||
}
|
||||
|
||||
// implement the load function
|
||||
public function load() {
|
||||
$this->repository = [
|
||||
['date' => '01/01/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'First Example Holiday'],
|
||||
['date' => '03/05/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'Second Example Holiday']
|
||||
];
|
||||
}
|
||||
}
|
@ -21,22 +21,18 @@ namespace Nischcodes\Shiftcalc\App\Model;
|
||||
|
||||
use Nischcodes\Shiftcalc\MVC\BaseModel;
|
||||
|
||||
class HomeModel implements BaseModel {
|
||||
|
||||
protected $repository = [];
|
||||
class HomeModel extends BaseModel {
|
||||
|
||||
// implement the init function
|
||||
public function init() {
|
||||
echo "HomeModel init";
|
||||
}
|
||||
|
||||
// implement the getAll function
|
||||
public function getAll() {
|
||||
return $this->repository;
|
||||
}
|
||||
|
||||
// implement the get function
|
||||
public function get($index){
|
||||
return $this->repository[$index];
|
||||
// implement the load function
|
||||
public function load() {
|
||||
$this->repository = [
|
||||
['date' => '01/01/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'First Example Holiday'],
|
||||
['date' => '03/05/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'Second Example Holiday']
|
||||
];
|
||||
}
|
||||
}
|
@ -15,5 +15,8 @@
|
||||
"email": "nischcodes@noreply.projects.nisch.codes"
|
||||
}
|
||||
],
|
||||
"require": {}
|
||||
"require": {},
|
||||
"scripts": {
|
||||
"serve": "php -S 127.0.0.1:8000 -t public"
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Nischcodes\Shiftcalc\MVC;
|
||||
* @link https://projects.nisch.codes/nischcodes/shiftcalc
|
||||
*/
|
||||
|
||||
class BaseController {
|
||||
abstract class BaseController {
|
||||
|
||||
public function __construct(
|
||||
protected BaseModel $model,
|
||||
|
@ -17,8 +17,20 @@ namespace Nischcodes\Shiftcalc\MVC;
|
||||
* @link https://projects.nisch.codes/nischcodes/shiftcalc
|
||||
*/
|
||||
|
||||
interface BaseModel {
|
||||
public function init();
|
||||
public function getAll();
|
||||
public function get($index);
|
||||
abstract class BaseModel {
|
||||
|
||||
protected $repository = [];
|
||||
|
||||
abstract public function init();
|
||||
abstract public function load();
|
||||
|
||||
// implement the getAll function
|
||||
public function getAll() {
|
||||
return $this->repository;
|
||||
}
|
||||
|
||||
// implement the get function
|
||||
public function get($index){
|
||||
return $this->repository[$index];
|
||||
}
|
||||
}
|
@ -17,8 +17,8 @@ namespace Nischcodes\Shiftcalc\MVC;
|
||||
* @link https://projects.nisch.codes/nischcodes/shiftcalc
|
||||
*/
|
||||
|
||||
interface BaseView {
|
||||
abstract class BaseView {
|
||||
|
||||
public function render($data);
|
||||
abstract public function render($data);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user