Highway to PSR2
[openemr.git] / portal / patient / libs / Reporter / UserReporter.php
blobe67d86c5fa688b027d52331f0bdbaac04e120300
1 <?php
2 /** @package Openemr::Reporter */
4 /**
6 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
8 * LICENSE: This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * @package OpenEMR
22 * @author Jerry Padgett <sjpadgett@gmail.com>
23 * @link http://www.open-emr.org
26 /** import supporting libraries */
27 require_once("verysimple/Phreeze/Reporter.php");
29 /**
30 * This is an example Reporter based on the User object. The reporter object
31 * allows you to run arbitrary queries that return data which may or may not fith within
32 * the data access API. This can include aggregate data or subsets of data.
34 * Note that Reporters are read-only and cannot be used for saving data.
36 * @package Openemr::Model::DAO
37 * @author ClassBuilder
38 * @version 1.0
40 class UserReporter extends Reporter
43 // the properties in this class must match the columns returned by GetCustomQuery().
44 // 'CustomFieldExample' is an example that is not part of the `users` table
45 public $CustomFieldExample;
47 public $Id;
48 public $Username;
49 public $Password;
50 public $Authorized;
51 public $Info;
52 public $Source;
53 public $Fname;
54 public $Mname;
55 public $Lname;
56 public $Federaltaxid;
57 public $Federaldrugid;
58 public $Upin;
59 public $Facility;
60 public $FacilityId;
61 public $SeeAuth;
62 public $Active;
63 public $Npi;
64 public $Title;
65 public $Specialty;
66 public $Billname;
67 public $Email;
68 public $EmailDirect;
69 public $EserUrl;
70 public $Assistant;
71 public $Organization;
72 public $Valedictory;
73 public $Street;
74 public $Streetb;
75 public $City;
76 public $State;
77 public $Zip;
78 public $Street2;
79 public $Streetb2;
80 public $City2;
81 public $State2;
82 public $Zip2;
83 public $Phone;
84 public $Fax;
85 public $Phonew1;
86 public $Phonew2;
87 public $Phonecell;
88 public $Notes;
89 public $CalUi;
90 public $Taxonomy;
91 public $SsiRelayhealth;
92 public $Calendar;
93 public $AbookType;
94 public $PwdExpirationDate;
95 public $PwdHistory1;
96 public $PwdHistory2;
97 public $DefaultWarehouse;
98 public $Irnpool;
99 public $StateLicenseNumber;
100 public $NewcropUserRole;
101 public $Cpoe;
102 public $PhysicianType;
105 * GetCustomQuery returns a fully formed SQL statement. The result columns
106 * must match with the properties of this reporter object.
108 * @see Reporter::GetCustomQuery
109 * @param Criteria $criteria
110 * @return string SQL statement
112 static function GetCustomQuery($criteria)
114 $sql = "select
115 'custom value here...' as CustomFieldExample
116 ,`users`.`id` as Id
117 ,`users`.`username` as Username
118 ,`users`.`password` as Password
119 ,`users`.`authorized` as Authorized
120 ,`users`.`info` as Info
121 ,`users`.`source` as Source
122 ,`users`.`fname` as Fname
123 ,`users`.`mname` as Mname
124 ,`users`.`lname` as Lname
125 ,`users`.`federaltaxid` as Federaltaxid
126 ,`users`.`federaldrugid` as Federaldrugid
127 ,`users`.`upin` as Upin
128 ,`users`.`facility` as Facility
129 ,`users`.`facility_id` as FacilityId
130 ,`users`.`see_auth` as SeeAuth
131 ,`users`.`active` as Active
132 ,`users`.`npi` as Npi
133 ,`users`.`title` as Title
134 ,`users`.`specialty` as Specialty
135 ,`users`.`billname` as Billname
136 ,`users`.`email` as Email
137 ,`users`.`email_direct` as EmailDirect
138 ,`users`.`url` as EserUrl
139 ,`users`.`assistant` as Assistant
140 ,`users`.`organization` as Organization
141 ,`users`.`valedictory` as Valedictory
142 ,`users`.`street` as Street
143 ,`users`.`streetb` as Streetb
144 ,`users`.`city` as City
145 ,`users`.`state` as State
146 ,`users`.`zip` as Zip
147 ,`users`.`street2` as Street2
148 ,`users`.`streetb2` as Streetb2
149 ,`users`.`city2` as City2
150 ,`users`.`state2` as State2
151 ,`users`.`zip2` as Zip2
152 ,`users`.`phone` as Phone
153 ,`users`.`fax` as Fax
154 ,`users`.`phonew1` as Phonew1
155 ,`users`.`phonew2` as Phonew2
156 ,`users`.`phonecell` as Phonecell
157 ,`users`.`notes` as Notes
158 ,`users`.`cal_ui` as CalUi
159 ,`users`.`taxonomy` as Taxonomy
160 ,`users`.`calendar` as Calendar
161 ,`users`.`abook_type` as AbookType
162 ,`users`.`pwd_expiration_date` as PwdExpirationDate
163 ,`users`.`pwd_history1` as PwdHistory1
164 ,`users`.`pwd_history2` as PwdHistory2
165 ,`users`.`default_warehouse` as DefaultWarehouse
166 ,`users`.`irnpool` as Irnpool
167 ,`users`.`state_license_number` as StateLicenseNumber
168 ,`users`.`newcrop_user_role` as NewcropUserRole
169 ,`users`.`cpoe` as Cpoe
170 ,`users`.`physician_type` as PhysicianType
171 from `users`";
173 // the criteria can be used or you can write your own custom logic.
174 // be sure to escape any user input with $criteria->Escape()
175 $sql .= $criteria->GetWhere();
176 $sql .= $criteria->GetOrder();
178 return $sql;
182 * GetCustomCountQuery returns a fully formed SQL statement that will count
183 * the results. This query must return the correct number of results that
184 * GetCustomQuery would, given the same criteria
186 * @see Reporter::GetCustomCountQuery
187 * @param Criteria $criteria
188 * @return string SQL statement
190 static function GetCustomCountQuery($criteria)
192 $sql = "select count(1) as counter from `users`";
194 // the criteria can be used or you can write your own custom logic.
195 // be sure to escape any user input with $criteria->Escape()
196 $sql .= $criteria->GetWhere();
198 return $sql;