From 0f69294121ee68616961af02bcfc0c7662cd3ba5 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 26 Feb 2016 14:59:53 +0100 Subject: * ActiveRecords model --- app/php/model/Calendar.php | 40 ++++++++++++++++++++++++++++++++++++++++ app/php/model/Category.php | 27 +++++++++++++++++++++++++++ app/php/model/Entry.php | 40 ++++++++++++++++++++++++++++++++++++++++ app/php/model/User.php | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 app/php/model/Calendar.php create mode 100644 app/php/model/Category.php create mode 100644 app/php/model/Entry.php create mode 100644 app/php/model/User.php (limited to 'app/php') diff --git a/app/php/model/Calendar.php b/app/php/model/Calendar.php new file mode 100644 index 0000000..4438572 --- /dev/null +++ b/app/php/model/Calendar.php @@ -0,0 +1,40 @@ + 'UID', + 'url' => 'Url', + 'name' => 'Name', + 'website' => 'Website', + 'visible' => 'Visible', + 'last_updated' => 'LastUpdated', + '_category' => 'CategoryID' + ]; + + public static $RELATIONS = [ + 'Entries' => [self::HAS_MANY, 'Entry', '_calendar'], + 'Category' => [self::BELONGS_TO, 'Category', '_category'] + ]; + + public static function finder($className=__CLASS__) { + return parent::finder($className); + } + +} + +?> diff --git a/app/php/model/Category.php b/app/php/model/Category.php new file mode 100644 index 0000000..03a368a --- /dev/null +++ b/app/php/model/Category.php @@ -0,0 +1,27 @@ + 'ID', + 'name' => 'Name' + ]; + + public static $RELATIONS = [ + 'Calendars' => [self::HAS_MANY, 'Calendar', '_category'] + ]; + + public static function finder($className=__CLASS__) { + return parent::finder($className); + } + +} + +?> diff --git a/app/php/model/Entry.php b/app/php/model/Entry.php new file mode 100644 index 0000000..85d522f --- /dev/null +++ b/app/php/model/Entry.php @@ -0,0 +1,40 @@ + 'ID', + 'uid' => 'UID', + 'begin_date' => 'BeginDate', + 'end_date' => 'EndDate', + 'all_day' => 'AllDay', + 'name' => 'Name', + 'location' => 'Location', + '_calendar' => 'CalendarID' + ]; + + public static $RELATIONS = [ + 'Calendar' => [self::BELONGS_TO, 'Calendar', '_calendar'] + ]; + + public static function finder($className=__CLASS__) { + return parent::finder($className); + } + +} + +?> diff --git a/app/php/model/User.php b/app/php/model/User.php new file mode 100644 index 0000000..8a33f67 --- /dev/null +++ b/app/php/model/User.php @@ -0,0 +1,33 @@ + 'ID', + 'login' => 'Login', + 'password' => 'Password', + 'is_admin' => 'IsAdmin', + 'last_login' => 'LastLogin' + ]; + + public static $RELATIONS = [ + 'Calendars' => [self::MANY_TO_MANY, 'Calendar', 'user_selections'] + ]; + + public static function finder($className=__CLASS__) { + return parent::finder($className); + } + +} + +?> -- cgit v1.2.3