New onsite patient portal, take 4.
[openemr.git] / portal / patient / fwk / libs / verysimple / Phreeze / ObserveToSmarty.php
blob96d5e5918e4ca2682a44db31cac04d43e7a536d8
1 <?php
2 /** @package verysimple::Phreeze */
4 /**
5 * import supporting libraries
6 */
7 require_once ("IObserver.php");
9 /**
10 * ObserverToBrowser is an implementation of IObserver that outputs all
11 * messages to the smarty debug console
13 * @package verysimple::Phreeze
14 * @author VerySimple Inc.
15 * @copyright 1997-2005 VerySimple, Inc.
16 * @license http://www.gnu.org/licenses/lgpl.html LGPL
17 * @version 2.0
19 class ObserveToSmarty implements IObserver {
20 private $_smarty = null;
21 private $_counter = 0;
22 public function __construct($smarty) {
23 $this->_smarty = $smarty;
24 $this->_smarty->debugging = true;
26 public function Observe($obj, $ltype = OBSERVE_INFO) {
27 if (is_object ( $obj ) || is_array ( $obj )) {
28 $msg = "<pre>" . print_r ( $obj, 1 ) . "</pre>";
29 } else {
30 $msg = $obj;
33 $desc = "";
35 switch ($ltype) {
36 case OBSERVE_DEBUG :
37 $desc = "DEBUG";
38 break;
39 case OBSERVE_QUERY :
40 $desc = "QUERY";
41 $msg = $desc . " " . $msg;
42 break;
43 case OBSERVE_FATAL :
44 $desc = "FATAL";
45 break;
46 case OBSERVE_INFO :
47 $desc = "INFO";
48 break;
49 case OBSERVE_WARN :
50 $desc = "WARN";
51 break;
54 $this->_smarty->assign ( str_pad ( $this->_counter ++, 3, "0", STR_PAD_LEFT ) . "_" . $desc, $msg );