diff options
Diffstat (limited to 'src/view/MainBuilder.php')
-rw-r--r-- | src/view/MainBuilder.php | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/view/MainBuilder.php b/src/view/MainBuilder.php index a478412..4bd79c3 100644 --- a/src/view/MainBuilder.php +++ b/src/view/MainBuilder.php | |||
@@ -54,13 +54,25 @@ class MainBuilder extends AbstractBuilder | |||
54 | { | 54 | { |
55 | $viewFile = self::VIEWS_PATH . $node->getName() . '.php'; // mode modification uniquement | 55 | $viewFile = self::VIEWS_PATH . $node->getName() . '.php'; // mode modification uniquement |
56 | 56 | ||
57 | // blocs disponibles | 57 | // blocs disponibles, même liste dans post.php |
58 | $blocs = ['Blog', 'Grille', 'Calendrier', 'Galerie', 'Formulaire']; // générer ça dynamiquement! | 58 | $blocks = [ // créer une classe pour ça? |
59 | $blocs_true_names = ['blog', 'grid', 'calendar', 'galery', 'form']; // même liste dans post.php | 59 | ['type' => 'blog', 'name' => 'Blog'], |
60 | ['type' => 'grid', 'name' => 'Grille'], | ||
61 | ['type' => 'calendar', 'name' => 'Calendrier'], | ||
62 | ['type' => 'galery', 'name' => 'Galerie'], | ||
63 | ['type' => 'form', 'name' => 'Formulaire']]; | ||
64 | |||
65 | function getBlockName(array $blocks, string $type){ // créer une classe pour ça? | ||
66 | for($i=0; $i < count($blocks); $i++){ | ||
67 | if($blocks[$i]['type'] === $type){ | ||
68 | return $blocks[$i]['name']; | ||
69 | } | ||
70 | } | ||
71 | } | ||
60 | 72 | ||
61 | $options = ''; | 73 | $options = ''; |
62 | for($i = 0; $i < count($blocs); $i++){ | 74 | for($i = 0; $i < count($blocks); $i++){ |
63 | $options .= '<option value= "' . $blocs_true_names[$i] . '">' . $blocs[$i] . "</option>\n"; | 75 | $options .= '<option value= "' . $blocks[$i]['type'] . '">' . $blocks[$i]['name'] . "</option>\n"; |
64 | } | 76 | } |
65 | 77 | ||
66 | // blabla | 78 | // blabla |
@@ -85,8 +97,7 @@ class MainBuilder extends AbstractBuilder | |||
85 | foreach($node->getChildren() as $child_node){ | 97 | foreach($node->getChildren() as $child_node){ |
86 | // renommage d'un bloc | 98 | // renommage d'un bloc |
87 | $bloc_edit .= '<div id="bloc_edit_' . $child_node->getId() . '"> | 99 | $bloc_edit .= '<div id="bloc_edit_' . $child_node->getId() . '"> |
88 | <p><label>Type <i>' . $child_node->getName() . '</i>, </label> | 100 | <p><label for="bloc_rename_' . $child_node->getId() . '"><b>' . getBlockName($blocks, $child_node->getName()) . '</b></label> |
89 | <label for="bloc_rename_' . $child_node->getId() . '">Titre</label> | ||
90 | <input type="text" id="bloc_rename_' . $child_node->getId() . '" name="bloc_rename_title" value="' . $child_node->getNodeData()->getdata()['title'] . '" required> | 101 | <input type="text" id="bloc_rename_' . $child_node->getId() . '" name="bloc_rename_title" value="' . $child_node->getNodeData()->getdata()['title'] . '" required> |
91 | <button onclick="renamePageBloc(' . $child_node->getId() . ')">Renommer</button>'. "\n"; | 102 | <button onclick="renamePageBloc(' . $child_node->getId() . ')">Renommer</button>'. "\n"; |
92 | // déplacement d'un bloc | 103 | // déplacement d'un bloc |