Highway to PSR2
[openemr.git] / library / ESign / Form / Factory.php
blobf5d3080fc7cb68f64f305a38ce1052f785831197
1 <?php
3 namespace ESign;
5 /**
6 * Contains all the methods for creation of ESign object
7 * components for the Form module
9 * Copyright (C) 2013 OEMR 501c3 www.oemr.org
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @package OpenEMR
23 * @author Ken Chapple <ken@mi-squared.com>
24 * @author Medical Information Integration, LLC
25 * @link http://www.open-emr.org
26 **/
28 require_once $GLOBALS['srcdir'].'/ESign/FactoryIF.php';
29 require_once $GLOBALS['srcdir'].'/ESign/Form/Configuration.php';
30 require_once $GLOBALS['srcdir'].'/ESign/Form/Signable.php';
31 require_once $GLOBALS['srcdir'].'/ESign/Form/LBF/Signable.php';
32 require_once $GLOBALS['srcdir'].'/ESign/Form/Button.php';
33 require_once $GLOBALS['srcdir'].'/ESign/Form/Log.php';
35 class Form_Factory implements FactoryIF
37 protected $_formId = null;
38 protected $_formDir = null;
39 protected $_encounterId = null;
41 public function __construct($formId, $formDir, $encounterId)
43 $this->_formId = $formId;
44 $this->_formDir = $formDir;
45 $this->_encounterId = $encounterId;
48 public function createConfiguration()
50 return new Form_Configuration();
53 public function createSignable()
55 $signable = null;
56 if (strpos($this->_formDir, 'LBF') === 0) {
57 $signable = new Form_LBF_Signable($this->_formId, $this->_formDir, $this->_encounterId);
58 } else {
59 $signable = new Form_Signable($this->_formId, $this->_formDir, $this->_encounterId);
62 return $signable;
65 public function createButton()
67 return new Form_Button($this->_formId, $this->_formDir, $this->_encounterId);
70 public function createLog()
72 return new Form_Log($this->_formId, $this->_formDir, $this->_encounterId);