1 <?PHP
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
29
30
31
32 if(!defined("GUI_LIB")){
33 define ("GUI_LIB", 1);
34
35
36 $GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"] = "";
37 if(isset($GLOBALS["CRVCL"]["TAG_WORDWRAP"]) && isset($GLOBALS["CRVCL"]["DEBUG"]) && $GLOBALS["CRVCL"]["DEBUG"] == true){
38 $GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"] = $GLOBALS["CRVCL"]["TAG_WORDWRAP"];
39 }
40
41 trait html_tComponent{
42 43 44 45 46
47 public $m_childs = null;
48
49 50 51 52 53 54
55 function &buildChilds($childs=null){
56 $js = '';
57 $html = '';
58
59 if($childs === null){
60 $childs = &$this->m_childs;
61 }
62
63 if($childs === null) return $html;
64
65 if(!is_array($childs)){
66 throw new Exception($this->m_name.'::buildChilds - paramter is not an array');
67 }
68
69 $c_childs = count($childs);
70 for($c = 0; $c < $c_childs; $c++){
71 $obj = &$childs[$c];
72 if(is_object($obj)){
73 if(method_exists($obj, "html")){
74
75 $html .= $obj->html();
76
77
78 if(defined('MVC_AJAX_EVENT') && MVC_AJAX_EVENT && isset($GLOBALS["CRVCL"]["RUNTIME"]["reset_form_component_state"]) && $GLOBALS["CRVCL"]["RUNTIME"]["reset_form_component_state"])
79 $js .= fw_mvc_reset_component_changed($obj);
80 }else{
81 throw new Exception("a object of class \"".get_class($obj)."\" not implements the method \"html\" and is passed a child, for more see also interface \"html_iComponent\"");
82 }
83
84 if(isset($GLOBALS["CRVCL"]["FREE_CHILDS_AFTER_BUILD"]) && $GLOBALS["CRVCL"]["FREE_CHILDS_AFTER_BUILD"] === true){
85 free($obj, false, true);
86 gc_collect_cycles_overX($GLOBALS['CRVCL']['GC_COLLECT_CYCLES_PERCENT']);
87 }
88
89 }else if(is_array($obj)){
90 $html .= $this->buildChilds($obj);
91 if(isset($GLOBALS["CRVCL"]["FREE_CHILDS_AFTER_BUILD"]) && $GLOBALS["CRVCL"]["FREE_CHILDS_AFTER_BUILD"] === true){
92 free($obj, false, true);
93 gc_collect_cycles_overX($GLOBALS['CRVCL']['GC_COLLECT_CYCLES_PERCENT']);
94 }
95 }else{
96 $html .= $obj;
97 }
98 }
99
100 gc_collect_cycles_overX($GLOBALS['CRVCL']['GC_COLLECT_CYCLES_PERCENT']);
101
102 if($js !== ''){
103 $js = js($js);
104 }
105
106 $html .= $js;
107 return $html;
108 }
109 }
110
111 interface html_iComponent
112 {
113 114 115
116 public function html($print=false);
117 }
118
119 120 121 122
123 abstract class html_Component implements html_iComponent{
124 use html_tComponent {buildChilds as tBuildChilds;}
125
126 127 128
129 protected $m_html = "";
130 131 132 133 134
135 public $m_style = "";
136 137 138 139 140
141 public $m_class = "";
142 143 144 145 146
147 public $m_name = "";
148 149 150 151 152
153 public $m_id = "";
154 155 156 157 158
159 public $m_attribute = "";
160
161 function __construct(){
162 $this->m_childs = array();
163 }
164
165 166 167 168 169
170 public function &getChilds(){
171 if($this instanceof html_Table){
172 $this->m_childs = array_merge($this->getCells(), $this->getFCells(), $this->getHCells());
173 }else if($this instanceof html_TabbedPane){
174 $this->m_childs = $this->getTabs();
175 }
176
177 return $this->m_childs;
178 }
179
180 181 182 183 184 185
186 protected function &buildChilds($childs=null){
187 return $this->tBuildChilds($childs);
188 }
189
190 191 192 193 194 195
196 public function html($print=false){
197 if($print){
198 print $this->m_html;
199 }
200 return $this->m_html;
201 }
202
203 204 205 206 207
208 public function setName($name){
209 $this->m_id = $name;
210 $this->m_name = $name;
211 }
212
213 214 215 216 217 218
219 public function getName(){
220 return $this->m_name;
221 }
222
223 224 225 226 227
228 public function setStyle($css_style){
229 $this->m_style = $css_style;
230 }
231
232 233 234 235 236
237 public function setClass($classid){
238 $this->m_class = $classid;
239 }
240 }
241
242
243
244
245 246 247 248
249 abstract class html_ComponentAMP implements html_iComponent{
250 use html_tComponent {buildChilds as tBuildChilds;}
251
252 253 254
255 protected $m_html = "";
256
257
258 function __construct(){
259 $this->m_childs = array();
260 }
261
262 263 264 265 266
267 public function &getChilds(){
268 if($this instanceof html_Table){
269 $this->m_childs = array_merge($this->getCells(), $this->getFCells(), $this->getHCells());
270 }else if($this instanceof html_TabbedPane){
271 $this->m_childs = $this->getTabs();
272 }
273
274 return $this->m_childs;
275 }
276
277 278 279 280 281 282
283 protected function &buildChilds($childs=null){
284 return $this->tBuildChilds($childs);
285 }
286
287 288 289 290 291 292
293 public function html($print=false){
294 if($print){
295 print $this->m_html;
296 }
297 return $this->m_html;
298 }
299 }
300
301
302
303 304 305 306
307 abstract class html_Events extends html_Component
308 {
309 310 311 312 313
314 public $m_onClick = "";
315 316 317 318 319
320 public $m_onDblClick = "";
321 322 323 324 325
326 public $m_onMouseOver = "";
327 328 329 330 331
332 public $m_onMouseOut = "";
333 334 335 336 337
338 public $m_onMouseDown = "";
339 340 341 342 343
344 public $m_onMouseUp = "";
345 346 347 348 349
350 public $m_onMouseMove = "";
351 352 353 354 355
356 public $m_onKeyPress = "";
357 358 359 360 361
362 public $m_onKeyDown = "";
363 364 365 366 367
368 public $m_onKeyUp = "";
369 370 371 372 373
374 public $m_tooltip = "";
375
376 377 378
379 public $m_itext = "";
380
381 protected function htmlEvents($onClick="", $onDblClick="", $onMouseOver="", $onMouseOut="", $onMouseDown="", $onMouseUp="", $onMouseMove="", $onKeyPress="", $onKeyDown="", $onKeyUp=""){
382 $events = "";
383
384 if($this->m_tooltip){
385 $this->m_onClick .= 'fw_hideTooltip();';
386 }
387
388 if($this->m_tooltip){
389 $this->m_onDblClick .= 'fw_hideTooltip();';
390 }
391
392 if($this->m_tooltip){
393 $this->m_onKeyDown .= 'fw_hideTooltip();';
394 }
395
396 if($this->m_tooltip){
397 $this->m_onMouseOver .= 'fw_showTooltip(\''.$this->m_tooltip.'\');';
398 }
399
400 if($this->m_itext){
401 $this->m_onMouseOver .= 'fw_showIText(\''.str_replace(array('"', "'", "\r", "\n"), array('', '', '', '<br>'), $this->m_itext).'\');';
402 $this->m_onMouseOut .= 'fw_hideIText();';
403 }
404
405 if($this->m_tooltip){
406 $this->m_onMouseOut .= 'fw_hideTooltip();';
407 }
408
409
410
411 $onClick .= $this->m_onClick;
412 if(!empty($onClick)){
413 $events .= ' onClick="'.$onClick.'"';
414 }
415 $onDblClick .= $this->m_onDblClick;
416 if(!empty($onDblClick)){
417 $events .= ' onDblClick="'.$onDblClick.'"';
418 }
419 $onMouseOver .= $this->m_onMouseOver;
420 if(!empty($onMouseOver)){
421 $events .= ' onMouseOver="'.$onMouseOver.'"';
422 }
423 $onMouseOut .= $this->m_onMouseOut;
424 if(!empty($onMouseOut)){
425 $events .= ' onMouseOut="'.$onMouseOut.'"';
426 }
427 $onMouseDown .= $this->m_onMouseDown;
428 if(!empty($onMouseDown)){
429 $events .= ' onMouseDown="'.$onMouseDown.'"';
430 }
431 $onMouseUp .= $this->m_onMouseUp;
432 if(!empty($onMouseUp)){
433 $events .= ' onMouseUp="'.$onMouseUp.'"';
434 }
435 $onMouseMove .= $this->m_onMouseMove;
436 if(!empty($onMouseMove)){
437 $events .= ' onMouseMove="'.$onMouseMove.'"';
438 }
439 $onKeyPress .= $this->m_onKeyPress;
440 if(!empty($onKeyPress)){
441 $events .= ' onKeyPress="'.$onKeyPress.'"';
442 }
443 $onKeyDown .= $this->m_onKeyDown;
444 if(!empty($onKeyDown)){
445 $events .= ' onKeyDown="'.$onKeyDown.'"';
446 }
447 $onKeyUp .= $this->m_onKeyUp;
448 if(!empty($onKeyUp)){
449 $events .= ' onKeyUp="'.$onKeyUp.'"';
450 }
451
452 return $events;
453 }
454
455 456 457 458 459
460 public function setHint($hint){
461 $this->m_tooltip = $hint;
462 }
463
464 465 466 467 468
469 public function setTooltip($s){
470 $this->setHint($s);
471 }
472
473 474 475 476 477
478 public function setOnClick($js){
479 $this->m_onClick = $js;
480 }
481
482 483 484 485 486
487 public function setOnDblClick($js){
488 $this->m_onDblClick = $js;
489 }
490
491 492 493 494 495
496 public function setOnMouseOver($js){
497 $this->m_onMouseOver = $js;
498 }
499
500 501 502 503 504
505 public function setOnMouseOut($js){
506 $this->m_onMouseOut = $js;
507 }
508
509 510 511 512 513
514 public function setOnMouseDown($js){
515 $this->m_onMouseDown = $js;
516 }
517
518 519 520 521 522
523 public function setOnMouseUp($js){
524 $this->m_onMouseUp = $js;
525 }
526
527 528 529 530 531
532 public function setOnMouseMove($js){
533 $this->m_onMouseMove = $js;
534 }
535
536 537 538 539 540
541 public function setOnKeyPress($js){
542 $this->m_onKeyPress = $js;
543 }
544
545 546 547 548 549
550 public function setOnKeyDown($js){
551 $this->m_onKeyDown = $js;
552 }
553
554 555 556 557 558
559 public function setOnKeyUp($js){
560 $this->m_onKeyUp = $js;
561 }
562
563 564 565 566 567
568 public function setIText($tooltip){
569 $this->m_itext = $tooltip;
570 }
571 }
572
573
574
575 abstract class html_FocusEvents extends html_Events
576 {
577 578 579 580 581
582 public $m_onBlur = "";
583 584 585 586 587
588 public $m_onFocus = "";
589
590
591 protected function htmlFocusEvents($onFocus="", $onBlur=""){
592 $events = "";
593
594 $onFocus .= $this->m_onFocus;
595 if(!empty($onFocus)){
596 $events .= ' onFocus="'.$onFocus.'"';
597 }
598 $onBlur .= $this->m_onBlur;
599 if(!empty($onBlur)){
600 $events .= ' onBlur="'.$onBlur.'"';
601 }
602
603 return $events;
604 }
605
606 607 608 609 610
611 public function setOnBlur($js){
612 $this->m_onBlur = $js;
613 }
614
615 616 617 618 619
620 public function setFocus($js){
621 $this->m_onFocus = $js;
622 }
623 }
624
625
626
627 abstract class html_FocusEventsEx extends html_FocusEvents
628 {
629 630 631 632 633
634 public $m_onChange = "";
635 636 637 638 639
640 public $m_mvc_set_componend_changed = true;
641
642 protected function htmlFocusEventsEx($onChange=""){
643 $events = "";
644
645 $onChange .= $this->m_onChange;
646
647 if(!empty($onChange)){
648 $events .= ' onChange="'.$onChange.'"';
649 }
650
651 return $events;
652 }
653
654 655 656 657 658
659 public function setChange($js){
660 $this->m_onChange = $js;
661 }
662 }
663
664
665
666 abstract class _html_Doc{
667 668 669
670 protected $m_html = "";
671
672 673 674
675 protected $m_title = "";
676 677 678
679 protected $m_send_headers = array();
680
681 682 683
684 protected $m_body = "";
685
686
687 688 689
690 public $m_head = "";
691 692 693 694 695
696 public $m_language = '';
697
698 699 700 701 702
703 public $m_compression = false;
704 705 706 707 708
709 public $m_output_buffering = false;
710
711 712 713 714 715
716 public $m_compression_level = 'auto';
717
718 protected function print_html() {
719 $compression = $this->m_compression;
720 $output_buffering = $this->m_output_buffering;
721
722 if (isset($GLOBALS['CRVCL']['OUTPUT_BUFFERING']) && $GLOBALS['CRVCL']['OUTPUT_BUFFERING'] === true) {
723 $output_buffering = $GLOBALS['CRVCL']['OUTPUT_BUFFERING'];
724 }
725 if (isset($GLOBALS['CRVCL']['COMPRESSION']) && ($GLOBALS['CRVCL']['COMPRESSION'] > 0 || $GLOBALS['CRVCL']['COMPRESSION'] === 'auto') && $compression === 0) {
726 $compression = $GLOBALS['CRVCL']['COMPRESSION'];
727 }
728
729
730 $client_encode = "";
731 if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
732 $client_encode = $_SERVER['HTTP_ACCEPT_ENCODING'];
733
734
735 if (($compression || $output_buffering) && (headers_sent() || ob_get_length() > 0)) {
736 $aFoundFiles = array();
737 if(isset($GLOBALS["CRVCL"]["SHOW_USELESS_LINEFEEDS_FILES_ON_ERROR"]) && $GLOBALS["CRVCL"]["SHOW_USELESS_LINEFEEDS_FILES_ON_ERROR"] == true){
738 $aFoundFiles = array();
739 $aFiles = get_included_files();
740 $c_files = acount($aFiles);
741 for($i=0; $i < $c_files; $i++)
742 {
743 $file = $aFiles[$i];
744 $fileBuf = file_get_contents($file);
745 if(left($fileBuf,2) != '<?' || right($fileBuf,2) != '?>')
746 {
747 $aFoundFiles[] = $file;
748 }
749 }
750 }
751
752
753 if ($compression) {
754 trigger_error("could not send document gzip compressed, because previous output exists: " . left(ob_get_contents(), 10) . "... (len: " . ob_get_length() . "), check you have maybe useless linefeeds at the end of your php script".CRLF.print_r($aFoundFiles,true)." -", E_USER_NOTICE);
755 } else {
756 trigger_error("could not send document with output buffering, because previous output exists: " . left(ob_get_contents(), 10) . "... (len: " . ob_get_length() . "), check you have maybe useless linefeeds at the end of your php script".CRLF.print_r($aFoundFiles,true)." -", E_USER_NOTICE);
757 }
758 }
759
760 $html_compressed = "";
761 $csize = 0;
762 if (!isset($GLOBALS["CRVCL"]["COMPRESSION_MIN_CONTENT_SIZE"]))
763 $GLOBALS["CRVCL"]["COMPRESSION_MIN_CONTENT_SIZE"] = "2K";
764 if ($compression && !headers_sent() && $client_encode != "" && ob_get_length() === 0 && ($csize = strlen($this->m_html)) > str2byteInt($GLOBALS["CRVCL"]["COMPRESSION_MIN_CONTENT_SIZE"])) {
765 $encodetype = "";
766 $encodemode = -1;
767
768
769 $clevel = $this->m_compression_level;
770 if ($clevel === "auto") {
771 @header('X-crVCL-Compression-Algorithm: true', true);
772
773 $clevel = 2;
774 if ($csize >= str2byteInt("100K")) {
775 $clevel = 6;
776 } else if ($csize >= str2byteInt("50K")) {
777 $clevel = 5;
778 }else if ($csize >= str2byteInt("25K")) {
779 $clevel = 4;
780 }
781 } else if ($clevel < 0) {
782 $clevel = 0;
783 }
784
785 @header('X-crVCL-Compression-Level: '.$clevel, true);
786 @header('X-crVCL-Content-Size: '. byte2str($csize), true);
787
788 if (strpos($client_encode, "gzip") !== false) {
789 if (strpos($client_encode, "x-gzip") !== false) {
790 $encodetype = "x-gzip";
791 }else{
792 $encodetype = "gzip";
793 }
794 $encodemode = FORCE_GZIP;
795 }
796
797 if (strpos($client_encode, "deflate") !== false && stripos($_SERVER['HTTP_USER_AGENT'], "MSIE 6") === false) {
798 $encodetype = "deflate";
799 $encodemode = FORCE_DEFLATE;
800 }
801 if ($encodetype != "" && extension_loaded("zlib")) {
802 $out_hand = trim(ini_get('output_handler'));
803 $zlib_out_hand = trim(ini_get('zlib.output_handler'));
804 $zlib_out_comp = trim(ini_get('zlib.output_compression'));
805 while (true) {
806 if (!empty($out_hand)) {
807 trigger_error("output_handler must be empty, if document compression is true (" . $out_hand . ")" . str2hex($out_hand), E_USER_NOTICE);
808 break;
809 }
810 if (!empty($zlib_out_comp)) {
811 trigger_error("you cannot use both ob_gzhandler() and zlib.output_compression, turn off zlib.output_compression (" . $zlib_out_comp . ")", E_USER_NOTICE);
812 break;
813 }
814 if (!empty($zlib_out_hand)) {
815 trigger_error("zlib.output_handler must be empty, if document compression is true (" . $zlib_out_hand . ")", E_USER_NOTICE);
816 break;
817 }
818
819
820 ob_implicit_flush(0);
821
822 ob_start(null);
823
824
825 @header("Vary: Accept-Encoding", false);
826 @header('Content-Encoding: ' . $encodetype, true);
827
828 $html_compressed = $this->m_html;
829
830 if ($GLOBALS["CRVCL"]["DEBUG"] != true)
831 optimizeHTML($html_compressed);
832
833 if ($encodemode === FORCE_DEFLATE) {
834 $html_compressed = gzcompress($html_compressed, $clevel);
835 $html_compressed = substr($html_compressed, 2);
836 } else {
837 $html_compressed = gzencode($html_compressed, $clevel, $encodemode);
838 }
839
840 $csize_compressed = strlen($html_compressed);
841 @header('X-crVCL-Content-Size-Compressed: '. byte2str($csize_compressed), true);
842 @header('X-crVCL-Compression-Rate: '. round( (($csize_compressed-$csize)/$csize)*100*-1 ).'%', true);
843
844 break;
845 }
846 } else {
847 $compression = false;
848
849 if ($output_buffering && !headers_sent() && ob_get_length() === 0) {
850 ob_implicit_flush(0);
851 ob_start(null);
852 }
853 }
854 } else {
855 $compression = false;
856
857 if ($output_buffering && !headers_sent() && ob_get_length() === 0) {
858 ob_implicit_flush(0);
859 ob_start(null);
860 }
861 }
862
863
864 if(!headers_sent()){
865 foreach($this->m_send_headers as $value){
866 @header($value, false);
867 }
868 }
869
870 871 872 873 874 875 876 877 878
879
880 if (!headers_sent()) {
881 @header('Content-Type: text/html; charset=' . $this->m_charset, true);
882 @header("Connection: close", true);
883 }
884
885 if ($compression) {
886 print $html_compressed;
887 } else {
888
889 if ($GLOBALS["CRVCL"]["DEBUG"] != true) {
890 $html = $this->m_html;
891
892 optimizeHTML($html);
893
894 print $html;
895 } else {
896 print $this->m_html;
897 }
898 }
899
900 if (($compression || $output_buffering) && !headers_sent()) {
901 @header('Content-Length: ' . ob_get_length(), true);
902 }
903
904 if (($compression || $output_buffering) && !headers_sent()) {
905 @header('X-crVCL-Output-Buffering: true', true);
906 }
907
908 if (!isset($GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"]) || ($GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"] != true && !headers_sent())) {
909 @header('X-Powered-By: crVCL PHP Framework Version ' . CRVCL_VERSION . ' (http://www.cr-solutions.net)', false);
910 }
911
912 if ($compression || $output_buffering) {
913 while (@ob_end_flush());
914 } else {
915 @ob_flush();
916 }
917
918 @flush();
919
920 if(strlen(ob_get_contents()) > 0)
921 @ob_end_clean();
922
923 free($html);
924 free($html_compressed);
925 gc_collect_cycles_overX($GLOBALS['CRVCL']['GC_COLLECT_CYCLES_PERCENT']);
926 }
927
928
929 930 931 932 933
934 function sendHeaders($headers){
935 $this->m_send_headers = $headers;
936 }
937
938 939 940 941 942
943 function setTitle($title) {
944 $this->m_title = $title;
945 }
946
947 948 949 950
951 function getTitle(){
952 return $this->m_title;
953 }
954
955
956 957 958 959 960
961 function setHead($head){
962 $this->m_head = $head;
963 }
964
965 966 967 968 969
970 function setBody(&$body) {
971 $this->m_body = & $body;
972 }
973 }
974
975
976
977 978 979
980 class html_DocAMP extends _html_Doc{
981
982 use html_tComponent {
983 buildChilds as tBuildChilds;
984 }
985
986 987 988 989 990
991 private $m_charset = "UTF-8";
992
993
994 private $m_css = "";
995
996 997 998 999 1000
1001 public $m_canonical = "";
1002
1003 1004 1005 1006 1007
1008 public $m_cache = false;
1009 1010 1011 1012 1013
1014 public $m_cache_time_sec = 3600;
1015
1016
1017 1018 1019 1020 1021 1022
1023 protected function &buildChilds($childs = null) {
1024 return $this->tBuildChilds($childs);
1025 }
1026
1027
1028 1029 1030 1031 1032
1033 function setCss($css){
1034 $this->m_css = $this->m_css.CRLF.$css;
1035 }
1036
1037
1038 function print_html() {
1039 print $this->m_html;
1040 }
1041
1042
1043 1044 1045 1046 1047 1048
1049 function html($print = false) {
1050
1051 $this->m_html .= '<!doctype html>'. CRLF;
1052 if ($this->m_language != '') {
1053 $this->m_html .= '<html amp lang="' . $this->m_language . '"' . $attribute_html . '>' . CRLF;
1054 header("Content-Language: ".$this->m_language, true);
1055 } else {
1056 $this->m_html .= '<html amp>' . CRLF;
1057 }
1058
1059
1060 $this->m_html .= '<head>' . CRLF;
1061 $this->m_html .= '<meta charset="utf-8">' . CRLF;
1062 $title = $this->m_title;
1063 if (empty($title)) {
1064 $title = $GLOBALS["CRVCL"]["DOC_TITLE"];
1065 }
1066 $this->m_html .= '<title>' . $title . '</title>' . CRLF;
1067
1068 if ($this->m_canonical != "") {
1069 $this->m_html .= '<link rel="canonical" href="' . $this->m_canonical . '">' . CRLF;
1070 }
1071
1072 $this->m_html .= '<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">' . CRLF;
1073
1074 $this->m_html .= $this->m_head.CRLF;
1075
1076 $this->m_html .= '<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>' . CRLF;
1077 if(!empty($this->m_css)){
1078 $this->m_html .= '<style amp-custom>' . CRLF;
1079 $this->m_html .= $this->m_css . CRLF;
1080 $this->m_html .= '</style>' . CRLF;
1081 }
1082 $this->m_html .= '<script async src="https://cdn.ampproject.org/v0.js"></script>' . CRLF;
1083
1084
1085
1086 if($this->m_cache === false){
1087
1088
1089
1090
1091
1092 if(!headers_sent()){
1093 $headers_cache_sent = false;
1094 if(acount($this->m_send_headers) > 0){
1095 for($h = 0; $h < acount($this->m_send_headers); $h++){
1096 $header = $this->m_send_headers[$h];
1097 if(stripos($header, 'Cache-Control') !== false
1098 || stripos($header, 'Expires') !== false
1099 || stripos($header, 'Pragma') !== false){
1100 $headers_cache_sent = true;
1101 }
1102 }
1103 }
1104
1105 if(!$headers_cache_sent){
1106 header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate, post-check=0, pre-check=0", true);
1107 header("Expires: Thu, 1 Jan 1970 00:00:00 GMT", true);
1108 header("Pragma: no-cache", true);
1109 header("Vary: User-Agent, Cookie", false);
1110 }
1111 }
1112
1113 }else if($this->m_cache === true || is_string($this->m_cache)){
1114
1115 1116 1117 1118 1119 1120 1121
1122 $post_check = 360;
1123 $pre_check = 3600;
1124 if($this->m_cache_time_sec < $post_check){
1125 $post_check = ceil($this->m_cache_time_sec/4);
1126 }
1127 if($this->m_cache_time_sec < $pre_check){
1128 $pre_check = ceil($this->m_cache_time_sec/2);
1129 }
1130
1131 $time_last_mod = time();
1132 if(isset($_SESSION['CRVCL']['SESSION']['START_TIME'])){
1133 if(!isset($_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'])){
1134 $_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'] = $_SESSION['CRVCL']['SESSION']['START_TIME'];
1135 }
1136
1137 $time_last_mod = $_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'];
1138
1139 if(time() > $time_last_mod + $this->m_cache_time_sec){
1140 $time_last_mod = $_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'] = time();
1141 }
1142 }
1143
1144 $dtExpire = new crDateTime($time_last_mod);
1145 $dtExpire->calc("seconds", $this->m_cache_time_sec);
1146
1147
1148 if($this->m_cache === true){
1149
1150 }else{
1151
1152 }
1153
1154
1155
1156 if(!headers_sent()){
1157 $headers_cache_sent = false;
1158 if(acount($this->m_send_headers) > 0){
1159 for($h = 0; $h < acount($this->m_send_headers); $h++){
1160 $header = $this->m_send_headers[$h];
1161 if(stripos($header, 'Cache-Control') !== false
1162 || stripos($header, 'Expires') !== false
1163 || stripos($header, 'Pragma') !== false){
1164 $headers_cache_sent = true;
1165 }
1166 }
1167 }
1168
1169 if(!$headers_cache_sent){
1170 if($this->m_cache === true){
1171 header("Cache-Control: private, must-revalidate, max-age=".$this->m_cache_time_sec.", post-check=".$post_check.", pre-check=".$pre_check, true);
1172 header("Pragma: private", true);
1173 }else{
1174 header("Cache-Control: ".$this->m_cache.", must-revalidate, proxy-revalidate, max-age=".$this->m_cache_time_sec.", post-check=".$post_check.", pre-check=".$pre_check, true);
1175 header("Pragma: ".$this->m_cache, true);
1176 }
1177 header("Expires: ".$dtExpire->toString("HTTP"), true);
1178
1179
1180 if(isset($_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'])){
1181 $dtLastMod = new crDateTime($_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD']);
1182 header("Last-Modified: ".$dtLastMod->toString("HTTP"), true);
1183 }
1184
1185 if(($this->m_cache === true || $this->m_cache === 'private')){
1186 header("Vary: User-Agent, Cookie", false);
1187 }
1188 }
1189 }
1190 }
1191
1192
1193 $this->m_html .= '</head>' . CRLF;
1194
1195 $this->m_html .= '<body>' . CRLF;
1196
1197 if (is_object($this->m_body) && method_exists($this->m_body, "html")) {
1198 $this->m_body = array($this->m_body);
1199 }
1200 if (is_array($this->m_body)) {
1201 $this->m_body = & $this->buildChilds($this->m_body);
1202 }
1203
1204 $this->m_html .= $GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"] . $this->m_body;
1205
1206 if (!isset($GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"]) || $GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"] != true) {
1207 $this->m_html .= CRLF . '<!-- crVCL PHP Framework Version ' . CRVCL_VERSION . ' (http://www.cr-solutions.net) -->' . CRLF;
1208 }
1209
1210
1211 $this->m_html .= '</body>' . CRLF;
1212 $this->m_html .= '</html>'. CRLF;
1213
1214
1215 if ($print) {
1216 $this->print_html();
1217 }
1218
1219 return $this->m_html;
1220 }
1221
1222 }
1223
1224
1225
1226 class html_Doc extends _html_Doc
1227 {
1228 use html_tComponent {buildChilds as tBuildChilds;}
1229
1230
1231
1232 1233 1234
1235 private $m_frameset = "";
1236
1237 1238 1239
1240 private $m_js = "";
1241 1242 1243
1244 private $m_js_ajax_cache = "";
1245 1246 1247
1248 private $m_js_files = array();
1249 1250 1251
1252 private $m_css_files = array();
1253 1254 1255
1256 private $m_css = "";
1257 1258 1259
1260 private $m_style = "";
1261 1262 1263
1264 public $m_class = "";
1265
1266
1267 1268 1269
1270 private $m_keywords = array();
1271 1272 1273
1274 private $m_descriptions = array();
1275 1276 1277
1278 private $m_cache_file = null;
1279
1280 1281 1282 1283 1284
1285 public $m_name = 'html_Doc';
1286 1287 1288 1289 1290
1291 public $m_favicon = "";
1292
1293 1294 1295 1296 1297
1298 public $m_apple_touch_icon_precomposed = "";
1299 1300 1301 1302 1303
1304 public $m_cache = false;
1305 1306 1307 1308 1309
1310 public $m_cache_time_sec = 3600;
1311 1312 1313 1314 1315
1316 public $m_author = "";
1317 1318 1319 1320 1321
1322 public $m_canonical = "";
1323
1324 1325 1326 1327 1328
1329 public $m_amp = "";
1330 1331 1332 1333 1334
1335 public $m_robots = "all";
1336 1337 1338 1339 1340
1341 public $m_charset = "UTF-8";
1342 1343 1344 1345 1346
1347 public $m_attribute = "";
1348 1349 1350 1351 1352
1353 public $m_onMouseMove = "";
1354 1355 1356 1357 1358
1359 public $m_onKeyPress = "";
1360 1361 1362 1363 1364
1365 public $m_tooltip_class = '';
1366 1367 1368 1369 1370
1371 public $m_itext_class = '';
1372 1373 1374 1375 1376
1377 public $m_itext_delay = 3;
1378 1379 1380 1381 1382
1383 public $m_tooltip_flat = true;
1384 1385 1386 1387 1388
1389 public $m_tooltip_delay = 3;
1390 1391 1392 1393 1394
1395 public $m_onResize = "";
1396
1397
1398 1399 1400 1401 1402
1403 public $m_ajax = false;
1404
1405
1406 1407 1408 1409 1410
1411 public $m_ajax_max_connections = 1;
1412 1413 1414 1415 1416
1417 public $m_onLoad = "";
1418 1419 1420 1421 1422
1423 public $m_onUnload = "";
1424 1425 1426 1427 1428
1429 public $m_meta = "";
1430 1431 1432 1433 1434
1435 public $m_cache_fw_js = false;
1436 1437 1438 1439 1440
1441 public $m_cache_fw_js_dir = "";
1442 1443 1444 1445 1446
1447 public $m_cache_fw_js_dir_ex = "";
1448 1449 1450 1451 1452
1453 public $m_cache_fw_css = false;
1454 1455 1456 1457 1458
1459 public $m_cache_fw_css_dir = "";
1460 1461 1462 1463 1464
1465 public $m_cache_fw_css_dir_ex = "";
1466 1467 1468 1469 1470
1471 public $m_cache_ajax_js = false;
1472 1473 1474 1475 1476
1477 public $m_deanedwards_ie_compliant = null;
1478 1479 1480 1481 1482
1483 public $m_deanedwards_ie7_png_suffix = '*-trans.png';
1484 1485 1486 1487 1488
1489 public $m_deanedwards_ie7_squish_holly_hack = false;
1490 1491 1492 1493 1494
1495 public $m_firebug_lite = false;
1496 1497 1498 1499 1500
1501 public $m_X_UA_Compatible = null;
1502
1503 1504 1505 1506 1507
1508 public $m_revisit_after = '5 days';
1509 1510 1511 1512 1513
1514 public $m_doctype = "<!DOCTYPE html>";
1515
1516 1517 1518 1519 1520
1521 public $m_attribute_html = '';
1522
1523 1524 1525 1526 1527
1528 public $m_noscript_html = null;
1529
1530
1531 function __construct(){
1532 if(isset($GLOBALS["CRVCL"]["CHARSET"]))
1533 $this->m_charset = $GLOBALS["CRVCL"]["CHARSET"];
1534 }
1535
1536 function __destruct(){
1537 if($this->m_compression === true){@ob_end_flush();}
1538 }
1539
1540 1541 1542 1543 1544 1545
1546 protected function &buildChilds($childs=null){
1547 return $this->tBuildChilds($childs);
1548 }
1549
1550 1551 1552 1553 1554 1555 1556 1557
1558 function readCacheFile($fname, $expire_sec=5, $print=false){
1559 $this->m_cache_file = $fname;
1560
1561
1562
1563
1564 if(!empty($this->m_cache_file) && is_file($this->m_cache_file) && time() < filemtime($this->m_cache_file)+$expire_sec){
1565 $this->m_html = @file_get_contents($this->m_cache_file);
1566 if(empty($this->m_html)){return null;}
1567
1568 if($print){
1569 $this->print_html();
1570 }
1571 return $this->m_html;
1572 }
1573
1574 return null;
1575 }
1576
1577 1578 1579 1580 1581 1582
1583 function html($print=false){
1584
1585 if(empty($this->m_cache_fw_js_dir)){
1586 $this->m_cache_fw_js = false;
1587 }
1588 $this->m_cache_fw_js_dir = fixpath($this->m_cache_fw_js_dir);
1589 $this->m_cache_fw_js_dir_ex = fixpath($this->m_cache_fw_js_dir_ex);
1590
1591
1592
1593 if(empty($this->m_cache_fw_css_dir)){
1594 $this->m_cache_fw_css = false;
1595 }
1596 $this->m_cache_fw_css_dir = fixpath($this->m_cache_fw_css_dir);
1597 $this->m_cache_fw_css_dir_ex = fixpath($this->m_cache_fw_css_dir_ex);
1598
1599
1600
1601 if(!empty($this->m_doctype)){
1602 $this->m_html .= $this->m_doctype.CRLF;
1603 }
1604
1605 $attribute_html = '';
1606 if($this->m_attribute_html != ''){
1607 $attribute_html = ' '.$this->m_attribute_html;
1608 }
1609
1610 if($this->m_language != ''){
1611 $this->m_html .= '<html lang="'.$this->m_language.'"'.$attribute_html.'>'.CRLF;
1612 }else{
1613 $this->m_html .= '<html>'.CRLF;
1614 }
1615
1616
1617 $this->m_html .= '<head>'.CRLF;
1618 $title = $this->m_title;
1619 if(empty($title)){
1620 $title = $GLOBALS["CRVCL"]["DOC_TITLE"];
1621 }
1622 $this->m_html .= '<title>'.$title.'</title>'.CRLF;
1623
1624
1625
1626 $this->m_html .= $this->m_meta.CRLF;
1627
1628 if($this->m_canonical != ""){
1629 $this->m_html .= '<link rel="canonical" href="'.$this->m_canonical.'">'.CRLF;
1630 }
1631 if($this->m_amp != ""){
1632 $this->m_html .= '<link rel="amphtml" href="'.$this->m_amp.'">'.CRLF;
1633 }
1634
1635 if(!isset($GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"]) || $GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"] != true){
1636 $this->m_html .= '<meta name="generator" content="crVCL PHP Framework Version '.CRVCL_VERSION.' (http://www.cr-solutions.net)">'.CRLF;
1637 }
1638
1639 if($this->m_deanedwards_ie_compliant !== null){
1640 $this->m_X_UA_Compatible = "IE=7; IE=8";
1641 }
1642
1643 if($this->m_X_UA_Compatible !== null){
1644 $this->m_html .= '<meta http-equiv="X-UA-Compatible" content="'.$this->m_X_UA_Compatible.'">'.CRLF;
1645 }
1646
1647 $this->m_html .= '<meta http-equiv="content-type" content="text/html; charset='.$this->m_charset.'">'.CRLF;
1648 $this->m_html .= '<meta name="author" content="'.$this->m_author.'">'.CRLF;
1649 if($this->m_language != ''){
1650 $this->m_html .= '<meta name="language" content="'.$this->m_language.'">'.CRLF;
1651 $this->m_html .= '<meta http-equiv="content-language" content="'.$this->m_language.'">'.CRLF;
1652 header("Content-Language: ".$this->m_language, true);
1653 }
1654
1655 while(list($key, $val) = each($this->m_keywords)){
1656 if($key === "null"){
1657 $this->m_html .= '<meta name="keywords" content="'.$val.'">'.CRLF;
1658 }else{
1659 $this->m_html .= '<meta name="keywords" lang="'.$key.'" content="'.$val.'">'.CRLF;
1660 }
1661 }
1662
1663 while(list($key, $val) = each($this->m_descriptions)){
1664 if($key === "null"){
1665 $this->m_html .= '<meta name="description" content="'.$val.'">'.CRLF;
1666 }else{
1667 $this->m_html .= '<meta name="description" lang="'.$key.'" content="'.$val.'">'.CRLF;
1668 }
1669 }
1670
1671 if($this->m_cache === false){
1672 $this->m_html .= '<meta http-equiv="expires" content="0">'.CRLF;
1673 $this->m_html .= '<meta http-equiv="cache-control" content="no-store, no-cache, max-age=0, s-maxage=0, must-revalidate, post-check=0, pre-check=0">'.CRLF;
1674 $this->m_html .= '<meta http-equiv="pragma" content="no-cache">'.CRLF;
1675
1676 if(!headers_sent()){
1677 $headers_cache_sent = false;
1678 if(acount($this->m_send_headers) > 0){
1679 for($h = 0; $h < acount($this->m_send_headers); $h++){
1680 $header = $this->m_send_headers[$h];
1681 if(stripos($header, 'Cache-Control') !== false
1682 || stripos($header, 'Expires') !== false
1683 || stripos($header, 'Pragma') !== false){
1684 $headers_cache_sent = true;
1685 }
1686 }
1687 }
1688
1689 if(!$headers_cache_sent){
1690 header("Cache-Control: no-store, no-cache, max-age=0, s-maxage=0, must-revalidate, post-check=0, pre-check=0", true);
1691 header("Expires: Thu, 1 Jan 1970 00:00:00 GMT", true);
1692 header("Pragma: no-cache", true);
1693 header("Vary: User-Agent, Cookie", false);
1694 }
1695 }
1696
1697 }else if($this->m_cache === true || is_string($this->m_cache)){
1698
1699 1700 1701 1702 1703 1704 1705
1706 $post_check = 360;
1707 $pre_check = 3600;
1708 if($this->m_cache_time_sec < $post_check){
1709 $post_check = ceil($this->m_cache_time_sec/4);
1710 }
1711 if($this->m_cache_time_sec < $pre_check){
1712 $pre_check = ceil($this->m_cache_time_sec/2);
1713 }
1714
1715 $time_last_mod = time();
1716 if(isset($_SESSION['CRVCL']['SESSION']['START_TIME'])){
1717 if(!isset($_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'])){
1718 $_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'] = $_SESSION['CRVCL']['SESSION']['START_TIME'];
1719 }
1720
1721 $time_last_mod = $_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'];
1722
1723 if(time() > $time_last_mod + $this->m_cache_time_sec){
1724 $time_last_mod = $_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'] = time();
1725 }
1726 }
1727
1728 $dtExpire = new crDateTime($time_last_mod);
1729 $dtExpire->calc("seconds", $this->m_cache_time_sec);
1730 $this->m_html .= '<meta http-equiv="expires" content="'.$dtExpire->toString("HTTP").'">'.CRLF;
1731 if($this->m_cache === true){
1732 $this->m_html .= '<meta http-equiv="cache-control" content="private, must-revalidate, max-age='.$this->m_cache_time_sec.', post-check='.$post_check.', pre-check='.$pre_check.'">'.CRLF;
1733 }else{
1734 $this->m_html .= '<meta http-equiv="cache-control" content="'.$this->m_cache.', must-revalidate, proxy-revalidate, max-age='.$this->m_cache_time_sec.', post-check='.$post_check.', pre-check='.$pre_check.'">'.CRLF;
1735 }
1736 $this->m_html .= '<meta http-equiv="pragma" content="cache">'.CRLF;
1737
1738 if(!headers_sent()){
1739 $headers_cache_sent = false;
1740 if(acount($this->m_send_headers) > 0){
1741 for($h = 0; $h < acount($this->m_send_headers); $h++){
1742 $header = $this->m_send_headers[$h];
1743 if(stripos($header, 'Cache-Control') !== false
1744 || stripos($header, 'Expires') !== false
1745 || stripos($header, 'Pragma') !== false){
1746 $headers_cache_sent = true;
1747 }
1748 }
1749 }
1750
1751 if(!$headers_cache_sent){
1752 if($this->m_cache === true){
1753 header("Cache-Control: private, must-revalidate, max-age=".$this->m_cache_time_sec.", post-check=".$post_check.", pre-check=".$pre_check, true);
1754 header("Pragma: private", true);
1755 }else{
1756 header("Cache-Control: ".$this->m_cache.", must-revalidate, proxy-revalidate, max-age=".$this->m_cache_time_sec.", post-check=".$post_check.", pre-check=".$pre_check, true);
1757 header("Pragma: ".$this->m_cache, true);
1758 }
1759 header("Expires: ".$dtExpire->toString("HTTP"), true);
1760
1761 if(isset($_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD'])){
1762 $dtLastMod = new crDateTime($_SESSION['CRVCL']['HTTP_HEADER']['TIME_LAST_MOD']);
1763 header("Last-Modified: ".$dtLastMod->toString("HTTP"), true);
1764 }
1765
1766 if(($this->m_cache === true || $this->m_cache === 'private')){
1767 header("Vary: User-Agent, Cookie", false);
1768 }
1769 }
1770 }
1771 }
1772
1773 $this->m_html .= '<meta http-equiv="Content-Script-Type" content="text/javascript">'.CRLF;
1774 $this->m_html .= '<meta http-equiv="Content-Script-Type" content="application/x-javascript">'.CRLF;
1775 $this->m_html .= '<meta http-equiv="Content-Script-Type" content="text/php">'.CRLF;
1776 $this->m_html .= '<meta http-equiv="Content-Style-Type" content="text/css">'.CRLF;
1777 if(stripos($this->m_html, '<meta name="robots"')===false && stripos($this->m_head, '<meta name="robots"')===false){
1778 $this->m_html .= '<meta name="robots" content="'.$this->m_robots.'">'.CRLF;
1779 }
1780 $this->m_html .= '<meta name="revisit-after" content="'.$this->m_revisit_after.'">'.CRLF;
1781
1782
1783
1784 $this->m_html .= $this->m_head.CRLF;
1785
1786
1787
1788 if(!empty($this->m_favicon)){
1789 $this->m_html .= '<link rel="shortcut icon" href="'.$this->m_favicon.'" type="image/x-icon">'.CRLF;
1790 $this->m_html .= '<link rel="icon" href="'.$this->m_favicon.'" type="image/x-icon">'.CRLF;
1791 }
1792 if(!empty($this->m_apple_touch_icon_precomposed)){
1793 $this->m_html .= '<link rel="apple-touch-icon" href="'.$this->m_apple_touch_icon_precomposed.'">'.CRLF;
1794 }
1795
1796
1797
1798 for($f = 0; $f < acount($this->m_css_files); $f++){
1799 $css_url = $this->m_css_files[$f];
1800 if(is_array($this->m_css_files[$f])){
1801 $css_optimized = $css_url[2];
1802 $css_file = $css_url[1];
1803 $css_url = $css_url[0];
1804
1805 if(!empty($this->m_cache_fw_css)){
1806 $css_cache_file = $this->scriptCacheFile($this->m_cache_fw_css_dir, $css_file, $css_optimized);
1807 $css_cache_file = strrcut($css_cache_file, '/', true);
1808
1809 $css_url = $this->m_cache_fw_css_dir_ex.'/'.$css_cache_file;
1810 }
1811 }
1812
1813 $this->m_html .= '<link rel="stylesheet" type="text/css" href="'.$css_url.'">'.CRLF;
1814 }
1815
1816
1817
1818 $fw_css = '';
1819 if($this->m_cache_fw_css && !empty($this->m_cache_fw_css)){
1820 $css_cache_file = $this->scriptCacheFile($this->m_cache_fw_css_dir, $GLOBALS["CRVCL"]["PATH"]."/fw.inc.css");
1821 $css_cache_file = strrcut($css_cache_file, '/', true);
1822 $this->m_html .= '<link rel="stylesheet" type="text/css" href="'.$this->m_cache_fw_css_dir_ex.'/'.$css_cache_file.'">'.CRLF;
1823
1824 $fw_css = $this->m_css;
1825 }else{
1826 $fw_css = getFrameworkCSS()."\r\n";
1827 $fw_css .= $this->m_css;
1828 }
1829 if(!empty($fw_css))
1830 $this->m_html .= '<style type="text/css">'.CRLF.$fw_css.CRLF.'</style>'.CRLF;
1831
1832
1833
1834
1835
1836 $gjs = "<!-- global js variables set by the document component -->".CRLF;
1837 $gjs .= "fw_start_tick = new Date(); fw_loadingtime_css_js_ms = null;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1838 $gjs .= "fw_tooltip_delay = ".$this->m_tooltip_delay.";".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1839 $gjs .= "fw_itext_delay = ".$this->m_itext_delay.";".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1840 if(isset($GLOBALS["CRVCL"]["TRACE_AJAX"]) && $GLOBALS["CRVCL"]["TRACE_AJAX"] === true){
1841 $gjs .= "fw_AjaxTrace = true;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1842 }else{
1843 $gjs .= "fw_AjaxTrace = false;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1844 }
1845 if(isset($GLOBALS["CRVCL"]["USE_FIREBUG_INSTEAD_DEBUG_POPUP"]) && $GLOBALS["CRVCL"]["USE_FIREBUG_INSTEAD_DEBUG_POPUP"] === true){
1846 $gjs .= "fw_useFirebug = true;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1847 }else{
1848 $gjs .= "fw_useFirebug = false;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1849 }
1850 $gjs .= "fw_page_charset = '".$this->m_charset."';".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1851 $gjs .= "fw_doc_onresize_js = '".str_replace("'","\"",$this->m_onResize)."';".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1852
1853 if(isset($GLOBALS["CRVCL"]["DEBUG"]) && $GLOBALS["CRVCL"]["DEBUG"] === true){
1854 $gjs .= "fw_debug = true;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1855 }else{
1856 $gjs .= "fw_debug = false;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1857 }
1858 if(isset($GLOBALS["CRVCL"]["AJAX_SHOW_ERROR_MSG"]) && $GLOBALS["CRVCL"]["AJAX_SHOW_ERROR_MSG"] === true){
1859 $gjs .= "fw_ajax_error_msg = true;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1860 }else{
1861 $gjs .= "fw_ajax_error_msg = false;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1862 }
1863 if(isset($GLOBALS["CRVCL"]["AJAX_SHOW_ERROR_STATUS_BIGGER_12000"]) && $GLOBALS["CRVCL"]["AJAX_SHOW_ERROR_STATUS_BIGGER_12000"] === true){
1864 $gjs .= "fw_ajax_error_status_bigger_12000 = true;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1865 }else{
1866 $gjs .= "fw_ajax_error_status_bigger_12000 = false;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1867 }
1868 if(isset($GLOBALS["CRVCL"]["AJAX_ALLOW_UNSIGNED_UNTRUSTED_CERTIFICATES"]) && $GLOBALS["CRVCL"]["AJAX_ALLOW_UNSIGNED_UNTRUSTED_CERTIFICATES"] === true){
1869 $gjs .= "fw_ajax_allow_unsigned_untrusted_certificates = true;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1870 }else{
1871 $gjs .= "fw_ajax_allow_unsigned_untrusted_certificates = false;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1872 }
1873
1874 $gjs .= 'fw_crvcl_version = "'.CRVCL_VERSION.'";'.CRLF;
1875 if(!isset($GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"]) || $GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"] != true){
1876 $gjs .= 'fw_exclusive_license = true;'.CRLF;
1877 }else{
1878 $gjs .= 'fw_exclusive_license = false;'.CRLF;
1879 }
1880
1881
1882 if($this->m_ajax){
1883 if(!isset($GLOBALS["CRVCL"]["AJAX_HIST_ID_FRAGMENT_NAME"])){
1884 $GLOBALS["CRVCL"]["AJAX_HIST_ID_FRAGMENT_NAME"] = "fw_ajax_hist_id";
1885 }
1886 $gjs .= "fw_ajax_hist_id_fragment_name = '".$GLOBALS["CRVCL"]["AJAX_HIST_ID_FRAGMENT_NAME"]."';".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1887 $gjs .= "var fw_blank_uri = '".protocol().'://'.$GLOBALS["CRVCL"]["URL"]."/blank.html';";
1888 }
1889
1890
1891
1892 $fw_js = '';
1893 if($this->m_cache_fw_js && !empty($this->m_cache_fw_js_dir)){
1894 $this->m_html .= '<script type="text/javascript">'.CRLF.$gjs.CRLF.'</script>'.CRLF;
1895
1896 $js_cache_file = $this->scriptCacheFile($this->m_cache_fw_js_dir, $GLOBALS["CRVCL"]["PATH"]."/fwtools.inc.js");
1897 $js_cache_file = strrcut($js_cache_file, '/', true);
1898 $this->m_html .= '<script type="text/javascript" src="'.$this->m_cache_fw_js_dir_ex.'/'.$js_cache_file.'"></script>'.CRLF;
1899
1900 $fw_js = $this->m_js;
1901 }else{
1902 $fw_js = getFrameworkJS()."\r\n";
1903 $fw_js .= $gjs.$this->m_js;
1904 }
1905 if(!empty($fw_js))
1906 $this->m_html .= '<script type="text/javascript">'.CRLF.$fw_js.CRLF.'</script>'.CRLF;
1907
1908
1909
1910
1911 $js = "<!-- js variables overwritten by the document component -->".CRLF;
1912
1913 if($GLOBALS["CRVCL"]["CHARSET"] === "UTF-8" || $$this->m_charset === "UTF-8"){
1914 $js .= "fw_utf8 = true;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1915 }
1916 $js .= "window.onload=fw_doc_init;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1917 $js .= "window.onresize=fw_doc_resize;".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1918
1919 $js .= "fw_last_window_width = getWindowWidth();".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1920 $js .= "fw_last_window_height = getWindowHeight();".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1921 $js .= "fw_last_doc_width = getDocWidth();".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1922 $js .= "fw_last_doc_height = getDocHeight();".$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
1923
1924 $this->m_html .= '<script type="text/javascript">'.CRLF.$js.CRLF.'</script>'.CRLF;
1925
1926
1927
1928 for($f = 0; $f < acount($this->m_js_files); $f++){
1929 $js_url = $this->m_js_files[$f];
1930 if(is_array($this->m_js_files[$f])){
1931 $js_optimized = $js_url[2];
1932 $js_file = $js_url[1];
1933 $js_url = $js_url[0];
1934
1935 if(!empty($this->m_cache_fw_js_dir)){
1936 $js_cache_file = $this->scriptCacheFile($this->m_cache_fw_js_dir, $js_file, $js_optimized);
1937 $js_cache_file = strrcut($js_cache_file, '/', true);
1938 $js_url = $this->m_cache_fw_js_dir_ex.'/'.$js_cache_file;
1939 }
1940 }
1941 if(left($js_url,6) === 'async:'){
1942 $js_url = substr($js_url, 6);
1943 $this->m_html .= '<script async src="'.$js_url.'" type="text/javascript"></script>'.CRLF;
1944 }else{
1945 $this->m_html .= '<script src="'.$js_url.'" type="text/javascript"></script>'.CRLF;
1946 }
1947 }
1948
1949
1950
1951 if(!empty($this->m_js_ajax_cache) && !empty($this->m_cache_fw_js_dir)){
1952 $fbuf = '';
1953 if(is_file($this->m_cache_fw_js_dir."/ajax_callback.runtime.js")){
1954 $fbuf = file_get_contents($this->m_cache_fw_js_dir."/ajax_callback.runtime.js");
1955
1956 if(diffSec("", date("YmdHis", filemtime($this->m_cache_fw_js_dir."/ajax_callback.runtime.js"))) < 1){
1957 sleep(2);
1958 }
1959 }
1960
1961 if($fbuf != $this->m_js_ajax_cache){
1962 $bytes = @file_put_contents($this->m_cache_fw_js_dir."/ajax_callback.runtime.js", $this->m_js_ajax_cache);
1963 if($bytes === false){
1964 trigger_error("can't write file or permission denied (".$this->m_cache_fw_js_dir."/ajax_callback.runtime.js)", E_USER_WARNING);
1965 }
1966 }
1967
1968
1969 $ajax_cache_file = $this->scriptCacheFile($this->m_cache_fw_js_dir, $this->m_cache_fw_js_dir."/ajax_callback.runtime.js");
1970 $ajax_cache_file = strrcut($ajax_cache_file, '/', true);
1971 $this->m_html .= '<script type="text/javascript" src="'.$this->m_cache_fw_js_dir_ex.'/'.$ajax_cache_file.'"></script>'.CRLF;
1972 }
1973
1974
1975
1976
1977 if($this->m_firebug_lite && is_file($GLOBALS["CRVCL"]["PATH"].'/external/firebug-lite/build/firebug-lite.js')){
1978 $script_uri = protocol().'://'.$GLOBALS["CRVCL"]["URL"].'/external/firebug-lite/build/firebug-lite.js';
1979 if($this->m_cache_fw_js && !empty($this->m_cache_fw_js_dir)){
1980
1981
1982
1983
1984
1985
1986
1987 if(strpos(file_get_contents($GLOBALS["CRVCL"]["PATH"].'/external/firebug-lite/build/firebug-lite.js'), '+\.cache\.js|.+\.cache\.js\.php') === false){
1988 trigger_error('if you changed the "firebug-lite.js", please modify the line begins with "var reFirebugFile=" to support the following file extensions ".cache.js", ".cache.js.php"', E_USER_WARNING);
1989 }
1990
1991 $cache_file = $this->scriptCacheFile($this->m_cache_fw_js_dir, $GLOBALS["CRVCL"]["PATH"].'/external/firebug-lite/build/firebug-lite.js');
1992 $cache_file = strrcut($cache_file, '/', true);
1993 $script_uri = $this->m_cache_fw_js_dir_ex.'/'.$cache_file;
1994 }
1995
1996 if(is_string($this->m_firebug_lite)){
1997 $script_uri .= '#'.$this->m_firebug_lite;
1998 }
1999
2000 $this->m_html .= '<script src="'.$script_uri.'" type="text/javascript"></script>'.CRLF;
2001 }
2002
2003
2004
2005
2006 if(isset($GLOBALS["CRVCL"]["TinyMCE"]) && $GLOBALS["CRVCL"]["TinyMCE"] === true && is_file($GLOBALS["CRVCL"]["PATH"].'/external/tinymce/jscripts/tiny_mce/tiny_mce.js')){
2007 $script_uri = protocol().'://'.$GLOBALS["CRVCL"]["URL"].'/external/tinymce/jscripts/tiny_mce/tiny_mce.js';
2008
2009 $this->m_html .= '<script src="'.$script_uri.'" type="text/javascript"></script>'.CRLF;
2010 }
2011
2012
2013
2014
2015
2016 if(isset($GLOBALS["CRVCL"]["CKEditor"]) && $GLOBALS["CRVCL"]["CKEditor"] === true && is_file($GLOBALS["CRVCL"]["PATH"].'/external/ckeditor/ckeditor.js')){
2017 $script_uri = protocol().'://'.$GLOBALS["CRVCL"]["URL"].'/external/ckeditor/ckeditor.js?t='.time();
2018
2019
2020 $this->m_html .= '<script src="'.$script_uri.'" type="text/javascript"></script>'.CRLF;
2021
2022 }
2023
2024
2025
2026
2027
2028 $ie_compliant = $this->m_deanedwards_ie_compliant;
2029 if($ie_compliant !== null && is_file($GLOBALS["CRVCL"]["PATH"].'/external/deanedwards/ie7/IE'.$ie_compliant.'.js')){
2030 $this->m_html .= CRLF;
2031 $this->m_html .= '<!-- Compliance patch for Microsoft Internet Explorer -->'.CRLF;
2032 $this->m_html .= '<!--[if lt IE '.$ie_compliant.']>'.CRLF;
2033
2034 $script_uri = protocol().'://'.$GLOBALS["CRVCL"]["URL"].'/external/deanedwards/ie7/IE'.$ie_compliant.'.js';
2035 if($this->m_cache_fw_js && !empty($this->m_cache_fw_js_dir)){
2036 $cache_file = $this->scriptCacheFile($this->m_cache_fw_js_dir, $GLOBALS["CRVCL"]["PATH"].'/external/deanedwards/ie7/IE'.$ie_compliant.'.js');
2037 $cache_file = strrcut($cache_file, '/', true);
2038 $script_uri = $this->m_cache_fw_js_dir_ex.'/'.$cache_file;
2039 }
2040
2041 $this->m_html .= '<script src="'.$script_uri.'" type="text/javascript">var IE7_PNG_SUFFIX = "'.$this->m_deanedwards_ie7_png_suffix.'";</script>'.CRLF;
2042
2043 if($this->m_deanedwards_ie7_squish_holly_hack === true){
2044
2045 $script_uri = protocol().'://'.$GLOBALS["CRVCL"]["URL"].'/external/deanedwards/ie7/ie7-squish.js';
2046 if($this->m_cache_fw_js && !empty($this->m_cache_fw_js_dir)){
2047 $cache_file = $this->scriptCacheFile($this->m_cache_fw_js_dir, $GLOBALS["CRVCL"]["PATH"].'/external/deanedwards/ie7/ie7-squish.js');
2048 $cache_file = strrcut($cache_file, '/', true);
2049 $script_uri = $this->m_cache_fw_js_dir_ex.'/'.$cache_file;
2050 }
2051 $this->m_html .= '<script src="'.$script_uri.'" type="text/javascript"></script>'.CRLF;
2052 }
2053
2054 $this->m_html .= '<![endif]-->'.CRLF;
2055 }
2056
2057
2058
2059 $onMouseMove = "fw_getMousePos(event);";
2060 $onKeyPress = "fw_setKeyCode(event);";
2061 $onLoad = "fw_doc_init();"
2062 . " fw_loadingtime_css_js_ms = (new Date()).valueOf() - fw_start_tick.valueOf();";
2063
2064 $onMouseMove .= $this->m_onMouseMove;
2065 $onKeyPress .= $this->m_onKeyPress;
2066 $onLoad .= $this->m_onLoad;
2067
2068 $onUnload = 'if(fw_DebugWin && fw_DebugWin !== null && (typeof fw_DebugWin) == \'object\' && fw_DebugWin.closed == false){fw_DebugWin.close();} '.$this->m_onUnload;
2069
2070
2071
2072 $this->m_html .= '</head>'.CRLF;
2073 $this->m_html .= $this->m_frameset.CRLF;
2074 if(!empty($this->m_attribute)){$this->m_attribute = ' '.$this->m_attribute;}
2075 $this->m_html .= '<body style="'.$this->m_style.'" class="'.$this->m_class.'" onLoad="'.$onLoad.'" onUnload="'.$onUnload.'" onMouseMove="'.$onMouseMove.'" onKeyPress="'.$onKeyPress.'"'.$this->m_attribute.'>'.CRLF;
2076
2077 if(!isset($GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"]) || $GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"] != true){
2078 $this->m_html .= '<!-- crVCL PHP Framework Version '.CRVCL_VERSION.' (http://www.cr-solutions.net) -->'.CRLF;
2079 }
2080
2081 $tooltipClass = '';
2082 $tooltipStyle = '';
2083 if($this->m_tooltip_class != '')
2084 {
2085 $tooltipClass = 'class="'.$this->m_tooltip_class.'"';
2086 }
2087 else
2088 {
2089 $tooltip_style = 'background-color:#FFFFCC;padding:5px;width:150px;position:absolute;left:0;top:0;visibility:hidden;z-index:9999;';
2090 if($this->m_tooltip_flat){
2091 $tooltip_style .= 'border-width:1px;border-style:solid;';
2092 }else{
2093 $tooltip_style .= 'border-width:2px;border-style:outset;';
2094 }
2095
2096 $tooltipStyle = 'style="'.$tooltip_style.'"';
2097 }
2098
2099
2100 $this->m_html .= '<div id="fw_Tooltip" '.$tooltipStyle.' '.$tooltipClass.'><div id="fw_Tooltip_Spacer"> </div></div>';
2101
2102 if($this->m_ajax){
2103 $this->m_html .= '<script type="text/javascript">'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2104 $this->m_html .= 'var iframe_hist = document.createElement("iframe");'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2105 $this->m_html .= 'iframe_hist.src = fw_blank_uri;'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2106 $this->m_html .= 'iframe_hist.name = "AjaxHistoryHandleFrame";'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2107 $this->m_html .= 'iframe_hist.id = "AjaxHistoryHandleFrame";'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2108 $this->m_html .= 'iframe_hist.width = "1px";'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2109 $this->m_html .= 'iframe_hist.height = "1px";'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2110 $this->m_html .= 'iframe_hist.style.display = "none";'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2111 $this->m_html .= 'document.body.appendChild(iframe_hist);'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2112 $this->m_html .= '</script>'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
2113 }
2114
2115 $itext_style = 'border-color:#F4F4F4;border-left-width:2px;border-right-width:2px;border-top-width:0px;border-bottom-width:0px;border-style:solid;width:150px;position:absolute;left:0;top:0;visibility:hidden;z-index:9998;';
2116
2117 $this->m_html .= '<div id="fw_IText" '.($this->m_itext_class != '' ? 'class="'.$this->m_itext_class.'"' : 'style="'.$itext_style.'" onmouseout="this.style.backgroundColor = \'\';" onmouseover="this.style.backgroundColor = \'#FFFFCC\';"').'><div id="fw_IText_Caption" '.($this->m_itext_class != '' ? '' : 'style="background-color:#FFFFCC;"').'> </div></div>';
2118 $this->m_html .= ($this->m_itext_class != '' ? '' : '<script type="text/javascript">rounded("div#fw_IText","","#F4F4F4", "small");</script>');
2119
2120 if($this->m_ajax){
2121 $this->m_html .= js("fw_AjaxHistHandler = new fwAjaxHistHandler();fw_AjaxHandler = new fwAjaxHandler(); fw_AjaxHandler.enableTrace(".boolstr($GLOBALS["CRVCL"]["TRACE_AJAX"])."); window.setInterval('fw_AjaxHistHandler.guard()', 999);");
2122 }
2123 $this->m_html .= '<input id="fwPageLoaded" name="fwPageLoaded" type="hidden" value="false">';
2124
2125
2126 if(is_object($this->m_body) && method_exists($this->m_body, "html")){
2127 $this->m_body = array($this->m_body);
2128 }
2129 if(is_array($this->m_body)){
2130 $this->m_body =& $this->buildChilds($this->m_body);
2131 }
2132
2133 $this->m_html .= $GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"] . $this->m_body;
2134
2135 if(!isset($GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"]) || $GLOBALS["CRVCL"]["EXCLUSIVE_LICENSE"] != true){
2136 $this->m_html .= CRLF.'<!-- crVCL PHP Framework Version '.CRVCL_VERSION.' (http://www.cr-solutions.net) -->'.CRLF;
2137 }
2138 if(!empty($this->m_js)){
2139 if($this->m_noscript_html !== null){
2140 $this->m_html .= $this->m_noscript_html;
2141 }else{
2142 $this->m_html .= '<noscript><p align="center"><font color="#FF0000">Please enable java script support in your browser,<br>to show the webpage!<br><br>Bitte aktivieren Sie die Unterstuetzung von Java-Script in ihrem Browser,<br>um diese Webseiten korrekt darzustellen!</font></p></noscript>'.CRLF;
2143 }
2144 }
2145
2146 if($GLOBALS["CRVCL"]["TIMESTAMP"] === true){
2147 $tracetags = '<table width="100%" border="0" cellspacing="0" cellpadding="0"'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
2148 $tracetags .= '<tr>';
2149 $tracetags .= '<td align="right" style="font-size:x-small;color:#C0C0C0;">'.date("Y-m-d H:i:s").'</td>';
2150 $tracetags .= '</tr>';
2151 $tracetags .= '</table>';
2152 $this->m_html .= $tracetags;
2153 }
2154
2155 $js_check_page_is_loaded = '
2156 var pageLoadInterval = window.setInterval(function(){
2157 if(document.readyState){
2158 if(/loaded|complete/.test(document.readyState)){
2159 clearInterval(pageLoadInterval);
2160 window.setTimeout("fw_isPageLoaded(true)", 100);
2161 }
2162 }else{ // old FF version < 3.6
2163 clearInterval(pageLoadInterval);
2164 window.setTimeout("fw_isPageLoaded(true)", 1500);
2165 }
2166 }, 500);
2167 ';
2168
2169 $this->m_html .= js($js_check_page_is_loaded);
2170
2171
2172 $this->m_html .= CRLF;
2173 $this->m_html .= '</body>'.CRLF;
2174 $this->m_html .= '</html>'.CRLF;
2175
2176 if($print){
2177 $this->print_html();
2178 }
2179
2180 if(!empty($this->m_cache_file)){
2181 @file_put_contents($this->m_cache_file, $this->m_html);
2182 }
2183
2184 return $this->m_html;
2185 }
2186
2187 private function scriptCacheFile($cdir, $org_file, $optimize=false){
2188
2189 if(!is_dir($cdir))
2190 @mkdir($cdir, 0777, true);
2191
2192
2193 $org_fname = extractFileName($org_file);
2194 $org_ext = extractFileExt($org_file);
2195 $org_path = str_replace($org_fname.'.'.$org_ext, '', $org_file);
2196 $org_path = fixpath($org_path);
2197
2198 $unixtime = filemtime($org_file);
2199 $md5 = protocol().'.'.md5($org_file);
2200 $cfile = $org_fname.'.'.strval($unixtime).".".$md5.".cache.".$org_ext;
2201
2202 if(!is_file($cdir."/".$cfile)){
2203
2204 $crit = new CriticalSection($cdir);
2205
2206 if($crit->enter($cfile, 100, 1000)){
2207
2208 $content = '';
2209 if(strpos($org_file, 'fwtools.inc.js') !== false){
2210 $content = getFrameworkJS()."\r\n";
2211 }else if(strpos($org_file, 'fw.inc.css') !== false){
2212 $content = getFrameworkCSS()."\r\n";
2213 }else{
2214 $content = @file_get_contents($org_file);
2215 }
2216
2217
2218 $files = array_filelist($cdir, $org_fname.".");
2219 for($i = 0; $i < acount($files)-2; $i++){
2220 if(strpos($files[$i], ".cache.") !== false){
2221 if(is_file($cdir."/".$files[$i]) && diffSec("", date("YmdHis", filemtime($cdir."/".$files[$i]))) > 10){
2222 if(is_file($cdir."/".$files[$i])){
2223 @unlink($cdir."/".$files[$i]);
2224 }
2225 }
2226 }
2227 }
2228
2229 if($optimize){
2230 if(strpos($org_ext, 'js') !== false){
2231 optimizeJS($content);
2232 }else if(strpos($org_ext, 'css') !== false){
2233 optimizeCSS($content);
2234 }
2235 }
2236
2237 $bytes = @file_put_contents($cdir."/".$org_fname."cache.".$org_ext.".foo", $content);
2238 if($bytes === false){
2239 trigger_error("can't write file or permission denied (".$cdir."/".$org_fname.".cache.".$org_ext.".foo)", E_USER_WARNING);
2240 }
2241
2242 $mv_ok = true;
2243 for($m = 0; $m < 10; $m++){
2244 $mv_ok = @move($cdir."/".$org_fname."cache.".$org_ext.".foo", $cdir."/".$cfile);
2245 if($mv_ok){break;}
2246 mssleep(10);
2247 }
2248 if(!$mv_ok){
2249 if(is_file($cdir."/".$org_fname."cache.".$org_ext.".foo") && !is_file($cdir."/".$cfile)){
2250 trigger_error("can't move file ".$cdir."/".$org_fname."cache.".$org_ext.".foo to ".$cdir."/".$cfile, E_USER_WARNING);
2251 }
2252 }
2253
2254
2255 if($this->m_compression){
2256 $cache_time_sec = 60*60*24*365;
2257 $dt = new crDateTime($unixtime);
2258 $dt->calc("seconds", $cache_time_sec);
2259
2260 $content_type = '';
2261 if(strpos($org_ext, 'js') !== false){
2262 $content_type = 'application/javascript';
2263 }else if(strpos($org_ext, 'css') !== false){
2264 $content_type = 'text/css';
2265 }
2266
2267 $phpcode = '';
2268 $phpcode .= '<?PHP'.CRLF;
2269 $phpcode .= 'ini_set("session.use_cookies", "0");'.CRLF;
2270 $phpcode .= 'header_remove("Cookie");'.CRLF;
2271 $phpcode .= 'header_remove("Set-Cookie");'.CRLF;
2272 $phpcode .= 'require("'.$GLOBALS["CRVCL"]["PATH"].'/tools.lib.php");'.CRLF;
2273 $phpcode .= 'if(!defined("CRVCL_VERSION")){define("CRVCL_VERSION", "'.CRVCL_VERSION.'");};';
2274 $phpcode .= 'print_gz(get_include_contents("'.$cdir."/".$cfile.'"), '.($this->m_compression_level==='auto'?'"auto"':$this->m_compression_level).', array("Content-type: '.$content_type.'", "Cache-Control: public, must-revalidate, proxy-revalidate, max-age='.$cache_time_sec.', post-check=3600, pre-check=604800", "Pragma: public", "Expires: '.$dt->toString("HTTP").'", "Last-Modified: '.gmdate("M d Y H:i:s", $unixtime).' GMT"));'.CRLF;
2275 $phpcode .= 'while(session_is_started()){ session_write_close(); mssleep(5); }'.CRLF;
2276 $phpcode .= '?>'.CRLF;
2277
2278 $bytes = @file_put_contents($cdir."/".$org_fname."cache.".$org_ext.".php.foo", $phpcode);
2279 if($bytes === false){
2280 trigger_error("can't write file or permission denied (".$cdir."/".$org_fname."cache.".$org_ext.".php.foo)", E_USER_WARNING);
2281 }
2282
2283 $mv_ok = true;
2284 for($m = 0; $m < 10; $m++){
2285 $mv_ok = @move($cdir."/".$org_fname."cache.".$org_ext.".php.foo", $cdir."/".$cfile.".php");
2286 if($mv_ok){break;}
2287 mssleep(10);
2288 }
2289 if(!$mv_ok){
2290 if(is_file($cdir."/".$org_fname."cache.".$org_ext.".php.foo") && !is_file($cdir."/".$cfile.".php")){
2291 trigger_error("can't move file ".$cdir."/".$org_fname."cache.".$org_ext.".php.foo to ".$cdir."/".$cfile.".php", E_USER_WARNING);
2292 }
2293 }
2294 }
2295
2296
2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308
2309 $crit->leave($cfile);
2310 }
2311 }
2312
2313 return $cdir."/".$cfile.($this->m_compression?'.php':'');
2314 }
2315
2316 2317 2318 2319 2320 2321
2322 function js_AjaxEnableTrace($b){
2323 if($this->m_ajax){
2324 return "fw_AjaxHandler.enableTrace(".boolstr($b).");";
2325 }
2326 return false;
2327 }
2328
2329
2330
2331 2332 2333 2334 2335 2336 2337 2338
2339 function setJs($js, $js_local='', $optimize=false, $async=false){
2340 if($async){
2341 $js = "async:".$js;
2342 }
2343
2344 if(strpos(strtolower(right($js,20)),'.js')!==false || strpos(strtolower(right($js,20)),'.php')!==false){
2345 if($js_local != '' && is_file($js_local)){
2346 $this->m_js_files[] = array($js,$js_local,$optimize);
2347 }else{
2348 $this->m_js_files[] = $js;
2349 }
2350 }else{
2351 $this->m_js = $this->m_js.CRLF.$js;
2352 }
2353 }
2354
2355 2356 2357 2358 2359
2360 function setFrameset($frameset){
2361 $this->m_frameset = $frameset;
2362 }
2363
2364 2365 2366 2367 2368 2369 2370
2371 function setCss($css, $css_local='', $optimize=false){
2372 if(strpos(strtolower(right($css,20)),'.css')!==false || strpos(strtolower(right($css,20)),'.php')!==false){
2373 if($css_local != '' && is_file($css_local)){
2374 $this->m_css_files[] = array($css,$css_local,$optimize);
2375 }else{
2376 $this->m_css_files[] = $css;
2377 }
2378 }else{
2379 $this->m_css = $this->m_css.CRLF.$css;
2380 }
2381 }
2382
2383 2384 2385 2386
2387 function setStyle($css_style){
2388 $this->m_style = $css_style;
2389 }
2390
2391 2392 2393 2394 2395
2396 function setHeader($header){
2397 $this->setHead($header);
2398 }
2399
2400
2401 2402 2403 2404 2405 2406
2407 function setKeywords($lang="", $keywords){
2408 if(empty($lang)){$lang = "null";}
2409
2410 $this->m_keywords[$lang] = $keywords;
2411 }
2412
2413 2414 2415 2416 2417 2418
2419 function setDescription($lang="", $description){
2420 if(empty($lang)){$lang = "null";}
2421
2422 $this->m_descriptions[$lang] = $description;
2423 }
2424
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445
2446 function registerAjax($id, $callback, $js_readyState4_200, $js_readyState4="", $js_readyState3="", $js_readyState2="", $js_readyState1="", $js_readyState0="", $js_readyStateUnknown=""){
2447
2448 $ajax_js = ajax_callback($id, $callback, $js_readyState4_200, $js_readyState4, $js_readyState3, $js_readyState2, $js_readyState1, $js_readyState0, $js_readyStateUnknown);
2449
2450 if($this->m_cache_ajax_js){
2451 $this->m_js_ajax_cache .= $ajax_js;
2452 }else{
2453 $this->setJs($ajax_js);
2454 }
2455 }
2456 }
2457
2458
2459
2460 class html_Button extends html_Events
2461 {
2462 2463 2464 2465 2466
2467 public $m_caption = "";
2468 2469 2470 2471 2472
2473 public $m_caption2 = "";
2474 2475 2476 2477 2478
2479 public $m_caption2beforecaption = false;
2480 2481 2482 2483 2484
2485 public $m_captionSpacer = ' ';
2486 2487 2488 2489 2490
2491 public $m_flatStyle = false;
2492 2493 2494 2495 2496
2497 public $m_border = true;
2498 2499 2500 2501 2502
2503 public $m_submit = false;
2504 2505 2506 2507 2508
2509 public $m_highlight = true;
2510 2511 2512 2513 2514
2515 public $m_highlight_color = COLOR_FORM_HIGHLIGHT_DEFAULT;
2516 2517 2518 2519 2520
2521 public $m_highlight_only_border = false;
2522 2523 2524 2525 2526
2527 public $m_color = COLOR_FORM_BUTTON_DEFAULT;
2528 2529 2530 2531 2532
2533 public $m_hotkey = "";
2534 2535 2536 2537 2538
2539 public $m_enabled = true;
2540 2541 2542 2543 2544
2545 public $m_value = "";
2546 2547 2548 2549 2550
2551 public $m_hidden = false;
2552 2553 2554 2555 2556
2557 public $m_width = null;
2558 2559 2560 2561 2562
2563 public $m_height = null;
2564 2565 2566 2567 2568
2569 public $m_fontsize = null;
2570 2571 2572 2573 2574
2575 public $m_fontweight = null;
2576 2577 2578 2579 2580
2581 public $m_round_border = false;
2582 2583 2584 2585 2586
2587 public $m_imgMargin = '5px';
2588 2589 2590 2591 2592
2593 public $m_cursor = 'pointer';
2594
2595 2596 2597 2598 2599
2600 public $m_imgStyle = '';
2601
2602 2603 2604 2605 2606
2607 public $m_imgClass = '';
2608
2609
2610 function __construct(){
2611 $this->m_name = "Button";
2612 }
2613
2614 function __destruct(){
2615 $this->m_childs = NULL;
2616 unset($this->m_childs);
2617 }
2618
2619 2620 2621 2622 2623 2624
2625 public function setSize($w, $h){
2626 $this->setWidth($w);
2627 $this->setHeight($h);
2628 }
2629
2630 2631 2632 2633 2634
2635 public function setWidth($w){
2636 $this->m_width = $w;
2637 }
2638
2639 2640 2641 2642 2643
2644 public function setHeight($h){
2645 $this->m_height = $h;
2646 }
2647
2648 2649 2650 2651 2652
2653 public function setFontSize($size){
2654 $this->m_fontsize = $size;
2655 }
2656
2657 2658 2659 2660 2661
2662 public function setFontWeight($weight){
2663 $this->m_fontweight = $weight;
2664 }
2665
2666 2667 2668 2669 2670 2671 2672
2673 public function setCaption($caption, $caption2="", $caption2beforecaption=false){
2674 $this->m_caption = $caption;
2675 $this->m_caption2 = $caption2;
2676 $this->m_caption2beforecaption = $caption2beforecaption;
2677 }
2678
2679 2680 2681 2682 2683 2684 2685
2686 public function setFlatStyle($b, $border=true, $round=false){
2687 $this->m_flatStyle = $b;
2688 $this->m_border = $border;
2689 $this->m_round_border = $round;
2690 }
2691
2692 2693 2694 2695 2696 2697 2698
2699 public function setFlatStyleHighlight($b, $color=COLOR_FORM_HIGHLIGHT_DEFAULT, $borderOnly=false){
2700 $this->m_highlight = $b;
2701 $this->m_highlight_color = $color;
2702 $this->m_highlight_only_border = $borderOnly;
2703 }
2704
2705 2706 2707 2708 2709
2710 public function setHotkey($char){
2711 $this->m_hotkey = $char;
2712 }
2713
2714 2715 2716 2717 2718
2719 public function setEnabeld($b){
2720 $this->m_enabled = $b;
2721 }
2722
2723 2724 2725 2726 2727
2728 public function setValue($val){
2729 $this->m_value = $val;
2730 }
2731
2732 2733 2734 2735 2736
2737 public function setVisible($b){
2738 $this->m_hidden = !$b;
2739 }
2740
2741 2742 2743 2744 2745
2746 function addChild($child){
2747 $this->m_childs[] = $child;
2748 }
2749
2750 2751 2752 2753 2754 2755
2756 function html($print=false){
2757 $style = '';
2758 if($this->m_flatStyle){
2759 if($this->m_enabled){
2760 if($this->m_border){
2761 $style .= 'border:2px solid #D7D7D7;background:'.$this->m_color.';border-style:outset;';
2762 }else{
2763 $style .= 'border:0 none #D7D7D7;background:'.$this->m_color.';border-style:none;';
2764 }
2765 }else{
2766 $style .= 'border:2px solid #D7D7D7;background:'.$this->m_color.';border-style:ridge;';
2767 }
2768 }
2769
2770 if($this->m_round_border){
2771 $style .= 'border-radius:3px; -moz-border-radius:3px; -khtml-border-radius:3px; -webkit-border-radius:3px;';
2772 }
2773
2774 $disabled = "";
2775 if(!$this->m_enabled){$disabled = " disabled"; $this->m_highlight = false;}
2776
2777 if($this->m_width !== null){
2778 $style .= 'width:'.$this->m_width.';';
2779 }
2780
2781 if($this->m_height !== null){
2782 $style .= 'height:'.$this->m_height.';';
2783 }
2784
2785 if($this->m_fontsize !== null){
2786 $style .= 'font-size:'.$this->m_fontsize.';';
2787 }
2788
2789 if($this->m_fontweight !== null){
2790 $style .= 'font-weight:'.$this->m_fontweight.';';
2791 }
2792
2793 if($this->m_cursor !== null){$style .= "cursor:".$this->m_cursor.";";}
2794
2795 if($this->m_style){
2796 $style .= $this->m_style;
2797 }
2798
2799 $class = '';
2800 if(!empty($this->m_class)){
2801 $class = ' class="'.$this->m_class.'"';
2802 }
2803
2804 $accesskey = "";
2805 if(!empty($this->m_hotkey)){
2806 $accesskey = ' accesskey="'.$this->m_hotkey.'"';
2807 $this->m_tooltip .= " ([Alt] or [Ctrl] + ".$this->m_hotkey.")";
2808 }
2809
2810 if($this->m_hidden === true){
2811 $style .= "visibility:hidden;";
2812 }
2813
2814 $onClick = '';
2815 $onMouseOver = '';
2816 $onMouseOut = '';
2817
2818 if($this->m_flatStyle && $this->m_highlight){
2819 if($this->m_border){
2820 $onMouseOver .= 'this.style.border=\'2px solid '.$this->m_highlight_color.'\';';
2821 $onMouseOver .= 'this.style.borderStyle=\'outset\';';
2822 }else{
2823 $onMouseOver .= 'this.style.border=\'0px none '.$this->m_highlight_color.'\';';
2824 $onMouseOver .= 'this.style.borderStyle=\'outset\';';
2825 }
2826
2827 if($this->m_highlight_only_border === false){
2828 $onMouseOver .= 'this.style.backgroundColor=\''.$this->m_highlight_color.'\';';
2829 }
2830 }
2831
2832 if($this->m_highlight && $this->m_flatStyle){
2833 if($this->m_border){
2834 $onMouseOut .= 'this.style.border=\'2px solid '.$this->m_color.'\';';
2835 $onMouseOut .= 'this.style.borderStyle=\'outset\';';
2836 }else{
2837 $onMouseOut .= 'this.style.border=\'0 none '.$this->m_color.'\';';
2838 $onMouseOut .= 'this.style.borderStyle=\'none\';';
2839 }
2840 if($this->m_highlight_only_border === false){
2841 $onMouseOut .= 'this.style.backgroundColor=\''.$this->m_color.'\';';
2842 }
2843 }
2844
2845
2846 if(is_string($this->m_caption)){
2847 if(strpos(strtolower($this->m_caption),".gif") !== false || strpos(strtolower($this->m_caption),".jpg") !== false || strpos(strtolower($this->m_caption),".png") !== false){
2848 $caption = $this->m_caption;
2849 $alt = '';
2850 $title = '';
2851 if(strpos($caption, '|')!==false){
2852 $caption = explode('|', $caption);
2853
2854 if(acount($caption) === 3){
2855 $title = $caption[0];
2856 $alt = $caption[1];
2857 $caption = $caption[2];
2858 }else if(acount($caption) === 2){
2859 $title = '';
2860 $alt = $caption[0];
2861 $caption = $caption[1];
2862 }else{
2863 $title = '';
2864 $alt = '';
2865 $caption = $caption[0];
2866 }
2867 }
2868
2869 $width = "";
2870 if($this->m_width){
2871 $width .= ' width="'.$this->m_width.'"';
2872 }
2873 $height = "";
2874 if($this->m_height){
2875 $height .= ' height="'.$this->m_height.'"';
2876 }
2877
2878 $istyle = '';
2879 if($this->m_caption2)
2880 {
2881 $istyle = 'margin-right: '.$this->m_imgMargin.';';
2882 if($this->m_caption2beforecaption){
2883 $istyle = 'margin-left: '.$this->m_imgMargin.';';
2884 }
2885 }
2886
2887 $iclass = '';
2888 if($this->m_imgClass != ''){
2889 $iclass = $this->m_imgClass;
2890 $istyle = '';
2891 }
2892
2893 if($this->m_imgStyle != ''){
2894 $istyle = $this->m_imgStyle;
2895 }
2896
2897 $this->m_caption = '<img name="'.$this->m_name.'_img" id="'.$this->m_id.'_img" src="'.$caption.'"'.($alt!=''?' alt="'.trim($alt).'"':'').($title!=''?' title="'.trim($title).'"':'').' border="0"'.$width.$height.' align="absmiddle" '.($istyle ? 'style="'.$istyle.'"' : '').' '.($iclass ? 'class="'.$iclass.'"' : '').'>';
2898 }else{
2899 $this->m_caption = $this->m_captionSpacer . $this->m_caption . $this->m_captionSpacer;
2900 }
2901 }
2902
2903 if($this->m_caption2beforecaption){
2904 $this->addChild($this->m_caption2);
2905 $this->addChild($this->m_caption);
2906 }else{
2907 $this->addChild($this->m_caption);
2908 $this->addChild($this->m_caption2);
2909 }
2910
2911
2912 $type = 'type="button"';
2913 if($this->m_submit){
2914 $type = 'type="submit"';
2915 }
2916
2917 if(!empty($style)){
2918 $style = ' style="'.$style.'"';
2919 }
2920 $html = '<button '.$type;
2921 if(!$this->m_id){$this->m_id = $this->m_name;}
2922 $html .= ' name="'.$this->m_name.'" id="'.$this->m_id.'"'.$class.$accesskey.$style.' value="'.$this->m_value.'"'.$this->htmlEvents($onClick,"",$onMouseOver,$onMouseOut).$disabled.'>';
2923 $html .= $this->buildChilds();
2924 $html .= '</button'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
2925
2926 $this->m_html = $html;
2927 $html = NULL;
2928 unset($html);
2929
2930
2931 return parent::html($print);
2932 }
2933 }
2934
2935
2936
2937 class html_OpenDialog extends html_FocusEventsEx
2938 {
2939 2940 2941 2942 2943
2944 public $m_size = 30;
2945 2946 2947 2948 2949
2950 public $m_maxLength = 255;
2951 2952 2953 2954 2955
2956 public $m_text = "";
2957 2958 2959 2960 2961
2962 public $m_text_display = "inline";
2963 2964 2965 2966 2967
2968 public $m_onKeydown = "";
2969 2970 2971 2972 2973
2974 public $m_onKeyup = "";
2975 2976 2977 2978 2979
2980 public $m_onKeypress = "";
2981 2982 2983 2984 2985
2986 public $m_highlight = false;
2987 2988 2989
2990 public $m_hightlight_color = "#0000FF";
2991 2992 2993 2994 2995
2996 public $m_bgcolor = "";
2997 2998 2999 3000 3001
3002 public $m_focus_bgcolor = "";
3003 3004 3005 3006 3007
3008 public $m_enabled = true;
3009 3010 3011 3012 3013
3014 public $m_mask = "*";
3015 3016 3017 3018 3019
3020 public $m_fontsize = null;
3021 3022 3023 3024 3025
3026 public $m_fontweight = null;
3027
3028
3029
3030 function __construct(){
3031 $this->m_name = "OpenDialog";
3032 }
3033
3034 3035 3036 3037 3038
3039 public function setFontSize($size){
3040 $this->m_fontsize = $size;
3041 }
3042
3043 3044 3045 3046 3047
3048 public function setFontWeight($weight){
3049 $this->m_fontweight = $weight;
3050 }
3051
3052 3053 3054 3055 3056 3057
3058 function html($print=false){
3059 $style = '';
3060 $text = '';
3061
3062 if($this->m_bgcolor){
3063 $style .= "background-color:".$this->m_bgcolor.";";
3064 }
3065
3066 $disabled = "";
3067 if(!$this->m_enabled){$disabled = " disabled"; $this->m_highlight = false;}
3068
3069 if($this->m_fontsize !== null){
3070 $style .= 'font-size:'.$this->m_fontsize.';';
3071 }
3072
3073 if($this->m_fontweight !== null){
3074 $style .= 'font-weight:'.$this->m_fontweight.';';
3075 }
3076
3077 if($this->m_highlight){$style .= 'border:1px solid #DCDCDC;';}
3078
3079 if($this->m_style){
3080 $style .= $this->m_style;
3081 }
3082
3083
3084 $onChange = '';
3085
3086 if($this->m_onChange){
3087 $onChange .= $this->m_onChange;
3088 }
3089
3090
3091 $onFocus = '';
3092 if($this->m_highlight){
3093 $onFocus .= 'this.style.border=\'1px solid '.$this->m_hightlight_color.'\';';
3094 }
3095 if($this->m_focus_bgcolor){
3096 $onFocus .= 'this.style.backgroundColor=\''.$this->m_focus_bgcolor.'\';';
3097 }
3098
3099 $onBlur = '';
3100 if($this->m_highlight){
3101 if(!$this->m_valid){
3102 $onBlur .= 'this.style.border=\'1px solid '.$this->m_validate_color.'\';';
3103 }else{
3104 $onBlur .= 'this.style.border=\'1px solid #000000\';';
3105 }
3106 }
3107 if($this->m_focus_bgcolor){
3108 $onBlur .= 'this.style.backgroundColor=\''.$this->m_bgcolor.'\';';
3109 }
3110
3111 $type = 'file';
3112
3113
3114 $valid_error_msg = '';
3115 if(!empty($this->m_text)){
3116 $text = '<div style="display:'.$this->m_text_display.';">'.$this->m_text.'</div>';
3117 }
3118
3119 if(!$this->m_id){$this->m_id = $this->m_name;}
3120 $this->m_html = '<span><input type="'.$type.'" name="'.$this->m_name.'" id="'.$this->m_id.'" size="'.$this->m_size.'" maxLength="'.$this->m_maxLength.'" style="'.$style.'" value="'.$this->m_text.'"'.$this->htmlEvents().$this->htmlFocusEvents($onFocus, $onBlur).$this->htmlFocusEventsEx($onChange).' accept="'.$this->m_mask.'"'.$disabled.'>'.$text.'</span'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3121
3122 return parent::html($print);
3123 }
3124 }
3125
3126
3127
3128 class html_Checkbox extends html_FocusEventsEx
3129 {
3130 private $m_items = array();
3131 private $m_icons = array();
3132 3133 3134 3135 3136
3137 public $m_listview = false;
3138 3139 3140 3141 3142
3143 public $m_text_align = "right";
3144 3145 3146 3147 3148
3149 public $m_onFocus = "";
3150 3151 3152 3153 3154
3155 public $m_enabled = true;
3156 3157 3158 3159 3160
3161 public $m_float = false;
3162 3163 3164 3165 3166
3167 public $m_max_width = null;
3168 3169 3170 3171 3172
3173 public $m_checkbox_margin = '5px';
3174 3175 3176 3177 3178
3179 public $m_cursor = 'pointer';
3180
3181
3182 function __construct(){
3183 $this->m_name = "Checkbox";
3184 }
3185
3186 function __destruct(){
3187 $this->m_items = NULL;
3188 $this->m_icons = NULL;
3189 }
3190
3191 3192 3193 3194 3195 3196
3197 function setIcons($checked_img, $unchecked_img){
3198 $this->m_icons = array($checked_img, $unchecked_img);
3199 }
3200
3201 3202 3203 3204 3205 3206
3207 function addItem($text, $val=""){
3208 if(is_string($val) && $val === ""){
3209 $val = $text;
3210 }
3211 $this->m_items[] = array($text,$val, false);
3212 return;
3213 }
3214
3215 3216 3217 3218 3219
3220 function selItem($i){
3221 if($i < count($this->m_items)){
3222 $this->m_items[$i][2] = true;
3223 }
3224 return;
3225 }
3226
3227 3228 3229 3230 3231 3232
3233 function selItemFromValue($val, $useRequestAsDefault=false){
3234
3235 if($useRequestAsDefault)
3236 {
3237 $this->selItemFromRequest($val);
3238 }
3239 else
3240 {
3241 for($i = 0; $i < count($this->m_items); $i++){
3242 if(is_array($val)){
3243 if(array_search($this->m_items[$i][1], $val) !== false){
3244 $this->selItem($i);
3245 }
3246 }else{
3247 if($val == $this->m_items[$i][1]){$this->selItem($i);}
3248 }
3249 }
3250 }
3251 }
3252
3253 3254 3255 3256 3257
3258 function selItemFromRequest($val=""){
3259
3260 $req_ok = false;
3261 if(isset($_REQUEST[$this->m_name.'_edt']) && !isset($_REQUEST[$this->m_name])){
3262 return;
3263
3264 }else if(isset($_REQUEST[$this->m_name])){
3265 for($i = 0; $i < count($this->m_items); $i++){
3266 if(is_array($_REQUEST[$this->m_name])){
3267 for($i2 = 0; $i2 < acount($_REQUEST[$this->m_name]); $i2++){
3268 if($_REQUEST[$this->m_name][$i2] == $this->m_items[$i][1]){
3269 $this->selItem($i);
3270 $req_ok = true;
3271 break;
3272 }
3273 }
3274 }else{
3275
3276 if($_REQUEST[$this->m_name] == $this->m_items[$i][1]){
3277 $this->selItem($i);
3278 $req_ok = true;
3279 break;
3280 }
3281 }
3282 }
3283 }
3284 if(!$req_ok){$this->selItemFromValue($val, false);}
3285 }
3286
3287 3288 3289 3290 3291
3292 function getSelected(){
3293 for($i = 0; $i < count($this->m_items); $i++){
3294 if($this->m_items[$i][2] == true){return $i;}
3295 }
3296 return -1;
3297 }
3298
3299 3300 3301 3302 3303 3304 3305
3306 function getItem($i){
3307 if($i < count($this->m_items)){
3308 return $this->m_items[$i];
3309 }
3310 return array();
3311 }
3312
3313 3314 3315 3316 3317 3318
3319 function html($print=false){
3320 $is_floating = false;
3321 $class = '';
3322
3323 if(count($this->m_items)>1 && strpos($this->m_name, "[]") === false){
3324 $this->m_name .= "[]";
3325 }
3326
3327 if(!$this->m_id){$this->m_id = $this->m_name;}
3328
3329 $style = '';
3330
3331 if($this->m_style){
3332 $style .= $this->m_style;
3333 }
3334
3335 if($this->m_class)
3336 {
3337 $class = 'class="' . $this->m_class . '"';
3338 }
3339
3340 $disabled = "";
3341 if(!$this->m_enabled){$disabled = " disabled";}
3342
3343 if(strpos($style,"color:") === false && $this->m_class == ""){
3344 $style .= "color:#000000;";
3345 }
3346
3347 $html = '';
3348 for($i = 0; $i < count($this->m_items); $i++){
3349
3350
3351 if($this->m_items[$i][0] != "" && $this->m_float)
3352 {
3353 $is_floating = true;
3354 }
3355
3356 $checked = '';
3357 if($this->m_items[$i][2] == true){
3358 $checked = ' checked';
3359 }
3360
3361 $xname = str_replace('[]', '', $this->m_name);
3362
3363 $set_component_changed = '';
3364 if(defined('MVC') && $this->m_mvc_set_componend_changed)
3365 $set_component_changed = 'fw_mvc_set_component_changed(\''.$this->m_id.'\');';
3366
3367 $ico = '';
3368 $xstyle = "";
3369 if($this->m_cursor !== null){$xstyle = "cursor:".$this->m_cursor.";";}
3370
3371 if(!empty($this->m_icons)){
3372 $xstyle .= "display:none;";
3373 $ico = '<span style="'.($this->m_cursor !== null ? 'cursor:'.$this->m_cursor.';' : '').($is_floating ? 'float: left; margin-right: '.$this->m_checkbox_margin.';' : '').$style.'"><img name="'.$xname.'_'.$i.'_ico" id="'.$xname.'_'.$i.'_ico" src="'.($this->m_items[$i][2] == true?$this->m_icons[0]:$this->m_icons[1]).'" onClick="'.$set_component_changed.'var chk_list = document.getElementsByName(\''.$this->m_name.'\');if(chk_list['.$i.'].disabled == false){if(chk_list['.$i.'].checked){chk_list['.$i.'].checked = false;this.src=\''.$this->m_icons[1].'\';}else{chk_list['.$i.'].checked = true;this.src=\''.$this->m_icons[0].'\';}}'.$this->m_onClick.'"></span>'.SP;
3374 }
3375
3376 $caption = '';
3377 $js_check_ico = 'sendMessage(chk, \'click\'); ';
3378 $js_uncheck_ico = 'sendMessage(chk, \'click\'); ';
3379 if(!empty($this->m_icons)){
3380 $js_check_ico = 'getObj(\''.$xname.'_'.$i.'_ico\').src = \''.$this->m_icons[0].'\';';
3381 $js_uncheck_ico = 'getObj(\''.$xname.'_'.$i.'_ico\').src = \''.$this->m_icons[1].'\';';
3382 }
3383
3384 if($this->m_items[$i][0])
3385 {
3386 $caption .= '<a name="'.$xname.'_caption_'.$i.'" id="'.$xname.'_caption_'.$i.'" class="'.$this->m_class.'" href="javascript:void(0);" style="'.($this->m_max_width ? 'max-width: ' . $this->m_max_width . ';' : '').'text-decoration:none;'.($is_floating ? 'float: left; margin-right: '.$this->m_checkbox_margin.';' : '').'cursor:pointer;'.$style.'" onClick="'.$set_component_changed.'var chk = document.getElementsByName(\''.$this->m_id.'\')['.$i.']; if(chk.disabled == false){if(chk.checked){'.$js_uncheck_ico.'}else{'.$js_check_ico.'}}">'.$this->m_items[$i][0].'</a>';
3387 }
3388
3389 $js_check_uncheck = '';
3390 if(!empty($this->m_icons)){
3391 $js_check = 'var oIco = getObj(\''.$xname.'_'.$i.'_ico\'); if(oIco.src != \''.$this->m_icons[0].'\'){oIco.src = \''.$this->m_icons[0].'\';}';
3392 $js_uncheck = 'var oIco = getObj(\''.$xname.'_'.$i.'_ico\'); if(oIco.src != \''.$this->m_icons[1].'\'){oIco.src = \''.$this->m_icons[1].'\';}';
3393 $js_check_uncheck = 'if(this.checked){'.$js_check.'}else{'.$js_uncheck.'}';
3394 }
3395
3396 $chkbox = '<input type="checkbox" name="'.$this->m_name.'" value="'.$this->m_items[$i][1].'" id="'.$this->m_id.'" '.$class.' style="'.($is_floating ? 'float: left; width: 20px; margin-right: '.$this->m_checkbox_margin.';' : '').$xstyle.'"'.$this->htmlEvents($js_check_uncheck.$set_component_changed).$this->htmlFocusEvents().$this->htmlFocusEventsEx($set_component_changed).' '.$checked.$disabled.'>';
3397
3398
3399 if(strtolower($this->m_text_align) === "left"){
3400 $html .= $caption.SP.$ico.$chkbox;
3401 }else{
3402 $html .= $chkbox.$ico.SP.$caption;
3403 }
3404
3405 if($is_floating && $this->m_listview)
3406 {
3407 $html .= CLEAR_LEFT . $GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
3408 }
3409 else if($this->m_listview)
3410 {
3411 $html .= BR . $GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
3412 }
3413
3414 }
3415
3416 if($is_floating && !$this->m_listview)
3417 {
3418 $html .= CLEAR_LEFT . $GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
3419 }
3420
3421 $this->m_html = $html;
3422
3423
3424
3425
3426 $edt = new html_Edit();
3427 $edt->m_name = $this->m_name . '_edt';
3428 $edt->m_hidden = true;
3429
3430 $this->m_html .= $edt->html();
3431
3432
3433 return parent::html($print);
3434 }
3435 }
3436
3437
3438
3439 3440 3441 3442 3443 3444 3445
3446 class html_Table extends html_Component
3447 {
3448 3449 3450
3451 private $m_cells = array();
3452 3453 3454
3455 private $m_cells_sval = array();
3456 3457 3458
3459 private $m_cellscolor = array();
3460 3461 3462
3463 private $m_cellstooltip = array();
3464 3465 3466
3467 private $m_rowsId = array();
3468 3469 3470
3471 private $m_cellsrowspan = array();
3472 3473 3474
3475 private $m_cellsrowspanBlocker = array();
3476 3477 3478
3479 private $m_cellscolspan = array();
3480 3481 3482
3483 private $m_cellsstyle = array();
3484 3485 3486
3487 private $m_rowsstyle = array();
3488 3489 3490
3491 private $m_rowsclass = array();
3492 3493 3494
3495 private $m_cellsclass = array();
3496 3497 3498
3499 private $m_cellsevent = array();
3500 3501 3502
3503 private $m_colsalign = array();
3504 3505 3506
3507 private $m_rowsalign = array();
3508 3509 3510
3511 private $m_colswidth = array();
3512 3513 3514
3515 private $m_rowsheight = array();
3516 3517 3518
3519 private $m_header_cells = array();
3520 3521 3522
3523 private $m_footer_cells = array();
3524 3525 3526
3527 private $m_sort_col = -1;
3528 3529 3530
3531 private $m_sort_desc = false;
3532 3533 3534
3535 private $m_last_add_column = -1;
3536 3537 3538
3539 private $m_last_add_row = -1;
3540 3541 3542
3543 private $m_last_add_column_header = -1;
3544 3545 3546
3547 private $m_last_add_column_footer = -1;
3548 3549 3550 3551 3552
3553 public $m_rows = 1;
3554 3555 3556 3557 3558
3559 public $m_columns = 1;
3560 3561 3562 3563 3564
3565 public $m_header = false;
3566 3567 3568 3569 3570
3571 public $m_footer = false;
3572 3573 3574 3575 3576
3577 public $m_border = true;
3578 3579 3580 3581 3582
3583 public $m_bordersize = 1;
3584 3585 3586 3587 3588 3589
3590 public $m_gridrules = "";
3591 3592 3593
3594 public $m_width= "";
3595 3596 3597
3598 public $m_height = "";
3599 3600 3601
3602 public $m_cellwidth = "";
3603 3604 3605
3606 public $m_cellheight = "";
3607 3608 3609
3610 public $m_cellspacing= " ";
3611 3612 3613
3614 public $m_cellpadding= " ";
3615 3616 3617 3618 3619
3620 public $m_cellspacer= "";
3621 3622 3623
3624 public $m_fontsize= "";
3625 3626 3627
3628 public $m_bordercolor = "#CCCCCC";
3629 3630 3631
3632 public $m_bgcolor = "";
3633 3634 3635
3636 public $m_bgcolor_row_even = "";
3637 3638 3639
3640 public $m_bgcolor_row_uneven = "";
3641 3642 3643 3644 3645
3646 public $m_round = false;
3647 3648 3649 3650 3651
3652 public $m_spacer_img_path = "";
3653 3654 3655 3656 3657
3658 public $m_spacer_img = "1px.gif";
3659 3660 3661 3662 3663
3664 public $m_dont_check_spacer_file = false;
3665 3666 3667 3668 3669
3670 public $m_sort_asc_img = "";
3671 3672 3673 3674 3675
3676 public $m_sort_desc_img = "";
3677 3678 3679 3680 3681
3682 public $m_sortcol_js = "";
3683 3684 3685 3686 3687
3688 public $m_highlight = false;
3689 3690 3691 3692 3693
3694 public $m_highlight_color = COLOR_FORM_HIGHLIGHT_DEFAULT;
3695 3696 3697 3698 3699
3700 public $m_highlight_type = "mousemove";
3701
3702
3703 function __construct(){
3704 $this->m_name = "Table";
3705 }
3706
3707 function __destruct(){
3708
3709 free($this->m_cells);
3710 free($this->m_cells_sval);
3711 free($this->m_cellscolor);
3712 free($this->m_cellstooltip);
3713 free($this->m_cellsrowspan);
3714 free($this->m_cellsrowspanBlocker);
3715 free($this->m_cellscolspan);
3716 free($this->m_cellsstyle);
3717 free($this->m_rowsstyle);
3718 free($this->m_rowsclass);
3719 free($this->m_cellsclass);
3720 free($this->m_cellsevent);
3721 free($this->m_colsalign);
3722 free($this->m_rowsId);
3723 free($this->m_rowsalign);
3724 free($this->m_colswidth);
3725 free($this->m_rowsheight);
3726 free($this->m_header_cells);
3727 free($this->m_footer_cells);
3728 }
3729
3730 3731 3732 3733 3734
3735 public function &getCells(){
3736 return $this->m_cells;
3737 }
3738
3739 3740 3741 3742 3743
3744 public function &getFCells(){
3745 return $this->m_footer_cells;
3746 }
3747
3748 3749 3750 3751 3752
3753 public function &getHCells(){
3754 return $this->m_header_cells;
3755 }
3756
3757 private function prepareCells(){
3758 for($c = 0; $c < $this->m_columns; $c++){
3759 $column = array();
3760 $column_sval = array();
3761 for($r = 0; $r < $this->m_rows; $r++){
3762 $column[] = ' ';
3763 $column_sval[] = '';
3764 }
3765 $this->m_cells[] = $column;
3766 $this->m_cells_sval[] = $column_sval;
3767 }
3768 }
3769
3770 private function prepareCellsColor(){
3771 for($c = 0; $c < $this->m_columns; $c++){
3772 $column = array();
3773 for($r = 0; $r < $this->m_rows; $r++){
3774 $column[] = '';
3775 }
3776 $this->m_cellscolor[] = $column;
3777 }
3778 }
3779
3780 private function prepareCellsTooltip(){
3781 for($c = 0; $c < $this->m_columns; $c++){
3782 $column = array();
3783 for($r = 0; $r < $this->m_rows; $r++){
3784 $column[] = '';
3785 }
3786 $this->m_cellstooltip[] = $column;
3787 }
3788 }
3789
3790
3791 private function prepareCellsRowspan(){
3792 for($c = 0; $c < $this->m_columns; $c++){
3793 $column = array();
3794 for($r = 0; $r < $this->m_rows; $r++){
3795 $column[] = 0;
3796 }
3797 $this->m_cellsrowspan[] = $column;
3798 }
3799 }
3800
3801
3802 private function prepareCellsRowspanBlocker(){
3803 for($c = 0; $c < $this->m_columns; $c++){
3804 $column = array();
3805 for($r = 0; $r < $this->m_rows; $r++){
3806 $column[] = 0;
3807 }
3808 $this->m_cellsrowspanBlocker[] = $column;
3809 }
3810 }
3811
3812
3813
3814 private function prepareCellsColspan(){
3815 for($c = 0; $c < $this->m_columns; $c++){
3816 $column = array();
3817
3818 for($r = 0; $r < $this->m_rows; $r++){
3819 $column[] = 0;
3820 }
3821 $this->m_cellscolspan[] = $column;
3822 }
3823
3824 }
3825
3826 private function prepareCellsStyle(){
3827 for($c = 0; $c < $this->m_columns; $c++){
3828 $column = array();
3829 for($r = 0; $r < $this->m_rows; $r++){
3830 $column[] = '';
3831 }
3832 $this->m_cellsstyle[] = $column;
3833 }
3834 }
3835
3836 private function prepareRowsStyle(){
3837 for($r = 0; $r < $this->m_rows; $r++){
3838 $this->m_rowsstyle[$r] = '';
3839 }
3840 }
3841
3842 private function prepareCellsClass(){
3843 for($c = 0; $c < $this->m_columns; $c++){
3844 $column = array();
3845 for($r = 0; $r < $this->m_rows; $r++){
3846 $column[] = '';
3847 }
3848 $this->m_cellsclass[] = $column;
3849 }
3850 }
3851
3852 private function prepareRowsClass(){
3853 for($r = 0; $r < $this->m_rows; $r++){
3854 $this->m_rowsclass[$r] = '';
3855 }
3856 }
3857
3858
3859 private function prepareCellsEvent(){
3860 for($c = 0; $c < $this->m_columns; $c++){
3861 $column = array();
3862 for($r = 0; $r < $this->m_rows; $r++){
3863 $column[] = array();
3864 }
3865 $this->m_cellsevent[] = $column;
3866 }
3867 }
3868
3869 private function prepareRowId(){
3870 for($r = 0; $r < $this->m_rows; $r++){
3871 $this->m_rowsId[$r] = $this->m_name . "_row_" . $r;
3872 }
3873 }
3874
3875 private function prepareColAlign(){
3876 for($c = 0; $c < $this->m_columns; $c++){
3877 $this->m_colsalign[] = "";
3878 }
3879 }
3880
3881 private function prepareRowAlign(){
3882 for($r = 0; $r < $this->m_rows; $r++){
3883 $this->m_rowsalign[] = "";
3884 }
3885 }
3886
3887 private function prepareColWitdh(){
3888 for($c = 0; $c < $this->m_columns; $c++){
3889 $this->m_colswidth[] = "";
3890 }
3891 }
3892
3893
3894 private function prepareRowHeight(){
3895 for($r = 0; $r < $this->m_rows; $r++){
3896 $this->m_rowsheight[] = "";
3897 }
3898 }
3899
3900
3901 private function prepareHeader(){
3902 for($c = 0; $c < $this->m_columns; $c++){
3903 $this->m_header_cells[] = array(" ","left","middle", false, "", 0, 0);
3904 }
3905 }
3906
3907 private function prepareFooter(){
3908 for($c = 0; $c < $this->m_columns; $c++){
3909 $this->m_footer_cells[] = array(" ","left","middle", false);
3910 }
3911 }
3912
3913 private function roundTable($html_table){
3914 $style = $this->m_style;
3915 $this->m_spacer_img_path = fixpath($this->m_spacer_img_path);
3916 $this->m_spacer_img = $this->m_spacer_img_path.'/'.$this->m_spacer_img;
3917
3918 if($this->m_dont_check_spacer_file === false && !fileExist($this->m_spacer_img)){
3919 showFrameworkError('can\'t read '.$this->m_spacer_img.', m_spacer_img_path is not valid, image '.$this->m_spacer_img.' is missing or allow url fopen is disabled.');
3920 return $html_table;
3921 }
3922 $inner_width = "";
3923 $inner_height = "";
3924 if(!empty($this->m_width) && !empty($this->m_height)){
3925 $inner_width = $this->m_width-8;
3926 $inner_height = $this->m_height-8;
3927 }
3928 if(!empty($style)){
3929 $style = ' style="'.$style.'"';
3930 }
3931
3932 $this->m_spacer_img = str_replace(array('https:', 'http:'), '', $this->m_spacer_img);
3933 $round_html = '<table width="'.$this->m_width.'" height="'.$this->m_height.'" border="0" cellspacing="0" cellpadding="0" '.$style.''.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3934 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3935 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3936 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3937 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3938 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3939 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3940 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3941 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3942 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3943 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3944 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3945 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3946 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3947 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3948 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3949 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3950 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3951 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3952 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3953 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3954 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3955 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3956 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3957 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3958 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3959 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3960 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3961 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3962 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3963 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3964 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3965 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3966 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3967 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3968 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3969 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3970 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3971 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3972 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3973 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3974 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3975 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3976 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3977 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3978
3979 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3980 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3981 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3982 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3983 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3984 $round_html .= '<td width="'.$inner_width.'" height="'.$inner_height.'" bgcolor="'.$this->m_bgcolor.'" style="vertical-align:top;text-align:left">'.$html_table.'</td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3985 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3986 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3987 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3988 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3989 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3990
3991 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3992 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3993 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3994 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3995 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3996 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3997 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3998 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
3999 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4000 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4001 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4002 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4003 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4004 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4005 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4006 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4007 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4008 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4009 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4010 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4011 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4012 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4013 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4014 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4015 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4016 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4017 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4018 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4019 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4020 $round_html .= '<td width="1px" height="1px" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4021 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4022 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4023 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4024 $round_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4025 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4026 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4027 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4028 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4029 $round_html .= '<td width="'.$inner_width.'" height="1" bgcolor="'.$this->m_bordercolor.'"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4030 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4031 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4032 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4033 $round_html .= '<td width="1px" height="1px"><img src="'.$this->m_spacer_img.'" border="0"></td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4034 $round_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4035 $round_html .= '</table'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4036
4037 return $round_html;
4038 }
4039
4040 private function autoColRow(&$column, &$row){
4041 if($column < 0){
4042 if($column === CELL_NEXT && $column < $this->m_columns-1){
4043 $this->m_last_add_column = $this->m_last_add_column + 1;
4044 }else if($column === CELL_PREV && $this->m_last_add_column > -1){
4045 $this->m_last_add_column = $this->m_last_add_column -1;
4046 }
4047 $column = $this->m_last_add_column;
4048 }else{
4049 $this->m_last_add_column = $column;
4050 }
4051
4052 if($row < 0){
4053 if($row === CELL_NEXT && $row < $this->m_rows-1){
4054 $this->m_last_add_row = $this->m_last_add_row + 1;
4055 }else if($row === CELL_PREV && $this->m_last_add_row > -1){
4056 $this->m_last_add_row = $this->m_last_add_row -1;
4057 }
4058 $row = $this->m_last_add_row;
4059 }else{
4060 $this->m_last_add_row = $row;
4061 }
4062 }
4063
4064 4065 4066 4067 4068 4069
4070 function html($print=false){
4071 if(count($this->m_cells)===0){$this->prepareCells();}
4072 if(count($this->m_header_cells)===0){$this->prepareHeader();}
4073 if(count($this->m_colsalign)===0){$this->prepareColAlign();}
4074 if(count($this->m_rowsalign)===0){$this->prepareRowAlign();}
4075 if(count($this->m_footer_cells)===0){$this->prepareFooter();}
4076 if(count($this->m_cellsevent)===0){$this->prepareCellsEvent();}
4077 if(count($this->m_colswidth)===0){$this->prepareColWitdh();}
4078 if(count($this->m_rowsheight)===0){$this->prepareRowHeight();}
4079
4080
4081 if(!$this->m_id){$this->m_id = $this->m_name;}
4082 $this->m_html = '<table name="'.$this->m_name.'" id="'.$this->m_id.'" rules="'.$this->m_gridrules.'"';
4083 if($this->m_width && !$this->m_round){ $this->m_html .= ' width="'.$this->m_width.'"'; }
4084 if($this->m_height && !$this->m_round){ $this->m_html .= ' height="'.$this->m_height.'"'; }
4085 if($this->m_round){ $this->m_html .= ' width="100%"'; }
4086 if($this->m_round){ $this->m_html .= ' height="100%"'; }
4087 if(!$this->m_border){$this->m_bordersize = 0;}
4088 $this->m_html .= ' border="'.$this->m_bordersize.'"';
4089 if(is_numeric($this->m_cellspacing)){ $this->m_html .= ' cellspacing="'.$this->m_cellspacing.'"'; }
4090 if(is_numeric($this->m_cellpadding)){ $this->m_html .= ' cellpadding="'.$this->m_cellpadding.'"'; }
4091 if(!empty($this->m_class)){ $this->m_html .= ' class="'.$this->m_class.'"';}
4092
4093
4094 $style = ' style="';
4095 if($this->m_round === true){
4096 if(empty($this->m_bordercolor)){
4097 $this->m_bordercolor = "#CCCCCC";
4098 }
4099 }
4100 if(!empty($this->m_bordercolor)){
4101
4102 $style .= 'border-color:'.$this->m_bordercolor.';';
4103 }
4104 if($this->m_style){
4105 $style .= $this->m_style;
4106 }
4107 $style .= '"';
4108
4109 $this->m_html .= $style;
4110 $this->m_html .= ''.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4111
4112
4113 $allcellstyle = ' style="';
4114 if($this->m_fontsize){ $allcellstyle .= 'font-size:'.$this->m_fontsize.';'; }
4115
4116 $rows = $this->m_rows;
4117 if($this->m_header === true){$rows++;}
4118
4119 $r = 0; while($r < $rows){
4120
4121 $r1 = $this->m_header ? $r-1 : $r;
4122
4123 $this->m_html .= '<tr';
4124
4125 if(isset($this->m_rowsId[$r1]))
4126 {
4127 $this->m_html .= ' name="'.$this->m_rowsId[$r1].'" id="'.$this->m_rowsId[$r1].'"';
4128 }else{
4129 $this->m_html .= ' name="'.$this->m_name.'_'.$r.'" id="'.$this->m_id.'_'.$r.'"';
4130 }
4131
4132 if(isset($this->m_rowsclass[$r1]) && $this->m_rowsclass[$r1] != '')
4133 {
4134 $this->m_html .= ' class="'.$this->m_rowsclass[$r1].'"';
4135 }
4136
4137 $rowStyle = '';
4138 if($this->m_bgcolor_row_even && $this->m_bgcolor_row_uneven)
4139 {
4140 if(even($r1))
4141 {
4142 $rowStyle .= 'background-color: ' . $this->m_bgcolor_row_even . ';';
4143 }
4144 else
4145 {
4146 $rowStyle .= 'background-color: ' . $this->m_bgcolor_row_uneven . ';';
4147 }
4148 }
4149 if(isset($this->m_rowsstyle[$r1]))
4150 {
4151
4152 if(strpos($this->m_rowsstyle[$r1], 'background') !== false)
4153 {
4154 $rowStyle = '';
4155 }
4156
4157 $rowStyle .= $this->m_rowsstyle[$r1];
4158 }
4159 if($rowStyle != '')
4160 {
4161 $this->m_html .= ' style="'.$rowStyle.'"';
4162 }
4163
4164 if($this->m_highlight){
4165 if(strtolower($this->m_highlight_type) === "mouseclick"){
4166 $this->m_html .= ' onclick="fw_setTableRowColor(\''.$this->m_id.'\', '.$r1.', '.$this->m_columns.', \''.$this->m_highlight_color.'\', \'click\');"';
4167 }else{
4168 $this->m_html .= ' onmouseover="fw_setTableRowColor(\''.$this->m_id.'\', '.$r1.', '.$this->m_columns.', \''.$this->m_highlight_color.'\');"';
4169 $this->m_html .= ' onmouseout="fw_setTableRowColor(\''.$this->m_id.'\', '.$r1.', '.$this->m_columns.', \'\');"';
4170 }
4171 }
4172 $this->m_html .= ''.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4173
4174 $c = 0; while($c < $this->m_columns){
4175 $style = $allcellstyle;
4176
4177 if($r === 0 && $this->m_header){
4178 if(!isset($this->m_header_cells[$c][0])){trigger_error(__CLASS__.' - '.$this->m_name.': method "setHeader" is called before the last number of columns modification', E_USER_NOTICE); continue;}
4179 if(is_string($this->m_header_cells[$c][0]) && strtolower($this->m_header_cells[$c][0]) === '#span#'){continue;}
4180 $sortimg = "";
4181 if($this->m_header_cells[$c][3] === true){
4182 $border_asc = "0";
4183 $border_desc = "0";
4184
4185 if($c === $this->m_sort_col || (isset($_REQUEST[$this->m_name.'_sort_col']) && $c === $_REQUEST[$this->m_name.'_sort_col'])){
4186 if($this->m_sort_desc || strtoupper($_REQUEST[$this->m_name."_sort_type"]) === "DESC"){$border_desc = "1";}else{$border_asc = "1";}
4187 }
4188
4189 $onClick_asc = "document.getElementById('".$this->m_id."_sort_col').value = '".$c."';";
4190 $onClick_asc .= "document.getElementById('".$this->m_id."_sort_type').value = 'asc';";
4191
4192 $onClick_desc = "document.getElementById('".$this->m_id."_sort_col').value = '".$c."';";
4193 $onClick_desc .= "document.getElementById('".$this->m_id."_sort_type').value = 'desc';";
4194
4195 if(empty($this->m_sort_asc_img)){$this->m_sort_asc_img = protocol().'://'.$GLOBALS["CRVCL"]["URL"].'/images/sort_asc.gif';}
4196 if(empty($this->m_sort_desc_img)){$this->m_sort_desc_img = protocol().'://'.$GLOBALS["CRVCL"]["URL"].'/images/sort_desc.gif';}
4197
4198 $sortimg .= ' ';
4199 $sortimg .= '<a href="javascript:void(0);" onclick="'.$onClick_asc.$this->m_sortcol_js.'"><img src="'.$this->m_sort_asc_img.'" alt="↑" border="'.$border_asc.'"></a> ';
4200 $sortimg .= '<a href="javascript:void(0);" onclick="'.$onClick_desc.$this->m_sortcol_js.'"><img src="'.$this->m_sort_desc_img.'" alt="↓" border="'.$border_desc.'"></a> ';
4201 }
4202
4203 $style .= 'text-align:'.$this->m_header_cells[$c][1].';';
4204 $style .= 'vertical-align:'.$this->m_header_cells[$c][2].';';
4205 $style .= $this->m_header_cells[$c][4];
4206 $this->m_html .= '<th ';
4207
4208 if(!empty($this->m_header_cells[$c][5])){
4209 $this->m_html .= ' colspan="'.$this->m_header_cells[$c][5].'"';
4210 }
4211
4212 if(!empty($this->m_header_cells[$c][6])){
4213 $this->m_html .= ' rowspan="'.$this->m_header_cells[$c][6].'"';
4214 }
4215
4216
4217 $this->m_html .= $style . '"';
4218
4219 if(empty($this->m_colswidth[$c])){
4220 if(!empty($this->m_cellwidth)){ $this->m_html .= ' width="'.$this->m_cellwidth.'"'; }
4221 }else{
4222 $this->m_html .= ' width="'.$this->m_colswidth[$c].'"';
4223 }
4224 if(empty($this->m_rowsheight[$r])){
4225 if(!empty($this->m_cellheight)){ $this->m_html .= ' height="'.$this->m_cellheight.'"'; }
4226 }else{
4227 $this->m_html .= ' height="'.$this->m_rowsheight[$r].'"';
4228 }
4229
4230 $this->m_html .= '>';
4231
4232 $childs = $this->m_header_cells[$c][0];
4233 if(!is_array($childs)){
4234 $childs = array($childs);
4235 }
4236
4237 $header_cell = '<nobr>'.$this->m_cellspacer.$this->buildChilds($childs).$sortimg.$this->m_cellspacer.'</nobr>';
4238
4239 free($childs, false, true);
4240
4241 if(strpos($header_cell,'<nobr>') !== false){
4242 $header_cell = $str = preg_replace("/<nobr>/i", "", $header_cell);
4243 $header_cell = $str = preg_replace("/<\/nobr>/i", "", $header_cell);
4244 $header_cell = '<nobr>' . $header_cell . '</nobr>';
4245 }
4246 $this->m_html .= $header_cell;
4247 $this->m_html .= '</th'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4248 }else{
4249 if($this->m_header === true){$r--;}
4250
4251 if(empty($this->m_colsalign[$c]) && $this->m_header === true){
4252 $this->m_colsalign[$c] = $this->m_header_cells[$c][1];
4253 }
4254 if(empty($this->m_rowsalign[$r]) && $this->m_header === true){
4255 $this->m_rowsalign[$r] = $this->m_header_cells[$c][2];
4256 }
4257
4258 if(!empty($this->m_colsalign[$c])){
4259 $style .= 'text-align:'.$this->m_colsalign[$c].';';
4260 }
4261 if(!empty($this->m_rowsalign[$r])){
4262 $style .= 'vertical-align:'.$this->m_rowsalign[$r].';';
4263 }
4264
4265 if(!empty($this->m_cellsstyle[$c][$r]['style'])){
4266 if($this->m_cellsstyle[$c][$r]['overwrite'])
4267 {
4268 $style = ' style="' . $this->m_cellsstyle[$c][$r]['style'];
4269 }
4270 else
4271 {
4272 $style .= $this->m_cellsstyle[$c][$r]['style'];
4273 }
4274 }
4275
4276 if(isset($this->m_cellsrowspanBlocker[$c][$r]) && $this->m_cellsrowspanBlocker[$c][$r])
4277 {
4278 $c++;
4279 continue;
4280 }
4281
4282 $this->m_html .= '<td name="'.$this->m_name.'_'.$c.'_'.$r.'" id="'.$this->m_id.'_'.$c.'_'.$r.'"';
4283
4284 if(!empty($this->m_cellsrowspan[$c][$r])){
4285 $this->m_html .= ' rowspan="'.$this->m_cellsrowspan[$c][$r].'"';
4286 }
4287
4288 if(!empty($this->m_cellscolspan[$c][$r])){
4289 $this->m_html .= ' colspan="'.$this->m_cellscolspan[$c][$r].'"';
4290 }
4291
4292 $bgcolor = "";
4293 if(!empty($this->m_cellscolor[$c][$r])){
4294 $bgcolor = $this->m_cellscolor[$c][$r];
4295 }else if(!empty($this->m_bgcolor)){
4296 $bgcolor = $this->m_bgcolor;
4297 }
4298 if(!empty($bgcolor)){
4299 $style .= 'background-color:'.$bgcolor.';';
4300 }
4301
4302 $this->m_html .= $style . '"';
4303
4304 $class = ' class="';
4305 if(!empty($this->m_cellsclass[$c][$r])){
4306 $class .= $this->m_cellsclass[$c][$r];
4307 }
4308 $this->m_html .= $class . '"';
4309
4310 if(empty($this->m_colswidth[$c])){
4311 if(!empty($this->m_cellwidth)){ $this->m_html .= ' width="'.$this->m_cellwidth.'"'; }
4312 }else{
4313 $this->m_html .= ' width="'.$this->m_colswidth[$c].'"';
4314 }
4315 if(empty($this->m_rowsheight[$r])){
4316 if(!empty($this->m_cellheight)){ $this->m_html .= ' height="'.$this->m_cellheight.'"'; }
4317 }else{
4318 $this->m_html .= ' height="'.$this->m_rowsheight[$r].'"';
4319 }
4320
4321
4322 $onClick = '';
4323 $onMouseOver = '';
4324 $onMouseOut = '';
4325 $onDblClick = '';
4326
4327 if(!empty($this->m_cellstooltip[$c][$r])){
4328 $onClick .= 'fw_hideTooltip();';
4329 $onMouseOver .= 'fw_showTooltip(\''.$this->m_cellstooltip[$c][$r].'\');';
4330 $onMouseOut .= 'fw_hideTooltip();';
4331 }
4332
4333 if(!empty($this->m_cellsevent[$c][$r])){
4334 $aevents = $this->m_cellsevent[$c][$r];
4335
4336 if(isset($aevents['onclick'])){
4337 $onClick .= $aevents["onclick"];
4338 }
4339 if(isset($aevents['onmouseover'])){
4340 $onMouseOver .= $aevents["onmouseover"];
4341 }
4342 if(isset($aevents['onmouseout'])){
4343 $onMouseOut .= $aevents["onmouseout"];
4344 }
4345 if(isset($aevents['ondblclick'])){
4346 $onDblClick .= $aevents["ondblclick"];
4347 }
4348 }
4349
4350 if(!empty($onClick)){
4351 $onClick = ' onclick="'.$onClick.'"';
4352 }
4353 if(!empty($onMouseOver)){
4354 $onMouseOver = ' onmouseover="'.$onMouseOver.'"';
4355 }
4356 if(!empty($onMouseOut)){
4357 $onMouseOut = ' onmouseout="'.$onMouseOut.'"';
4358 }
4359 if(!empty($onDblClick)){
4360 $onDblClick = ' ondblclick="'.$onDblClick.'"';
4361 }
4362
4363
4364 $this->m_html .= $onClick.$onMouseOver.$onMouseOut.$onDblClick;
4365
4366 $this->m_html .= '>';
4367 $alink_textcolor = str_getCssValue($style,"color");
4368 if(empty($alink_textcolor)){$alink_textcolor = "#000000";}
4369
4370
4371
4372 if(empty($style) && (!empty($onClick) || !empty($onDblClick))){$this->m_html .= '<a href="javascript:void(0);" style="text-decoration:none;color:'.$alink_textcolor.';">';}
4373
4374
4375 $childs = $this->m_cells[$c][$r];
4376 if(!is_array($childs)){
4377 $childs = array($childs);
4378 }
4379
4380 $this->m_html .= $this->m_cellspacer.$this->buildChilds($childs).$this->m_cellspacer;
4381
4382 free($childs, false, true);
4383
4384 if(!empty($onClick) || !empty($onDblClick)){$this->m_html .= '</a>';}
4385 if($this->m_highlight){
4386 $this->m_html .= '<input type="hidden" value="'.$bgcolor.'" name="'.$this->m_name.'_cellcolor_'.$c.'_'.$r.'" id="'.$this->m_id.'_cellcolor_'.$c.'_'.$r.'">';
4387 }
4388
4389 $this->m_html .= '</td'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4390 if($this->m_header === true){$r++;}
4391 }
4392
4393 $rHeaderFixed = $this->m_header ? $r-1 : $r;
4394 if(!empty($this->m_cellscolspan[$c][$rHeaderFixed])){
4395 $c +=($this->m_cellscolspan[$c][$rHeaderFixed]-1);
4396 }
4397
4398 $c++;
4399 }
4400 $this->m_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4401
4402 $r++;
4403 }
4404
4405
4406 if($this->m_footer){
4407 $this->m_html .= '<tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4408 for($c = 0; $c < $this->m_columns; $c++){
4409 $style = $allcellstyle;
4410
4411 $sortimg = "";
4412 if($this->m_footer_cells[$c][3] === true){
4413 $border_asc = "0";
4414 $border_desc = "0";
4415 if($c === $this->m_sort_col){
4416 if($this->m_sort_desc){$border_desc = "1";}else{$border_asc = "1";}
4417 }
4418
4419 $onClick_asc = "document.getElementById('".$this->m_id."_sort_col').value = '".$c."';";
4420 $onClick_asc .= "document.getElementById('".$this->m_id."_sort_type').value = 'asc';";
4421
4422 $onClick_desc = "document.getElementById('".$this->m_id."_sort_col').value = '".$c."';";
4423 $onClick_desc .= "document.getElementById('".$this->m_id."_sort_type').value = 'desc';";
4424
4425 $sortimg .= ' ';
4426 $sortimg .= '<a href="javascript:void(0);" onclick="'.$onClick_asc.$this->m_sortcol_js.'"><img src="'.$this->m_sort_asc_img.'" alt="↑" border="'.$border_asc.'"></a> ';
4427 $sortimg .= '<a href="javascript:void(0);" onclick="'.$onClick_desc.$this->m_sortcol_js.'"><img src="'.$this->m_sort_desc_img.'" alt="↓" border="'.$border_desc.'"></a> ';
4428 }
4429
4430 $style .= 'text-align:'.$this->m_footer_cells[$c][1].';';
4431 $style .= 'vertical-align:'.$this->m_footer_cells[$c][2].';';
4432 $style .= $this->m_footer_cells[$c][4];
4433 $this->m_html .= '<th ';
4434 $this->m_html .= $style . '"';
4435
4436 if(!empty($this->m_footer_cells[$c][5])){
4437 $this->m_html .= " onclick=\"fw_hideTooltip();\"";
4438 $this->m_html .= " onmouseover=\"fw_showTooltip('".$this->m_footer_cells[$c][5]."');\"";
4439 $this->m_html .= " onmouseout=\"fw_hideTooltip();\"";
4440 }
4441
4442 if($this->m_colswidth[$c] === ""){
4443 if(!empty($this->m_cellwidth)){ $this->m_html .= ' width="'.$this->m_cellwidth.'"'; }
4444 }else{
4445 $this->m_html .= ' width="'.$this->m_colswidth[$c].'"';
4446 }
4447 if(empty($this->m_rowsheight[$r])){
4448 if(!empty($this->m_cellheight)){ $this->m_html .= ' height="'.$this->m_cellheight.'"'; }
4449 }else{
4450 $this->m_html .= ' height="'.$this->m_rowsheight[$r].'"';
4451 }
4452 $this->m_html .= '>';
4453
4454
4455
4456 $childs = $this->m_footer_cells[$c][0];
4457 if(!is_array($childs)){
4458 $childs = array($childs);
4459 }
4460
4461
4462 $this->m_html .= $this->m_cellspacer.$this->buildChilds($childs).$sortimg.$this->m_cellspacer;
4463
4464 free($childs, false, true);
4465
4466 $this->m_html .= '</th'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4467 }
4468 $this->m_html .= '</tr'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4469 }
4470
4471 $lastsort = "-1";
4472 if(isset($_REQUEST[$this->m_name."_sort_col"])){
4473 $lastsort = $_REQUEST[$this->m_name."_sort_col"];
4474 }
4475 $lastsort_type = "";
4476 if(isset($_REQUEST[$this->m_name."_sort_type"])){
4477 $lastsort_type = $_REQUEST[$this->m_name."_sort_type"];
4478 }
4479
4480 $this->m_html .= '</table'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4481 $this->m_html .= '<input type="hidden" name="'.$this->m_name.'_sort_col" id="'.$this->m_id.'_sort_col" value="'.$lastsort.'"'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4482 $this->m_html .= '<input type="hidden" name="'.$this->m_name.'_sort_type" id="'.$this->m_id.'_sort_type" value="'.$lastsort_type.'"'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4483 $this->m_html .= '<input type="hidden" name="'.$this->m_name.'_highlight_row" id="'.$this->m_id.'_highlight_row" value=""'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
4484
4485 if($this->m_round){
4486 $this->m_html = $this->roundTable($this->m_html);
4487 }
4488
4489 return parent::html($print);
4490 }
4491
4492
4493 4494 4495 4496 4497 4498
4499 function setRowId($row, $id=''){
4500 if(count($this->m_rowsId)===0){$this->prepareRowId();}
4501 if($id != ''){$this->m_rowsId[$row] = $id;}
4502 }
4503
4504
4505
4506 4507 4508 4509 4510 4511 4512 4513
4514 function setCell($column, $row, $value, $sort_val=null){
4515 if($value===""){$value = " ";}
4516 if(count($this->m_cells)===0){$this->prepareCells();}
4517 if($sort_val===null){$sort_val = $value;}
4518 if($column >= $this->m_columns || $row >= $this->m_rows){return;}
4519
4520 $this->autoColRow($column, $row);
4521
4522 $this->m_cells[$column][$row] = $value;
4523 $this->m_cells_sval[$column][$row] = $sort_val;
4524 }
4525
4526 4527 4528 4529 4530 4531 4532
4533 function setCellColor($column, $row, $color){
4534 if(count($this->m_cellscolor)===0){$this->prepareCellsColor();}
4535 $this->autoColRow($column, $row);
4536 $this->m_cellscolor[$column][$row] = $color;
4537 }
4538
4539 4540 4541 4542 4543 4544 4545
4546 function setCellTooltip($column, $row, $tooltip){
4547 if(count($this->m_cellstooltip)===0){$this->prepareCellsTooltip();}
4548 $this->autoColRow($column, $row);
4549 $this->m_cellstooltip[$column][$row] = $tooltip;
4550 }
4551
4552 4553 4554 4555 4556 4557 4558
4559 function setCellRowspan($column, $row, $numOfRows){
4560 if(count($this->m_cellsrowspan)===0){$this->prepareCellsRowspan();}
4561 if(count($this->m_cellsrowspanBlocker)===0){$this->prepareCellsRowspanBlocker();}
4562 $this->autoColRow($column, $row);
4563 $this->m_cellsrowspan[$column][$row] = $numOfRows;
4564
4565 for($r=$row+1; $r<$row+$numOfRows; $r++)
4566 {
4567 $this->m_cellsrowspanBlocker[$column][$r] = true;
4568 }
4569 }
4570
4571 4572 4573 4574 4575 4576 4577
4578 function setCellColspan($column, $row, $numOfCols){
4579 if(count($this->m_cellscolspan)===0){$this->prepareCellsColspan();}
4580 $this->autoColRow($column, $row);
4581 $this->m_cellscolspan[$column][$row] = $numOfCols;
4582 }
4583
4584 4585 4586 4587 4588 4589 4590 4591
4592 function setCellStyle($column, $row, $style, $overwriteStyle=false){
4593 if(count($this->m_cellsstyle)===0){$this->prepareCellsStyle();}
4594 $this->autoColRow($column, $row);
4595 $this->m_cellsstyle[$column][$row] = array('style'=>$style, 'overwrite'=>$overwriteStyle);
4596 }
4597
4598 4599 4600 4601 4602 4603
4604 function setRowStyle($row, $style){
4605 if(count($this->m_rowsstyle)===0){$this->prepareRowsStyle();}
4606 $this->m_rowsstyle[$row] = $style;
4607 }
4608
4609 4610 4611 4612 4613 4614 4615
4616 function setCellClass($column, $row, $class){
4617 if(count($this->m_cellsclass)===0){$this->prepareCellsClass();}
4618 $this->autoColRow($column, $row);
4619 $this->m_cellsclass[$column][$row] = $class;
4620 }
4621
4622 4623 4624 4625 4626 4627
4628 function setRowClass($row, $class){
4629 if(count($this->m_rowsclass)===0){$this->prepareRowsClass();}
4630 $this->m_rowsclass[$row] = $class;
4631 }
4632
4633 4634 4635 4636 4637 4638
4639 function setColAlign($column, $align){
4640 if(count($this->m_colsalign)===0){$this->prepareColAlign();}
4641 $this->m_colsalign[$column] = $align;
4642 }
4643
4644 4645 4646 4647 4648 4649
4650 function setRowAlign($row, $align){
4651 if(count($this->m_rowsalign)===0){$this->prepareRowAlign();}
4652 $this->m_rowsalign[$row] = $align;
4653 }
4654
4655 4656 4657 4658 4659 4660
4661 function setColWidth($column, $width){
4662 if(count($this->m_colswidth)===0){$this->prepareColWitdh();}
4663 $this->m_colswidth[$column] = $width;
4664 }
4665
4666 4667 4668 4669 4670 4671
4672 function setRowHeight($row, $height){
4673 if(count($this->m_rowsheight)===0){$this->prepareRowHeight();}
4674 $this->m_rowsheight[$row] = $height;
4675 }
4676
4677 4678 4679 4680 4681 4682 4683 4684 4685 4686
4687 function setHeader($column, $value, $align="left", $valign="middle", $canSort=false, $style="", $colspan=0, $rowspan=0){
4688 if(count($this->m_header_cells)===0){$this->prepareHeader();}
4689
4690 if($column < 0){
4691 if($column === CELL_NEXT && $column < $this->m_columns-1){
4692 $this->m_last_add_column_header = $this->m_last_add_column_header + 1;
4693 }else if($column === CELL_PREV && $this->m_last_add_column_header > -1){
4694 $this->m_last_add_column_header = $this->m_last_add_column_header -1;
4695 }
4696 $column = $this->m_last_add_column_header;
4697 }else{
4698 $this->m_last_add_column_header = $column;
4699 }
4700
4701
4702 $this->m_header_cells[$column] = array($value, $align, $valign, $canSort, $style, $colspan, $rowspan);
4703 }
4704
4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715
4716 function setFooter($column, $value, $align="left", $valign="middle", $canSort=false, $style="", $tooltip=""){
4717 if(count($this->m_footer_cells)===0){$this->prepareFooter();}
4718 if($column < 0){
4719 if($column === CELL_NEXT && $column < $this->m_columns){
4720 $this->m_last_add_column_footer = $this->m_last_add_column_footer + 1;
4721 }else if($column === CELL_PREV && $this->m_last_add_column_footer > -1){
4722 $this->m_last_add_column_footer = $this->m_last_add_column_footer -1;
4723 }
4724 $column = $this->m_last_add_column_footer;
4725 }else{
4726 $this->m_last_add_column_footer = $column;
4727 }
4728 $this->m_footer_cells[$column] = array($value, $align, $valign, $canSort, $style, $tooltip);
4729 }
4730
4731 4732 4733 4734 4735 4736 4737 4738
4739 function setCellEvent($column, $row, $eventname, $js){
4740 $eventname = strtolower($eventname);
4741 if(count($this->m_cellsevent)===0){$this->prepareCellsEvent();}
4742 $this->autoColRow($column, $row);
4743 $aevents = $this->m_cellsevent[$column][$row];
4744 $aevents[$eventname] = $js;
4745
4746 $this->m_cellsevent[$column][$row] = $aevents;
4747 }
4748
4749 4750 4751 4752 4753
4754 function getLastAddCol(){
4755 return $this->m_last_add_column;
4756 }
4757
4758 4759 4760 4761 4762
4763 function getLastAddRow(){
4764 return $this->m_last_add_row;
4765 }
4766
4767
4768
4769 4770 4771 4772 4773
4774 function setCellRowPointer($row){
4775 $this->m_last_add_row = $row;
4776 }
4777
4778
4779 4780 4781 4782 4783
4784 function setCellColPointer($column){
4785 $this->m_last_add_column = $column;
4786 }
4787
4788
4789
4790 4791 4792 4793 4794
4795 function setHeaderColPointer($column){
4796 $this->m_last_add_column_header = $column;
4797 }
4798
4799
4800 4801 4802 4803 4804
4805 function setFooterColPointer($column){
4806 $this->m_last_add_column_footer = $column;
4807 }
4808
4809
4810 4811 4812 4813 4814 4815 4816
4817 function colSort($col, $descend=false, $sort_flags=SORT_REGULAR){
4818
4819
4820 if(count($this->m_cells)===0){$this->prepareCells();}
4821 if(count($this->m_cellscolor)===0){$this->prepareCellsColor();}
4822 if(count($this->m_cellsstyle)===0){$this->prepareCellsStyle();}
4823 if(count($this->m_cellsclass)===0){$this->prepareCellsClass();}
4824 if(count($this->m_rowsalign)===0){$this->prepareRowAlign();}
4825 if(count($this->m_cellstooltip)===0){$this->prepareCellsTooltip();}
4826 if(count($this->m_cellscolspan)===0){$this->prepareCellsColspan();}
4827 if(count($this->m_cellsrowspan)===0){$this->prepareCellsRowspan();}
4828 if(count($this->m_cellsevent)===0){$this->prepareCellsEvent();}
4829
4830 if(strtolower($descend) === "dsc" || strtolower($descend) === "desc"){$descend = true;}else{$descend = false;}
4831 $col = (int)$col;
4832
4833 if($descend === true){
4834 arsort($this->m_cells_sval[$col], $sort_flags);
4835 }else{
4836 asort($this->m_cells_sval[$col], $sort_flags);
4837 }
4838 reset($this->m_cells_sval[$col]);
4839
4840 $new_order = array_keys($this->m_cells_sval[$col]);
4841
4842 $cells_sorted = array();
4843 $cells_sval_sorted = array();
4844 $cells_color_sorted = array();
4845 $cells_style_sorted = array();
4846 $cells_class_sorted = array();
4847 $cells_tooltip_sorted = array();
4848 $cells_rowspan_sorted = array();
4849 $cells_colspan_sorted = array();
4850 $cells_event_sorted = array();
4851
4852 for($c = 0; $c < $this->m_columns; $c++){
4853 $column = array();
4854 $column_sval = array();
4855 $column_color = array();
4856 $column_style = array();
4857 $column_class = array();
4858 $column_tooltip = array();
4859 $column_rowspan = array();
4860 $column_colspan = array();
4861 $column_event = array();
4862 for($r = 0; $r < $this->m_rows; $r++){
4863 $index = $new_order[$r];
4864 $column[] = $this->m_cells[$c][$index];
4865 $column_sval[] = $this->m_cells_sval[$c][$index];
4866 $column_color[] = $this->m_cellscolor[$c][$index];
4867 $column_style[] = $this->m_cellsstyle[$c][$index];
4868 $column_class[] = $this->m_cellsclass[$c][$index];
4869 $column_tooltip[] = $this->m_cellstooltip[$c][$index];
4870 $column_rowspan[] = $this->m_cellsrowspan[$c][$index];
4871 $column_colspan[] = $this->m_cellscolspan[$c][$index];
4872 $column_event[] = $this->m_cellsevent[$c][$index];
4873
4874 }
4875 $cells_sorted[] = $column;
4876 $cells_sval_sorted[] = $column_sval;
4877 $cells_color_sorted[] = $column_color;
4878 $cells_style_sorted[] = $column_style;
4879 $cells_class_sorted[] = $column_class;
4880 $cells_tooltip_sorted[] = $column_tooltip;
4881 $cells_colspan_sorted[] = $column_colspan;
4882 $cells_rowspan_sorted[] = $column_rowspan;
4883 $cells_event_sorted[] = $column_event;
4884 }
4885
4886 $this->m_cells = $cells_sorted;
4887 $this->m_cells_sval = $cells_sval_sorted;
4888 $this->m_cellscolor = $cells_color_sorted;
4889 $this->m_cellsstyle = $cells_style_sorted;
4890 $this->m_cellsclass = $cells_class_sorted;
4891 $this->m_cellstooltip = $cells_tooltip_sorted;
4892 $this->m_cellsrowspan = $cells_rowspan_sorted;
4893 $this->m_cellscolspan = $cells_colspan_sorted;
4894 $this->m_cellsevent = $cells_event_sorted;
4895
4896
4897 $rowsalign_sorted = array();
4898 for($r = 0; $r < $this->m_rows; $r++){
4899 $index = $new_order[$r];
4900 $rowsalign_sorted[] = $this->m_rowsalign[$index];
4901 }
4902 $this->m_rowsalign = $rowsalign_sorted;
4903
4904
4905
4906 $this->m_sort_col = $col;
4907 $this->m_sort_desc = $descend;
4908
4909 return;
4910 }
4911
4912 }
4913
4914
4915
4916 class html_ImgAMP extends html_ComponentAMP{
4917 4918 4919 4920 4921
4922 public $m_width = null;
4923 4924 4925 4926 4927
4928 public $m_height = null;
4929 4930 4931 4932 4933
4934 public $m_src = "";
4935 4936 4937 4938 4939
4940 public $m_caption = "";
4941
4942 4943 4944
4945 public $m_layout="responsive";
4946
4947
4948 4949 4950 4951 4952 4953
4954 function html($print=false){
4955
4956 $src = '';
4957 if(!empty($this->m_src))
4958 {
4959 $src = ' src="'.$this->m_src.'"';
4960 }
4961
4962 $caption = &$this->m_caption;
4963
4964 if($caption != "")
4965 {
4966 $caption = ' alt="'.trim($caption).'"';
4967 }
4968
4969 if(!empty($this->m_width) && strpos($this->m_width," width=")===false){$this->m_width = " width=".$this->m_width;}
4970 if(!empty($this->m_height) && strpos($this->m_height," height=")===false){$this->m_height = " height=".$this->m_height;}
4971 $this->m_html = '<amp-img layout="'.$this->m_layout.'"'.$src.trim($this->m_width.' '.$this->m_height).$caption.'>'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
4972
4973 return parent::html($print);
4974 }
4975 }
4976
4977
4978
4979 class html_Img extends html_Events
4980 {
4981 4982 4983 4984 4985
4986 public $m_width = null;
4987 4988 4989 4990 4991
4992 public $m_height = null;
4993 4994 4995 4996 4997
4998 public $m_src = "";
4999 5000 5001 5002 5003
5004 public $m_border = 0;
5005 5006 5007 5008 5009
5010 public $m_caption = "";
5011 5012 5013 5014 5015
5016 public $m_title = "";
5017
5018 5019 5020 5021 5022
5023 public $m_lazyload = false;
5024
5025 5026 5027 5028 5029
5030 public $m_onError = '';
5031 5032 5033 5034 5035
5036 public $m_onAbort = '';
5037 5038 5039 5040 5041
5042 public $onLoad = '';
5043
5044
5045 function __construct($src=null){
5046 $this->m_name = "Image";
5047 if($src !== null){
5048 $this->m_src = $src;
5049 }
5050 }
5051
5052 5053 5054 5055 5056 5057
5058 function html($print=false){
5059 if(!$this->m_id){$this->m_id = $this->m_name;}
5060
5061
5062 $style = '';
5063 if($this->m_style){
5064 $style .= ' style="'.$this->m_style.'"';
5065 }
5066
5067 $class = '';
5068 if($this->m_class){
5069 $class .= ' class="'.$this->m_class.'"';
5070 }
5071
5072 $src = '';
5073 if(!empty($this->m_src))
5074 {
5075 $src = ' src="'.$this->m_src.'"';
5076 }
5077
5078 $caption = &$this->buildChilds(array($this->m_caption));
5079
5080 if($caption != "")
5081 {
5082 $caption = ' alt="'.trim($caption).'"';
5083 }
5084
5085
5086 $attribute = '';
5087 if(!empty($this->m_attribute)){
5088 $attribute .= ' '.trim($this->m_attribute);
5089 }
5090
5091 if($this->m_lazyload === true){
5092 $attribute .= ' lazyload="1"';
5093 $attribute = trim($attribute);
5094 }
5095
5096 if(!empty($this->m_onError)){
5097 $attribute .= ' onError="'.$this->m_onError.'"';
5098 $attribute = trim($attribute);
5099 }
5100 if(!empty($this->m_onAbort)){
5101 $attribute .= ' onAbort="'.$this->m_onAbort.'"';
5102 $attribute = trim($attribute);
5103 }
5104 if(!empty($this->m_onLoad)){
5105 $attribute .= ' onLoad="'.$this->m_onLoad.'"';
5106 $attribute = trim($attribute);
5107 }
5108
5109 if(!empty($this->m_width) && strpos($this->m_width," width=")===false){$this->m_width = " width=".$this->m_width;}
5110 if(!empty($this->m_height) && strpos($this->m_height," height=")===false){$this->m_height = " height=".$this->m_height;}
5111 $this->m_html = '<img'.$src.trim($this->m_width.' '.$this->m_height).$caption.($this->m_title!=''?' title="'.trim($this->m_title).'"':'').' border="'.$this->m_border.'" '.($this->m_name?'name="'.$this->m_name.'"':'').' '.($this->m_id?'id="'.$this->m_id.'"':'').' '.$class.$style.$this->htmlEvents().$attribute.'>'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
5112
5113 return parent::html($print);
5114 }
5115 }
5116
5117
5118
5119 class html_Optionbox extends html_FocusEventsEx
5120 {
5121 5122 5123
5124 private $m_items = array();
5125
5126 public $m_ismultisel = false;
5127 5128 5129
5130 public $m_sort = false;
5131 5132 5133
5134 public $m_sort_values = false;
5135 5136 5137
5138 public $m_highlight = false;
5139 5140 5141
5142 public $m_hightlight_color = "#0000FF";
5143 5144 5145 5146 5147
5148 public $m_enabled = true;
5149 5150 5151 5152 5153
5154 public $m_hidden = false;
5155 5156 5157 5158 5159
5160 public $m_height = 5;
5161
5162 5163 5164 5165
5166 private $m_validated = false;
5167 5168 5169 5170 5171
5172 public $m_validate_color = "#FF0000";
5173 5174 5175 5176 5177
5178 public $m_valid = true;
5179 5180 5181 5182 5183
5184 public $m_valid_values = null;
5185 5186 5187 5188 5189
5190 public $m_invalid_values = null;
5191 5192 5193 5194 5195
5196 public $m_valid_error_msg = "";
5197 5198 5199 5200 5201
5202 public $m_valid_error_display = "inline";
5203 5204 5205 5206 5207
5208 public $m_border_color = COLOR_FORM_BORDER_DEFAULT;
5209
5210 5211 5212 5213 5214
5215 public $m_cursor = 'pointer';
5216
5217
5218
5219 function __construct(){
5220 $this->m_name = "Optionbox";
5221 }
5222
5223 function __destruct(){
5224 $this->m_items = NULL;
5225 }
5226
5227 5228 5229 5230 5231 5232
5233 function validate($force=false){
5234 if(!$this->m_validated || $force){
5235
5236 $cvalid = acount($this->m_valid_values);
5237 $cinvalid = acount($this->m_invalid_values);
5238
5239 if($cvalid > 0 || $cinvalid > 0){
5240 $selected = $this->getSelected();
5241
5242 if(is_numeric($selected)){
5243 $selected = array($selected);
5244 }
5245
5246 for($s = 0; $s < acount($selected); $s++){
5247
5248 if($cvalid > 0 && array_search($selected[$s], $this->m_valid_values) === false){
5249 $this->m_valid = false;
5250 break;
5251 }
5252 if($cinvalid > 0 && array_search($selected[$s], $this->m_invalid_values) !== false){
5253 $this->m_valid = false;
5254 break;
5255 }
5256 }
5257 }
5258
5259 $this->m_validated = true;
5260 }
5261 return $this->m_valid;
5262 }
5263
5264 5265 5266 5267 5268 5269
5270 function html($print=false){
5271 $this->validate(false);
5272
5273 $style = '';
5274
5275 if($this->m_cursor !== null){$style .= "cursor:".$this->m_cursor.";";}
5276
5277 if(!$this->m_height){$this->m_height = 5;}
5278
5279 $disabled = "";
5280 if(!$this->m_enabled){$disabled = " disabled"; $this->m_highlight = false;}
5281
5282 $multisel = '';
5283 if($this->m_ismultisel){
5284 $multisel = ' multiple';
5285 }
5286
5287 if($this->m_hidden == true){
5288 $style .= "visibility:hidden;";
5289 }
5290
5291 if(!$this->m_valid){
5292 $style .= 'border:1px solid '.$this->m_validate_color.';';
5293 }else if($this->m_highlight){$style .= 'border:1px solid '.$this->m_border_color.';';}
5294
5295
5296 if($this->m_style){
5297 $style .= $this->m_style;
5298 }
5299
5300 $onFocus = '';
5301 if($this->m_highlight){
5302 $onFocus .= 'this.style.border=\'1px solid '.$this->m_hightlight_color.'\';';
5303 }
5304
5305
5306 $onBlur = '';
5307 if($this->m_highlight){
5308 if(!$this->m_valid){
5309 $onBlur .= 'this.style.border=\'1px solid '.$this->m_validate_color.'\';';
5310 }else{
5311
5312 $onBlur .= 'this.style.border=\'1px solid #DCDCDC\';';
5313 }
5314 }
5315
5316
5317 $html = '';
5318 if($this->m_ismultisel && strpos($this->m_name, "[]") === false){
5319 $this->m_name .= "[]";
5320 }
5321
5322
5323 $valid_error_msg = '';
5324 if(!$this->m_valid && !empty($this->m_valid_error_msg)){
5325 $valid_error_msg = '<div style="display:'.$this->m_valid_error_display.';">'.$this->m_valid_error_msg.'</div>';
5326 }
5327
5328 $class = '';
5329 if($this->m_class){
5330 $class = $this->m_class;
5331 }
5332
5333 if(!$this->m_id){$this->m_id = $this->m_name;}
5334
5335 $set_component_changed = '';
5336 if(defined('MVC') && $this->m_mvc_set_componend_changed)
5337 $set_component_changed = 'fw_mvc_set_component_changed(\''.$this->m_id.'\');';
5338
5339 $html .= '<select id="'.$this->m_id.'" name="'.$this->m_name.'" size="'.$this->m_height.'" class="'.$this->m_class.'" style="'.$style.'"'.$this->htmlEvents().$this->htmlFocusEvents($onFocus, $onBlur).$this->htmlFocusEventsEx($set_component_changed).$multisel.$disabled.''.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
5340
5341 if($this->m_sort){
5342 $asort = array();
5343 if($this->m_sort_values){
5344 for($i = 0; $i < count($this->m_items); $i++){
5345 $asort[] = $this->m_items[$i][1];
5346 }
5347 }else{
5348 for($i = 0; $i < count($this->m_items); $i++){
5349 $asort[] = $this->m_items[$i][0];
5350 }
5351 }
5352 asort($asort);
5353 $temp = $this->m_items;
5354 unset($this->m_items);
5355 $this->m_items = array();
5356 reset($asort);
5357 for($i = 0; $i < count($asort); $i++){
5358 $key = key($asort);
5359 $this->m_items[] = array($temp[$key][0],$temp[$key][1],$temp[$key][2]);
5360 next($asort);
5361 }
5362 unset($temp);
5363 unset($asort);
5364 }
5365
5366
5367 for($i = 0; $i < count($this->m_items); $i++){
5368 $sel = '';
5369 if(isset($this->m_items[$i][2]) && $this->m_items[$i][2] == true){
5370 $sel = ' selected';
5371 }
5372 $html .= '<option value="'.(isset($this->m_items[$i][1]) ? $this->m_items[$i][1] : '').'"'.$sel.'>'.(isset($this->m_items[$i][0]) ? $this->m_items[$i][0] : '').'</option'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
5373 }
5374
5375 $html .= '</select>'.$valid_error_msg.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"];
5376
5377 $this->m_html = $html;
5378
5379 return parent::html($print);
5380 }
5381
5382 5383 5384 5385 5386 5387
5388 function addItem($text, $val=""){
5389 if(is_string($val) && $val === ""){
5390 $val = $text;
5391 }
5392 $this->m_items[] = array($text,$val,false);
5393 return;
5394 }
5395
5396 5397 5398 5399 5400
5401 function selItem($i){
5402 if($i < count($this->m_items)){
5403 $this->m_items[$i][2] = true;
5404 }
5405 return;
5406 }
5407
5408 5409 5410 5411 5412 5413
5414 function selItemFromValue($val, $useRequestAsDefault=false){
5415
5416 if($useRequestAsDefault)
5417 {
5418 $this->selItemFromRequest($val);
5419 }
5420 else
5421 {
5422 for($i = 0; $i < count($this->m_items); $i++){
5423 if(is_array($val)){
5424 if(array_search($this->m_items[$i][1], $val) !== false){
5425 $this->selItem($i);
5426 }
5427 }else{
5428 if($val == $this->m_items[$i][1]){$this->selItem($i);}
5429 }
5430 }
5431 }
5432
5433 }
5434
5435 5436 5437 5438 5439
5440 function getSelected(){
5441 $selected = array();
5442 for($i = 0; $i < count($this->m_items); $i++){
5443 if($this->m_items[$i][2] == true){
5444 $selected[] = $i;
5445 if($this->m_ismultisel == false){
5446 break;
5447 }
5448 }
5449 }
5450 if(count($selected) === 1){
5451 return $selected[0];
5452 }else if(count($selected) == 0){
5453 return -1;
5454 }else{
5455 return $selected;
5456 }
5457 }
5458
5459 5460 5461 5462 5463 5464 5465
5466 function getItem($i){
5467 if($i < count($this->m_items)){
5468 return $this->m_items[$i];
5469 }
5470 return array();
5471 }
5472
5473 5474 5475 5476 5477
5478 function selItemFromRequest($val = "") {
5479 $req_ok = false;
5480 if (isset($_REQUEST[$this->m_name])) {
5481 for ($i = 0; $i < count($this->m_items); $i++) {
5482 if (is_array($_REQUEST[$this->m_name])){
5483 for ($i2 = 0; $i2 < acount($_REQUEST[$this->m_name]); $i2++) {
5484 if ($_REQUEST[$this->m_name][$i2] == $this->m_items[$i][1]) {
5485 $this->selItem($i);
5486 $req_ok = true;
5487 break;
5488 }
5489 }
5490 } else {
5491
5492 if ($_REQUEST[$this->m_name] == $this->m_items[$i][1]) {
5493 $this->selItem($i);
5494 $req_ok = true;
5495 break;
5496 }
5497 }
5498 }
5499 }
5500 if (!$req_ok) {
5501 $this->selItemFromValue($val, false);
5502 }
5503 }
5504 }
5505
5506
5507
5508 class html_Listbox extends html_Optionbox {
5509
5510
5511 function __construct(){
5512 $this->m_name = "Listbox";
5513 $this->m_height = 5;
5514 }
5515 }
5516
5517
5518
5519 class html_Combobox extends html_Optionbox {
5520
5521
5522 function __construct(){
5523 $this->m_name = "Combobox";
5524 $this->m_height = 1;
5525 }
5526 }
5527
5528
5529
5530 class html_Choosebox extends html_Combobox {
5531
5532
5533 function __construct(){
5534 parent::__construct();
5535 $this->m_name = "Choosebox";
5536 }
5537 }
5538
5539
5540
5541 class html_Edit extends html_FocusEventsEx{
5542 5543 5544 5545
5546 private $m_validated = false;
5547
5548 5549 5550 5551 5552
5553 public $m_fontsize = null;
5554 5555 5556 5557 5558
5559 public $m_fontweight = null;
5560 5561 5562 5563 5564
5565 public $m_text = "";
5566 5567 5568 5569 5570
5571 public $m_highlight = false;
5572 5573 5574
5575 public $m_hightlight_color = "#0000FF";
5576 5577 5578 5579 5580
5581 public $m_password = false;
5582 5583 5584 5585 5586
5587 public $m_hidden = false;
5588 5589 5590 5591 5592
5593 public $m_readOnly = false;
5594 5595 5596 5597 5598
5599 public $m_readOnlyColor = "#C0C0C0";
5600 5601 5602 5603 5604
5605 public $m_enabled = true;
5606 5607 5608 5609 5610
5611 public $m_size = 30;
5612 5613 5614 5615 5616
5617 public $m_maxLength = 50;
5618 5619 5620 5621 5622
5623 public $m_valid = true;
5624 5625 5626 5627 5628
5629 public $m_validate_color = "#FF0000";
5630 5631 5632 5633 5634
5635 public $m_valid_len = 0;
5636 5637 5638 5639 5640
5641 public $m_valid_email = false;
5642 5643 5644 5645 5646
5647 public $m_valid_num = false;
5648 5649 5650 5651 5652
5653 public $m_valid_date = false;
5654 5655 5656 5657 5658
5659 public $m_valid_cmptxt = "";
5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670
5671 public $m_mask = "";
5672 5673 5674 5675 5676
5677 public $m_hotkey = "";
5678 5679 5680 5681 5682
5683 public $m_valid_error_msg = "";
5684 5685 5686 5687 5688
5689 public $m_valid_error_display = "inline";
5690 5691 5692 5693 5694
5695 public $m_bgcolor = "";
5696 5697 5698 5699 5700
5701 public $m_focus_bgcolor = "";
5702 5703 5704 5705 5706
5707 public $m_border_color = COLOR_FORM_BORDER_DEFAULT;
5708 5709 5710 5711 5712
5713 public $m_autocomplete = null;
5714
5715
5716
5717 function __construct(){
5718 $this->m_name = "Edit";
5719 }
5720
5721 5722 5723 5724 5725 5726
5727 function validate($force=false){
5728
5729 if(!$this->m_validated || $force){
5730 if($this->m_valid_len > 0 && strlen(trim($this->m_text)) < $this->m_valid_len){
5731 $this->m_valid = false;
5732 }
5733
5734 if($this->m_text != ""){
5735
5736 $val = $this->m_text;
5737
5738 if(!empty($val)){
5739 if($this->m_valid_email){
5740 $val = trim($this->m_text);
5741 $this->m_valid = checkEmail($val);
5742 }
5743
5744 if($this->m_valid_num){
5745 $this->m_valid = is_numeric($val);
5746 }
5747
5748 if($this->m_valid_date){
5749 $this->m_valid = is_date($val);
5750 }
5751 }
5752
5753 if(!empty($this->m_valid_cmptxt) && strpos($val, $this->m_valid_cmptxt) === false){
5754 $this->m_valid = false;
5755 }
5756 }
5757 $this->m_validated = true;
5758 }
5759
5760 return $this->m_valid;
5761 }
5762
5763 5764 5765 5766 5767
5768 public function setFontSize($size){
5769 $this->m_fontsize = $size;
5770 }
5771
5772 5773 5774 5775 5776
5777 public function setFontWeight($weight){
5778 $this->m_fontweight = $weight;
5779 }
5780
5781 5782 5783 5784 5785 5786
5787 function setText($val, $useRequestAsDefault=false){
5788
5789 $reqVal = isset($_REQUEST[$this->m_name]) ? $_REQUEST[$this->m_name] : null;
5790
5791
5792 if(strpos($this->m_name, '[') !== false && right($this->m_name, 1) === ']')
5793 {
5794 $pos = strpos($this->m_name, '[');
5795 $reqName = substr($this->m_name, 0, $pos);
5796 $index = substr($this->m_name, $pos+1, -1);
5797
5798 $reqVal = isset($_REQUEST[$reqName][$index]) ? $_REQUEST[$reqName][$index] : null;
5799 }
5800
5801
5802
5803 if($useRequestAsDefault && $reqVal !== null){
5804 $this->m_text = $reqVal;
5805 }else{
5806 $this->m_text = $val;
5807 }
5808 }
5809
5810 5811 5812 5813 5814 5815
5816 function html($print=false){
5817 $this->validate(false);
5818
5819 $style = '';
5820
5821 if($this->m_class == "" && $this->m_bgcolor == "")
5822 {
5823 $this->m_bgcolor = '#FFFFFF';
5824 }
5825
5826 $readOnly = "";
5827 if($this->m_readOnly){
5828 $readOnly = " readOnly"; $this->m_highlight = false;
5829 $style .= "background-color:".$this->m_readOnlyColor.";";
5830 }else if($this->m_bgcolor){
5831 $style .= "background-color:".$this->m_bgcolor.";";
5832 }
5833
5834 $disabled = "";
5835 if(!$this->m_enabled){$disabled = " disabled"; $this->m_highlight = false;}
5836
5837 if($this->m_fontsize === null && $this->m_class == ""){
5838 $style .= 'font-size:14px;';
5839 }else{
5840 $style .= 'font-size:'.$this->m_fontsize.';';
5841 }
5842
5843 if($this->m_fontweight === null && $this->m_class == ""){
5844 $style .= 'font-weight:normal;';
5845 }else if($this->m_fontweight !== null){
5846 $style .= 'font-weight:'.$this->m_fontweight.';';
5847 }
5848
5849 if(!$this->m_valid){
5850 $style .= 'border:1px solid '.$this->m_validate_color.';';
5851 }else if($this->m_highlight){$style .= 'border:1px solid '.$this->m_border_color.';';}
5852
5853 if($this->m_style){
5854 $style .= $this->m_style;
5855 }
5856
5857
5858 $onKeypress = '';
5859 if($this->m_mask){
5860 if($this->m_mask == "##.##.####" || "####-##-##"){
5861 $this->m_maxLength = 10;
5862 }
5863 if($this->m_mask == "##:##:##" && $this->m_maxLength > 8){
5864 $this->m_maxLength = 8;
5865 }
5866 $onKeypress .= " return fw_mask(event, this,'".$this->m_mask."');";
5867 }
5868
5869
5870 $onFocus = '';
5871 if($this->m_highlight){
5872 $onFocus .= 'this.style.border=\'1px solid '.$this->m_hightlight_color.'\';';
5873 }
5874 if($this->m_focus_bgcolor){
5875 $onFocus .= 'this.style.backgroundColor=\''.$this->m_focus_bgcolor.'\';';
5876 }
5877
5878 $onBlur = '';
5879 if($this->m_highlight){
5880 if(!$this->m_valid){
5881 $onBlur .= 'this.style.border=\'1px solid '.$this->m_validate_color.'\';';
5882 }else{
5883 $onBlur .= 'this.style.border=\'1px solid '.$this->m_border_color.'\';';
5884 }
5885 }
5886 if($this->m_focus_bgcolor){
5887 $onBlur .= 'this.style.backgroundColor=\''.$this->m_bgcolor.'\';';
5888 }
5889
5890
5891 $accesskey = "";
5892 if(!empty($this->m_hotkey)){
5893 $accesskey = ' accesskey="'.$this->m_hotkey.'"';
5894 $this->m_tooltip .= " ([Alt] or [Ctrl] + ".$this->m_hotkey.")";
5895 }
5896
5897 $type = 'text';
5898 if($this->m_password){
5899 $type = 'password';
5900 }
5901 if($this->m_hidden){
5902 $type = 'hidden';
5903 }
5904
5905 $valid_error_msg = '';
5906 if(!$this->m_valid && !empty($this->m_valid_error_msg)){
5907 $valid_error_msg = '<div style="display:'.$this->m_valid_error_display.';">'.$this->m_valid_error_msg.'</div>';
5908 }
5909
5910 $class = '';
5911 if($this->m_class){
5912 $class = $this->m_class;
5913 }
5914
5915 if($this->m_maxLength < $this->m_size && $this->m_size !== null){$this->m_maxLength = $this->m_size;}
5916 if(!$this->m_id){$this->m_id = $this->m_name;}
5917
5918 $size = '';
5919 if($this->m_size !== null){
5920 $size = ' size="'.$this->m_size.'"';
5921 }
5922
5923 $set_component_changed = '';
5924 if(defined('MVC') && $this->m_mvc_set_componend_changed)
5925 $set_component_changed = 'fw_mvc_set_component_changed(\''.$this->m_id.'\');';
5926
5927
5928 if(get_magic_quotes_gpc() == 1)
5929 $this->m_text = stripslashes($this->m_text);
5930
5931 $attribute = '';
5932 if(!empty($this->m_attribute)){
5933 $attribute .= ' '.trim($this->m_attribute);
5934 }
5935
5936
5937 $this->m_html = '';
5938 if(!empty($valid_error_msg)){
5939 $this->m_html .= '<span>';
5940 }
5941
5942 $autocomplete = '';
5943 if($this->m_autocomplete === false){
5944 $autocomplete = ' autocomplete="off"';
5945 }else if($this->m_autocomplete === true){
5946 $autocomplete = ' autocomplete="on"';
5947 }else if(is_string ($this->m_autocomplete)){
5948 $autocomplete = ' autocomplete="'.$this->m_autocomplete.'"';
5949 }
5950
5951 if(!empty($class)) $class = 'class="'.$class.'" ';
5952 if(!empty($style)) $style = 'style="'.$style.'" ';
5953 $this->m_html .= '<input type="'.$type.'" name="'.$this->m_name.'" id="'.$this->m_id.'"'.$accesskey.$size.' maxLength="'.$this->m_maxLength.'" '.$class.$style.' value="'.str_replace('"', '"', $this->m_text).'"'.$this->htmlEvents("", "", "", "", "", "", "", $onKeypress).$this->htmlFocusEvents($onFocus, $onBlur).$this->htmlFocusEventsEx($set_component_changed).$readOnly.$disabled.$autocomplete.$attribute.'>';
5954 if(!empty($valid_error_msg)){
5955 $this->m_html .= $valid_error_msg.'</span>';
5956 }
5957
5958 return parent::html($print);
5959 }
5960 }
5961
5962
5963
5964 class html_Label extends html_Events{
5965
5966 private $m_text = "";
5967 private $m_tagname = "";
5968 5969 5970 5971 5972
5973 public $m_fontsize = null;
5974 5975 5976 5977 5978
5979 public $m_fontweight = null;
5980 5981 5982 5983 5984
5985 public $m_fontcolor = null;
5986 5987 5988 5989 5990 5991 5992 5993 5994
5995 function __construct($text='', $tagname="span", $class_style="", $name="html_Label", $attribute=''){
5996 if(empty($tagname)) $tagname = 'span';
5997
5998 $this->m_name = $name;
5999 $this->m_class = $class_style;
6000 $this->m_tagname = $tagname;
6001 $this->m_attribute = $attribute;
6002
6003 $this->setText($text);
6004 }
6005
6006 6007 6008 6009 6010
6011 public function setText($s){
6012 if($GLOBALS["CRVCL"]["CHARSET"] === "UTF-8"){
6013 $s = utf8_fix($s);
6014 }
6015 $this->m_text = $s;
6016 }
6017
6018 6019 6020
6021 public function getText(){
6022 return $this->m_text;
6023 }
6024
6025 6026 6027 6028 6029
6030 public function setFontSize($size){
6031 $this->m_fontsize = $size;
6032 }
6033
6034 6035 6036 6037 6038
6039 public function setFontWeight($weight){
6040 $this->m_fontweight = $weight;
6041 }
6042
6043 6044 6045 6046 6047
6048 public function setFontColor($color){
6049 $this->m_fontcolor = $color;
6050 }
6051
6052 6053 6054 6055 6056 6057
6058 function html($print=false){
6059 $style = '';
6060
6061 if($this->m_fontsize !== null){
6062 $style .= 'font-size:'.$this->m_fontsize.';';
6063 }
6064
6065 if($this->m_fontweight !== null){
6066 $style .= 'font-weight:'.$this->m_fontweight.';';
6067 }
6068
6069 if($this->m_fontcolor !== null){
6070 $style .= 'color:'.$this->m_fontcolor.';';
6071 }
6072
6073 $class = '';
6074 if(!empty($this->m_class)){
6075 if(strpos($this->m_class, ':') !== false && strpos($this->m_class, ';') !== false){
6076 $style .= $this->m_class;
6077 }else{
6078 $class = ' class="'.$this->m_class.'"';
6079 }
6080 }
6081
6082 if(!empty($this->m_style)){
6083 $style .= $this->m_style;
6084 }
6085 if(!empty($style)){
6086 $style = ' style="'.$style.'"';
6087 }
6088
6089 if(!$this->m_id){$this->m_id = $this->m_name;}
6090
6091 $labelFor = '';
6092 $tagname = $this->m_tagname;
6093 if(stripos($this->m_tagname, 'label:') !== false)
6094 {
6095 $labelFor = ' for="'. strrcut($this->m_tagname, 'label:', true).'"';
6096 $tagname = 'label';
6097 }
6098
6099 $attribute = '';
6100 if(!empty($this->m_attribute)){
6101 $attribute = ' '.trim($this->m_attribute);
6102 }
6103
6104 $this->m_html = '<'.$tagname.' '.($this->m_name?'name="'.$this->m_name.'"':'').' '.($this->m_id?'id="'.$this->m_id.'"':'').''.$labelFor.$class.$style.$this->htmlEvents().$attribute.'>'.$this->m_text.'</'.$tagname.'>';
6105 return parent::html($print);
6106 }
6107 }
6108
6109
6110
6111 class html_Anchor extends html_Component{
6112 function __construct($name){
6113 $this->m_name = $name;
6114 }
6115
6116 6117 6118 6119 6120 6121
6122 function html($print=false){
6123 if(!$this->m_id){$this->m_id = $this->m_name;}
6124 $this->m_html = '<a name="'.$this->m_name.'" id="'.$this->m_id.'"></a'.$GLOBALS["CRVCL"]["MY_TAG_WORDWRAP"].'>';
6125
6126 return parent::html($print);
6127 }
6128 }
6129
6130
6131
6132 class html_LinkLabel extends html_Events{
6133 6134 6135 6136 6137
6138 public $m_caption = " ";
6139 6140 6141 6142 6143
6144 public $m_caption2 = "";
6145 6146 6147 6148 6149
6150 public $m_caption2beforecaption = false;
6151 6152 6153 6154 6155
6156 public $m_url = "javascript:void(0);";
6157 6158 6159 6160 6161
6162 public $m_target = "";
6163 6164 6165 6166 6167
6168 public $m_underline = true;
6169 6170 6171 6172 6173
6174 public $m_fontsize = null;
6175 6176 6177 6178 6179
6180 public $m_fontweight = null;
6181 6182 6183 6184 6185
6186 public $m_width = null;
6187 6188 6189 6190 6191
6192 public $m_height = null;
6193 6194 6195 6196 6197
6198 public $m_rel = '';
6199
6200 6201 6202
6203 public $m_hreflang = '';
6204
6205 6206 6207 6208 6209
6210 public $m_rev = '';
6211 6212 6213 6214 6215
6216 public $m_imgMargin = '5px';
6217 6218 6219 6220
6221 public $m_style_img = '';
6222 6223 6224 6225
6226 public $m_lazyload = false;
6227 6228 6229 6230 6231
6232 public $m_type = '';
6233 6234 6235 6236
6237 public $m_js_onClick_img = '';
6238
6239
6240 function __construct(){
6241 $this->m_name = "Linklabel";
6242 }
6243
6244
6245 6246 6247 6248 6249 6250 6251
6252 public function setCaption($caption, $caption2="", $caption2beforecaption=false){
6253 $this->m_caption = $caption;
6254 $this->m_caption2 = $caption2;
6255 $this->m_caption2beforecaption = $caption2beforecaption;
6256 }
6257
6258
6259 6260 6261 6262 6263
6264 public function setFontSize($size){
6265 $this->m_fontsize = $size;
6266 }
6267
6268 6269 6270 6271 6272
6273 public function setFontWeight($weight){
6274 $this->m_fontweight = $weight;
6275 }
6276
6277 6278 6279 6280 6281 6282