示例#1
0
 /**
  * Enlaza un recurso externo
  *
  * @param string $href direccion url del recurso a enlazar
  * @param string|array $attrs atributos
  */
 public static function headLink($href, $attrs = '')
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     self::$_headLinks[] = array('href' => $href, 'attrs' => $attrs);
 }
示例#2
0
 /**
  * Crea un enlace externo
  *
  * @example echo DwHtml::outLink('http://kumbiaphp.com', 'Enlace') Crea un enlace a esa url
  *
  * @param string $action Ruta o dirección de la página web
  * @param string $text Texto a mostrar
  * @param mixed $attrs Atributos adicionales
  * @return string
  */
 public static function outLink($url, $text, $attrs = NULL)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     return '<a href="' . "{$url}\" {$attrs} >{$text}</a>";
 }
 /**
  * Crea un metatag
  *
  * @param string $content contenido del metatag
  * @param string|array $attrs atributos
  */
 public static function meta($content, $attrs = NULL)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     self::$_metatags[] = array('content' => $content, 'attrs' => $attrs);
 }
 /**
  * Genera un formulario Ajax
  *
  * @param string $update capa que se actualizara
  * @param string $action accion a ejecutar
  * @param string $class clase de estilo
  * @param string $method metodo de envio
  * @param string|array $attrs atributos
  * @return string
  */
 public static function form($update, $action = NULL, $class = NULL, $method = 'post', $attrs = NULL)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     if ($action) {
         $action = PUBLIC_PATH . $action;
     } else {
         $action = PUBLIC_PATH . ltrim(Router::get('route'), '/');
     }
     return "<form action=\"{$action}\" method=\"{$method}\" class=\"js-remote {$class}\" data-to=\"{$update}\" {$attrs}>";
 }
示例#5
0
文件: js.php 项目: ocidfigueroa/sice
 /**
  * Crea un boton de tipo imagen
  *  
  * @param string $img
  * @param string $class clases adicionales para el link
  * @param string|array $attrs atributos adicionales
  * @return string
  */
 public static function submitImage($img, $confirm = '¿Está Seguro?', $class = NULL, $attrs = NULL)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     return "<input type=\"image\" data-msg=\"{$confirm}\" src=\"" . PUBLIC_PATH . "img/{$img}\" class=\"js-confirm {$class}\" {$attrs}/>";
 }
示例#6
0
 /**
  * Crea un botón tipo submit
  *
  * @param string $text Texto del botón
  * @param array $attrs Atributos de campo (opcional)
  * @return string
  */
 public static function btnSubmit($text, $attrs = NULL, $icon = Null)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     $btn = '';
     if ($icon) {
         $btn .= '<i class="fa fa-pd-expand ' . $icon . '"></i>';
     }
     $btn .= $text;
     return "<button type=\"submit\" {$attrs}>{$btn}</button>";
 }
示例#7
0
 /**
  * Método que genera un input type="checkbox"
  * @param type $field Nombre del input
  * @param string $checkValue Valor del checkbox
  * @param type $attrs Atributos del input, se puede especificar array('class'=>'inline') para mostrar en línea
  * @param type $checked Indica si está seleccionado o no
  * @param type $label Detalle de la etiqueta label
  * @return string
  */
 public static function check2($field, $checkValue, $attrs = NULL, $checked = NULL, $label = '')
 {
     //Tomo los nuevos atributos definidos en las clases
     $attrs = self::_getAttrsClass($attrs, 'checkbox');
     $input = self::label($label, $field, null, $attrs['class'], 'checkbox');
     $input = str_replace('</label>', '', $input);
     //Quito el cierre de la etiqueta label
     $input = str_replace($label, '', $input);
     //Quito el texto del label para ponerlo al final
     //Armo el input del form
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     // Obtiene name y id para el campo y los carga en el scope
     extract(self::getFieldDataCheck($field, $checkValue, $checked), EXTR_OVERWRITE);
     $name = str_replace("[]", '', $name);
     $id = str_replace(array('[', ']'), '_', $id);
     if ($checked) {
         $checked = 'checked="checked"';
     }
     self::$_counter--;
     //Para que tome el contador del label
     $input .= "<input id=\"{$id}" . self::$_counter . "\" name=\"{$name}[]\" type=\"checkbox\" value=\"{$checkValue}\" {$attrs} {$checked}/>";
     self::$_counter++;
     //Para que siga
     $input .= $label;
     $input .= '</label>';
     //Cierro el label
     return $input . PHP_EOL;
 }
 /**
  * Crea un campo de texo para fecha (Requiere JS )
  *
  * @param string $field Nombre de campo
  * @param string $class Clase de estilo (opcional)
  * @param string|array $attrs Atributos de campo (opcional)
  * @param string $value (opcional)
  * @return string
  */
 public static function datepicker($field, $class = NULL, $attrs = NULL, $value = NULL)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     // Obtiene name, id y value (solo para autoload) para el campo y los carga en el scope
     extract(self::getFieldData($field, $value), EXTR_OVERWRITE);
     return "<input id=\"{$id}\" name=\"{$name}\" class=\"js-datepicker {$class}\" type=\"text\" value=\"{$value}\" {$attrs}/>";
 }
