html .= "\n";
// cas particulier de la page article où l'article est greffé sur main
if(Director::$page_path->getLast()->getEndOfPath() === 'article'){
// pas censé arriver
if(!isset($_GET['id'])){
header('Location: ' . new URL);
die;
}
if($node->getAdoptedChild() == null){
$date = new \DateTime;
$article = new Article('', $date);
$new = new Node('new', 'i' . (string)$date->getTimestamp(), [], 0, null, null, $article);
}
else{
$new = $node->getAdoptedChild();
}
//$builder_name = $this->snakeToPascalCase($new->getName()) . 'Builder';
$builder_name = 'NewBuilder';
$builder = new $builder_name($new);
$this->html .= $builder->render();
}
else{
// si action = "modif_page", affiche des commandes pour modifier
if($_SESSION['admin'] && self::$modif_mode){
// ajouter un contrôle du champ in_menu
$this->viewEditBlocks($node);
}
$this->useChildrenBuilder($node);
}
$this->html .= "\n";
}
private function viewEditBlocks($node): void
{
// blocs disponibles
$blocs = ['Blog', 'Grille', 'Calendrier', 'Galerie']; // générer ça dynamiquement!
$blocs_true_names = ['blog', 'grid', 'calendar', 'galery'];
$options = '';
for($i = 0; $i < count($blocs); $i++){
$options .= '\n";
}
// blabla
/*$this->html .= '' . "\n";*/
// création d'un bloc
$this->html .= '
' . "\n";
$this->html .= '
Modifier un bloc
';
foreach($node->getChildren() as $child_node){
// renommage d'un bloc
$this->html .= '
'. "\n";
}
$this->html .= "
\n";
}
}