Highway to PSR2
[openemr.git] / portal / patient / libs / Model / OnsiteActivityView.php
blob79e3a8308f8e5ed4c3e5ee76ff807a082eabf4e2
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/OnsiteActivityViewDAO.php");
28 require_once("OnsiteActivityViewCriteria.php");
30 /**
31 * The OnsiteActivityView class extends OnsiteActivityViewDAO which provides the access
32 * to the datastore.
34 * @package Openemr::Model
35 * @author ClassBuilder
36 * @version 1.0
38 class OnsiteActivityView extends OnsiteActivityViewDAO
41 /**
42 * Override default validation
43 * @see Phreezable::Validate()
45 public function Validate()
47 // example of custom validation
48 // $this->ResetValidationErrors();
49 // $errors = $this->GetValidationErrors();
50 // if ($error == true) $this->AddValidationError('FieldName', 'Error Information');
51 // return !$this->HasValidationErrors();
53 return parent::Validate();
56 /**
57 * @see Phreezable::OnSave()
59 public function OnSave($insert)
61 // the controller create/update methods validate before saving. this will be a
62 // redundant validation check, however it will ensure data integrity at the model
63 // level based on validation rules. comment this line out if this is not desired
64 if (!$this->Validate()) {
65 throw new Exception('Unable to Save OnsiteActivityView: ' . implode(', ', $this->GetValidationErrors()));
68 // OnSave must return true or Phreeze will cancel the save operation
69 return true;