diff --git a/Admin/Activate.php b/Admin/Activate.php new file mode 100644 index 0000000..95fac52 --- /dev/null +++ b/Admin/Activate.php @@ -0,0 +1,44 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\ActivateAbstract; +use phpOMS\Module\InfoManager; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Activate extends ActivateAbstract +{ + + /** + * {@inheritdoc} + */ + public static function activate(DatabasePool $dbPool, InfoManager $info) + { + parent::activate($dbPool, $info); + } +} diff --git a/Admin/Deactivate.php b/Admin/Deactivate.php new file mode 100644 index 0000000..0355621 --- /dev/null +++ b/Admin/Deactivate.php @@ -0,0 +1,44 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\DeactivateAbstract; +use phpOMS\Module\InfoManager; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Deactivate extends DeactivateAbstract +{ + + /** + * {@inheritdoc} + */ + public static function deactivate(DatabasePool $dbPool, InfoManager $info) + { + parent::deactivate($dbPool, $info); + } +} diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json new file mode 100644 index 0000000..4095673 --- /dev/null +++ b/Admin/Install/Navigation.install.json @@ -0,0 +1,98 @@ +[ + { + "id": 1002401001, + "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", + "type": 2, + "subtype": 0, + "name": "HumanResourceManagement", + "uri": null, + "target": "self", + "icon": "fa fa-user", + "order": 90, + "from": "HumanResourceManagement", + "permission": null, + "parent": 0, + "children": [ + { + "id": 1002402001, + "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", + "type": 2, + "subtype": 1, + "name": "Employees", + "uri": "/{/lang}/backend/hr/staff/list?{?}", + "target": "self", + "icon": null, + "order": 1, + "from": "HumanResourceManagement", + "permission": null, + "parent": 1002401001, + "children": [ + { + "id": 1002402101, + "pid": "29a67db2902a784f66b5e896efd84b0004be2087", + "type": 3, + "subtype": 1, + "name": "List", + "uri": "/{/lang}/backend/hr/staff/list?{?}", + "target": "self", + "icon": null, + "order": 1, + "from": "HumanResourceManagement", + "permission": null, + "parent": 1002402001, + "children": [ + ] + }, + { + "id": 1002402201, + "pid": "29a67db2902a784f66b5e896efd84b0004be2087", + "type": 3, + "subtype": 1, + "name": "Create", + "uri": "/{/lang}/backend/hr/staff/create?{?}", + "target": "self", + "icon": null, + "order": 5, + "from": "HumanResourceManagement", + "permission": null, + "parent": 1002402001, + "children": [ + ] + } + ] + }, + { + "id": 1002403001, + "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", + "type": 2, + "subtype": 1, + "name": "Departments", + "uri": "/{/lang}/backend/hr/department/list?{?}", + "target": "self", + "icon": null, + "order": 1, + "from": "HumanResourceManagement", + "permission": null, + "parent": 1002401001, + "children": [ + { + "id": 1002403101, + "pid": "5696bf086bb04c219b1a2654ad9df177c35be669", + "type": 3, + "subtype": 1, + "name": "List", + "uri": "/{/lang}/backend/hr/department/list?{?}", + "target": "self", + "icon": null, + "order": 1, + "from": "HumanResourceManagement", + "permission": null, + "parent": 1002403001, + "children": [ + ] + } + ] + } + ] + } +] diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php new file mode 100644 index 0000000..c82c4c3 --- /dev/null +++ b/Admin/Install/Navigation.php @@ -0,0 +1,40 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Admin\Install; +use phpOMS\DataStorage\Database\DatabasePool; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Navigation +{ + public static function install(string $path, DatabasePool $dbPool) + { + $navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true); + + $class = '\\Modules\\Navigation\\Admin\\Installer'; + /** @var $class \Modules\Navigation\Admin\Installer */ + $class::installExternal($dbPool, $navData); + } +} diff --git a/Admin/Installer.php b/Admin/Installer.php new file mode 100644 index 0000000..38ff9bc --- /dev/null +++ b/Admin/Installer.php @@ -0,0 +1,153 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Admin; + +use phpOMS\DataStorage\Database\DatabaseType; +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\InfoManager; +use phpOMS\Module\InstallerAbstract; + +/** + * Human Resources install class. + * + * @category Modules + * @package Modules\HumanResourceManagement + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Installer extends InstallerAbstract +{ + + /** + * {@inheritdoc} + */ + public static function install(string $path, DatabasePool $dbPool, InfoManager $info) + { + parent::install($path, $dbPool, $info); + + switch ($dbPool->get('core')->getType()) { + case DatabaseType::MYSQL: + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_staff` ( + `hr_staff_id` int(11) NOT NULL AUTO_INCREMENT, + `hr_staff_account` int(11) DEFAULT NULL, + PRIMARY KEY (`hr_staff_id`), + KEY `hr_staff_account` (`hr_staff_account`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_staff` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_ibfk_1` FOREIGN KEY (`hr_staff_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_staff_history` ( + `hr_staff_history_id` int(11) NOT NULL AUTO_INCREMENT, + `hr_staff_history_staff` int(11) DEFAULT NULL, + `hr_staff_history_position` int(11) DEFAULT NULL, + `hr_staff_history_department` int(11) DEFAULT NULL, + `hr_staff_history_start` datetime DEFAULT NULL, + `hr_staff_history_end` datetime DEFAULT NULL, + PRIMARY KEY (`hr_staff_history_id`), + KEY `hr_staff_history_staff` (`hr_staff_history_staff`), + KEY `hr_staff_history_department` (`hr_staff_history_department`), + KEY `hr_staff_history_position` (`hr_staff_history_position`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_staff_history` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_history_ibfk_1` FOREIGN KEY (`hr_staff_history_staff`) REFERENCES `' . $dbPool->get('core')->prefix . 'hr_staff` (`hr_staff_id`), + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_history_ibfk_2` FOREIGN KEY (`hr_staff_history_department`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_department` (`organization_department_id`), + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_history_ibfk_3` FOREIGN KEY (`hr_staff_history_position`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_position` (`organization_position_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_staff_contract` ( + `hr_staff_contract_id` int(11) NOT NULL AUTO_INCREMENT, + `hr_staff_contract_stype` tinyint(1) DEFAULT NULL, + `hr_staff_contract_salary` decimal(8,2) DEFAULT NULL, + `hr_staff_contract_cformingbenefits` decimal(8,2) DEFAULT NULL, + `hr_staff_contract_working_hours` int(11) DEFAULT NULL, + `hr_staff_contract_vacation` tinyint(3) DEFAULT NULL, + `hr_staff_contract_vtype` tinyint(3) DEFAULT NULL, + `hr_staff_contract_personal_time` tinyint(3) DEFAULT NULL, + `hr_staff_contract_start` datetime DEFAULT NULL, + `hr_staff_contract_end` datetime DEFAULT NULL, + `hr_staff_contract_employee` int(11) DEFAULT NULL, + PRIMARY KEY (`hr_staff_contract_id`), + KEY `hr_staff_contract_employee` (`hr_staff_contract_employee`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_staff_contract` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_contract_ibfk_1` FOREIGN KEY (`hr_staff_contract_employee`) REFERENCES `' . $dbPool->get('core')->prefix . 'hr_staff` (`hr_staff_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_planning_shift` ( + `HRPlanningShiftID` int(11) NOT NULL AUTO_INCREMENT, + `amount` int(11) DEFAULT NULL, + `position` int(11) DEFAULT NULL, + `department` int(11) DEFAULT NULL, + `start` datetime DEFAULT NULL, + `end` datetime DEFAULT NULL, + PRIMARY KEY (`HRPlanningShiftID`), + KEY `department` (`department`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8;' + )->execute(); + + /* + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_planning_shift` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_planning_shift_ibfk_1` FOREIGN KEY (`department`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_department` (`organization_department_id`);' + )->execute();*/ + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_planning_staff` ( + `HRPlanningStaffID` int(11) NOT NULL AUTO_INCREMENT, + `person` int(11) DEFAULT NULL, + `start` datetime DEFAULT NULL, + `end` datetime DEFAULT NULL, + `status` tinyint(1) NOT NULL, + `type` tinyint(1) NOT NULL, + `repeat` tinyint(1) NOT NULL, + `rep_interval` tinyint(3) NOT NULL, + `rep_monday` tinyint(1) NOT NULL, + `rep_tuesday` tinyint(1) NOT NULL, + `rep_wednesday` tinyint(1) NOT NULL, + `rep_thursday` tinyint(1) NOT NULL, + `rep_friday` tinyint(1) NOT NULL, + `rep_saturday` tinyint(1) NOT NULL, + `rep_sunday` tinyint(1) NOT NULL, + PRIMARY KEY (`HRPlanningStaffID`), + KEY `person` (`person`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_planning_staff` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_planning_staff_ibfk_1` FOREIGN KEY (`person`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + break; + } + } +} diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php new file mode 100644 index 0000000..8cdfbbf --- /dev/null +++ b/Admin/Routes/Web/Backend.php @@ -0,0 +1,24 @@ + [ + [ + 'dest' => '\Modules\HumanResourceManagement\Controller:viewHrList', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/hr/staff/create.*$' => [ + [ + 'dest' => '\Modules\HumanResourceManagement\Controller:viewHrCreate', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/hr/department/list.*$' => [ + [ + 'dest' => '\Modules\HumanResourceManagement\Controller:viewHrDepartmentList', + 'verb' => RouteVerb::GET, + ], + ], +]; diff --git a/Admin/Routes/console.php b/Admin/Routes/console.php new file mode 100644 index 0000000..1ecbfac --- /dev/null +++ b/Admin/Routes/console.php @@ -0,0 +1,3 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\DataStorage\Database\Schema\Builder; +use phpOMS\Module\UninstallAbstract; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Uninstall extends UninstallAbstract +{ + + /** + * {@inheritdoc} + */ + public static function uninstall(DatabasePool $dbPool, InfoManager $info) + { + parent::uninstall($dbPool, $info); + + $query = new Builder($dbPool->get()); + + $query->prefix($dbPool->get('core')->getPrefix())->drop( + 'hr_planning_staff', + 'hr_planning_shift', + 'hr_staff_contract', + 'hr_staff_history', + 'hr_staff' + ); + + $dbPool->get()->con->prepare($query->toSql())->execute(); + } +} diff --git a/Admin/Update.php b/Admin/Update.php new file mode 100644 index 0000000..6367a4f --- /dev/null +++ b/Admin/Update.php @@ -0,0 +1,46 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Admin; + + +use phpOMS\DataStorage\Database\DatabasePool; +use phpOMS\Module\UpdateAbstract; +use phpOMS\System\File\Directory; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Update extends UpdateAbstract +{ + + /** + * {@inheritdoc} + */ + public static function update(DatabasePool $dbPool, array $info) + { + Directory::deletePath(__DIR__ . '/Update'); + mkdir('Update'); + parent::update($dbPool, $info); + } +} diff --git a/Controller.php b/Controller.php new file mode 100644 index 0000000..6984556 --- /dev/null +++ b/Controller.php @@ -0,0 +1,139 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement; + +use phpOMS\Message\RequestAbstract; +use phpOMS\Message\ResponseAbstract; +use phpOMS\Module\ModuleAbstract; +use phpOMS\Module\WebInterface; +use phpOMS\Views\View; +use Modules\HumanResourceManagement\Models\EmployeeMapper; + +/** + * Human Resources controller class. + * + * @category Modules + * @package Modules\HumanResourceManagement + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Controller extends ModuleAbstract implements WebInterface +{ + + /** + * Module path. + * + * @var string + * @since 1.0.0 + */ + /* public */ const MODULE_PATH = __DIR__; + + /** + * Module version. + * + * @var string + * @since 1.0.0 + */ + /* public */ const MODULE_VERSION = '1.0.0'; + + /** + * Module name. + * + * @var string + * @since 1.0.0 + */ + /* public */ const MODULE_NAME = 'HumanResourceManagement'; + + /** + * Providing. + * + * @var string + * @since 1.0.0 + */ + protected static $providing = []; + + /** + * Dependencies. + * + * @var string + * @since 1.0.0 + */ + protected static $dependencies = [ + ]; + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewHrList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response)); + + $view->setData('employees', EmployeeMapper::getAll()); + + return $view; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewHrCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/staff-create'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002402001, $request, $response)); + + return $view; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewHrDepartmentList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/HumanResourceManagement/Theme/Backend/department-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002403001, $request, $response)); + + return $view; + } + +} diff --git a/Models/Department.php b/Models/Department.php new file mode 100644 index 0000000..e69de29 diff --git a/Models/Employee.php b/Models/Employee.php new file mode 100644 index 0000000..b966432 --- /dev/null +++ b/Models/Employee.php @@ -0,0 +1,60 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Models; + +use Modules\Admin\Models\Account; + +/** + * Employee class. + * + * @category HumanResources + * @package Framework + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Employee { + + /** + * Employee ID. + * + * @var int + * @since 1.0.0 + */ + private $id = 0; + + private $account = null; + + private $history = []; + + private $status = []; + + public function setAccount(Account $account) + { + $this->account = $account; + } + + public function getAccount() : Account { + return $this->account; + } + + public function getId() : int + { + return $this->id; + } +} diff --git a/Models/EmployeeHistory.php b/Models/EmployeeHistory.php new file mode 100644 index 0000000..b32ca30 --- /dev/null +++ b/Models/EmployeeHistory.php @@ -0,0 +1,31 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Models; + +/** + * Employee class. + * + * @category HumanResources + * @package Framework + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class EmployeeHistory { + +} \ No newline at end of file diff --git a/Models/EmployeeHistoryMapper.php b/Models/EmployeeHistoryMapper.php new file mode 100644 index 0000000..8c3b2c1 --- /dev/null +++ b/Models/EmployeeHistoryMapper.php @@ -0,0 +1,22 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Models; + +use phpOMS\DataStorage\Database\DataMapperAbstract; + +class EmployeeHistoryMapper extends DataMapperAbstract +{ +} diff --git a/Models/EmployeeMapper.php b/Models/EmployeeMapper.php new file mode 100644 index 0000000..5ba5f7a --- /dev/null +++ b/Models/EmployeeMapper.php @@ -0,0 +1,57 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Models; + +use Modules\Admin\Models\AccountMapper; +use phpOMS\DataStorage\Database\DataMapperAbstract; + +class EmployeeMapper extends DataMapperAbstract +{ + + /** + * Columns. + * + * @var array + * @since 1.0.0 + */ + protected static $columns = [ + 'hr_staff_id' => ['name' => 'hr_staff_id', 'type' => 'int', 'internal' => 'id'], + 'hr_staff_account' => ['name' => 'hr_staff_account', 'type' => 'int', 'internal' => 'account'], + ]; + + protected static $ownsOne = [ + 'account' => [ + 'mapper' => AccountMapper::class, + 'src' => 'hr_staff_account', + ], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static $table = 'hr_staff'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static $primaryField = 'hr_staff_id'; +} diff --git a/Models/PositionType.php b/Models/PositionType.php new file mode 100644 index 0000000..cd2bdeb --- /dev/null +++ b/Models/PositionType.php @@ -0,0 +1,48 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Models; + +use phpOMS\Datatypes\Enum; + +/** + * Position type enum. + * + * @category Module + * @package Modules\HumanResources + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +abstract class PositionType extends Enum +{ + /* public */ const INTERN = 0; + + /* public */ const APPRENTICE = 1; + + /* public */ const JUNIOR = 2; + + /* public */ const REGULAR = 3; + + /* public */ const SENIOR = 4; + + /* public */ const ASSISTANT = 5; + + /* public */ const TEAMLEADER = 6; + + /* public */ const HEAD = 7; +} diff --git a/Models/StaffList.php b/Models/StaffList.php new file mode 100644 index 0000000..c3611dd --- /dev/null +++ b/Models/StaffList.php @@ -0,0 +1,107 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\HumanResourceManagement\Models; + +use phpOMS\DataStorage\Database\DatabaseType; + +/** + * Staff list class. + * + * @category Modules + * @package HumanResources + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class StaffList +{ + + /** + * Database instance. + * + * @var \phpOMS\DataStorage\Database\Pool + * @since 1.0.0 + */ + private $dbPool = null; + + /** + * Constructor. + * + * @param \phpOMS\DataStorage\Database\DatabasePool $dbPool Database pool instance + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function __construct($dbPool) + { + $this->dbPool = $dbPool; + } + + /** + * Get all staff members. + * + * This function gets all accounts in a range + * + * @param array $filter Filter for search results + * @param int $offset Offset for first account + * @param int $limit Limit for results + * + * @return array + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getList($filter = null, $offset = 0, $limit = 100) + { + $result = null; + + switch ($this->dbPool->get('core')->getType()) { + case DatabaseType::MYSQL: + $search = $this->dbPool->get('core')->generate_sql_filter($filter, true); + + $sth = $this->dbPool->get('core')->con->prepare('SELECT + `' . $this->dbPool->get('core')->prefix . 'hr_staff`.* + FROM + `' . $this->dbPool->get('core')->prefix . 'hr_staff` ' + . $search . 'LIMIT ' . $offset . ',' . $limit); + $sth->execute(); + + $result['list'] = $sth->fetchAll(); + + $sth = $this->dbPool->get('core')->con->prepare('SELECT FOUND_ROWS();'); + $sth->execute(); + + $result['count'] = $sth->fetchAll()[0][0]; + break; + } + + return $result; + } + + /** + * Get task stats. + * + * @return array + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getStats() + { + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e0c2ca --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Human Resources # diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php new file mode 100644 index 0000000..7bb11c7 --- /dev/null +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -0,0 +1,27 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +return ['Navigation' => [ + 'Departments' => 'Departments', + 'Employees' => 'Employees', + 'HumanResources' => 'Human Resources', + 'HumanResourceManagement' => 'Human Resources', + 'List' => 'List', + 'Planning' => 'Planning', + 'Positions' => 'Positions', + 'Shifts' => 'Shifts', + 'Staff' => 'Staff', + 'Structure' => 'Structure', +]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php new file mode 100644 index 0000000..81ff0c6 --- /dev/null +++ b/Theme/Backend/Lang/en.lang.php @@ -0,0 +1,28 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +return ['HumanResourceManagement' => [ + 'Department' => 'Department', + 'Departments' => 'Departments', + 'Employees' => 'Employees', + 'Name' => 'Name', + 'Parent' => 'Parent', + 'Personnel' => 'Personnel', + 'Position' => 'Position', + 'Shifts' => 'Shifts', + 'Staff' => 'Staff', + 'Status' => 'Status', + 'Vacation' => 'Vacation', +]]; diff --git a/Theme/Backend/department-create.tpl.php b/Theme/Backend/department-create.tpl.php new file mode 100644 index 0000000..e69de29 diff --git a/Theme/Backend/department-list.tpl.php b/Theme/Backend/department-list.tpl.php new file mode 100644 index 0000000..5fdb13a --- /dev/null +++ b/Theme/Backend/department-list.tpl.php @@ -0,0 +1,54 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ + +$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response); +$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); + +$footerView->setPages(1 / 25); +$footerView->setPage(1); +$footerView->setResults(1); + +echo $this->getData('nav')->render(); ?> + +
+ + + + + + + $value) : $c++; + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?> + +
getText('Departments'); ?>
getText('ID', 0, 0); ?> + getText('Name'); ?> + getText('Employees'); ?> + getText('Parent'); ?> +
render(); ?> +
getId(); ?> + getName(); ?> + + + + + +
getText('Empty', 0, 0); ?> + +
+
diff --git a/Theme/Backend/department-single.tpl.php b/Theme/Backend/department-single.tpl.php new file mode 100644 index 0000000..e69de29 diff --git a/Theme/Backend/planning-dashboard.tpl.php b/Theme/Backend/planning-dashboard.tpl.php new file mode 100644 index 0000000..d878407 --- /dev/null +++ b/Theme/Backend/planning-dashboard.tpl.php @@ -0,0 +1,98 @@ +
+

app->accountManager->get($request->getAccount())->getL11n()->lang['HumanResourceManagement']['Vacation'] ?>

+ +
+
+ +
+ + + + + + + +
+ asldkf +
+ asldkf +
+ asldkf +
+ asldkf +
+ asldkf +
+ + +
+
+ +
+

app->accountManager->get($request->getAccount())->getL11n()->lang['HumanResourceManagement']['Shifts'] ?>

+ +
+
+ +
+ + + + + + + +
+ asldkf +
+ asldkf +
+ asldkf +
+ asldkf +
+ asldkf +
+ + +
+
+ +
+

app->accountManager->get($request->getAccount())->getL11n()->lang['HumanResourceManagement']['Personnel'] ?>

+ +
+
+ +
+ + + + + + + +
+ asldkf +
+ asldkf +
+ asldkf +
+ asldkf +
+ asldkf +
+ + +
+
diff --git a/Theme/Backend/position-create.tpl.php b/Theme/Backend/position-create.tpl.php new file mode 100644 index 0000000..e69de29 diff --git a/Theme/Backend/position-list.tpl.php b/Theme/Backend/position-list.tpl.php new file mode 100644 index 0000000..e69de29 diff --git a/Theme/Backend/position-single.tpl.php b/Theme/Backend/position-single.tpl.php new file mode 100644 index 0000000..e69de29 diff --git a/Theme/Backend/staff-create.tpl.php b/Theme/Backend/staff-create.tpl.php new file mode 100644 index 0000000..7e0b03e --- /dev/null +++ b/Theme/Backend/staff-create.tpl.php @@ -0,0 +1,21 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ + +echo $this->getData('nav')->render(); ?> + diff --git a/Theme/Backend/staff-list.tpl.php b/Theme/Backend/staff-list.tpl.php new file mode 100644 index 0000000..2cabb72 --- /dev/null +++ b/Theme/Backend/staff-list.tpl.php @@ -0,0 +1,56 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ + +$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response); +$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); + +$footerView->setPages(1 / 25); +$footerView->setPage(1); +$footerView->setResults(1); + +$employees = $this->getData('employees'); + +echo $this->getData('nav')->render(); ?> + +
+ + + + + + + $value) : $c++; + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?> + +
getText('Staff'); ?>
getText('ID', 0, 0); ?> + getText('Name'); ?> + getText('Position'); ?> + getText('Department'); ?> + getText('Status'); ?> +
render(); ?> +
getId(); ?> + getNewestHistory()->getPosition(); ?> + getNewestHistory()->getPosition(); ?> + getNewestStatus()->getStatus(); ?> + + +
getText('Empty', 0, 0); ?> + +
+
diff --git a/Theme/Backend/staff-single.tpl.php b/Theme/Backend/staff-single.tpl.php new file mode 100644 index 0000000..d278a9c --- /dev/null +++ b/Theme/Backend/staff-single.tpl.php @@ -0,0 +1,159 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +echo $this->getData('nav')->render(); ?> + +
+

getText('Employee'); ?>

+
+ + + + + + + + + + + + + + + +
getText('Name'); ?> + getName3(); ?>, getName1(); ?> +
getText('Position'); ?> + Sailor +
getText('Department'); ?> + Sailor +
getText('Birthday'); ?> + 06.09.1934 +
getText('Email'); ?> + getEmail(); ?> +
Address + +
Private + SMALLSYS INC
795 E DRAGRAM
TUCSON AZ 85705
USA +
Work + SMALLSYS INC
795 E DRAGRAM
TUCSON AZ 85705
USA +
getText('Phone'); ?> + +
Private + +01 12345-4567 +
Mobile + +01 12345-4567 +
Work + +01 12345-4567 +
getText('Status'); ?> + getStatus(); ?> +
+ +
+
+ +
+

getText('Overview'); ?>

+
+ + + + + + + +
getText('Start'); ?> + getName3(); ?> +
getText('End'); ?> + getName3(); ?> +
getText('Hours'); ?> + getName3(); ?> +
getText('Vacation'); ?> + getName3(); ?> +
getText('Salary'); ?> + getName3(); ?> +
+ +
+
+ +
+ + + + + + + $value) : $c++; + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?> + +
getText('Working'); ?>
getText('Start'); ?> + getText('End'); ?> + getText('Position'); ?> + getText('Department'); ?> + getText('Salary'); ?> +
render(); ?> +
getId(); ?> + getNewestHistory()->getPosition(); ?> + getNewestHistory()->getPosition(); ?> + + +
getText('Empty', 0, 0); ?> + +
+
+ +
+ + + + + + + $value) : $c++; + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?> + +
getText('Timing'); ?>
getText('Start'); ?> + getText('End'); ?> + getText('Type'); ?> +
render(); ?> +
getId(); ?> + getNewestHistory()->getPosition(); ?> + getNewestHistory()->getPosition(); ?> + + +
getText('Empty', 0, 0); ?> + +
+
+ +
+

getText('Salary'); ?>

+
+ + + + + +
getText('Date'); ?> + getName3(); ?> +
getText('SalaryType'); ?> + getName3(); ?> +
getText('Amount'); ?> + getName3(); ?> +
+ +
+
diff --git a/img/module_teaser_small.png b/img/module_teaser_small.png new file mode 100644 index 0000000..f56e6ff Binary files /dev/null and b/img/module_teaser_small.png differ diff --git a/info.json b/info.json new file mode 100644 index 0000000..36b8752 --- /dev/null +++ b/info.json @@ -0,0 +1,45 @@ +{ + "name": { + "id": 1002400000, + "internal": "HumanResourceManagement", + "external": "OMS Human Resources" + }, + "version": "1.0.0", + "requirements": { + "phpOMS": "1.0.0", + "phpOMS-db": "1.0.0" + }, + "creator": { + "name": "Orange Management", + "website": "www.spl1nes.com" + }, + "description": "Human Resources module.", + "directory": "HumanResourceManagement", + "dependencies": { + "Admin" : "1.0.0", + "Organization" : "1.0.0" + }, + "providing": { + "Navigation": "*" + }, + "load": [ + { + "pid": [ + "41e01e60d64554c69eef1d1f6a45b0d1609c0345" + ], + "type": 4, + "for": 0, + "from": "HumanResourceManagement", + "file": "HumanResourceManagement" + }, + { + "pid": [ + "754a08ddf8bcb1cf22f310f09206dd783d42f7dd" + ], + "type": 5, + "from": "HumanResourceManagement", + "for": "Navigation", + "file": "Navigation" + } + ] +}