CMS  Version 3.9
event_type.inc
Go to the documentation of this file.
1 <?php
8 /**************************************************************
9 
10  Copyright (c) 2010 Sonjara, Inc
11 
12  Permission is hereby granted, free of charge, to any person
13  obtaining a copy of this software and associated documentation
14  files (the "Software"), to deal in the Software without
15  restriction, including without limitation the rights to use,
16  copy, modify, merge, publish, distribute, sublicense, and/or sell
17  copies of the Software, and to permit persons to whom the
18  Software is furnished to do so, subject to the following
19  conditions:
20 
21  The above copyright notice and this permission notice shall be
22  included in all copies or substantial portions of the Software.
23 
24  Except as contained in this notice, the name(s) of the above
25  copyright holders shall not be used in advertising or otherwise
26  to promote the sale, use or other dealings in this Software
27  without prior written authorization.
28 
29  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
31  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
33  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
34  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
36  OTHER DEALINGS IN THE SOFTWARE.
37 
38 *****************************************************************/
39 
40 class EventType extends DataItem
41 {
42  // Fields
43 
44  var $fields = array("event_type_id" => Number,
45  "name" => String,
46  );
47 
48  // Relations
49 
50  var $relations = array();
51 
52  /*
53  * This function is deprecated. Since event types are supposed to
54  * be specific to a calendar, it is not useful to retrieve the
55  * list this way.
56  */
57  function getEventTypeList()
58  {
59  $eventTypeList = array();
60 
61  $eventTypes = Query::create(EventType, "ORDER BY name")->execute();
62  if(count($eventTypes) > 0)
63  {
64  foreach($eventTypes as $eventType)
65  {
66  $eventTypeList[$eventType->name] = $eventType->name;
67  }
68  }
69 
70  return $eventTypeList;
71  }
72 
73  static function formatOptions($eventTypes)
74  {
75  $eventTypeList = array();
76 
77  if(count($eventTypes) > 0)
78  {
79  foreach($eventTypes as $eventType)
80  {
81  $eventTypeList[$eventType->name] = $eventType->name;
82  }
83  }
84 
85  return $eventTypeList;
86  }
87 
88  function EventType()
89  {
90  $this->table = "event_type";
91  $this->primary_key = "event_type_id";
92 
93  $this->DataItem(func_get_args());
94  }
95 }
96 ?>
$eventTypes
$eventType
getEventTypeList()
Definition: event_type.inc:57
static formatOptions($eventTypes)
Definition: event_type.inc:73