summaryrefslogtreecommitdiff
path: root/app/frontend/dto/CalendarDTO.php
blob: 18b376771ca80292398ac65afb7792140c04fb88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

Prado::using('Application.dto.BaseDTO');
Prado::using('Application.model.Calendar');

class CalendarDTO extends BaseDTO {

    public $ID;
    public $Name;
    public $Website;
    public $Image;
    public $Url;
    public $LastUpdated;
    public $GroupID;

    public function loadRecord(Calendar $calendarRecord) {
        $this->ID = $calendarRecord->UID;
        $this->Name = self::getTranslation(
            $calendarRecord->CustomName ?: $calendarRecord->Name,
            'Calendar.Name'
        );
        $this->Website = $calendarRecord->Website;
        $this->Image = $calendarRecord->CustomImageUrl;
        $this->Url = $calendarRecord->CustomUrl;
        $this->LastUpdated = $calendarRecord->LastUpdated;
        $this->GroupID = $calendarRecord->CategoryID;
    }

    public static function __compare(CalendarDTO $cal1, CalendarDTO $cal2) {
        return strcmp($cal1->Name, $cal2->Name);
    }

}

?>