diff --git a/config/packages/mapping/ActorEntity.orm.xml b/config/packages/mapping/ActorEntity.orm.xml new file mode 100644 index 0000000..825bfce --- /dev/null +++ b/config/packages/mapping/ActorEntity.orm.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/config/packages/mapping/WorkspaceEntity.orm.xml b/config/packages/mapping/WorkspaceEntity.orm.xml deleted file mode 100644 index 096c084..0000000 --- a/config/packages/mapping/WorkspaceEntity.orm.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/config/routes/main.yaml b/config/routes/main.yaml deleted file mode 100644 index 0fa6856..0000000 --- a/config/routes/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ -app_workspace_selector: - path: / - controller: App\Controller\MainController::workspaceSelector \ No newline at end of file diff --git a/config/routes/settings.yaml b/config/routes/settings.yaml new file mode 100644 index 0000000..79a3d25 --- /dev/null +++ b/config/routes/settings.yaml @@ -0,0 +1,3 @@ +settings_actors: + path: / + controller: App\Controller\SettingsController::actors \ No newline at end of file diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php deleted file mode 100644 index 895674b..0000000 --- a/src/Controller/MainController.php +++ /dev/null @@ -1,36 +0,0 @@ -getDoctrine()->getManager(); - /** @var workspaceRepository WorkspaceRepository */ - $workspaceRepository = $entityManager->getRepository(WorkspaceEntity::class); - $workspaces = $workspaceRepository->findAll(); - - // Add workspace form - $workspaceAddForm = $this->createNamedCustomForm("addForm", WorkspaceAddForm::class); - - return $this->render("workspaceSelector.html.twig", [ - "workspaces" => $workspaces, - "workspaceAddForm" => $workspaceAddForm, - ]); - } -} \ No newline at end of file diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php new file mode 100644 index 0000000..dc90897 --- /dev/null +++ b/src/Controller/SettingsController.php @@ -0,0 +1,19 @@ +render("actors.html.twig", [ + ]); + } +} + diff --git a/src/Entity/ActorEntity.php b/src/Entity/ActorEntity.php new file mode 100644 index 0000000..78f7075 --- /dev/null +++ b/src/Entity/ActorEntity.php @@ -0,0 +1,178 @@ +id; + } + + /** + * Set the ID of the entity + *
This should not be done after creation + * + * @param string $id + * @return self + */ + public function setId(string $id): self + { + $this->id = $id; + + return $this; + } + + /** + * Generate and save a random ID + * + * @return string Generated ID + */ + public function generateId(): string + { + // Generate ID + $base = array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9')); + $id = ""; + for ($index = 0; $index < 8; $index ++) { + $id .= $base[rand(0, count($base) - 1)]; + } + + // Save and return + $this->setId($id); + return $id; + } + + /** + * Get the first name of the actor + * + * @return string + */ + public function getFirstName(): string + { + return $this->firstName; + } + + /** + * Set the first name of the actor + * + * @param string $firstName + * @return self + */ + public function setFirstName(string $firstName): self + { + $this->firstName = $firstName; + + return $this; + } + + /** + * Get the last name of the actor + * + * @return string + */ + public function getLastName(): string + { + return $this->lastName; + } + + /** + * Set the last name of the actor + * + * @param string $lastName + * @return self + */ + public function setLastName(string $lastName): self + { + $this->lastName = $lastName; + + return $this; + } + + /** + * Get the formated version of the full name (Firstname LASTNAME) + * + * @return string + */ + public function getFullName(): string + { + return printf("%s %s", ucfirst(strtolower($this->firstName)), strtoupper($this->lastName)); + } + + /** + * Get the nickname of the actor + * + * @return string|null + */ + public function getNickname(): ?string + { + return $this->nickname; + } + + /** + * Set the nickname name of the actor + * + * @param string $nickname + * @return self + */ + public function setNickname(?string $nickname): self + { + $this->nickname = $nickname; + + return $this; + } + + /** + * Get the display name of the actor. Equals nickname if set, Firstname LASTNAME else. + * @return string + */ + public function getDisplayName(): string + { + return is_null($this->nickname) ? $this->nickname : $this->getFullName(); + } + + /** + * If the actor is active + * + * @return bool + */ + public function getActive(): bool + { + return $this->active; + } + + /** + * Set the active status of the actor + * + * @param bool $active + * @return self + */ + public function setActive(bool $active): self + { + $this->active = $active; + + return $this->active; + } +} \ No newline at end of file diff --git a/src/Entity/WorkspaceEntity.php b/src/Entity/WorkspaceEntity.php deleted file mode 100644 index c7c2f5e..0000000 --- a/src/Entity/WorkspaceEntity.php +++ /dev/null @@ -1,104 +0,0 @@ -id; - } - - /** - * Set the ID of the workspace - *
This should not be done after creation - * - * @param string $id - * @return self - */ - public function setId(string $id): self - { - $this->id = $id; - - return $this; - } - - /** - * Generate and save a random ID - * - * @return string Generated ID - */ - public function generateId(): string - { - // Generate ID - $base = array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9')); - $id = ""; - for ($index = 0; $index < 8; $index ++) { - $id .= $base[rand(0, count($base) - 1)]; - } - - // Save and return - $this->setId($id); - return $id; - } - - /** - * Get the name of the workspace - * - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * Set a new name for the workspace - * @param string $name - * @return self - */ - public function setName(string $name): self - { - $this->name = $name; - - return $this; - } - - /** - * If the workspace is active - * - * @return bool - */ - public function getActive(): bool - { - return $this->active; - } - - /** - * Set the active status of the workspace - * - * @param bool $active - * @return self - */ - public function setActive(bool $active): self - { - $this->active = $active; - - return $this->active; - } -} \ No newline at end of file diff --git a/src/Repository/ActorRepository.php b/src/Repository/ActorRepository.php new file mode 100644 index 0000000..13df440 --- /dev/null +++ b/src/Repository/ActorRepository.php @@ -0,0 +1,12 @@ + -
  • {% include "_includes/html/component/navLink.html.twig" with {route: "app_workspace_selector", icon: "icofont-briefcase-2", name: "Workspaces"} %} -
  • +
  • {% include "_includes/html/component/navLink.html.twig" with {route: "settings_actors", icon: "icofont-people", name: "Acteurs"} %} +
  • diff --git a/templates/actors.html.twig b/templates/actors.html.twig new file mode 100644 index 0000000..b17996f --- /dev/null +++ b/templates/actors.html.twig @@ -0,0 +1,38 @@ +{% extends '_includes/html/base.html.twig' %} + +{% set page="Acteurs" %} + +{% block pageContent %} +
    +
    +
    +

    Acteurs

    +
    +
    + + + + + + + + + + + + + +
    IDNomPrénomSurnomActif
    +
    +
    +
    +
    +
    +
    +

    Ajouter un acteur

    +
    +
    +
    +
    +
    +{% endblock %} \ No newline at end of file diff --git a/templates/workspaceSelector.html.twig b/templates/workspaceSelector.html.twig deleted file mode 100644 index ccbf5ed..0000000 --- a/templates/workspaceSelector.html.twig +++ /dev/null @@ -1,48 +0,0 @@ -{% extends '_includes/html/base.html.twig' %} - -{% set page="Workspaces" %} - -{% block pageContent %} -
    -
    -
    -

    Workspaces

    -
    -
    - - - - - - - - - - - {% for workspace in workspaces %} - - - - - - - {% endfor %} - -
    IDNomActif
    - {{ workspace.id }} - {{ workspace.name }}{% if workspace.active %} {% endif %}
    -
    -
    -
    -
    -
    -
    -

    Ajouter un workspace

    -
    -
    - {% include '_includes/html/genericForm.html.twig' with {'form': workspaceAddForm} only %} -
    -
    -
    -{% endblock %} \ No newline at end of file