KumbiaPHP beta2-dev
Framework PHP en español
|
00001 <?php 00032 function xhtml_start_tag($tag, $attrs=null) { 00033 $params = is_array($tag) ? $tag : Util::getParams(func_get_args()); 00034 $xw = new xmlWriter(); 00035 $xw->openMemory(); 00036 00037 if(APP_CHARSET != 'UTF-8'){ 00038 $params = utf8_encode($params); 00039 } 00040 if(isset($params[1]) && is_array($params[1])) { 00041 $attrs = $params[1]; 00042 unset($params[1]); 00043 $attrs = array_merge($attrs, $params); 00044 } else { 00045 $attrs = $params; 00046 } 00047 00048 $xw->startElement($tag); 00049 00050 foreach ($attrs as $k => $v) { 00051 if (! is_numeric($k)) { 00052 $xw->writeAttribute($k, $v); 00053 } 00054 } 00055 //$xw->endElement(); 00056 return $xw->outputMemory(true) . '>'; 00057 } 00058 00065 function xhtml_end_tag($tag) { 00066 $params = is_array($tag) ? $tag : Util::getParams(func_get_args()); 00067 $tag = $params[0]; 00068 return "</$tag>"; 00069 } 00070 00086 function xhtml_tag($tag, $attrs=null) { 00087 $params = is_array($tag) ? $tag : Util::getParams(func_get_args()); 00088 $xw = new xmlWriter(); 00089 $xw->openMemory(); 00090 00091 if(APP_CHARSET != 'UTF-8'){ 00092 $params = utf8_encode($params); 00093 } 00094 00098 $short_close = array('input', 'link', 'img'); 00102 $need_cdata = array('script', 'style','a'); 00103 00104 $tag = $params[0]; 00105 unset($params[0]); 00106 00110 if(isset($params['content'])) { 00111 $content = $params['content']; 00112 unset($params['content']); 00113 } else { 00114 $content = ''; 00115 } 00116 00117 if(isset($params[1]) && is_array($params[1])) { 00118 $attrs = $params[1]; 00119 unset($params[1]); 00120 $attrs = array_merge($attrs, $params); 00121 } else { 00122 $attrs = $params; 00123 } 00124 $xw->startElement($tag); 00125 foreach($attrs as $k=>$v) { 00126 if (! is_numeric($k)) { 00127 $xw->writeAttribute($k,$v); 00128 } 00129 } 00130 if($content || !in_array($tag, $short_close)) { 00131 if($tag == 'select' || in_array($tag, $need_cdata)) { 00132 $xw->writeRaw($content); 00133 } else { 00134 $xw->text($content); 00135 } 00136 } 00137 $xw->endElement(); 00138 return $xw->outputMemory(true); 00139 } 00140 00152 function link_to($action, $text=''){ 00153 $params = is_array($action) ? $action : Util::getParams(func_get_args()); 00154 00155 if(isset($params['confirm'])&&$params['confirm']){ 00156 if(isset($params['onclick'])) { 00157 $params['onclick'] = "if(!confirm(\"{$params['confirm']}\")) { return false; }; ".$params['onclick']; 00158 } else { 00159 $params['onclick'] = "if(!confirm(\"{$params['confirm']}\")) { return false; };"; 00160 } 00161 unset($params['confirm']); 00162 } 00163 00164 if(isset($params['text'])) { 00165 $params[1] = $params['text']; 00166 unset($params['text']); 00167 } 00168 00169 if(!isset($params[1])) { 00170 $text = strtr($params[0], '_/', ' '); 00171 $params[1] = ucwords($text); 00172 } 00173 00174 $params['href'] = get_kumbia_url($params[0]); 00175 00176 return xhtml_tag('a', $params, "content: {$params[1]}"); 00177 } 00178 00189 function link_to_action($action, $text=''){ 00190 $params = is_array($action) ? $action : Util::getParams(func_get_args()); 00191 00192 if(isset($params['confirm'])&&$params['confirm']){ 00193 if(isset($params['onclick'])) { 00194 $params['onclick'] = "if(!confirm(\"{$params['confirm']}\")) { return false; }; ".$params['onclick']; 00195 } else { 00196 $params['onclick'] = "if(!confirm(\"{$params['confirm']}\")) { return false; };"; 00197 } 00198 unset($params['confirm']); 00199 } 00200 00201 if(isset($params['text'])) { 00202 $params[1] = $params['text']; 00203 unset($params['text']); 00204 } 00205 00206 if(!isset($params[1])) { 00207 $text = strtr($params[0], '_/', ' '); 00208 $params[1] = ucwords($text); 00209 } 00210 00211 $module_name = Router::get('module'); 00212 $controller_name = Router::get('controller'); 00213 if($module_name) { 00214 $path = "$module_name/$controller_name"; 00215 } else { 00216 $path = $controller_name; 00217 } 00218 $params['href'] = get_kumbia_url("$path/{$params[0]}"); 00219 00220 return xhtml_tag('a', $params, "content: {$params[1]}"); 00221 } 00222 00237 function link_to_remote($action){ 00238 $params = is_array($action) ? $action : Util::getParams(func_get_args()); 00239 00240 if(!isset($params['update'])||!$params['update']){ 00241 $update = isset($params[2]) ? $params[2] : ""; 00242 } else { 00243 $update = $params['update']; 00244 } 00245 if(!isset($params['text'])||!$params['text']){ 00246 $text = isset($params[1]) ? $params[1] : ""; 00247 } else { 00248 $text = $params['text']; 00249 } 00250 if(!$text){ 00251 $text = $params[0]; 00252 } 00253 if(!isset($params['action'])||!$params['action']){ 00254 $action = $params[0]; 00255 } else { 00256 $action = $params['action']; 00257 } 00258 00259 $code = ''; 00260 if(isset($params['confirm'])){ 00261 $code.= "if(confirm('{$params['confirm']}')) {"; 00262 } 00263 $action = PUBLIC_PATH . $action; 00264 $code.= "new AJAX.viewRequest({action: '$action', container: '$update'"; 00265 00266 $call = array(); 00267 if(isset($params['before'])){ 00268 $call["before"] = "before: function(){ {$params['before']} }"; 00269 } 00270 if(isset($params['oncomplete'])){ 00271 $call["oncomplete"] = "oncomplete: function(){ {$params['oncomplete']} }"; 00272 } 00273 if(isset($params['success'])){ 00274 $call["success"] = "success: function(){ {$params['success']} }"; 00275 } 00276 if(count($call)){ 00277 $code.=", callbacks: { "; 00278 $code.=join(",", $call); 00279 $code.="}"; 00280 } 00281 $code.="})"; 00282 if(isset($params['confirm'])){ 00283 $code.=" }"; 00284 } 00285 $code.="; return false;"; 00286 00287 $params['onclick'] = $code; 00288 $params['href'] = '#'; 00289 00290 unset($params['action']); 00291 unset($params['before']); 00292 unset($params['oncomplete']); 00293 unset($params['success']); 00294 unset($params['loading']); 00295 unset($params['update']); 00296 unset($params['confirm']); 00297 00298 return xhtml_tag('a',$params, "content: $text"); 00299 } 00300 00311 function javascript_include_tag($src=''){ 00312 $params = is_array($src) ? $src : Util::getParams(func_get_args()); 00313 00314 if(isset($params['cache']) && $params['cache']=='false') { 00315 $cache = false; 00316 unset($params['cache']); 00317 } else { 00318 $cache = true; 00319 } 00320 00321 if(!isset($params[0])) { 00322 $params[0] = Router::get('controller'); 00323 } 00324 00325 $code = ''; 00326 foreach($params as $src) { 00327 $src.=".js"; 00328 if(!$cache) { 00329 $src.="?nocache=".md5(uniqid()); 00330 } 00331 $src = PUBLIC_PATH."javascript/$src"; 00332 $code.=xhtml_tag('script', $params, 'type: text/javascript', "src: $src"); 00333 } 00334 00335 return $code; 00336 } 00337 00344 function javascript_library_tag($src){ 00345 $params = is_array($src) ? $src : Util::getParams(func_get_args()); 00346 $code = ''; 00347 foreach($params as $src) { 00348 $src = PUBLIC_PATH."javascript/kumbia/$src.js"; 00349 $code.=xhtml_tag('script', 'type: text/javascript', "src: $src"); 00350 } 00351 return $code; 00352 } 00353 00364 function stylesheet_link_tag($name){ 00365 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00366 $params['rel'] = 'stylesheet'; 00367 $params['type'] = 'text/css'; 00368 00369 $kb = substr(PUBLIC_PATH, 0, strlen(PUBLIC_PATH)-1); 00370 $code = ''; 00371 for($i=0; isset($params[$i]); $i++){ 00372 $src = $params[$i]; 00373 $params['href'] = PUBLIC_PATH."css/$src.css"; 00374 $code.=xhtml_tag('link',$params); 00375 } 00376 00377 if(!$i){ //$i=0 si no se especificaron hojas de estilo 00378 $src = $_REQUEST['action']; 00379 $params['href'] = PUBLIC_PATH."css/$src.css"; 00380 $code.=xhtml_tag('link',$params); 00381 } 00382 TagsData::$data['KUMBIA_CSS_IMPORTS'][]=$code; 00383 return; 00384 } 00385 00397 function img_tag($img){ 00398 $params = is_array($img) ? $img : Util::getParams(func_get_args()); 00399 00400 if(!isset($params['src']) && isset($params[0])){ 00401 $params['src'] = PUBLIC_PATH."img/{$params[0]}"; 00402 } 00403 if(!isset($params['alt'])) { 00404 $params['alt'] = ''; 00405 } 00406 00407 if(isset($params['drag'])&&$params['drag']) { 00408 $drag = true; 00409 unset($params['drag']); 00410 } else { 00411 $drag = false; 00412 } 00413 if(isset($params['reflect'])&&$params['reflect']) { 00414 $reflect = true; 00415 unset($params['reflect']); 00416 } else{ 00417 $reflect = false; 00418 } 00419 00420 $code = xhtml_tag('img', $params); 00421 if($drag){ 00422 $code.=xhtml_tag('script', 'type: text/javascript', "content: new Draggable('{$atts['id']}', {revert:true})"); 00423 } 00424 if($reflect){ 00425 $code.=xhtml_tag('script', 'type: text/javascript', "content: new Reflector.reflect('{$atts['id']}')"); 00426 } 00427 00428 return $code; 00429 } 00430 00443 function form_remote_tag($data){ 00444 $params = is_array($data) ? $data : Util::getParams(func_get_args()); 00445 00446 if(!isset($params['action'])||!$params['action']) { 00447 $params['action'] = $params[0]; 00448 }else{ 00449 $params['action'] = $params['action']; 00450 } 00451 00452 if(!isset($params['method'])||!$params['method']) { 00453 $params['method'] = 'post'; 00454 } 00455 00456 if(isset($params['update'])) { 00457 $update = $params['update']; 00458 unset($params['update']); 00459 } else { 00460 $update = ''; 00461 } 00462 00463 $callbacks = array(); 00464 $id = Router::get('id'); 00465 if(isset($params['complete'])&&$params['complete']){ 00466 $callbacks[] = " complete: function(){ ".$params['complete']." }"; 00467 unset($params['complete']); 00468 } 00469 if(isset($params['before'])&&$params['before']){ 00470 $callbacks[] = " before: function(){ ".$params['before']." }"; 00471 unset($params['before']); 00472 } 00473 if(isset($params['success'])&&$params['success']){ 00474 $callbacks[] = " success: function(){ ".$params['success']." }"; 00475 unset($params['sucess']); 00476 } 00477 if(isset($params['required'])&&$params['required']){ 00478 $requiredFields = Util::encomillar($params['required']); 00479 $params['onsubmit'] = "if(validaForm(this,new Array({$requiredFields}))){ return ajaxRemoteForm(this,\"{$update}\",{".join(",",$callbacks)."}); } else{ return false; }"; 00480 unset($params['required']); 00481 } else{ 00482 $params['onsubmit'] = "return ajaxRemoteForm(this, \"{$update}\", { ".join(",", $callbacks)." });"; 00483 } 00484 $params['action'] = get_kumbia_url("{$params['action']}/$id"); 00485 00486 return xhtml_start_tag('form', $params); 00487 } 00488 00489 00499 function form_tag($action){ 00500 $params = is_array($action) ? $action : Util::getParams(func_get_args()); 00501 if(!isset($params['action']) && isset($params[0])) { 00502 $params['action'] = $params[0]; 00503 } 00504 if(isset($params['action'])) { 00505 $params['action'] = get_kumbia_url("{$params['action']}"); 00506 } 00507 if(!isset($params['method'])||!$params['method']) { 00508 $params['method'] = "post"; 00509 } 00510 if(isset($params['confirm'])&&$params['confirm']){ 00511 if(isset($params['onsubmit'])) { 00512 $params['onsubmit'].=";if(!confirm(\"{$params['confirm']}\")) { return false; }"; 00513 } else { 00514 $params['onsubmit'] = "if(!confirm(\"{$params['confirm']}\")) { return false; }"; 00515 } 00516 unset($params['confirm']); 00517 } 00518 return xhtml_start_tag('form', $params); 00519 } 00520 00521 00522 00528 function end_form_tag(){ 00529 $str = "</form>\r\n"; 00530 return $str; 00531 } 00532 00539 function submit_tag($caption){ 00540 $params = is_array($caption) ? $caption : Util::getParams(func_get_args()); 00541 if(isset($params['caption'])) { 00542 $params['value'] = $params['caption']; 00543 unset($params['caption']); 00544 } elseif(isset($params[0])) { 00545 $params['value'] = $params[0]; 00546 } 00547 return xhtml_tag('input', $params, 'type: submit'); 00548 } 00549 00563 function submit_remote_tag($caption){ 00564 $params = is_array($caption) ? $caption : Util::getParams(func_get_args()); 00565 00566 if(isset($params['caption'])) { 00567 $params['value'] = $params['caption']; 00568 unset($params['caption']); 00569 } elseif(isset($params[0])) { 00570 $params['value'] = $params[0]; 00571 } 00572 00573 if(isset($params['update'])) { 00574 $update = $params['update']; 00575 unset($params['update']); 00576 } else { 00577 $update = ''; 00578 } 00579 00580 $callbacks = array(); 00581 if(isset($params['complete']) && $params['complete']){ 00582 $callbacks[] = " complete: function(){ ".$params['complete']." }"; 00583 unset($params['complete']); 00584 } 00585 if(isset($params['before']) && $params['before']){ 00586 $callbacks[] = " before: function(){ ".$params['before']." }"; 00587 unset($params['before']); 00588 } 00589 if(isset($params['success']) && $params['success']){ 00590 $callbacks[] = " success: function(){ ".$params['success']." }"; 00591 unset($params['success']); 00592 } 00593 00594 if(isset($params['onclick'])) { 00595 $params['onclick'].= "; return ajaxRemoteForm(this.form, \"$update\", { ".join(",", $callbacks)." });"; 00596 } else { 00597 $params['onclick'] = "return ajaxRemoteForm(this.form, \"$update\", { ".join(",", $callbacks)." });"; 00598 } 00599 00600 00601 return xhtml_tag('input', $params, 'type: submit'); 00602 } 00603 00613 function submit_image_tag($caption, $src=''){ 00614 $params = is_array($caption) ? $caption : Util::getParams(func_get_args()); 00615 if(isset($params['caption'])) { 00616 $params['value'] = $params['caption']; 00617 unset($params['caption']); 00618 } elseif(isset($params[0])) { 00619 $params['value'] = $params[0]; 00620 } 00621 if(!isset($params['src']) && isset($params[1])) { 00622 $params['src'] = PUBLIC_PATH."img/{$params[1]}"; 00623 } 00624 return xhtml_tag('input', $params, 'type: image'); 00625 } 00626 00635 function button_tag($caption=''){ 00636 $params = is_array($caption) ? $caption : Util::getParams(func_get_args()); 00637 if(isset($params['caption'])) { 00638 $params['value'] = $params['caption']; 00639 unset($params['caption']); 00640 } elseif(isset($params[0])) { 00641 $params['value'] = $params[0]; 00642 } 00643 return xhtml_tag('input', $params, 'type: button'); 00644 } 00645 00655 function get_value_from_action($name){ 00656 $p = explode('.', $name); 00657 if(count($p)>1) { 00658 $value = get_value_from_action($p[0]); 00659 if(is_object($value) && isset($value->$p[1])) { 00660 return $value->$p[1]; 00661 }elseif(is_array($value) && isset($value[$p[1]])) { 00662 return $value[$p[1]]; 00663 }else { 00664 return null; 00665 } 00666 } else { 00667 $controller = Dispatcher::get_controller(); 00668 00669 if(isset($controller->$name)){ 00670 return $controller->$name; 00671 } else { 00672 return null; 00673 } 00674 } 00675 } 00676 00683 function get_id_and_name($value){ 00684 $p = explode('.', $value); 00685 if(count($p)>1) { 00686 $id = "{$p[0]}_{$p[1]}"; 00687 $name = "{$p[0]}[{$p[1]}]"; 00688 } else { 00689 $id = $name = $value; 00690 } 00691 return array('id'=>$id, 'name'=>$name); 00692 } 00693 00694 # Helpers 00695 00700 function input_field_tag($name) { 00701 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00705 if(isset($params[0])) { 00706 $params = array_merge(get_id_and_name($params[0]), $params); 00707 $value = get_value_from_action($params[0]); 00708 if(!isset($params['value'])) { 00709 if(!is_null($value)) { 00710 $params['value'] = $value; 00711 } 00712 } elseif($params['type']=='radio' || $params['type']=='checkbox') { 00713 if($params['value']==$value) { 00714 $params['checked'] = 'checked'; 00715 } 00716 } 00717 } 00718 return xhtml_tag('input', $params); 00719 } 00720 00727 function text_field_tag($name){ 00728 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00729 $params['type'] = 'text'; 00730 return input_field_tag($params); 00731 } 00732 00739 function checkbox_field_tag($name){ 00740 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00741 $params['type'] = 'checkbox'; 00742 return input_field_tag($params); 00743 } 00744 00751 function numeric_field_tag($name){ 00752 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00753 if(!isset($params['onkeydown'])) { 00754 $params['onkeydown'] = "valNumeric(event)"; 00755 } else { 00756 $params['onkeydown'].=";valNumeric(event)"; 00757 } 00758 return text_field_tag($params); 00759 } 00760 00767 function textupper_field_tag($name){ 00768 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00769 if(!isset($params['onblur'])) { 00770 $params['onblur'] = "keyUpper2(this)"; 00771 } else { 00772 $params['onblur'].=";keyUpper2(this)"; 00773 } 00774 return text_field_tag($params); 00775 } 00776 00786 function date_field_tag($name){ 00787 static $i = false; 00788 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00789 00790 if(isset($params['format'])){ 00791 $format = $params['format']; 00792 unset($params['format']); 00793 } else { 00794 $format = "d-m-Y"; 00795 } 00796 00797 if(isset($params['language'])){ 00798 $lang = $params['language']; 00799 unset($params['language']); 00800 } else { 00801 $lang = "es"; 00802 } 00803 00804 if(isset($params[0])) { 00805 $params = array_merge(get_id_and_name($params[0]), $params); 00806 } 00807 00808 $code = ''; 00809 if($i == false){ 00810 $i = true; 00811 $code .= javascript_include_tag("datepicker/lang/$lang"); 00812 $code .= javascript_include_tag('datepicker/datepicker'); 00813 stylesheet_link_tag('datepicker'); 00814 } 00815 00816 $data = get_id_and_name($name); 00817 $format = str_replace('-', '-ds-', $format); 00818 $code .= " 00819 <script type=\"text/javascript\"> 00820 var opts = { 00821 formElements:{'{$data['id']}':'$format'} 00822 }; 00823 datePickerController.createDatePicker(opts); 00824 </script> 00825 "; 00826 00827 return text_field_tag($params) . $code; 00828 } 00829 00836 function file_field_tag($name){ 00837 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00838 $params['type'] = 'file'; 00839 return input_field_tag($params); 00840 } 00841 00848 function radio_field_tag($name){ 00849 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00850 $params['type'] = 'radio'; 00851 return input_field_tag($params); 00852 } 00853 00861 function textarea_tag($name, $value=null){ 00862 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00866 $params = array_merge(get_id_and_name($name), $params); 00867 00868 if(isset($params[1])) { 00869 $value = $params[1]; 00870 } else { 00871 $value = get_value_from_action($name); 00872 } 00873 00874 $value = htmlspecialchars($value, ENT_QUOTES, APP_CHARSET); 00875 00876 if(!isset($params['rows'])) { 00877 $params['rows'] = '25'; 00878 } 00879 if(!isset($params['cols'])) { 00880 $params['cols'] = '50'; 00881 } 00882 00883 $code = xhtml_start_tag('textarea', $params); 00884 $code.= $value; 00885 $code.= xhtml_end_tag('textarea'); 00886 return $code; 00887 } 00888 00895 function password_field_tag($name){ 00896 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00897 $params['type'] = 'password'; 00898 return input_field_tag($params); 00899 } 00900 00907 function hidden_field_tag($name){ 00908 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00909 $params['type'] = 'hidden'; 00910 return input_field_tag($params); 00911 } 00912 00935 function select_tag($name, $data=array()){ 00936 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 00937 00941 $params = array_merge(get_id_and_name($params[0]), $params); 00942 if(!isset($params['selected'])) { 00943 $value = get_value_from_action($params[0]); 00944 if(!is_null($value)) { 00945 $params['selected'] = $value; 00946 } 00947 } 00948 00949 if(!isset($params[1])) { 00950 return xhtml_start_tag('select', $params); 00951 } 00952 00953 if(isset($params['selected'])) { 00954 $selected = $params['selected']; 00955 unset($params['selected']); 00956 } 00957 if(isset($params['separator'])) { 00958 $separator = $params['separator']; 00959 unset($params['separator']); 00960 } else { 00961 $separator = ''; 00962 } 00963 00964 $options = ''; 00965 if(isset($params['include_blank'])) { 00966 $options.="\t".xhtml_tag('option', array('value'=>''), "content: {$params['include_blank']}"); 00967 unset($params['include_blank']); 00968 } 00969 00970 if(is_array($params[1])){ 00971 if(isset($params[1][0]) && is_object($params[1][0])){ 00972 if(isset($params['option'])) { 00973 $fields = array_map('trim', explode(',', $params['option'])); 00974 unset($params['option']); 00975 } else { 00976 $fields = array('id'); 00977 } 00978 00979 foreach($params[1] as $item) { 00980 $value = $item->primary_key[0]; 00981 $vals = array(); 00982 foreach($fields as $option) { 00983 array_push($vals, $item->$option); 00984 } 00985 00986 $k = $item->$value; 00987 $v = implode($vals, $separator); 00988 00989 if(isset($selected) && $selected==$k) { 00990 $options.="\t".option_tag($k, $v, 'selected: selected'); 00991 } else { 00992 $options.="\t".option_tag($k, $v); 00993 } 00994 } 00995 } else { 00996 foreach($params[1] as $k=>$v){ 00997 if(isset($selected) && $selected==$k) { 00998 $options.= option_tag($k, $v, 'selected: selected'); 00999 } else { 01000 $options.= option_tag($k, $v); 01001 } 01002 } 01003 } 01004 } elseif(is_string($params[1])) { 01005 if(isset($params['option'])) { 01006 $fields = array_map('trim', explode(',', $params['option'])); 01007 unset($params['option']); 01008 } else { 01009 $fields = array('id'); 01010 } 01011 01015 $m = ActiveRecord::get($params[1]); 01016 01017 if(isset($params['value'])) { 01018 $value = $params['value']; 01019 unset($params['value']); 01020 } else { 01021 $m2 = clone $m; 01022 $m2->dump_model(); 01023 $value = $m2->primary_key[0]; 01024 } 01025 01026 if(isset($params[2]) && $params[2]) { 01027 $items = $m2->find_all_by_sql($params[2]); 01028 } else { 01032 $find_args = array(); 01033 01037 if(isset($params['conditions'])) { 01038 array_push($find_args, "conditions: {$params['conditions']}"); 01039 unset($params['conditions']); 01040 } 01041 if(isset($params['columns'])) { 01042 array_push($find_args, "columns: {$params['columns']}"); 01043 unset($params['columns']); 01044 } 01045 if(isset($params['join'])) { 01046 array_push($find_args, "join: {$params['join']}"); 01047 unset($params['join']); 01048 } 01049 if(isset($params['group'])) { 01050 array_push($find_args, "group: {$params['group']}"); 01051 unset($params['group']); 01052 } 01053 if(isset($params['having'])) { 01054 array_push($find_args, "having: {$params['having']}"); 01055 unset($params['having']); 01056 } 01057 if(isset($params['order'])) { 01058 array_push($find_args, "order: {$params['order']}"); 01059 unset($params['order']); 01060 } 01061 if(isset($params['distinct'])) { 01062 array_push($find_args, "distinct: {$params['distinct']}"); 01063 unset($params['distinct']); 01064 } 01065 if(isset($params['limit'])) { 01066 array_push($find_args, "limit: {$params['limit']}"); 01067 unset($params['limit']); 01068 } 01069 if(isset($params['offset'])) { 01070 array_push($find_args, "limit: {$params['offset']}"); 01071 unset($params['offset']); 01072 } 01073 01074 $items = call_user_func_array(array($m2, 'find'), $find_args); 01075 } 01076 01077 foreach($items as $item) { 01078 $vals = array(); 01079 foreach($fields as $option) { 01080 array_push($vals, $item->$option); 01081 } 01082 01083 $k = $item->$value; 01084 $v = implode($vals, $separator); 01085 01086 if(isset($selected) && $selected==$k) { 01087 $options.="\t".option_tag($k, $v, 'selected: selected'); 01088 } else { 01089 $options.="\t".option_tag($k, $v); 01090 } 01091 } 01092 } 01093 return xhtml_tag('select', $params, "content: $options"); 01094 } 01095 01103 function option_tag($value, $text=''){ 01104 $params = is_array($value) ? $value : Util::getParams(func_get_args()); 01105 01106 $params['value'] = $params[0]; 01107 if(isset($params[1])) { 01108 $text = $params[1]; 01109 } else { 01110 $text = ''; 01111 } 01112 return xhtml_tag('option', $params, "content: $text"); 01113 } 01114 01115 01122 function upload_image_tag($name){ 01123 $opts = is_array($name) ? $name : Util::getParams(func_get_args()); 01124 $code = ''; 01125 01126 if(isset($opts[0])){ 01127 $opts['name'] = $opts[0]; 01128 } else { 01129 $opts['name'] = ''; 01130 } 01131 if(isset($opts['value'])){ 01132 $opts['value'] = $opts[1]; 01133 } else { 01134 $opts['value'] = ''; 01135 } 01136 01137 $path = PUBLIC_PATH; 01138 01139 $code.="<span id='{$opts['name']}_span_pre'> 01140 <select name='{$opts[0]}' id='{$opts[0]}' onchange='show_upload_image(this, \"$path\")'>"; 01141 $code.="<option value='@'>Seleccione...\n"; 01142 foreach(scandir("public/img/upload") as $file){ 01143 if($file!='index.html'&&$file!='.'&&$file!='..'&&$file!='Thumbs.db'&&$file!='desktop.ini'){ 01144 $nfile = str_replace('.gif', '', $file); 01145 $nfile = str_replace('.jpg', '', $nfile); 01146 $nfile = str_replace('.png', '', $nfile); 01147 $nfile = str_replace('.bmp', '', $nfile); 01148 $nfile = strtr($nfile, '_', ' '); 01149 $nfile = ucfirst($nfile); 01150 if(urlencode("upload/$file")==$opts['value']){ 01151 $code.="<option selected='selected' value='upload/$file' style='background: #EAEAEA'>$nfile</option>\n"; 01152 } else { 01153 $code.="<option value='upload/$file'>$nfile</option>\n"; 01154 } 01155 } 01156 } 01157 $code.="</select> <a href='#{$opts['name']}_up' name='{$opts['name']}_up' id='{$opts['name']}_up' onclick='enable_upload_file(\"{$opts['name']}\")'>Subir Imagen</a></span> 01158 <span style='display:none' id='{$opts['name']}_span'> 01159 <input type='file' id='{$opts['name']}_file' onchange='upload_file(\"{$opts['name']}\")' /> 01160 <a href='#{$opts['name']}_can' name='{$opts['name']}_can' id='{$opts['name']}_can' style='color:red' onclick='cancel_upload_file(\"{$opts['name']}\")'>Cancelar</a></span> 01161 "; 01162 if(!isset($opts['width'])) { 01163 $opts['width'] = 128; 01164 } 01165 if(!isset($opts['value'])){ 01166 $opts['style']="border: 1px solid black;margin: 5px;".$opts['value']; 01167 } else { 01168 $opts['style']="border: 1px solid black;display:none;margin: 5px;".$opts['value']; 01169 } 01170 $code.="<div>".img_tag(urldecode($opts['value']), 'width: '.$opts['width'], 'style: '.$opts['style'], 'id: '.$opts['name']."_im")."</div>"; 01171 return $code; 01172 } 01173 01183 function set_droppable($obj, $action=''){ 01184 $params = is_array($obj) ? $obj : Util::getParams(func_get_args()); 01185 if(!isset($params['name']) || !$params['name']){ 01186 $params['name'] = $params[0]; 01187 } 01188 if(!isset($params['action']) || !$params['action']){ 01189 $params['action'] = $params[1]; 01190 } 01191 return xhtml_tag('script', 'type: text/javascript', "content: Droppables.add('{$params['name']}', {hoverclass: '{$params['hover_class']}',onDrop:{$params['action']}})"); 01192 } 01193 01194 function tr_break($x=''){ 01195 static $l; 01196 if($x=='') { 01197 $l = 0; 01198 return; 01199 } 01200 if(!$l) { 01201 $l = 1; 01202 } else { 01203 $l++; 01204 } 01205 if(($l%$x)==0) { 01206 print "</tr><tr>"; 01207 } 01208 } 01209 01210 function br_break($x=''){ 01211 static $l; 01212 if($x=='') { 01213 $l = 0; 01214 return; 01215 } 01216 if(!$l) { 01217 $l = 1; 01218 } else { 01219 $l++; 01220 } 01221 if(($l%$x)==0) { 01222 print "<br/>\n"; 01223 } 01224 } 01229 function tr_color(){ 01230 static $i; 01231 if(func_num_args()>1){ 01232 $params = Util::getParams(func_get_args()); 01233 } 01234 if(!$i) { 01235 $i = 1; 01236 } 01237 print "<tr bgcolor=\"{$params[$i-1]}\""; 01238 if(count($params)==$i) { 01239 $i = 1; 01240 } else { 01241 $i++; 01242 } 01243 if(isset($params)){ 01244 if(is_array($params)){ 01245 foreach($params as $key => $value){ 01246 if(!is_numeric($key)){ 01247 print " $key = '$value'"; 01248 } 01249 } 01250 } 01251 } 01252 print ">"; 01253 } 01260 function tr_color_class(){ 01261 static $i; 01262 static $c = true; 01263 $id = ""; 01264 $code = ""; 01265 $params = Util::getParams(func_get_args()); 01266 if(isset($params['id'])){ 01267 $id = " id=\"{$params['id']}\""; 01268 } 01269 if($c){ 01270 $code = "<tr class='$params[0]' $id"; 01271 $c = false; 01272 } else { 01273 $code = "<tr class='$params[1]' $id"; 01274 $c = true; 01275 } 01276 $code .= ">"; 01277 return $code; 01278 } 01279 01293 function button_to_action($caption, $action='', $classCSS=''){ 01294 $params= is_array($caption) ? $caption : Util::getParams(func_get_args()); 01295 01296 if(isset($params['caption'])) { 01297 $caption = $params['caption']; 01298 unset($params['caption']); 01299 } elseif(isset($params[0])) { 01300 $caption = $params[0]; 01301 } else { 01302 $caption = ''; 01303 } 01304 if(isset($params['action'])) { 01305 $action = $params['action']; 01306 unset($params['action']); 01307 } elseif(isset($params[1])) { 01308 $action = $params[1]; 01309 } else { 01310 $action = ''; 01311 } 01312 if(isset($params[2])) { 01313 $params['class'] = $params[2]; 01314 } 01315 01316 if(isset($params['onclick'])) { 01317 $params['onclick'].=';window.location="'.get_kumbia_url($action).'";'; 01318 } else { 01319 $params['onclick'] = 'window.location="'.get_kumbia_url($action).'";'; 01320 } 01321 01322 return xhtml_tag('button', $params, "content: $caption"); 01323 } 01324 01334 function button_to_remote_action($caption, $action='', $classCSS=''){ 01335 $opts = is_array($caption) ? $caption : Util::getParams(func_get_args()); 01336 if(func_num_args()==2){ 01337 $opts['action'] = $opts[1]; 01338 $opts['caption'] = $opts[0]; 01339 } else { 01340 if(!isset($opts['action'])||!$opts['action']) { 01341 $opts['action'] = $opts[1]; 01342 } 01343 if(!isset($opts['caption'])||!$opts['caption']) { 01344 $opts['caption'] = $opts[0]; 01345 } 01346 } 01347 01348 $opts['action'] = PUBLIC_PATH . $opts['action']; 01349 01350 if(!isset($opts['update'])){ 01351 $opts['update'] = ""; 01352 } 01353 01354 if(!isset($opts['success'])){ 01355 $opts['success'] = ''; 01356 } 01357 if(!isset($opts['before'])){ 01358 $opts['before'] = ''; 01359 } 01360 if(!isset($opts['complete'])){ 01361 $opts['complete'] = ''; 01362 } 01363 01364 $code = "<button onclick='AJAX.execute({action:\"{$opts['action']}\", container:\"{$opts['update']}\", callbacks: { success: function(){{$opts['success']}}, before: function(){{$opts['before']}} } })'"; 01365 unset($opts['action']); 01366 unset($opts['success']); 01367 unset($opts['before']); 01368 unset($opts['complete']); 01369 foreach($opts as $k => $v){ 01370 if(!is_numeric($k)&&$k!='caption'){ 01371 $code.=" $k='$v' "; 01372 } 01373 } 01374 $code.=">{$opts['caption']}</button>"; 01375 return $code; 01376 } 01377 01393 function updater_select($name, $data=array()){ 01394 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 01395 01399 if(isset($params[0])) { 01400 $params = array_merge(get_id_and_name($params[0]), $params); 01401 if(!isset($params['selected'])) { 01402 $value = get_value_from_action($params[0]); 01403 if(!is_null($value)) { 01404 $params['selected'] = $value; 01405 } 01406 } 01407 } 01408 01409 if(isset($params['container'])) { 01410 $update = $params['container']; 01411 unset($params['container']); 01412 } elseif(isset($params['update'])) { 01413 $update = $params['update']; 01414 unset($params['update']); 01415 } else { 01416 $update = ''; 01417 } 01418 01419 if(isset($params['action'])) { 01420 $action = $params['action']; 01421 unset($params['action']); 01422 } else { 01423 $action = ''; 01424 } 01425 01426 $action = PUBLIC_PATH . $action; 01427 01428 $onchange = "AJAX.viewRequest({action: '$action/'+$(\"{$params['id']}\").value, container: '$update'"; 01429 $call = array(); 01430 if(isset($params['before'])){ 01431 $call["before"] = "before: function(){ {$params['before']} }"; 01432 unset($params['before']); 01433 } 01434 if(isset($params['oncomplete'])){ 01435 $call["oncomplete"] = "oncomplete: function(){ {$params['oncomplete']} }"; 01436 unset($params['oncomplete']); 01437 } 01438 if(isset($params['success'])){ 01439 $call["success"] = "success: function(){ {$params['success']} }"; 01440 unset($params['success']); 01441 } 01442 if(count($call)){ 01443 $onchange.=", callbacks: { "; 01444 $onchange.=implode(",", $call); 01445 $onchange.="}"; 01446 } 01447 $onchange.="})"; 01448 01449 if(isset($params['onchange'])) { 01450 $params['onchange'].=';'.$onchange; 01451 } else { 01452 $params['onchange'] = $onchange; 01453 } 01454 01455 return select_tag($params); 01456 } 01457 01469 function text_field_with_autocomplete($name){ 01470 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 01471 01475 if(isset($params[0])) { 01476 $params = array_merge(get_id_and_name($params[0]), $params); 01477 if(!isset($params['value'])) { 01478 $value = get_value_from_action($params[0]); 01479 if(!is_null($value)) { 01480 $params['value'] = $value; 01481 } 01482 } 01483 } 01484 01485 $hash = md5(uniqid()); 01486 01487 if(isset($params['after_update'])) { 01488 $after_update = $params['after_update']; 01489 unset($params['after_update']); 01490 }else { 01491 $after_update = 'function(){}'; 01492 } 01493 if(isset($params['action'])) { 01494 $action = $params['action']; 01495 unset($params['action']); 01496 }else { 01497 $action = ''; 01498 } 01499 if(isset($params['message'])) { 01500 $message = $params['message']; 01501 unset($params['message']); 01502 }else { 01503 $message = 'Consultando..'; 01504 } 01505 01506 $code = text_field_tag($params); 01507 01508 $code.= " 01509 <span id='indicator$hash' style='display: none'><img src='".PUBLIC_PATH."img/spinner.gif' alt='$message'/></span> 01510 <div id='{$params[0]}_choices' class='autocomplete'></div> 01511 <script type='text/javascript'> 01512 <!-- <![CDATA[ 01513 new Ajax.Autocompleter(\"{$params['id']}\", \"{$params['id']}_choices\", \"".get_kumbia_url($action)."\", { minChars: 2, indicator: 'indicator$hash', afterUpdateElement : {$after_update}}); 01514 // ]]> --> 01515 </script> 01516 "; 01517 return $code; 01518 } 01519 01525 function xhtml_template($template='template'){ 01526 print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 01527 <html xmlns="http://www.w3.org/1999/xhtml"> 01528 <head> 01529 <title>Kumbia PHP Framework</title> 01530 <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />'; 01531 print stylesheet_link_tag("style", 'use_variables: true'); 01532 kumbia::stylesheet_link_tags(). 01533 print '</head> 01534 <body class="'.$template.'">'; 01535 content(); 01536 print ' 01537 </body> 01538 </html>'; 01539 01540 } 01541 01542 function tab_tag($tabs, $color='green', $width=800){ 01543 01544 switch($color){ 01545 case 'blue': 01546 $col1 = '#E8E8E8'; $col2 = '#C0c0c0'; $col3 = '#000000'; 01547 break; 01548 01549 case 'pink': 01550 $col1 = '#FFE6F2'; $col2 = '#FFCCE4'; $col3 = '#FE1B59'; 01551 break; 01552 01553 case 'orange': 01554 $col1 = '#FCE6BC'; $col2 = '#FDF1DB'; $col3 = '#DE950C'; 01555 break; 01556 01557 case 'green': 01558 $col2 = '#EAFFD7'; $col1 = '#DAFFB9'; $col3 = '#008000'; 01559 break; 01560 } 01561 01562 01563 print " 01564 <table cellspacing=0 cellpadding=0 width=$width> 01565 <tr>"; 01566 $p = 1; 01567 $w = $width; 01568 foreach($tabs as $tab){ 01569 if($p==1) $color = $col1; 01570 else $color = $col2; 01571 $ww = (int) ($width * 0.22); 01572 $www = (int) ($width * 0.21); 01573 print "<td align='center' 01574 width=$ww style='padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:-5px'> 01575 <div style='width:$www"."px;border-top:1px solid $col3;border-left:1px solid $col3;border-right:1px solid $col3;background:$color;padding:2px;color:$col3;cursor:pointer' id='spanm_$p' 01576 onclick='showTab($p, this)' 01577 >".$tab['caption']."</div></td>"; 01578 $p++; 01579 $w-=$ww; 01580 } 01581 print " 01582 <script> 01583 function showTab(p, obj){ 01584 for(i=1;i<=$p-1;i++){ 01585 $('tab_'+i).hide(); 01586 $('spanm_'+i).style.background = '$col2'; 01587 } 01588 $('tab_'+p).show(); 01589 obj.style.background = '$col1' 01590 } 01591 </script> 01592 "; 01593 $p = $p + 1; 01594 //$w = $width/2; 01595 print "<td width=$w></td><tr>"; 01596 print "<td colspan=$p style='border:1px solid $col3;background:$col1;padding:10px'>"; 01597 $p = 1; 01598 foreach($tabs as $tab){ 01599 if($p!=1){ 01600 print "<div id='tab_$p' style='display:none'>"; 01601 } else { 01602 print "<div id='tab_$p'>"; 01603 } 01604 View::partial($tab['partial']); 01605 print "</div>"; 01606 $p++; 01607 } 01608 print "<br></td><td width=30></td>"; 01609 print "</table>"; 01610 } 01611 01616 function js_execute($s) { 01617 return xhtml_tag('script', 'type: text/javascript', "content: $s"); 01618 } 01619 01624 function js_alert($s) { 01625 return js_execute('alert("'.addslashes($s).'");'); 01626 } 01627 01636 function time_field_tag($name='') { 01637 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 01638 01639 $hours = array ('00' => '00', '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05' , '06' => '06', 01640 '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', '13' => '13', 01641 '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', 01642 '21' => '21', '22' => '22', '23' => '23'); 01643 01644 $mins = array ('00' => '00', '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05' , '06' => '06', 01645 '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', '13' => '13', 01646 '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', 01647 '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27', 01648 '28' => '28', '29' => '29', '30' => '30', '31' => '31', '32' => '32', '33' => '33', '34' => '34', 01649 '35' => '35', '36' => '36', '37' => '37', '38' => '38', '39' => '39', '40' => '40', '41' => '41', 01650 '42' => '42', '43' => '43', '44' => '44', '45' => '45', '46' => '46', '47' => '47', '48' => '48', '49' => '49', 01651 '50' => '50', '51' => '51' , '52' => '52', '53' => '53', '54' => '54', '55' => '55', '56' => '56', 01652 '57' => '57', '58' => '58', '59' => '59' ); 01653 01654 if(isset($params['value'])) { 01655 $value = $params['value']; 01656 unset($params['value']); 01657 } else { 01658 $value = get_value_from_action($name); 01659 } 01660 01661 if(is_null($value)) { 01662 $value = '00:00:00'; 01663 } 01664 01665 $format = isset($params['format']) ? $params['format']: '%h:%m'; 01666 $hidden = hidden_field_tag($params[0], "value: $value"); 01667 01668 if($value) { 01669 $value = explode(':', $value); 01670 } 01671 01672 $data = get_id_and_name($params[0]); 01673 $code = ''; 01674 $format = explode(':', $format); 01675 01676 $onchange = " 01677 var hora = document.getElementById('{$data['id']}_h'); 01678 var min = document.getElementById('{$data['id']}_m'); 01679 var seg = document.getElementById('{$data['id']}_s'); 01680 var value = ''; 01681 if(hora) { 01682 value+=hora.value; 01683 } else { 01684 value+='00'; 01685 } 01686 value+=':'; 01687 if(min) { 01688 value+=min.value; 01689 } else { 01690 value+='00'; 01691 } 01692 value+=':'; 01693 if(seg) { 01694 value+=seg.value; 01695 } else { 01696 value+='00'; 01697 } 01698 document.getElementById('{$data['id']}').value = value; 01699 "; 01700 01701 if(isset($params['onchange'])) { 01702 $params['onchange'].=$onchange; 01703 } else { 01704 $params['onchange'] = $onchange; 01705 } 01706 01707 foreach($format as $f) { 01708 if($f=='%h') { 01709 if($code) { 01710 $code.=':'; 01711 } 01712 if($value) { 01713 $params['selected'] = $value[0]; 01714 } 01715 $params[1] = $hours; 01716 $code.=select_tag(array_merge($params, array('name'=>'', 'id'=>$data['id'].'_h'))); 01717 unset($params['selected']); 01718 } elseif($f=='%m') { 01719 if($code) { 01720 $code.=':'; 01721 } 01722 if($value) { 01723 $params['selected'] = $value[1]; 01724 } 01725 $params[1] = $mins; 01726 $code.=select_tag(array_merge($params, array('name'=>'', 'id'=>$data['id'].'_m'))); 01727 unset($params['selected']); 01728 } elseif($f=='%s') { 01729 if($code) { 01730 $code.=':'; 01731 } 01732 if($value) { 01733 $params['selected'] = $value[2]; 01734 } 01735 $params[1] = $mins; 01736 $code.=select_tag(array_merge($params, array('name'=>'', 'id'=>$data['id'].'_s'))); 01737 unset($params['selected']); 01738 } 01739 } 01740 01741 return $code.$hidden; 01742 } 01743 01750 function month_field_tag($name) { 01751 $params = is_array($name) ? $name : Util::getParams(func_get_args()); 01752 if(isset($params['use_month_numbers'])) { 01753 $meses = array('01'=>'01', '02'=>'02', '03'=>'03', '04'=>'04', '05'=>'05','06'=>'06', 01754 '07'=>'07', '08'=>'08', '09'=>'09', '10'=>'10', '11'=>'11', '12'=>'12'); 01755 unset($params['use_month_numbers']); 01756 } else { 01757 $meses = array('01'=>'Enero', '02'=>'Febrero', '03'=>'Marzo', '04'=>'Abril', '05'=>'Mayo','06'=>'Junio', 01758 '07'=>'Julio', '08'=>'Agosto', '09'=>'Septiembre', '10'=>'Octubre', '11'=>'Noviembre', '12'=>'Diciembre'); 01759 } 01760 $params[1] = $meses; 01761 return select_tag($params); 01762 } 01763 01775 function swf_tag($data){ 01776 $params = is_array($data) ? $data : Util::getParams(func_get_args()); 01777 01778 if(!isset($params['data']) && isset($params[0])){ 01779 $temp = str_replace(".swf", "", $params[0]); 01780 $params['data'] = PUBLIC_PATH."swf/{$temp}.swf"; 01781 unset($params[0]); 01782 }else{ 01783 $temp = str_replace(".swf", "", $params['data']); 01784 $params['data'] = PUBLIC_PATH."swf/{$temp}.swf"; 01785 } 01786 01787 if(!isset($params['type'])){ 01788 $params['type'] = 'application/x-shockwave-flash'; 01789 } 01790 01791 if(!isset($params['wmode'])){ 01792 $wmode = 'transparent'; 01793 }else{ 01794 $wmode = $params['wmode']; 01795 unset($params['wmode']); 01796 } 01797 01798 $code = xhtml_start_tag('object', $params); 01799 $code .= '<param name="movie" value="'.$params['data'].'" />'; 01800 $code .= '<param name="wmode" value="'.$wmode.'" />'; 01801 $code .= xhtml_end_tag('object'); 01802 01803 return $code; 01804 } 01811 function get_kumbia_url($url){ 01812 $return_url = PUBLIC_PATH; 01813 01814 $action = $url; 01815 $module = ''; 01816 if(is_array($url)){ 01817 $action = $url[0]; 01818 if(isset($url['module'])){ 01819 $module = $url['module']; 01820 } 01821 if(isset($url['application']) && $url['application']){ 01822 $application = $url['application']; 01823 } 01824 } 01825 if($module){ 01826 $return_url.=$module.'/'; 01827 } 01828 $return_url.=$action; 01829 return $return_url; 01830 } 01836 function stylesheet_link_tags() 01837 { 01838 if(isset(TagsData::$data['KUMBIA_CSS_IMPORTS'])){ 01839 $imports = TagsData::$data['KUMBIA_CSS_IMPORTS']; 01840 if (is_array($imports)) { 01841 foreach ($imports as $css) { 01842 echo $css; 01843 } 01844 } else { 01845 echo $imports; 01846 } 01847 } 01848 } 01849 // Añadida para permitir la compatibilidad de los helpers antiguos 01850 class TagsData { 01851 public static $data = array(); 01852 }