<?php
namespace nur\v\base;

use nur\co;
use nur\v\v;
use nur\v\vo;

/**
 * Trait TBasicPage: implémentation réutilisable de {@link IBasicPage}
 */
trait TBasicPage {
  function beforePrintStartHtml(): void {}
  function afterPrintStartHtml(): void {}

  ##

  function beforePrintStartHead(): void {}
  function afterPrintStartHead(): void {}

  function beforePrintCssLinks(): void {}
  function afterPrintCssLinks(): void {}

  function beforePrintCss(): void {}
  function printCss(): void {}
  function afterPrintCss(): void {}

  function beforePrintJsLinks(): void {}
  function afterPrintJsLinks(): void {}

  function beforePrintJs(): void {}
  function printJs(): void {}
  function afterPrintJs(): void {}

  function beforePrintJquery(): void {}
  function printJquery(): void {}
  function afterPrintJquery(): void {}

  function beforePrintScript(): void {}
  function printScript(): void {}
  function afterPrintScript(): void {}

  function getTitle(): ?string { return $this->configGet("title"); }
  function beforePrintHeadTitle(): void {}
  function printHeadTitle(): void {
    co::_print(v::tag("title", $this->getTitle(), true));
  }
  function afterPrintHeadTitle(): void {}

  function beforePrintEndHead(): void {}
  function afterPrintEndHead(): void {}

  ##

  function beforePrintStartBody(): void {}
  function afterPrintStartBody(): void {}

  function beforePrintContent(): void {}
  function printTitle(): void {
    vo::h1($this->getTitle());
  }
  function printContent(): void {
    $this->print();
  }
  function afterPrintContent(): void {}

  function beforePrintEndBody(): void {}
  function afterPrintEndBody(): void {}

  ##

  function beforePrintEndHtml(): void {}
  function afterPrintEndHtml(): void {}
}
