Skip to content

Commit

Permalink
Various minimal updates
Browse files Browse the repository at this point in the history
  • Loading branch information
joanhey committed Apr 21, 2015
1 parent 6613307 commit 98bc297
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
14 changes: 7 additions & 7 deletions core/extensions/helpers/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Ajax
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function link($action, $text, $update, $class=NULL, $attrs=NULL)
public static function link($action, $text, $update, $class='', $attrs='')
{
$attrs = Tag::getAttrs($attrs);
return '<a href="' . PUBLIC_PATH . "$action\" class=\"js-remote $class\" data-to=\"{$update}\" $attrs>$text</a>";
Expand All @@ -53,7 +53,7 @@ public static function link($action, $text, $update, $class=NULL, $attrs=NULL)
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function linkAction($action, $text, $update, $class=NULL, $attrs=NULL)
public static function linkAction($action, $text, $update, $class='', $attrs='')
{
$attrs = Tag::getAttrs($attrs);
return '<a href="' . PUBLIC_PATH . Router::get('controller_path') . "/$action\" class=\"js-remote $class\" data-to=\"{$update}\" $attrs>$text</a>";
Expand All @@ -71,7 +71,7 @@ public static function linkAction($action, $text, $update, $class=NULL, $attrs=N
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function linkConfirm($action, $text, $update, $confirm, $class=NULL, $attrs=NULL)
public static function linkConfirm($action, $text, $update, $confirm, $class='', $attrs='')
{
$attrs = Tag::getAttrs($attrs);
return '<a href="' . PUBLIC_PATH . "$action\" class=\"js-remote-confirm $class\" data-to=\"{$update}\" title=\"$confirm\" $attrs>$text</a>";
Expand All @@ -89,7 +89,7 @@ public static function linkConfirm($action, $text, $update, $confirm, $class=NUL
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function linkActionConfirm($action, $text, $update, $confirm, $class=NULL, $attrs=NULL)
public static function linkActionConfirm($action, $text, $update, $confirm, $class='', $attrs='')
{
$attrs = Tag::getAttrs($attrs);
return '<a href="' . PUBLIC_PATH . Router::get('controller_path') . "/$action\" class=\"js-remote-confirm $class\" data-to=\"{$update}\" title=\"$confirm\" $attrs>$text</a>";
Expand All @@ -105,7 +105,7 @@ public static function linkActionConfirm($action, $text, $update, $confirm, $cla
* @param string $class
* @param string|array $attrs
*/
public static function select($field, $data, $update, $action, $class=null, $attrs=null)
public static function select($field, $data, $update, $action, $class='', $attrs='')
{
$attrs = Tag::getAttrs($attrs);
// ruta a la accion
Expand All @@ -126,7 +126,7 @@ public static function select($field, $data, $update, $action, $class=null, $att
* @param string $class
* @param string|array $attrs
*/
public static function dbSelect($field, $show, $data, $update, $action, $blank=null, $class=null, $attrs=null)
public static function dbSelect($field, $show, $data, $update, $action, $blank='', $class='', $attrs='')
{
$attrs = Tag::getAttrs($attrs);
// ruta a la accion
Expand All @@ -146,7 +146,7 @@ public static function dbSelect($field, $show, $data, $update, $action, $blank=n
* @param string|array $attrs atributos
* @return string
*/
public static function form($update, $action = '', $class = NULL, $method = 'post', $attrs = '')
public static function form($update, $action = '', $class = '', $method = 'post', $attrs = '')
{
$attrs = Tag::getAttrs($attrs);
if ($action) {
Expand Down
48 changes: 24 additions & 24 deletions core/extensions/helpers/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static function getFieldDataCheck($field, $checkValue, $checked = false)
* @param string $value
* @params string|array $attrs
*/
protected static function tag ($tag, $field, $attrs = NULL, $value=NULL, $extra='', $close = TRUE){
protected static function tag ($tag, $field, $attrs = '', $value='', $extra='', $close = TRUE){
$attrs = Tag::getAttrs($attrs);
$end = $close ? ">{{value}}</$tag>" : '/>';
// Obtiene name, id y value (solo para autoload) para el campo y los carga en el scope
Expand All @@ -163,7 +163,7 @@ protected static function tag ($tag, $field, $attrs = NULL, $value=NULL, $extra=
* @param string $value
* @return string
*/
public static function input($type, $field, $attrs = NULL, $value=NULL)
public static function input($type, $field, $attrs = '', $value='')
{
return self::tag('input', $field, $attrs, $value, "type=\"$type\" value=\"{{value}}\"", FALSE);
}
Expand Down Expand Up @@ -194,7 +194,7 @@ public static function open($action = '', $method = 'post', $attrs = '')
* @param string|array $attrs Atributos de etiqueta (opcional)
* @return string
*/
public static function openMultipart($action = NULL, $attrs = NULL)
public static function openMultipart($action = '', $attrs = '')
{
self::$_multipart = TRUE;
if (is_array($attrs)) {
Expand Down Expand Up @@ -224,7 +224,7 @@ public static function close()
* @param string|array $attrs Atributos de campo (opcional)
* @return string
*/
public static function submit($text, $attrs = NULL)
public static function submit($text, $attrs = '')
{
return self::button($text, $attrs, 'submit');
}
Expand All @@ -236,7 +236,7 @@ public static function submit($text, $attrs = NULL)
* @param string|array $attrs Atributos de campo (opcional)
* @return string
*/
public static function reset($text, $attrs = NULL)
public static function reset($text, $attrs = '')
{
return self::button($text, $attrs, 'reset');
}
Expand All @@ -251,7 +251,7 @@ public static function reset($text, $attrs = NULL)
* @todo FALTA AGREGAR NOMBRE YA QUE SIN ESTE EL VALUE NO LLEGA AL SERVER
* @return string
*/
public static function button($text, $attrs = NULL, $type = 'button', $value= NULL)
public static function button($text, $attrs = '', $type = 'button', $value= '')
{
$attrs = Tag::getAttrs($attrs);
$value = is_null($value) ? '' : "value=\"$value\"";
Expand All @@ -266,7 +266,7 @@ public static function button($text, $attrs = NULL, $type = 'button', $value= NU
* @param string|array Atributos de campo (opcional)
* @return string
*/
public static function label($text, $field, $attrs = NULL)
public static function label($text, $field, $attrs = '')
{
$attrs = Tag::getAttrs($attrs);
return "<label for=\"$field\" $attrs>$text</label>";
Expand All @@ -280,7 +280,7 @@ public static function label($text, $field, $attrs = NULL)
* @param string $value (opcional)
* @return string
*/
public static function text($field, $attrs = NULL, $value = NULL)
public static function text($field, $attrs = '', $value = '')
{
return self::input('text', $field, $attrs, $value);
}
Expand All @@ -297,7 +297,7 @@ public static function text($field, $attrs = NULL, $value = NULL)
* @param string $show texto a mostrar, si es empty usa el to string
* @return string
*/
public static function select($field, $data, $attrs = NULL, $value = NULL, $blank = '',$itemId = 'id', $show='')
public static function select($field, $data, $attrs = '', $value = '', $blank = '',$itemId = 'id', $show='')
{
$attrs = Tag::getAttrs($attrs);
// Obtiene name, id y value (solo para autoload) para el campo y los carga en el scope
Expand Down Expand Up @@ -380,7 +380,7 @@ public static function check($field, $checkValue, $attrs = '', $checked = false)
* @param boolean $checked Indica si se marca el campo (opcional)
* @return string
*/
public static function radio($field, $radioValue, $attrs = NULL, $checked = NULL)
public static function radio($field, $radioValue, $attrs = '', $checked = false)
{
$attrs = Tag::getAttrs($attrs);
// Obtiene name y id para el campo y los carga en el scope
Expand Down Expand Up @@ -408,7 +408,7 @@ public static function radio($field, $radioValue, $attrs = NULL, $checked = NULL
* @param string|array $attrs Atributos de campo (opcional)
* @return string
*/
public static function submitImage($img, $attrs = NULL)
public static function submitImage($img, $attrs = '')
{
$attrs = Tag::getAttrs($attrs);
return "<input type=\"image\" src=\"" . PUBLIC_PATH . "img/$img\" $attrs/>";
Expand All @@ -422,7 +422,7 @@ public static function submitImage($img, $attrs = NULL)
* @param string $value
* @return string
*/
public static function hidden($field, $attrs = NULL, $value = NULL)
public static function hidden($field, $attrs = '', $value = '')
{
return self::input('hidden', $field, $attrs, $value);
}
Expand All @@ -435,7 +435,7 @@ public static function hidden($field, $attrs = NULL, $value = NULL)
* @param string|array $attrs Atributos de campo (opcional)
* @param string $value
*/
public static function pass($field, $attrs = NULL, $value = NULL)
public static function pass($field, $attrs = '', $value = '')
{
return self::password($field, $attrs, $value);
}
Expand All @@ -446,7 +446,7 @@ public static function pass($field, $attrs = NULL, $value = NULL)
* @param string|array $attrs Atributos de campo (opcional)
* @param string $value
*/
public static function password($field, $attrs = NULL, $value = NULL)
public static function password($field, $attrs = '', $value = '')
{
return self::input('password',$field, $attrs, $value);
}
Expand All @@ -462,7 +462,7 @@ public static function password($field, $attrs = NULL, $value = NULL)
* @param string|array $value (opcional) Array en select multiple
* @return string
*/
public static function dbSelect($field, $show = NULL, $data = NULL, $blank = 'Seleccione', $attrs = NULL, $value = NULL)
public static function dbSelect($field, $show = '', $data = NULL, $blank = 'Seleccione', $attrs = '', $value = NULL)
{

$model = ($data === NULL) ? substr($field, strpos($field, '.')+1, -3):$data[0];
Expand All @@ -487,7 +487,7 @@ public static function dbSelect($field, $show = NULL, $data = NULL, $blank = 'Se
* @param string|array $attrs Atributos de campo (opcional)
* @return string
*/
public static function file($field, $attrs = NULL)
public static function file($field, $attrs = '')
{
// aviso al programador
if (!self::$_multipart) {
Expand All @@ -509,7 +509,7 @@ public static function file($field, $attrs = NULL)
* @param string $value (opcional)
* @return string
*/
public static function textarea($field, $attrs = NULL, $value = NULL)
public static function textarea($field, $attrs = '', $value = '')
{
return self::tag('textarea', $field, $attrs, $value);
}
Expand All @@ -522,7 +522,7 @@ public static function textarea($field, $attrs = NULL, $value = NULL)
* @param string $value (opcional)
* @return string
*/
public static function date($field, $attrs = NULL, $value = NULL)
public static function date($field, $attrs = '', $value = '')
{
return self::input('date',$field, $attrs, $value);
}
Expand All @@ -536,7 +536,7 @@ public static function date($field, $attrs = NULL, $value = NULL)
* @param string $value (opcional)
* @return string
*/
public static function datepicker($field, $class = NULL, $attrs = NULL, $value = NULL)
public static function datepicker($field, $class = '', $attrs = '', $value = '')
{
return self::tag('input', $field, $attrs, NULL, "class=\"js-datepicker $class\" type=\"text\" value=\"$value\" ");
}
Expand All @@ -549,7 +549,7 @@ public static function datepicker($field, $class = NULL, $attrs = NULL, $value =
* @param string $value (opcional)
* @return string
*/
public static function time($field, $attrs = NULL, $value = NULL)
public static function time($field, $attrs = '', $value = '')
{
return self::input('time',$field, $attrs, $value);
}
Expand All @@ -562,7 +562,7 @@ public static function time($field, $attrs = NULL, $value = NULL)
* @param string $value (opcional)
* @return string
*/
public static function datetime($field, $attrs = NULL, $value = NULL)
public static function datetime($field, $attrs = '', $value = '')
{
return self::input('datetime',$field, $attrs, $value);
}
Expand All @@ -575,7 +575,7 @@ public static function datetime($field, $attrs = NULL, $value = NULL)
* @param string $value (opcional)
* @return string
*/
public static function number($field, $attrs = NULL, $value = NULL)
public static function number($field, $attrs = '', $value = '')
{
return self::input('number',$field, $attrs, $value);
}
Expand All @@ -589,7 +589,7 @@ public static function number($field, $attrs = NULL, $value = NULL)
* @param string $value (opcional)
* @return string
*/
public static function url($field, $attrs = NULL, $value = NULL)
public static function url($field, $attrs = '', $value = '')
{
return self::input('url',$field, $attrs, $value);
}
Expand All @@ -602,7 +602,7 @@ public static function url($field, $attrs = NULL, $value = NULL)
* @param string $value (opcional)
* @return string
*/
public static function email($field, $attrs = NULL, $value = NULL)
public static function email($field, $attrs = '', $value = '')
{
return self::input('email',$field, $attrs, $value);
}
Expand Down
8 changes: 4 additions & 4 deletions core/extensions/helpers/js.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Js
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function link($action, $text, $confirm = '¿Está Seguro?', $class = NULL, $attrs = NULL)
public static function link($action, $text, $confirm = '¿Está Seguro?', $class = '', $attrs = '')
{
$attrs = Tag::getAttrs($attrs);
return '<a href="' . PUBLIC_PATH . "$action\" data-msg=\"$confirm\" class=\"js-confirm $class\" $attrs>$text</a>";
Expand All @@ -55,7 +55,7 @@ public static function link($action, $text, $confirm = '¿Está Seguro?', $class
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function linkAction($action, $text, $confirm = '¿Está Seguro?', $class = NULL, $attrs = NULL)
public static function linkAction($action, $text, $confirm = '¿Está Seguro?', $class = '', $attrs = '')
{
$attrs = Tag::getAttrs($attrs);
return '<a href="' . PUBLIC_PATH . Router::get('controller_path') . "/$action\" data-msg=\"$confirm\" class=\"js-confirm $class\" $attrs>$text</a>";
Expand All @@ -71,7 +71,7 @@ public static function linkAction($action, $text, $confirm = '¿Está Seguro?',
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function submit($text, $confirm = '¿Está Seguro?', $class = NULL, $attrs = NULL)
public static function submit($text, $confirm = '¿Está Seguro?', $class = '', $attrs = '')
{
$attrs = Tag::getAttrs($attrs);
return "<input type=\"submit\" value=\"$text\" data-msg=\"$confirm\" class=\"js-confirm $class\" $attrs/>";
Expand All @@ -85,7 +85,7 @@ public static function submit($text, $confirm = '¿Está Seguro?', $class = NULL
* @param string|array $attrs atributos adicionales
* @return string
*/
public static function submitImage($img, $confirm = '¿Está Seguro?', $class = NULL, $attrs = NULL)
public static function submitImage($img, $confirm = '¿Está Seguro?', $class = '', $attrs = '')
{
$attrs = Tag::getAttrs($attrs);
return "<input type=\"image\" data-msg=\"$confirm\" src=\"" . PUBLIC_PATH . "img/$img\" class=\"js-confirm $class\" $attrs/>";
Expand Down

0 comments on commit 98bc297

Please sign in to comment.