Fixes #4497 - FHIR search via POST (#4498)
[openemr.git] / interface / clickmap / AbstractClickmapModel.php
blob653bd0cfe581d80e5a42870fe40183ff66947d4d
1 <?php
3 use OpenEMR\Common\ORDataObject\ORDataObject;
5 /*
6 * Copyright Medical Information Integration,LLC info@mi-squared.com
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * @file AbstractClickmapModel.php
14 * @brief This file contains the AbstractClickmapModel class, used to model form contents.
18 /* for $GLOBALS['srcdir','pid'] */
19 /* remember that include paths are calculated relative to the including script, not this file. */
20 require_once(dirname(__FILE__) . '/../globals.php');
22 /**
23 * @class AbstractClickmapModel
25 * @brief code This class extends the OrDataObject class, which is used to model form data for a smarty generated form.
27 * This class extends the ORDataObject class, to model the contents of an image-based form.
30 abstract class AbstractClickmapModel extends ORDataObject
33 /**
34 * The row to persist information to/from.
36 * @var id
38 var $id;
39 /**
41 * FIXME: either last modification date OR creation date?
43 * @var date
45 var $date;
46 /**
48 * The unique identifier of the patient this form belongs to.
50 * @var pid
52 var $pid;
53 /**
55 * required field in database table. not used, always defaulted to NULL.
57 * @var user
59 var $user;
60 /**
62 * required field in database table. not used, always defaulted to NULL.
64 * @var groupname
66 var $groupname;
67 /**
69 * required field in the database table. always defaulted to NULL.
71 * @var authorized
73 var $authorized;
74 /**
76 * required field in the database table. always defaulted to NULL.
78 * @var activity
80 var $activity;
81 /**
83 * The contents of our form, in one field.
85 * @var data
87 var $data;
89 /**
90 * @brief Initialize a newly created object belonging to this class
92 * @param table
93 * The sql table to persist form contents from/to.
95 * @param id
96 * The index of a row in the given table to initialize form contents from.
98 public function __construct($table, $id = "")
100 parent::__construct();
102 /* Only accept numeric IDs as arguments. */
103 if (is_numeric($id)) {
104 $this->id = $id;
105 } else {
106 $id = "";
109 $this->date = date("Y-m-d H:i:s");
110 $this->_table = $table;
111 $this->data = "";
112 $this->pid = $GLOBALS['pid'];
113 if ($id != "") {
114 $this->populate();
119 * @brief Override this abstract function with your implementation of getTitle.
121 * @return The title of this form.
123 abstract function getTitle();
126 * @brief Override this abstract function with your implementation of getCode.
128 * @return A string thats a 'code' for this form.
130 abstract function getCode();
133 * @brief Fill in this object's members with the contents from the database representing the stored form.
135 function populate()
137 /* Run our parent's implementation. */
138 parent::populate();
142 * @brief Store the current structure members representing the form into the database.
144 function persist()
146 /* Run our parent's implementation. */
147 parent::persist();
150 /* 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. */
152 function get_id()
154 return $this->id;
157 function set_id($id)
159 if (!empty($id) && is_numeric($id)) {
160 $this->id = $id;
161 } else {
162 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
166 function get_pid()
168 return $this->pid;
171 function set_pid($pid)
173 if (!empty($pid) && is_numeric($pid)) {
174 $this->pid = $pid;
175 } else {
176 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
180 function get_activity()
182 return $this->activity;
185 function set_activity($tf)
187 if (!empty($tf) && is_numeric($tf)) {
188 $this->activity = $tf;
189 } else {
190 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
194 /* get_date()
197 function get_date()
199 return $this->date;
202 /* set_date()
205 function set_date($dt)
207 if (!empty($dt)) {
208 $this->date = $dt;
209 } else {
210 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
214 function get_user()
216 return $this->user;
219 function set_user($u)
221 if (!empty($u)) {
222 $this->user = $u;
223 } else {
224 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
228 function get_data()
230 return $this->data;
233 function set_data($data)
235 if (!empty($data)) {
236 $this->data = $data;
237 } else {
238 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);