Restyled Procedure order to match the other restyled pages (#1720)
[openemr.git] / library / ESign / Viewer.php
blobfb032c9ab3a9b724ae345619bdf5dc27e8eef67b
1 <?php
2 namespace ESign;
4 /**
5 * Enables echoing and stringifying objects that implement the
6 * ViewableIF interface.
8 * Copyright (C) 2013 OEMR 501c3 www.oemr.org
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
21 * @package OpenEMR
22 * @author Ken Chapple <ken@mi-squared.com>
23 * @author Medical Information Integration, LLC
24 * @link http://www.open-emr.org
25 **/
27 require_once $GLOBALS['srcdir'].'/ESign/Abstract/Model.php';
28 require_once $GLOBALS['srcdir'].'/ESign/ViewableIF.php';
30 class Viewer extends Abstract_Model
32 public function __construct(array $args = null)
34 parent::__construct($args);
36 // Force the args key => value pairs to be set as properties on the viewer objet
37 $this->pushArgs(true);
40 protected function setAttributes(array $attributes)
42 foreach ($attributes as $key => $value) {
43 $this->{$key} = $value;
47 public function render(ViewableIF $viewable, array $attributes = null)
49 if ($attributes) {
50 $this->setAttributes($attributes);
53 include $viewable->getViewScript();
56 public function getHtml(ViewableIF $viewable, array $attributes = null)
58 ob_start();
59 $this->render($viewable, $attributes);
60 $buffer = ob_get_clean();
61 return $buffer;