====== ConsentDao ====== **Layer:** ''DAO'' · **Source:** ''lib/dao/ConsentDao.php:22'' (lines 22–199) ---- class ConsentDao extends Dao ConsentDao Class Data Access Object for consent records ======= Docblock Metadata ======= ^ Tag ^ Value ^ | ''@category'' | Dao Class | | ''@author'' | Scriptlog | | ''@license'' | MIT | | ''@version'' | 1.0 | | ''@since'' | Since Release 1.0 | ======= Inheritance ======= ^ Relation ^ Type ^ Meaning ^ | extends | [[scriptlog:lib:core:dao|''Dao'']] | parent class/interface | ======= Constants (0) ======= //None.// ======= Properties (0) ======= //None declared.// ======= Methods (9) ======= ^ Visibility ^ Method ^ Summary ^ Line ^ | public | ''__construct()'' | Constructor | 27 | | public | ''recordConsent()'' | Record a new consent | 41 | | public | ''updateConsent()'' | Update existing consent record | 60 | | public | ''getLatestConsent()'' | Get latest consent by type | 76 | | public | ''getAllConsents()'' | Get all consent records | 99 | | public | ''getConsentsByIp()'' | Get consent history by IP | 120 | | public | ''hasConsented()'' | Check if user has given consent | 148 | | public | ''deleteOldConsents()'' | Delete consent records older than specified days | 176 | | public | ''totalConsentRecords()'' | Total consent records | 193 | ======== __construct() ======== public function __construct() //lines 27–30 (4)// Constructor //Takes no parameters.// ======== recordConsent() ======== public function recordConsent($consentType, $consentStatus, $ipAddress, $userAgent = null) //lines 41–51 (11)// Record a new consent ^ Parameter ^ Type ^ Default ^ Description ^ | ''$consentType'' | ''(untyped)'' | //required// | //none// | | ''$consentStatus'' | ''(untyped)'' | //required// | //none// | | ''$ipAddress'' | ''(untyped)'' | //required// | //none// | | ''$userAgent'' | ''(untyped)'' | ''null'' | //none// | **Returns:** ''(none declared)'' — int|bool ======== updateConsent() ======== public function updateConsent($id, $consentStatus) //lines 60–68 (9)// Update existing consent record ^ Parameter ^ Type ^ Default ^ Description ^ | ''$id'' | ''(untyped)'' | //required// | //none// | | ''$consentStatus'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — bool ======== getLatestConsent() ======== public function getLatestConsent($consentType) //lines 76–88 (13)// Get latest consent by type ^ Parameter ^ Type ^ Default ^ Description ^ | ''$consentType'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array|bool ======== getAllConsents() ======== public function getAllConsents($orderBy = 'ID') //lines 99–112 (14)// Get all consent records Sort column is validated against an explicit allow-list so raw input is never interpolated into the query. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$orderBy'' | ''(untyped)'' | '''ID''' | //none// | **Returns:** ''(none declared)'' — array|bool ======== getConsentsByIp() ======== public function getConsentsByIp($ipAddress) //lines 120–131 (12)// Get consent history by IP ^ Parameter ^ Type ^ Default ^ Description ^ | ''$ipAddress'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array|bool ======== hasConsented() ======== public function hasConsented($consentType, $ipAddress = null) //lines 148–168 (21)// Check if user has given consent Consent is evaluated per visitor when an IP address is provided; without one the check falls back to the site-global record (legacy). Semantics: returns true if the visitor has EVER accepted the given consent type. Retention is enforced separately by deleteOldConsents(), so a record pruned by the retention window simply no longer counts as an acceptance. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$consentType'' | ''(untyped)'' | //required// | //none// | | ''$ipAddress'' | ''(untyped)'' | ''null'' | //none// | **Returns:** ''(none declared)'' — bool ======== deleteOldConsents() ======== public function deleteOldConsents($days = 365) //lines 176–186 (11)// Delete consent records older than specified days ^ Parameter ^ Type ^ Default ^ Description ^ | ''$days'' | ''(untyped)'' | ''365'' | //none// | **Returns:** ''(none declared)'' — bool ======== totalConsentRecords() ======== public function totalConsentRecords() //lines 193–198 (6)// Total consent records //Takes no parameters.// **Returns:** ''(none declared)'' — int ======= Imports ======= ^ Alias ^ Fully-qualified name ^ | ''Dao'' | [[scriptlog:lib:core:dao|''Scriptlog\Core\Dao'']] | ---- //This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//