Converted delete_form.php to standard security model
[openemr.git] / library / ESign / Viewer.php
blob2ec888bead76ce653ea451cc2d9f1365b606f1b7
1 <?php
2 namespace ESign;
4 /**
5 * Enables echoing and stringifying objects that implement the
6 * ViewableIF interface.
7 *
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 );
52 include $viewable->getViewScript();
55 public function getHtml( ViewableIF $viewable, array $attributes = null )
57 ob_start();
58 $this->render( $viewable, $attributes );
59 $buffer = ob_get_clean();
60 return $buffer;