<?php
require_once DAO . 'TopicDao.php';
require_once DTO . 'MenuDto.php';
final class Menu extends Action {
  private $dto;
  public function __construct() {
    $this->checkAccess();
    $this->dto = new MenuDto();
  }
  protected function getDto() {
    return $this->dto;
  }
  public function index() {
    $dao = new TopicDao();
    $this->dto->topic = mysql_fetch_assoc($dao->getByPk(1))['topic'];
    return new forward();
  }
  public function delete() {
    header('Content-Type: application/json; charset=utf-8');
    $dao = new TopicDao();
    $dao->update('', 1);
    echo '{"result" : "OK"}';
    return new Direct();
  }
  public function update() {
    header('Content-Type: application/json; charset=utf-8');
    $dao = new TopicDao();
    $dao->update($this->dto->topic, 1);
    echo '{"result" : "OK"}';
    return new Direct();
  }
}
// EOF.
