public static function getInstance() { if (!isset(ForumManager::$instance)) { ForumManager::$instance = new ForumManager(); } return ForumManager::$instance; }
/** * Constructeur de la Classe, * @param id Identifiant du Forum à afficher * @param nom Nom du forum à afficher * @param page Page à afficher dans le cas de plusieur page de Topic * @since 1.0.0 */ public function __construct($id, $nom, $page = 0) { $this->id = $id; $this->nom = $nom; $this->page = $page; echo 'page :' . $this->page; $manager = ForumManager::getInstance(); $this->forum = $manager->getById($id); $title = "forum " . $this->nom; $topics = $this->forum->getTopics(); $css_file_name = "forum.css"; $CSS_DIR = ROOT_PATH; //$_SERVER["DOCUMENT_ROOT"]."Forum/Forum/css/"; //Appele de la vue qui est un simple fichier HTML avec quelques echo include_once HTDOCS_PATH . 'view/ForumView.php'; }
private function __construct() { $this->forumManager = ForumManager::getInstance(); $this->categories = CategorieDAO::getInsance()->getAll(); $this->bindAllForum(); }
$bool_str = $isBlocked ? "true" : "false"; printf("Forum Post %d is blocked: %s\n", 1667447439, $bool_str); //unblock forum post printf("Unblocking post %d\n", 1667447439); $forumPost2->unblock(); $isBlocked = $forumPost2->isBlocked(); $bool_str = $isBlocked ? "true" : "false"; printf("Forum Post %d is blocked: %s\n", 1667447439, $bool_str); //////////////////////////// //DocumentManager UNIT TESTS //////////////////////////// printf("/////////////////////////////////\n"); printf("STARTING ForumManager UNIT TESTS\n"); printf("/////////////////////////////////\n"); //show all topics printf("Show all forum topics:\n"); $topics = ForumManager::showTopics(); while ($row = $topics->fetch_assoc()) { printf("%s\n", $row['topic_name']); } //search posts by topic $topic_id = 1895578464; printf("Show all forum posts for topic %d\n", $topic_id); $posts = ForumManager::getPostsByTopic($topic_id); while ($row = $posts->fetch_assoc()) { printf("%s\n", $row['post_content']); } ?> </body> </html>