CMS  Version 3.9
module.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 $mod_type = array
40 (
41  NewsItem => "News Item",
42  Program => "Program",
43  HTML => "HTML"
44 );
45 
46 $ord_by = array
47 (
48  created_date => "created_date",
49  name => "name",
50  last_modified => "last_modified"
51  );
52 
56 class Module extends DataItem
57 {
58  var $fields = array("module_id" => Number,
59  "title" => String,
60  "group_id" => Number,
61  "content_type" => String,
62  "num_items" => Number,
63  "query_constraint" => String,
64  "ord_by" => String,
65  "template" => Text,
66  "php_code_file" => String,
67  "menu_id" => Number,
68  "menu_parameters" => String,
69  "css_class" => String,
70  "global" => Boolean,
71  "global_position" => String);
72 
73  var $relations = array("Menu" => Menu);
74 
75  function Module()
76  {
77  $this->table = "module";
78  $this->primary_key = "module_id";
79  $this->default_format = "{title}";
80  $this->DataItem(func_get_args());
81  }
82 
83  function Menu()
84  {
85  return $this->getRelated(Menu);
86  }
87 
88  function getTitle()
89  {
90  if ($this->title) return $this->title;
91 
92  }
93 
94  function getPdf_file()
95  {
96  if ($this->pdf_file) return $this->pdf_file;
97 
98  }
99 
100  function getContent_Type()
101  {
102  if ($this->content_type) return $this->content_type;
103 
104  }
105 
106  function getConstraint()
107  {
108  if($this->query_constraint) return $this->query_constraint;
109 
110  }
111 
112  function getNum_Items()
113  {
114  if ($this->num_items) return $this->num_items;
115 
116  }
117 
118  function getOrd_By()
119  {
120  if ($this->ord_by) return $this->ord_by;
121 
122  }
123 
124  function getTemplate()
125  {
126  if ($this->template) return $this->template;
127 
128  }
129 
130  function getAdminForm()
131  {
132  switch($this->content_type)
133  {
134  case "Menu":
135  return "/admin/menu_module_form";
136 
137  case "Code":
138  return "/admin/code_module_form";
139 
140  case "HTML":
141  return "/admin/html_module_form";
142 
143  default:
144  return "/admin/query_module_form";
145  }
146  }
147 }
148 ?>
$bookmark title
Definition: menus.inc:41
Defines the Module class.
Definition: module.inc:57
getTitle()
Definition: module.inc:88
getTemplate()
Definition: module.inc:124
getConstraint()
Definition: module.inc:106
getAdminForm()
Definition: module.inc:130
Menu()
Definition: module.inc:83
Module()
Definition: module.inc:75
getOrd_By()
Definition: module.inc:118
getPdf_file()
Definition: module.inc:94
$fields
Definition: module.inc:58
getNum_Items()
Definition: module.inc:112
$relations
Definition: module.inc:73
getContent_Type()
Definition: module.inc:100
$module content_type
$mod_type
Definition: module.inc:39
$ord_by
Definition: module.inc:46
$feedback created_date
Definition: save.inc:16
$content_type