CMS
Version 3.9
video_gallery.inc
Go to the documentation of this file.
1
<?php
7
/**************************************************************
8
9
Copyright (c) 2010 Sonjara, Inc
10
11
Permission is hereby granted, free of charge, to any person
12
obtaining a copy of this software and associated documentation
13
files (the "Software"), to deal in the Software without
14
restriction, including without limitation the rights to use,
15
copy, modify, merge, publish, distribute, sublicense, and/or sell
16
copies of the Software, and to permit persons to whom the
17
Software is furnished to do so, subject to the following
18
conditions:
19
20
The above copyright notice and this permission notice shall be
21
included in all copies or substantial portions of the Software.
22
23
Except as contained in this notice, the name(s) of the above
24
copyright holders shall not be used in advertising or otherwise
25
to promote the sale, use or other dealings in this Software
26
without prior written authorization.
27
28
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
30
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
32
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
33
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35
OTHER DEALINGS IN THE SOFTWARE.
36
37
*****************************************************************/
38
39
class
VideoGallery
extends
DataItem
40
{
41
// Fields
42
43
var
$fields
= array(
"video_gallery_id"
=> Number,
44
"gallery_name"
=> String,
45
"identifier"
=> String,
46
"description"
=> HTML,
47
"keywords"
=> String,
48
"hidden"
=> Boolean,
49
"owner_id"
=> Number,
50
"read_access"
=> String,
51
"write_access"
=> String,
52
"published"
=> Boolean,
53
"last_modified"
=> Timestamp);
54
55
// Relations
56
57
var
$relations
= array(
"Videos"
=>
Video
,
58
"Owner"
=>
""
);
59
60
61
function
Videos
(
$constraint
=
""
)
62
{
63
return
$this->getRelatedList(
Video
,
""
,
$constraint
);
64
}
65
66
function
Owner
()
67
{
68
$mgr
=
new
UserManager
();
69
return
$mgr
->getUser($this->
owner_id
);
70
}
71
72
function
getOwnerName
()
73
{
74
return
$this->
Owner
()->getFullName();
75
}
76
77
function
countVideos
(
$constraint
=
""
)
78
{
79
if
(
$constraint
)
80
{
81
$constraint
.=
" AND "
;
82
}
83
else
84
{
85
$constraint
=
"WHERE "
;
86
}
87
$constraint
.=
"video_gallery_id={$this->video_gallery_id}"
;
88
return
queryValue(
Video
,
"COUNT(1)"
,
$constraint
);
89
}
90
91
function
getGalleryDirectory
()
92
{
93
return
VideoManager::getVideoFolder
() . DIRECTORY_SEPARATOR .
"gallery_{$this->video_gallery_id}"
;
94
}
95
96
static
function
findByIdentifier
(
$identifier
)
97
{
98
$match = Query::create(
VideoGallery
,
"WHERE identifier=:id"
)
99
->bind(
":id"
,
$identifier
)
100
->executeSingle();
101
102
return
$match;
103
}
104
105
function
VideoGallery
()
106
{
107
$this->primary_key =
"video_gallery_id"
;
108
$this->table =
"video_gallery"
;
109
110
// Patch in the user class, since this can be overridden by the application
111
$mgr
=
new
UserManager
();
112
$this->relations[
"Owner"
] =
$mgr
->getUserClass();
113
114
$this->default_format =
"{gallery_name}"
;
115
116
$this->DataItem(func_get_args());
117
}
118
}
119
?>
$constraint
$constraint
Definition:
activity_report.inc:13
$mgr
$mgr
Definition:
authentication_token_form.inc:55
owner_id
$calendar owner_id
Definition:
calendar_form.inc:52
UserManager
Provides the interface to the user model for the application.
Definition:
user_manager.inc:50
VideoGallery
Definition:
video_gallery.inc:40
VideoGallery\Videos
Videos($constraint="")
Definition:
video_gallery.inc:61
VideoGallery\findByIdentifier
static findByIdentifier($identifier)
Definition:
video_gallery.inc:96
VideoGallery\VideoGallery
VideoGallery()
Definition:
video_gallery.inc:105
VideoGallery\getGalleryDirectory
getGalleryDirectory()
Definition:
video_gallery.inc:91
VideoGallery\countVideos
countVideos($constraint="")
Definition:
video_gallery.inc:77
VideoGallery\Owner
Owner()
Definition:
video_gallery.inc:66
VideoGallery\$fields
$fields
Definition:
video_gallery.inc:43
VideoGallery\getOwnerName
getOwnerName()
Definition:
video_gallery.inc:72
VideoGallery\$relations
$relations
Definition:
video_gallery.inc:57
Video
Definition:
video.inc:42
VideoManager\getVideoFolder
static getVideoFolder()
Definition:
video_manager.inc:102
$identifier
$identifier
Definition:
rss.inc:37
code
cms.sonjara.com
cms
components
video
datamodel
video_gallery.inc
Generated on Tue Mar 23 2021 15:36:15 for CMS by
1.9.1