Compact css tweak
[openemr.git] / interface / clickmap / AbstractClickmapModel.php
blob808263577d1caa2399a539bd84a2eba61c03b2cb
1 <?php
3 /*
4 * Copyright Medical Information Integration,LLC info@mi-squared.com
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * @file AbstractClickmapModel.php
12 * @brief This file contains the AbstractClickmapModel class, used to model form contents.
16 /* for $GLOBALS['srcdir','pid'] */
17 /* remember that include paths are calculated relative to the including script, not this file. */
18 require_once(dirname(__FILE__).'/../globals.php');
20 /**
21 * @class AbstractClickmapModel
23 * @brief code This class extends the OrDataObject class, which is used to model form data for a smarty generated form.
25 * This class extends the ORDataObject class, to model the contents of an image-based form.
28 abstract class AbstractClickmapModel extends ORDataObject
31 /**
32 * The row to persist information to/from.
34 * @var id
36 var $id;
37 /**
39 * FIXME: either last modification date OR creation date?
41 * @var date
43 var $date;
44 /**
46 * The unique identifier of the patient this form belongs to.
48 * @var pid
50 var $pid;
51 /**
53 * required field in database table. not used, always defaulted to NULL.
55 * @var user
57 var $user;
58 /**
60 * required field in database table. not used, always defaulted to NULL.
62 * @var groupname
64 var $groupname;
65 /**
67 * required field in the database table. always defaulted to NULL.
69 * @var authorized
71 var $authorized;
72 /**
74 * required field in the database table. always defaulted to NULL.
76 * @var activity
78 var $activity;
79 /**
81 * The contents of our form, in one field.
83 * @var data
85 var $data;
87 /**
88 * @brief Initialize a newly created object belonging to this class
90 * @param table
91 * The sql table to persist form contents from/to.
93 * @param id
94 * The index of a row in the given table to initialize form contents from.
96 public function __construct($table, $id = "")
98 parent::__construct();
100 /* Only accept numeric IDs as arguments. */
101 if (is_numeric($id)) {
102 $this->id = $id;
103 } else {
104 $id = "";
107 $this->date = date("Y-m-d H:i:s");
108 $this->_table = $table;
109 $this->data = "";
110 $this->pid = $GLOBALS['pid'];
111 if ($id != "") {
112 $this->populate();
117 * @brief Override this abstract function with your implementation of getTitle.
119 * @return The title of this form.
121 abstract function getTitle();
124 * @brief Override this abstract function with your implementation of getCode.
126 * @return A string thats a 'code' for this form.
128 abstract function getCode();
131 * @brief Fill in this object's members with the contents from the database representing the stored form.
133 function populate()
135 /* Run our parent's implementation. */
136 parent::populate();
140 * @brief Store the current structure members representing the form into the database.
142 function persist()
144 /* Run our parent's implementation. */
145 parent::persist();
148 /* The rest of this object consists of set_ and get_ pairs, for setting and getting the value of variables that are members of this object. */
150 function get_id()
152 return $this->id;
155 function set_id($id)
157 if (!empty($id) && is_numeric($id)) {
158 $this->id = $id;
159 } else {
160 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
164 function get_pid()
166 return $this->pid;
169 function set_pid($pid)
171 if (!empty($pid) && is_numeric($pid)) {
172 $this->pid = $pid;
173 } else {
174 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
178 function get_activity()
180 return $this->activity;
183 function set_activity($tf)
185 if (!empty($tf) && is_numeric($tf)) {
186 $this->activity = $tf;
187 } else {
188 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
192 /* get_date()
195 function get_date()
197 return $this->date;
200 /* set_date()
203 function set_date($dt)
205 if (!empty($dt)) {
206 $this->date = $dt;
207 } else {
208 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
212 function get_user()
214 return $this->user;
217 function set_user($u)
219 if (!empty($u)) {
220 $this->user = $u;
221 } else {
222 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
226 function get_data()
228 return $this->data;
231 function set_data($data)
233 if (!empty($data)) {
234 $this->data = $data;
235 } else {
236 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);