41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Data manipulation for the terms
|
|
*/
|
|
class TermsModel{
|
|
|
|
/**
|
|
* get html version form terms and conditions
|
|
* @return string html string for terms and conditions
|
|
*/
|
|
public function getTermsHTML($idTerms){
|
|
global $database;
|
|
$extraSql = intval($idTerms) === 0 ? "ORDER BY id DESC" : "WHERE id=$idTerms";
|
|
|
|
$sql = "SELECT html, version
|
|
FROM ".TABLES['terms']."
|
|
$extraSql
|
|
LIMIT 1";
|
|
$row = $database->fetchResultArray($sql);
|
|
|
|
return !empty($row) ? $row[0] : [];
|
|
}
|
|
|
|
/**
|
|
* get pdf version for terms and conditions
|
|
* @return bloob hex for pdf file
|
|
*/
|
|
public function pdfTerms($idTerms){
|
|
global $database;
|
|
$extraSql = intval($idTerms) === 0 ? "ORDER BY id DESC" : "WHERE id=$idTerms";
|
|
|
|
$sql = "SELECT pdf
|
|
FROM ".TABLES['terms']."
|
|
$extraSql
|
|
LIMIT 1";
|
|
$pdf = $database->fetchResultArray($sql);
|
|
|
|
return !empty($pdf) ? $pdf[0]['pdf'] : 'invalid pdf';
|
|
}
|
|
}
|