getName() . '.php'; // = news_block.php, actuellement identique à post_block.php
if(file_exists($viewFile))
{
if(!empty($node->getNodeData()->getData()))
{
extract($node->getNodeData()->getData());
}
// stratégie d'affichage du contenu (utilisation de méthodes ou de classe List, GridPresentation, etc)
$section_class = $node->getNodeData()->getPresentation()->getName(); // = list, grid , mosaic ou carousel
$cols_min_width = '';
if($section_class === 'grid'){
$min_width = $node->getNodeData()->getColsMinWidth();
$cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . (string)$min_width . 'px, 1fr));';
}
// ajouter un article
$new_article = '';
if($_SESSION['admin'])
{
$id = 'n' . $this->id_node;
$share_button = '

';
$new_button = '
';
$modify_js = 'onclick="openEditor(\'' . $id . '\')"';
$modify_article = '
' . "\n";
$up_js = 'onclick="switchPositions(\'' . $id . '\', \'up\')"';
$up_button = '
' . "\n";
$down_js = 'onclick="switchPositions(\'' . $id . '\', \'down\')"';
$down_button = '
' . "\n";
$delete_js = 'onclick="deleteArticle(\'' . $id . '\')"';
$delete_article = '
' . "\n";
$close_js = 'onclick="closeEditor(\'' . $id . '\')"';
$close_editor = '';
$submit_js = 'onclick="submitArticle(\'' . $id . '\', clone' . $this->id_node . ')"';
$submit_article = '';
$html = '';
$admin_buttons = $new_button . $modify_article . $up_button . $down_button . $delete_article . $close_editor . $submit_article;
// post vide mis là pour le bouton "Nouvel article" => déplace vers page "article"
ob_start();
require self::VIEWS_PATH . 'post.php'; // nécéssite $admin_buttons et $html
$new_article = ob_get_clean();
}
// articles existants
$this->useChildrenBuilder($node);
$content = $this->html;
ob_start();
require $viewFile; // utilise $content
$this->html = ob_get_clean(); // nouveau contenu
}
}
}