public function shouldDefaultTitleToPlaceholder()
 {
     // Empty string title
     $view = new \view\HTMLView("");
     assert($view->getTitle() !== null && $view->getTitle() === "Placeholder", "<p>Test failed, placeholder title was wrong</p>");
     echo "<p>Test successful</p>";
     // null title
     $view = new \view\HTMLView(null);
     assert($view->getTitle() !== null && $view->getTitle() === "Placeholder", "<p>Test failed, placeholder title was wrong</p>");
     echo "<p>Test successful</p>";
 }
 public function Run()
 {
     //CREATE OBJECTS OF THE VIEWS
     $lv = new \view\LayoutView();
     $hv = new \view\HTMLView();
     $fv = new \view\FooterView();
     $cv = new \view\CrawlerView();
     //CREATE OBJECT OF THE MODEL
     $cm = new \model\Crawler();
     if ($hv->IsPosted()) {
         $cv->renderMovies($cm->Scrape($hv->getURL()));
     } else {
         if ($cv->checkAvailableTable()) {
             if (isset($_SESSION['URL'])) {
                 $url = $_SESSION['URL'];
                 $cv->bookTable($cm->getTables($cv->getAvailableTable(), $url));
             }
         } else {
             $cv->resetMovies();
         }
     }
     $lv->render($hv, $cv, $fv);
 }
Exemple #3
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once "controller/MasterController.php";
require_once "view/HTMLView.php";
$mc = new \controller\MasterController();
$mc->handleInput();
$view = $mc->generateOutput();
$htmlView = new \view\HTMLView("utf-8");
echo $htmlView->getHTMLPage("I like it!", $view->getHTML());
Exemple #4
0
<?php

require_once 'controller/ScrapeController.php';
require_once 'view/HTMLView.php';
require_once 'view/ScrapeView.php';
require_once 'model/Scraper.php';
require_once 'model/MovieSuggestion.php';
$urlPostLocation = "url";
$submitPostLocation = "submit";
if (isset($_POST[$submitPostLocation])) {
    setcookie(\controller\ScrapeController::$baseURLlocation, $_POST[$urlPostLocation], time() + 60 * 60 * 24 * 30);
    $_COOKIE[\controller\ScrapeController::$baseURLlocation] = $_POST[$urlPostLocation];
    header("Location: scraper.php");
}
$view = new \view\HTMLView();
echo $view->getHTML("<form method='post'>\n                         <label>Ange URL: </label>\n                         <input type='text' class='form-control' style='max-width:30%;' name='" . $urlPostLocation . "'>\n                         <br>\n                         <input type='submit' class='btn btn-primary' name='" . $submitPostLocation . "'>\n                        </form>");
<?php

/**
 * Project in web development with PHP
 * @author Joakim Holmewi
 * With some references from Daniel Toll
 */
require_once "Settings.php";
require_once "exceptions/ImageException.php";
require_once "exceptions/ProductException.php";
require_once "exceptions/DatabaseException.php";
require_once "exceptions/CategoryException.php";
require_once "view/HTMLView.php";
require_once "controller/MasterController.php";
if (Settings::DISPLAY_ERRORS) {
    error_reporting(-1);
    ini_set('display_errors', 'ON');
}
session_start();
$mc = new \controller\MasterController();
$mc->doMasterControl();
$container = $mc->generateContainer();
$aside = $mc->generateAside();
$html = new \view\HTMLView();
$html->getHTML($container->getResponse(), $aside->getResponse());
<?php

require_once "model/Logger.php";
require_once "view/HTMLView.php";
require_once "controller/LogController.php";
session_start();
$nav = new \view\NavigationView();
$m = new \model\Logger();
$v = new \view\HTMLView($nav);
$c = new \controller\LogController($m, $v, $nav);
$c->doControl();
$container = $c->getView();
echo $v->getHTML($container);
Exemple #7
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once "HTMLView.php";
$htmlView = new \view\HTMLView("utf-8");
echo $htmlView->getHTMLPage("Hello", "<h2>hello world</h2>");
<?php

spl_autoload_register(function ($class) {
    $class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
    $filename = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . $class . '.php';
    if (file_exists($filename)) {
        require_once $filename;
    }
});
include_once "Settings.php";
$c = new \controller\Program();
$view = new \view\HTMLView();
$view->Render($c->Main());