Completed
Branch master (49228f)
by Henry Stivens
02:50
created
core/extensions/helpers/model_form.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
         if (!$action)
38 38
             $action = ltrim(Router::get('route'), '/');
39 39
 
40
-        echo '<form action="', PUBLIC_PATH . $action, '" method="post" id="', $model_name, '" class="scaffold">' , PHP_EOL;
40
+        echo '<form action="', PUBLIC_PATH . $action, '" method="post" id="', $model_name, '" class="scaffold">', PHP_EOL;
41 41
         $pk = $model->primary_key[0];
42
-        echo '<input id="', $model_name, '_', $pk, '" name="', $model_name, '[', $pk, ']" class="id" value="', $model->$pk , '" type="hidden">' , PHP_EOL;
42
+        echo '<input id="', $model_name, '_', $pk, '" name="', $model_name, '[', $pk, ']" class="id" value="', $model->$pk, '" type="hidden">', PHP_EOL;
43 43
 
44 44
         $fields = array_diff($model->fields, $model->_at, $model->_in, $model->primary_key);
45 45
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
             $formName = $model_name . '[' . $field . ']';
52 52
 
53 53
             if (in_array($field, $model->not_null)) {
54
-                echo "<label for=\"$formId\" class=\"required\">$alias *</label>" , PHP_EOL;
54
+                echo "<label for=\"$formId\" class=\"required\">$alias *</label>", PHP_EOL;
55 55
             } else
56
-                echo "<label for=\"$formId\">$alias</label>" , PHP_EOL;
56
+                echo "<label for=\"$formId\">$alias</label>", PHP_EOL;
57 57
 
58 58
             switch ($tipo) {
59 59
                 case 'tinyint': case 'smallint': case 'mediumint':
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
                         echo Form::dbSelect($model_name . '.' . $field, NULL, NULL, 'Seleccione', NULL, $model->$field);
67 67
                         break;
68 68
                     } else {
69
-                        echo "<input id=\"$formId\" type=\"number\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
69
+                        echo "<input id=\"$formId\" type=\"number\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
70 70
                         break;
71 71
                     }
72 72
 
73 73
                 case 'date': // Usar el js de datetime
74
-                    echo "<input id=\"$formId\" type=\"date\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
74
+                    echo "<input id=\"$formId\" type=\"date\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
75 75
                     break;
76 76
                 case 'datetime': case 'timestamp':
77
-                    echo "<input id=\"$formId\" type=\"datetime\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
77
+                    echo "<input id=\"$formId\" type=\"datetime\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
78 78
 
79 79
                     //echo '<script type="text/javascript" src="/javascript/kumbia/jscalendar/calendar.js"></script>
80 80
                     //<script type="text/javascript" src="/javascript/kumbia/jscalendar/calendar-setup.js"></script>
@@ -83,26 +83,26 @@  discard block
 block discarded – undo
83 83
                     break;
84 84
 
85 85
                 case 'enum': case 'set': case 'bool':
86
-                    $enumList = explode(",", str_replace("'", "", substr($model->_data_type[$field], 5, (strlen($model->_data_type[$field])-6))));
86
+                    $enumList = explode(",", str_replace("'", "", substr($model->_data_type[$field], 5, (strlen($model->_data_type[$field]) - 6))));
87 87
                     echo "<select id=\"$formId\" class=\"select\" name=\"$formName\" >", PHP_EOL;
88
-                    foreach($enumList as $value)
88
+                    foreach ($enumList as $value)
89 89
                         echo "<option value=\"{$value}\">$value</option>", PHP_EOL;
90 90
                     echo '</select>', PHP_EOL;
91 91
                     break;
92 92
 
93 93
                 case 'text': case 'mediumtext': case 'longtext':
94 94
                 case 'blob': case 'mediumblob': case 'longblob': // Usar textarea
95
-                    echo "<textarea id=\"$formId\" name=\"$formName\">{$model->$field}</textarea>" , PHP_EOL;
95
+                    echo "<textarea id=\"$formId\" name=\"$formName\">{$model->$field}</textarea>", PHP_EOL;
96 96
                     break;
97 97
 
98 98
                 default: //text,tinytext,varchar, char,etc se comprobara su tamaño
99
-                    echo "<input id=\"$formId\" type=\"text\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
99
+                    echo "<input id=\"$formId\" type=\"text\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
100 100
                 //break;
101 101
             }
102 102
         }
103 103
         //echo radio_field_tag("actuacion", array("U" => "una", "D" => "dos", "N" => "Nada"), "value: N");
104
-        echo '<input type="submit" value="Enviar" />' , PHP_EOL;
105
-        echo '</form>' , PHP_EOL;
104
+        echo '<input type="submit" value="Enviar" />', PHP_EOL;
105
+        echo '</form>', PHP_EOL;
106 106
     }
107 107
 
108 108
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
     {
35 35
 
36 36
         $model_name = Util::smallcase(get_class($model));
37
-        if (!$action)
38
-            $action = ltrim(Router::get('route'), '/');
37
+        if (!$action) {
38
+                    $action = ltrim(Router::get('route'), '/');
39
+        }
39 40
 
40 41
         echo '<form action="', PUBLIC_PATH . $action, '" method="post" id="', $model_name, '" class="scaffold">' , PHP_EOL;
41 42
         $pk = $model->primary_key[0];
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
 
53 54
             if (in_array($field, $model->not_null)) {
54 55
                 echo "<label for=\"$formId\" class=\"required\">$alias *</label>" , PHP_EOL;
55
-            } else
56
-                echo "<label for=\"$formId\">$alias</label>" , PHP_EOL;
56
+            } else {
57
+                            echo "<label for=\"$formId\">$alias</label>" , PHP_EOL;
58
+            }
57 59
 
