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>;.
22 * @author Ken Chapple <ken@mi-squared.com>
23 * @author Medical Information Integration, LLC
24 * @link http://www.open-emr.org
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 )
50 $this->setAttributes( $attributes );
52 include $viewable->getViewScript();
55 public function getHtml( ViewableIF
$viewable, array $attributes = null )
58 $this->render( $viewable, $attributes );
59 $buffer = ob_get_clean();