<?php
/**
 * TermsController controlls the actions for the terms and conditions page
 */
class TermsController{
    private $model;

    function __construct(){
        $this->model = new TermsModel();
    }

    /**
     * output file content for pdf verison of terms and conditions
     * @return file pdf file content
     */
    public function pdfTerms(){
        header("Content-type: application/pdf");
        header("Content-Disposition: inline; filename=\"".APPLICATION_NAME." Terms and Conditions.pdf\"");
        $idTerms = isset($_REQUEST['idTerms']) ? $_REQUEST['idTerms'] : 0;
        echo $this->model->pdfTerms($idTerms);
    }

    /**
     * open shop page
     */
    public function getTerms(){
        $idTerms = isset($_REQUEST['idTerms']) ? $_REQUEST['idTerms'] : 0;
        echo json_encode($this->model->getTermsHTML($idTerms));
    }
}