58 60
             switch ($tipo) {
59 61
                 case 'tinyint': case 'smallint': case 'mediumint':
@@ -85,8 +87,9 @@  discard block
 block discarded – undo
85 87
                 case 'enum': case 'set': case 'bool':
86 88
                     $enumList = explode(",", str_replace("'", "", substr($model->_data_type[$field], 5, (strlen($model->_data_type[$field])-6))));
87 89
                     echo "<select id=\"$formId\" class=\"select\" name=\"$formName\" >", PHP_EOL;
88
-                    foreach($enumList as $value)
89
-                        echo "<option value=\"{$value}\">$value</option>", PHP_EOL;
90
+                    foreach($enumList as $value) {
91
+                                            echo "<option value=\"{$value}\">$value</option>", PHP_EOL;
92
+                    }
90 93
                     echo '</select>', PHP_EOL;
91 94
                     break;
92 95
 
Please login to merge, or discard this patch.
core/extensions/helpers/tag.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     public static function getAttrs($params)
44 44
     {
45
-        if(!is_array($params))return (string)$params;
45
+        if (!is_array($params))return (string) $params;
46 46
         $data = '';
47 47
         foreach ($params as $k => $v) {
48 48
             $data .= " $k=\"$v\"";
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@
 block discarded – undo
42 42
      */
43 43
     public static function getAttrs($params)
44 44
     {
45
-        if(!is_array($params))return (string)$params;
45
+        if(!is_array($params)) {
46
+            return (string)$params;
47
+        }
46 48
         $data = '';
47 49
         foreach ($params as $k => $v) {
48 50
             $data .= " $k=\"$v\"";
Please login to merge, or discard this patch.
core/extensions/helpers/css.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      *
32 32
      * @var array
33 33
      * */
34
-    protected static $_dependencies  = array();
34
+    protected static $_dependencies = array();
35 35
     
36 36
     /**
37 37
      * Css
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param string $file nombre del archivo a añadir
54 54
      * @param array $dependencies  archivos que son requisito del archivo a añadir
55 55
      */
56
-    public static function add( $file, array $dependencies = [] )
56
+    public static function add($file, array $dependencies = [])
57 57
     {
58 58
         self::$_css[$file] = $file;
59 59
         foreach ($dependencies  as $file) self::$_dependencies [$file] = $file;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public static function inc()
68 68
     {
69
-        $css = self::$_dependencies  + self::$_css;
69
+        $css = self::$_dependencies + self::$_css;
70 70
         $html = '';
71 71
         foreach ($css as $file)
72 72
         {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,9 @@
 block discarded – undo
56 56
     public static function add( $file, array $dependencies = [] )
57 57
     {
58 58
         self::$_css[$file] = $file;
59
-        foreach ($dependencies  as $file) self::$_dependencies [$file] = $file;
59
+        foreach ($dependencies  as $file) {
60
+            self::$_dependencies [$file] = $file;
61
+        }
60 62
     }
61 63
     
62 64
     /**
Please login to merge, or discard this patch.
core/extensions/helpers/ajax.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param string $class
127 127
      * @param string|array $attrs
128 128
      */
129
-    public static function dbSelect($field, $show, $data, $update, $action, $blank=null, $class = '', $attrs = '')
129
+    public static function dbSelect($field, $show, $data, $update, $action, $blank = null, $class = '', $attrs = '')
130 130
     {
131 131
         $attrs = Tag::getAttrs($attrs);
132 132
         // ruta a la accion
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public static function form($update, $action = '', $class = '', $method = 'post', $attrs = '')
150 150
     {
151
-        $attrs = "class=\"js-remote $class\" data-to=\"$update\" ".Tag::getAttrs($attrs);
151
+        $attrs = "class=\"js-remote $class\" data-to=\"$update\" " . Tag::getAttrs($attrs);
152 152
         return Form::open($action, $method, $attrs);
153 153
     }
154 154
 
Please login to merge, or discard this patch.
default/app/libs/scaffold_controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     /** @var string Nombre del modelo en CamelCase */
14 14
     public $model = '';
15 15
 
16
-    public function index($page=1)
16
+    public function index($page = 1)
17 17
     {
18 18
         $this->data = (new $this->model)->paginate("page: $page", 'order: id desc');
19 19
     }
Please login to merge, or discard this patch.
default/app/libs/active_record.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 /**
3 3
  * @see KumbiaActiveRecord
4 4
  */
5
-require_once CORE_PATH.'libs/kumbia_active_record/kumbia_active_record.php';
5
+require_once CORE_PATH . 'libs/kumbia_active_record/kumbia_active_record.php';
6 6
 
7 7
 /**
8 8
  * ActiveRecord
Please login to merge, or discard this patch.
default/app/controllers/pages_controller.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         $this->limit_params = false;
34 34
         // Si es AJAX enviar solo el view
35 35
         if (Input::isAjax()) {
36
-          View::template(null);
36
+            View::template(null);
37 37
         }
38 38
     }
39 39
 
Please login to merge, or discard this patch.