getName() . '.php'; if(file_exists($viewFile)) { // id (timestamp) if(!empty($node->getAttributes())) { extract($node->getAttributes()); } // html, date $title = $node->getArticle()->getTitle(); $preview = $node->getArticle()->getPreview(); $id = $node->getArticleTimestamp(); $content = ''; // page article unique if(Director::$page_path->getLast()->getEndOfPath() === 'article') { $content = $node->getArticle()->getContent(); $from_to_button = '
'; } // page d'accueil (avec des news) else { $from_to_button = ''; } $date_object = $node->getArticle()->getDateTime(); // class DateTime $date = 'le ' . str_replace(':', 'h', $date_object->format('d-m-Y à H:i')); // partage $share_link = new URL(['page' => CURRENT_PAGE], $id); isset($_GET['id']) ? $share_link->addParams(['id' => $_GET['id']]) : ''; $share_js = 'onclick="copyInClipBoard(\'' . $share_link . '\')"'; $share_button = '' . "\n"; // modifier un article $admin_buttons = ''; if($_SESSION['admin']) { if(Director::$page_path->getLast()->getEndOfPath() === 'article'){ $modify_js = 'onclick="openEditor(\'' . $id . '\', \'article\')"'; $modify_article = '' . "\n"; $up_button = ''; $down_button = ''; $delete_js = 'onclick="deleteArticle(\'' . $id . '\', \'' . CURRENT_PAGE . '\')"'; $delete_article = '' . "\n"; $close_js = 'onclick="closeEditor(\'' . $id . '\', \'article\')"'; $close_editor = ''; $submit_js = 'onclick="submitArticle(\'' . $id . '\', \'article\')"'; $submit_article = ''; } else{ $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_editor = ''; $submit_article = ''; $submit_article = ''; } $admin_buttons = $modify_article . $up_button . $down_button . $delete_article . $close_editor . $submit_article; } ob_start(); require($viewFile); $this->html .= ob_get_clean(); } } }