use calendar widget for date select; remember last viewed calendar date
[openemr.git] / library / plugins / function.popup.php
blob90323ce5029b5dfc8ef0657f0cb12dad14efda90
1 <?php
2 /**
3 * Smarty plugin
4 * @package Smarty
5 * @subpackage plugins
6 */
9 /**
10 * Smarty {popup} function plugin
12 * Type: function<br>
13 * Name: popup<br>
14 * Purpose: make text pop up in windows via overlib
15 * @link http://smarty.php.net/manual/en/language.function.popup.php {popup}
16 * (Smarty online manual)
17 * @param array
18 * @param Smarty
19 * @return string
21 function smarty_function_popup($params, &$smarty)
23 $append = '';
24 foreach ($params as $_key=>$_value) {
25 switch ($_key) {
26 case 'text':
27 case 'trigger':
28 $$_key = (string)$_value;
29 break;
31 case 'caption':
32 case 'closetext':
33 case 'status':
34 $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
35 break;
37 case 'fgcolor':
38 case 'bgcolor':
39 case 'textcolor':
40 case 'capcolor':
41 case 'closecolor':
42 case 'textfont':
43 case 'captionfont':
44 case 'closefont':
45 case 'textsize':
46 case 'captionsize':
47 case 'closesize':
48 case 'width':
49 case 'height':
50 case 'border':
51 case 'offsetx':
52 case 'offsety':
53 case 'fgbackground':
54 case 'bgbackground':
55 case 'inarray':
56 case 'caparray':
57 case 'capicon':
58 case 'snapx':
59 case 'snapy':
60 case 'fixx':
61 case 'fixy':
62 case 'background':
63 case 'padx':
64 case 'pady':
65 case 'frame':
66 case 'timeout':
67 case 'delay':
68 case 'function':
69 $append .= ',' . strtoupper($_key) . ",'$_value'";
70 break;
72 case 'sticky':
73 case 'left':
74 case 'right':
75 case 'center':
76 case 'above':
77 case 'below':
78 case 'noclose':
79 case 'autostatus':
80 case 'autostatuscap':
81 case 'fullhtml':
82 case 'hauto':
83 case 'vauto':
84 if ($_value) $append .= ',' . strtoupper($_key);
85 break;
87 default:
88 $smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
92 if (empty($text) && !isset($inarray) && empty($function)) {
93 $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required");
94 return false;
97 if (empty($trigger)) { $trigger = "onmouseover"; }
99 $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
100 $retval .= $append . ');" onmouseout="nd();"';
102 return $retval;
105 /* vim: set expandtab: */