fix: restore url and text for immunizations card (#6991)
[openemr.git] / interface / clickmap / AbstractClickmapModel.php
blobff770f6a51dacaf547ef19b124e878f557ef2b8a
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
32 /**
33 * The row to persist information to/from.
35 * @var id
37 var $id;
38 /**
40 * FIXME: either last modification date OR creation date?
42 * @var date
44 var $date;
45 /**
47 * The unique identifier of the patient this form belongs to.
49 * @var pid
51 var $pid;
52 /**
54 * required field in database table. not used, always defaulted to NULL.
56 * @var user
58 var $user;
59 /**
61 * required field in database table. not used, always defaulted to NULL.
63 * @var groupname
65 var $groupname;
66 /**
68 * required field in the database table. always defaulted to NULL.
70 * @var authorized
72 var $authorized;
73 /**
75 * required field in the database table. always defaulted to NULL.
77 * @var activity
79 var $activity;
80 /**
82 * The contents of our form, in one field.
84 * @var data
86 var $data;
88 /**
89 * @brief Initialize a newly created object belonging to this class
91 * @param table
92 * The sql table to persist form contents from/to.
94 * @param id
95 * The index of a row in the given table to initialize form contents from.
97 public function __construct($table, $id = "")
99 parent::__construct();
101 /* Only accept numeric IDs as arguments. */
102 if (is_numeric($id)) {
103 $this->id = $id;
104 } else {
105 $id = "";
108 $this->date = date("Y-m-d H:i:s");
109 $this->_table = $table;
110 $this->data = "";
111 $this->pid = $GLOBALS['pid'];
112 if ($id != "") {
113 $this->populate();
118 * @brief Override this abstract function with your implementation of getTitle.
120 * @return The title of this form.
122 abstract function getTitle();
125 * @brief Override this abstract function with your implementation of getCode.
127 * @return A string thats a 'code' for this form.
129 abstract function getCode();
132 * @brief Fill in this object's members with the contents from the database representing the stored form.
134 function populate()
136 /* Run our parent's implementation. */
137 parent::populate();
141 * @brief Store the current structure members representing the form into the database.
143 function persist()
145 /* Run our parent's implementation. */
146 parent::persist();
149 /* 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. */
151 function get_id()
153 return $this->id;
156 function set_id($id)
158 if (!empty($id) && is_numeric($id)) {
159 $this->id = $id;
160 } else {
161 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
165 function get_pid()
167 return $this->pid;
170 function set_pid($pid)
172 if (!empty($pid) && is_numeric($pid)) {
173 $this->pid = $pid;
174 } else {
175 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
179 function get_activity()
181 return $this->activity;
184 function set_activity($tf)
186 if (!empty($tf) && is_numeric($tf)) {
187 $this->activity = $tf;
188 } else {
189 trigger_error('API violation: set function called with empty or non numeric string.', E_USER_WARNING);
193 /* get_date()
196 function get_date()
198 return $this->date;
201 /* set_date()
204 function set_date($dt)
206 if (!empty($dt)) {
207 $this->date = $dt;
208 } else {
209 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
213 function get_user()
215 return $this->user;
218 function set_user($u)
220 if (!empty($u)) {
221 $this->user = $u;
222 } else {
223 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);
227 function get_data()
229 return $this->data;
232 function set_data($data)
234 if (!empty($data)) {
235 $this->data = $data;
236 } else {
237 trigger_error('API violation: set function called with empty string.', E_USER_WARNING);