function test_acceso_final() { $etiqueta = "Etiquet&a"; $res = tecla_acceso($etiqueta); $this->AssertEqual($res[0], "Etiquet<u>a</u>"); $this->AssertEqual($res[1], "a"); }
/** * Genera el HTML del BOTON */ function get_html($id_submit, $objeto_js, $id_componente) { if ($this->anulado) { return null; } $tab_order = toba_manejador_tabs::instancia()->siguiente(); $tip = ''; if (isset($this->datos['ayuda'])) { $tip = $this->datos['ayuda']; } $acceso = tecla_acceso($this->datos['etiqueta']); if (!$this->es_seleccion_multiple()) { $clase_predeterminada = $this->esta_sobre_fila() ? 'ei-boton-fila' : 'ei-boton'; $clase = isset($this->datos['estilo']) && trim($this->datos['estilo']) != "" ? $this->datos['estilo'] : $clase_predeterminada; $tipo_boton = 'button'; if (!$this->esta_sobre_fila() && isset($this->datos['defecto']) && $this->datos['defecto']) { $tipo_boton = 'submit'; $clase .= ' ei-boton-defecto'; } $estilo_inline = $this->oculto ? 'display: none' : null; $html = ''; $html .= $this->get_imagen(); $html .= $acceso[0]; $tecla = $acceso[1]; $js = $this->get_invocacion_js($objeto_js, $id_componente); if (isset($js)) { $js = 'onclick="' . $js . '"'; return toba_form::button_html($id_submit . "_" . $this->get_id(), $html, $js, $tab_order, $tecla, $tip, $tipo_boton, '', $clase, true, $estilo_inline, $this->activado); } } else { $js = $this->get_invocacion_js($objeto_js, $id_componente); $html = '<label>'; $html .= $this->get_imagen(); if (isset($js)) { $extra = 'onclick="' . $js . '"'; $extra .= " title='{$tip}'"; $extra .= $this->activado ? '' : ' disabled'; $valor_actual = $this->es_check_activo ? $this->parametros : null; $html .= toba_form::checkbox($id_submit . "_" . $this->get_id(), $valor_actual, $this->parametros, '', $extra); } $html .= '</label>'; return $html; } }
/** * Retorna el HTML del tab * * @param string $tipo 'V' para vertical o 'H' para horizontal * @param string $id_submit Id. unico del contenedor (utilizado para formar el id del tab) * @param string $id_componente Id. de js del componente contenedor * @param boolean $seleccionado * @param string $editor */ function get_html($tipo, $id_submit, $id_componente, $seleccionado, $editor = '') { if ($this->anulado) { return null; } if ($tipo != 'V' && $tipo != 'H') { throw new toba_error_def("Los tipos validos de TABS son 'V' y 'H'."); } static $id_tab = 1; $evento = $this->datos['identificador']; $contenido = ''; $tab_order = toba_manejador_tabs::instancia()->siguiente(); $img = $this->get_imagen(); if (!isset($img) && $tipo == 'H') { $img = gif_nulo(1, 16); } $contenido .= $img . ' '; $tip = $this->datos['ayuda']; $acceso = tecla_acceso($this->datos['etiqueta']); $contenido .= $acceso[0]; $tecla = $acceso[1]; if (!isset($tecla) && $id_tab < 10) { $tecla = $id_tab; } $tip = str_replace("'", "\\'", $tip); $acceso = toba_recurso::ayuda($tecla, $tip); $id = $id_submit . '_cambiar_tab_' . $evento; $js = "onclick=\"{$id_componente}.ir_a_pantalla('{$evento}');return false;\""; $js_extra = ''; if ($this->activado) { $clase_boton = ''; } else { $clase_boton = 'ci-tabs-boton-desact'; } if ($tipo == 'H') { //********************* TABs HORIZONTALES ********************** if ($seleccionado) { // -- Tab ACTUAL -- $estilo_li = 'background:url("' . toba_recurso::imagen_skin('tabs/left_on.gif') . '") no-repeat left top;'; $estilo_a = 'background:url("' . toba_recurso::imagen_skin('tabs/right_on.gif') . '") no-repeat right top;'; $html = "<li class='ci-tabs-h-solapa-sel'>{$editor}"; $html .= "<a href='#' id='{$id}' {$acceso}>{$contenido}</a>"; $html .= "</li>"; } else { $oculto = $this->oculto ? '; display: none' : ''; $estilo_li = 'background:url("' . toba_recurso::imagen_skin('tabs/left.gif') . '") no-repeat left top;'; $estilo_a = 'background:url("' . toba_recurso::imagen_skin('tabs/right.gif') . '") no-repeat right top;'; $html = "<li class='ci-tabs-h-solapa' style='{$oculto}'>{$editor}"; $html .= "<a href='#' id='{$id}' class='{$clase_boton}' {$acceso} {$js}>{$contenido}</a>"; $html .= "</li>"; $html .= $js_extra; } } else { // ********************* TABs VERTICALES ************************ if ($seleccionado) { // -- Tab ACTUAL -- $html = "<div class='ci-tabs-v-solapa-sel'><div class='ci-tabs-v-boton-sel'>{$editor} "; $html .= "<div id='{$id}'>{$contenido}</div>"; $html .= "</div></div>"; } else { $clase_extra = ''; if (!$this->activado) { $clase_extra = 'ci-tabs-v-desactivado'; } $oculto = $this->oculto ? "style='display: none'" : ''; $html = "<div class='ci-tabs-v-solapa {$clase_extra}' {$oculto} >{$editor} "; $html .= "<a href='#' id='{$id}' {$clase_extra} {$acceso} {$js}>{$contenido}</a>"; $html .= "</div>"; $html .= $js_extra; } } $id_tab++; return $html; }