/** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Model.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types; use ARUNOX\API\PHP; use ARUNOX\Database\Attribute; use ARUNOX\Database\BaseModel; #[PHP\Attributes\Database\Definitions\Table( "projects_types" )] #[PHP\Attributes\Database\Definitions\HashID( "ptyp" )] #[PHP\Attributes\Database\Definitions\Entity( Entity::class )] #[PHP\Attributes\Logs\Rules\Create()] #[PHP\Attributes\Logs\Rules\Update( "status", "Status wurde auf '%4\$t' gesetzt", Status::class )] class Model extends BaseModel { /* ### VARIABLES ################################################ # */ /* ### PUBLIC STATIC FUNCTIONS ################################## # */ /* ### PUBLIC STATIC LOG FUNCTIONS ############################## # */ } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => Controller::getRoute(), "label" => Controller::getLabelGroup(), "icon" => Controller::getIcon(), "menu" => "administration", ]; return $routes; }, 50 ); } } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Projects; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Projekttyp", "Projekttypen" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::Layers )] #[PHP\Attributes\Controller\Route( "types", Projects\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Projects\Types\Model::class )] #[PHP\Attributes\Controller\Notifications( "statuschanged.2", '{$LABEL.singular} wurde als Standard gesetzt' )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /projects/types * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /projects/types/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /projects/types/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /projects/types * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /projects/types/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /projects/types/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /projects/types * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/projects/types/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /projects/types/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/projects/types" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /projects/types/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /projects/types * @route.description REST-Konfiguration für Logbuch-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { $tabs = REST\Response::addWrapper( "details", static::getPlural() )->get(); $tabs = $tabs->addTab( "Übersicht", FALSE )->get() ->setIcon( static::getIcon() ) ->addHeadline( static::getPlural(), 2 ) ->addContent( static::restConfigTable() ) ->parent(); $tabs = $tabs->addTab( Projects\Types\Steps\API\v1\Controller::getPlural(), "steps" )->get() ->setIcon( Projects\Types\Steps\API\v1\Controller::getIcon() ) ->addHeadline( Projects\Types\Steps\API\v1\Controller::getPlural(), 2 ) ->addContent( Projects\Types\Steps\API\v1\Controller::restConfigTable() ) ->parent(); return $tabs; } /** * @internal rest * @method GET * * @route.path /projects/types/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "details", static::getSingular( "%t bearbeiten" ) ) ->setBacklink( "/projects/types" ) ->get() ->setApi( "/projects/types/{$hashid}" ) ->setAction( "/projects/types/{$hashid}", "PUT" ) ->addTab( "Kalender" )->get() ->addHeadline( "Kalender", 2 ) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", FALSE, "projects/types" )) ->parent() ->addCallable( [ Projects\Types\Steps\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /projects/types/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /projects/types/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTab( REST\Generator\Base\BaseGenerator $rest, $type ) : void { $rest->addTab( $type->title )->get() ->setIcon( static::getIcon() ) ->addContent( Projects\API\v1\Controller::restConfigTable( $type->getHashId() ) ) ; } public static function restConfigTable() : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( "/projects/types" ) ->setAction( "/projects/types/{hashid}" ) ->setOrder( "title", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "projects/types" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [ "options" => Projects\Types\Status::getAll(), ], "status", [], "projects/types", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "title", TRUE, TRUE, TRUE, "projects/types" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_create", TRUE, FALSE, TRUE, "projects/types" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "projects/types" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "projects/types", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "projects/types", "hashid" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "projects/types" )) ; return $rest->top()->getChildren(); } } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Entity.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types; use ARUNOX\API\PHP; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Database\Attributes( "status", Status::class )] #[PHP\Attributes\Database\Attributes( "date_edit" )] #[PHP\Attributes\Database\Attributes( "date_create" )] #[PHP\Attributes\Database\Definitions\Model( Model::class )] class Entity extends BaseEntity { /* ### VARIABLES ################################################ # */ /* ### PUBLIC FUNCTIONS ######################################### # */ public function getSteps() : array { return Steps\Model::getByOrigin( $this->id ); } } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Steps/Model.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types\Steps; use ARUNOX\API\PHP; use ARUNOX\Plugins\Projects; use ARUNOX\Database\Attribute; use ARUNOX\Database\BaseModel; #[PHP\Attributes\Database\Definitions\Table( "projects_types_steps" )] #[PHP\Attributes\Database\Definitions\HashID( "ptstp" )] #[PHP\Attributes\Database\Definitions\Entity( Entity::class )] class Model extends BaseModel { /* ### VARIABLES ################################################ # */ /* ### PUBLIC STATIC FUNCTIONS ################################## # */ public static function getByOrigin( int|string|array $origin, null|string $column = NULL ) { $origin = Projects\Types\Model::getValue( $origin ); $where = [ "origin_id" => $origin, "ORDERBY" => "status asc, sorting asc", ]; if( $column ) return Model::getAllValue( $where, $column ); return Model::getAll( $where ); } public static function getAsOptions( string|array $labelColumn = "name", ?string $valueColumn = NULL, array $excluded = [] ) : array { return static::getAsOptionsArray( [], $labelColumn, $valueColumn, $excluded, function( $option, $item ) { $option["icon"] = $item->status->icon ?? $option["icon"] ?? NULL; $option["color"] = $item->status->color ?? $option["color"] ?? NULL; $option["emoji"] = $item->status->emoji ?? $option["emoji"] ?? NULL; return $option; }); } /* ### PUBLIC STATIC LOG FUNCTIONS ############################## # */ } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Steps/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types\Steps\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); } } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Steps/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types\Steps\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Projects; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Schritt", "Schritte", "Fortschritt" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::BarChartSteps )] #[PHP\Attributes\Controller\Route( "steps", Projects\Types\API\v1\Controller::class )] #[PHP\Attributes\Database\Definitions\Model( Projects\Types\Steps\Model::class )] class Controller extends BaseController { /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /projects/types/steps * @route.description Listet alle Logeinträge */ public static function getAllPrepared() : array { return parent::getAllPrepared(); } /** * @api * @method GET * * @route.path /projects/types/{origin}/steps * @route.description Listet alle Logeinträge */ public static function getByOriginPrepared( string $origin ) : array { return parent::getByOriginPrepared( $origin ); } /** * @api * @method GET * * @route.path /projects/types/steps/{hashid} * @route.description Gibt einen einzelnen Logeintrag anhand der ID zurück */ public static function getPrepared( string $hashid ) : BaseEntity | HTTP\Response { return parent::getPrepared( $hashid ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /projects/types/steps/{hashid} * @route.description Speichert Änderungen an einem bestehenden Termin */ public static function savePrepared( string $hashid, array $data ) : HTTP\Response { return parent::savePrepared( $hashid, $data ); } /** * @api * @method POST * * @route.path /projects/types/steps * @route.description Erstellt einen neuen Kalender */ public static function createPrepared( array $data ) : HTTP\Response { return parent::createPrepared( $data ); } /** * @api * @method DELETE * * @route.path /projects/types/steps/{hashid} * @route.description Löscht ein Logeintrag anhand der ID */ public static function deletePrepared( string $hashid ) : HTTP\Response { return parent::deletePrepared( $hashid ); } /** * @api * @method PATCH * * @route.path /projects/types/steps/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Kalenders */ public static function toggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::toggleStatusPrepared( $hashid ); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method POST * * @route.path /projects/types/steps * @route.description REST-Antwort nach dem Erstellen eines Kalenders */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::createPrepared( $data ); if( $result->isStatus( 200 ) ) { REST\Response::closeModals(); REST\Response::redirect( "/projects/types/steps/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /projects/types/steps/{hashid} * @route.description REST-Antwort nach dem Löschen eines Logeintrag */ public static function restResponseDelete( string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::deletePrepared( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/projects/types/steps" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /projects/types/steps/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Kalenders */ public static function restResponseToggleStatusPrepared( string $hashid ) : HTTP\Response { return parent::restResponseToggleStatusPrepared( $hashid ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /projects/types/steps/{hashid} * @route.description REST-Konfiguration für Detailansicht eines Logeintrags */ public static function restConfigDetails( string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", static::getSingular( "%t bearbeiten" ) ) ->get() ->setApi( "/projects/types/steps/{$hashid}" ) ->setAction( "/projects/types/steps/{$hashid}", "PUT" ) ->addTab( static::getSingular() )->get() ->addChildren( static::restConfigInputs() ) ->parent() ->addCallable( [ Projects\Entries\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Projects\Tasks\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ); } /** * @internal rest * @method GET * * @route.path /projects/types/steps/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreatePrepared() : REST\Generator\Base\BaseGenerator { return parent::restConfigCreatePrepared(); } /** * @internal rest * @method GET * * @route.path /projects/types/{origin}/steps/create * @route.description REST-Konfiguration für das Erstellen eines Kalenders (Formular) */ public static function restConfigCreateByOriginPrepared( bool | string $origin = FALSE ) : REST\Generator\Base\BaseGenerator { return parent::restConfigCreateByOriginPrepared( $origin ); } /** * @internal rest * @method GET * * @route.path /projects/types/steps/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Logeintrags */ public static function restConfigDeletePrepared( string $hashid ) : REST\Generator\Base\BaseGenerator { return parent::restConfigDeletePrepared( $hashid ); } /* ### PUBLIC REST EXTENSION FUNCTIONS ########################## # */ public static function restConfigTab( REST\Generator\Base\BaseGenerator $rest, null|string $origin = NULL ) : void { $rest->addTab( static::getPlural(), "steps" )->get() ->setIcon( static::getIcon() ) ->addContent( static::restConfigTable( $origin ) ) ; } public static function restConfigTable( null|string $origin = NULL ) : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Table::create() ->setApi( "/projects/types/{$origin}/steps" ) ->setAction( "/projects/types/steps/{hashid}" ) ->setOrder( "status", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "projects/types/{$origin}/steps" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [ "options" => Projects\Types\Steps\Status::getAll(), ], "status", [], "projects/types/steps", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "title", TRUE, TRUE, TRUE, "projects/types/steps" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "description", TRUE, TRUE, TRUE, "projects/types/steps" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->amount", [], "sorting", TRUE, TRUE, TRUE, "projects/types/steps" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_create", TRUE, FALSE, TRUE, "projects/types/steps" )) ; return $rest; } public static function restConfigInputs() : array { $rest = REST\Generator\Data\Form::create() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "title", TRUE, "projects/types/steps" )) ->addField(...Hooks::filter( "rest.generator::control.type->number", [], "sorting", TRUE, "projects/types/steps" )) ->addField(...Hooks::filter( "rest.generator::control.type->textarea", [], "description", FALSE, "projects/types/steps" )) ; return $rest->top()->getChildren(); } public static function restConfigOrigin( bool|string $hashid ) : REST\Generator\Base\BaseGenerator { $rest = REST\Generator\Data\Form::create(); if( $hashid === FALSE ) { return $rest->addField(...Hooks::filter( "rest.generator::control.type->select", [ "options" => Projects\Types\Model::getAsOptions( "title" ), ], "origin_id", TRUE, FALSE, "projects/types/steps" )); } $origin = Projects\Types\Model::getValue( $hashid, "id" ); return $rest->addField(...Hooks::filter( "rest.generator::control.type->hidden", [], "origin_id", $origin ?? $hashid, "projects/types/steps" )); } } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Steps/Entity.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Projects\Types\Steps; use ARUNOX\API\PHP; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Database\Attributes( "status", Status::class )] #[PHP\Attributes\Database\Attributes( "date_edit" )] #[PHP\Attributes\Database\Attributes( "date_create" )] #[PHP\Attributes\Database\Definitions\Model( Model::class )] class Entity extends BaseEntity { /* ### VARIABLES ################################################ # */ /* ### PUBLIC FUNCTIONS ######################################### # */ } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Steps/Status.php **/ value} ($this->label)"; } } /** Datei: plugins/projects/library/ARUNOX/Plugins/Projects/Types/Status.php **/