示例#9
0
文件: form.php 项目: Jamp/sgas
 /**
  * Crea un campo file
  *
  * @param string $field Nombre de campo
  * @param string|array $attrs Atributos de campo (opcional)
  * @return string
  */
 public static function file($field, $attrs = '')
 {
     // aviso al programador
     if (!self::$_multipart) {
         Flash::error('Para poder subir ficheros, debe abrir el form con Form::openMultipart()');
     }
     $attrs = Tag::getAttrs($attrs);
     // Obtiene name y id, y los carga en el scope
     list($id, $name, ) = self::getFieldData($field, FALSE);
     return "<input id=\"{$id}\" name=\"{$name}\" type=\"file\" {$attrs}/>";
 }
示例#10
0
 /**
  * Método que se encarga de crear el botón
  * @param type $icon
  * @param type $attrs
  * @param type $text
  * @param type $type
  * @return type
  */
 public static function showButton($icon = '', $attrs = array(), $text = '', $type = 'button')
 {
     $text = strtoupper($text);
     $attrs['class'] = 'btn ' . $attrs['class'];
     if (!preg_match("/\\bdw-text-bold\\b/i", $attrs['class'])) {
         $attrs['class'] = $attrs['class'] . ' dw-text-bold';
     }
     $attrs = Tag::getAttrs($attrs);
     $text = !empty($text) && $icon ? '<span class="hidden-phone">' . strtoupper($text) . '</span>' : strtoupper($text);
     if ($icon) {
         $text = '<i class="fa fa-' . $icon . '"></i> ' . $text;
     }
     return "<button type=\"{$type}\" {$attrs}>{$text}</button>";
 }
示例#11
0
 public static function foto($src, $alt = NULL, $attrs = NULL)
 {
     $usuario = new Usuario();
     if (!$usuario->getInformacionUsuario(Session::get('id'))) {
         DwMessage::get('id_no_found');
         return DwRedirect::to('dashboard');
     }
     $usuario->perfil = $perfil;
     $usuario->fotografia = $persona->fotografia;
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     return '<img src="' . PUBLIC_PATH . "img/{$src}\" alt=\"{$alt}\" {$attrs} />";
 }
示例#12
0
 /**
  * Aplica estilo zebra a una tabla.
  *
  * @param string $class class css
  * @param string | array $attrs
  * @param unknown_type $start
  */
 public static function trClass($class, $attrs = NULL)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     if (self::$_trClassAlternate) {
         self::$_trClassAlternate = FALSE;
         return "<tr class='{$class}' {$attrs}>";
     } else {
         self::$_trClassAlternate = TRUE;
         return "<tr {$attrs}>";
     }
 }
 public static function dbCity($field, $data, $show, $blank = null, $attrs = null, $value = null, $label = '', $req = false, $err = false)
 {
     if (is_array($attrs)) {
         $attrs = Tag::getAttrs($attrs);
     }
     extract(parent::_getFieldData($field, $value === null), EXTR_OVERWRITE);
     if (is_null($blank)) {
         $options = '';
     } else {
         $options = '<option value="">' . htmlspecialchars($blank, ENT_COMPAT, APP_CHARSET) . '</option>';
     }
     foreach ($data as $p) {
         $options .= "<option value=\"{$p->id}\"";
         if ($p->id == $value) {
             $options .= ' selected="selected"';
         }
         $options .= '>' . $p->convencion . " | " . htmlspecialchars($p->{$show}, ENT_COMPAT, APP_CHARSET) . '</option>';
     }
     $attrs = self::_getAttrsClass($attrs, 'select', $req);
     $input = "\n<select id=\"{$id}\" name=\"{$name}\" {$attrs}>{$options}</select>\n";
     $input .= self::label($field, $label, null, $req, $err);
     return $input . "\n";
 }
示例#14
0
 /**
  * Genera un formulario Ajax
  *
  * @param string $update capa que se actualizara
  * @param string $action accion a ejecutar
  * @param string $class clase de estilo
  * @param string $method metodo de envio
  * @param string|array $attrs atributos
  * @return string
  */
 public static function form($update, $action = '', $class = '', $method = 'post', $attrs = '')
 {
     $attrs = "class=\"js-remote {$class}\" data-to=\"{$update}\" " . Tag::getAttrs($attrs);
     return Form::open($action, $method, $attrs);
 }
示例#15
0
 /**
  * Método que se encarga de crear el botón
  * @param type $icon
  * @param type $attrs
  * @param type $text
  * @param type $type
  * @return type
  */
 public static function showButton($icon = '', $attrs = array(), $text = '', $type = 'button', $iconAlign = 'left')
 {
     $text = Filter::get($text, 'upper');
     $attrs['class'] = 'btn ' . $attrs['class'];
     if (!preg_match("/\\btext-bold\\b/i", $attrs['class'])) {
         $attrs['class'] = $attrs['class'] . ' text-bold';
     }
     $attrs = Tag::getAttrs($attrs);
     $text = !empty($text) && $icon ? '<span class="hidden-xs">' . $text . '</span>' : $text;
     if ($icon) {
         if ($iconAlign !== 'left') {
             $text = $text . ' <i class="btn-icon-only fa ' . $icon . '"></i>';
         } else {
             $text = '<i class="btn-icon-only fa ' . $icon . '"></i> ' . $text;
         }
     }
     return "<button type=\"{$type}\" {$attrs}>{$text}</button>";
 }