New onsite patient portal, take 4.
[openemr.git] / portal / patient / libs / Model / UserCriteria.php
blob0499e8b5d5595111a2295ecb8b84ebb81a4bb32f
1 <?php
2 /** @package Openemr::Model */
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("DAO/UserCriteriaDAO.php");
29 /**
30 * The UserCriteria class extends UserDAOCriteria and is used
31 * to query the database for objects and collections
33 * @inheritdocs
34 * @package Openemr::Model
35 * @author ClassBuilder
36 * @version 1.0
38 class UserCriteria extends UserCriteriaDAO
41 /**
42 * GetFieldFromProp returns the DB column for a given class property
44 * If any fields that are not part of the table need to be supported
45 * by this Criteria class, they can be added inside the switch statement
46 * in this method
48 * @see Criteria::GetFieldFromProp()
51 public function GetFieldFromProp($propname)
53 switch($propname)
55 case 'CustomProp1':
56 return 'my_db_column_1';
57 case 'CustomProp2':
58 return 'my_db_column_2';
59 default:
60 return parent::GetFieldFromProp($propname);
65 /**
66 * For custom query logic, you may override OnPrepare and set the $this->_where to whatever
67 * sql code is necessary. If you choose to manually set _where then Phreeze will not touch
68 * your where clause at all and so any of the standard property names will be ignored
70 * @see Criteria::OnPrepare()
73 function OnPrepare()
75 if ($this->MyCustomField == "special value")
77 // _where must begin with "where"
78 $this->_where = "where db_field ....";