Focus the search term on load
[openemr.git] / interface / clickmap / AbstractClickmapModel.php
blob7c87f5ef80d30d0effa22f5b9cbac03667e6301f
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('../../globals.php');
20 /* for OrDataObject, the class we're extending. */
21 require_once ($GLOBALS['srcdir'] . '/classes/ORDataObject.class.php');
23 /**
24 * @class AbstractClickmapModel
26 * @brief code This class extends the OrDataObject class, which is used to model form data for a smarty generated form.
28 * This class extends the ORDataObject class, to model the contents of an image-based form.
31 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 AbstractClickmapModel($table, $id="") {
99 /* Only accept numeric IDs as arguments. */
100 if (is_numeric($id)) {
101 $this->id = $id;
102 } else {
103 $id = "";
106 $this->date = date("Y-m-d H:i:s");
107 $this->_table = $table;
108 $this->data = "";
109 $this->pid = $GLOBALS['pid'];
110 if ($id != "") {
111 $this->populate();
116 * @brief Override this abstract function with your implementation of getTitle.
118 * @return The title of this form.
120 abstract function getTitle();
123 * @brief Override this abstract function with your implementation of getCode.
125 * @return A string thats a 'code' for this form.
127 abstract function getCode();
130 * @brief Fill in this object's members with the contents from the database representing the stored form.
132 function populate() {
133 /* Run our parent's implementation. */
134 parent::populate();
138 * @brief Store the current structure members representing the form into the database.
140 function persist() {
141 /* Run our parent's implementation. */
142 parent::persist();
145 /* 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. */
147 function get_id() {
148 return $this->id;
151 function set_id($id) {
152 if (!empty($id) && is_numeric($id)) {
153 $this->id = $id;
155 else
157 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
161 function get_pid() {
162 return $this->pid;
165 function set_pid($pid) {
166 if (!empty($pid) && is_numeric($pid)) {
167 $this->pid = $pid;
169 else
171 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
175 function get_activity() {
176 return $this->activity;
179 function set_activity($tf) {
180 if (!empty($tf) && is_numeric($tf)) {
181 $this->activity = $tf;
183 else
185 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
189 /* get_date()
192 function get_date() {
193 return $this->date;
196 /* set_date()
199 function set_date($dt) {
200 if (!empty($dt)) {
201 $this->date = $dt;
203 else
205 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
209 function get_user() {
210 return $this->user;
213 function set_user($u) {
214 if (!empty($u)) {
215 $this->user = $u;
217 else
219 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
223 function get_data() {
224 return $this->data;
227 function set_data($data) {
228 if (!empty($data)) {
229 $this->data = $data;
231 else
233 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);