@@ -67,8 +67,10 @@ |
||
67 | 67 | $name = $ui->getAttribute('user_fullname'); |
68 | 68 | if ($name): |
69 | 69 | echo $name; |
70 | - else : |
|
70 | + else { |
|
71 | + : |
|
71 | 72 | echo $ownerName; |
73 | + } |
|
72 | 74 | endif; |
73 | 75 | ?> |
74 | 76 | </div><br> |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /** |
4 | 6 | * Breadcrumb helper |
@@ -241,9 +243,11 @@ discard block |
||
241 | 243 | $segment .= $uri_array_original[$i].'/'; |
242 | 244 | |
243 | 245 | // If replace value is an array |
244 | - if (! in_array($i, $skip_key, TRUE) && is_array($value)) // Skip link if replace value is null |
|
246 | + if (! in_array($i, $skip_key, TRUE) && is_array($value)) { |
|
247 | + // Skip link if replace value is null |
|
245 | 248 | { |
246 | 249 | $number_added_value_array = count($value); |
250 | + } |
|
247 | 251 | |
248 | 252 | foreach ($value as $pair_values) |
249 | 253 | { |
@@ -253,8 +257,7 @@ discard block |
||
253 | 257 | if ($number_pv_array == 1) |
254 | 258 | { |
255 | 259 | $val_name = $pv_array[0]; |
256 | - } |
|
257 | - else |
|
260 | + } else |
|
258 | 261 | { |
259 | 262 | $val_name = $pv_array[1]; |
260 | 263 | } |
@@ -292,12 +295,10 @@ discard block |
||
292 | 295 | if ($number_pv_array == 1 || $val_url == $uri_array_original[$i]) |
293 | 296 | { |
294 | 297 | $new_segment_url = $segment; |
295 | - } |
|
296 | - else if ($val_url[0] == '/') |
|
298 | + } else if ($val_url[0] == '/') |
|
297 | 299 | { |
298 | 300 | $new_segment_url = base_url().substr($val_url, 1); |
299 | - } |
|
300 | - else |
|
301 | + } else |
|
301 | 302 | { |
302 | 303 | $new_segment_url = $segment.$val_url; |
303 | 304 | } |
@@ -305,14 +306,15 @@ discard block |
||
305 | 306 | $str_link[] = $new_segment_url; |
306 | 307 | $str_name[] = ucwords($val_name); |
307 | 308 | } |
308 | - } |
|
309 | - else if (! in_array($i, $skip_key, TRUE)) // If value is NOT an array |
|
309 | + } else if (! in_array($i, $skip_key, TRUE)) { |
|
310 | + // If value is NOT an array |
|
310 | 311 | { |
311 | 312 | // Add multilanguage |
312 | 313 | if ($CI->config->item('multilang')) |
313 | 314 | { |
314 | 315 | if ($CI->lang->line($value)) { |
315 | 316 | $value = ucwords($CI->lang->line($value)); |
317 | + } |
|
316 | 318 | } |
317 | 319 | } |
318 | 320 |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | function get_list() |
49 | 49 | { |
50 | - if($this->table_name === null) |
|
51 | - return false; |
|
50 | + if($this->table_name === null) { |
|
51 | + return false; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | $select = "`{$this->table_name}`.*"; |
54 | 55 | |
@@ -65,14 +66,14 @@ discard block |
||
65 | 66 | { |
66 | 67 | $related_field_title = str_replace(" "," ",$related_field_title); |
67 | 68 | $select .= ", CONCAT('".str_replace(array('{','}'),array("',COALESCE({$unique_join_name}.",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $unique_field_name"; |
68 | - } |
|
69 | - else |
|
69 | + } else |
|
70 | 70 | { |
71 | 71 | $select .= ", $unique_join_name.$related_field_title AS $unique_field_name"; |
72 | 72 | } |
73 | 73 | |
74 | - if($this->field_exists($related_field_title)) |
|
75 | - $select .= ", `{$this->table_name}`.$related_field_title AS '{$this->table_name}.$related_field_title'"; |
|
74 | + if($this->field_exists($related_field_title)) { |
|
75 | + $select .= ", `{$this->table_name}`.$related_field_title AS '{$this->table_name}.$related_field_title'"; |
|
76 | + } |
|
76 | 77 | } |
77 | 78 | } |
78 | 79 | |
@@ -120,8 +121,7 @@ discard block |
||
120 | 121 | { |
121 | 122 | $title_field_selection_table = str_replace(" ", " ", $title_field_selection_table); |
122 | 123 | $field .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$title_field_selection_table))."')"; |
123 | - } |
|
124 | - else |
|
124 | + } else |
|
125 | 125 | { |
126 | 126 | $field .= "$selection_table.$title_field_selection_table"; |
127 | 127 | } |
@@ -191,8 +191,9 @@ discard block |
||
191 | 191 | |
192 | 192 | function set_basic_table($table_name = null) |
193 | 193 | { |
194 | - if( !($this->db->table_exists($table_name)) ) |
|
195 | - return false; |
|
194 | + if( !($this->db->table_exists($table_name)) ) { |
|
195 | + return false; |
|
196 | + } |
|
196 | 197 | |
197 | 198 | $this->table_name = $table_name; |
198 | 199 | |
@@ -252,24 +253,27 @@ discard block |
||
252 | 253 | { |
253 | 254 | $related_field_title = str_replace(" ", " ", $related_field_title); |
254 | 255 | $select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash"; |
255 | - } |
|
256 | - else |
|
256 | + } else |
|
257 | 257 | { |
258 | 258 | $select .= "$related_table.$related_field_title as $field_name_hash"; |
259 | 259 | } |
260 | 260 | |
261 | 261 | $this->db->select($select,false); |
262 | - if($where_clause !== null) |
|
263 | - $this->db->where($where_clause); |
|
262 | + if($where_clause !== null) { |
|
263 | + $this->db->where($where_clause); |
|
264 | + } |
|
264 | 265 | |
265 | - if($where_clause !== null) |
|
266 | - $this->db->where($where_clause); |
|
266 | + if($where_clause !== null) { |
|
267 | + $this->db->where($where_clause); |
|
268 | + } |
|
267 | 269 | |
268 | - if($limit !== null) |
|
269 | - $this->db->limit($limit); |
|
270 | + if($limit !== null) { |
|
271 | + $this->db->limit($limit); |
|
272 | + } |
|
270 | 273 | |
271 | - if($search_like !== null) |
|
272 | - $this->db->having("$field_name_hash LIKE '%".$this->db->escape_like_str($search_like)."%'"); |
|
274 | + if($search_like !== null) { |
|
275 | + $this->db->having("$field_name_hash LIKE '%".$this->db->escape_like_str($search_like)."%'"); |
|
276 | + } |
|
273 | 277 | |
274 | 278 | $order_by !== null |
275 | 279 | ? $this->db->order_by($order_by) |
@@ -292,8 +296,9 @@ discard block |
||
292 | 296 | |
293 | 297 | function get_relation_total_rows($field_name , $related_table , $related_field_title, $where_clause) |
294 | 298 | { |
295 | - if($where_clause !== null) |
|
296 | - $this->db->where($where_clause); |
|
299 | + if($where_clause !== null) { |
|
300 | + $this->db->where($where_clause); |
|
301 | + } |
|
297 | 302 | |
298 | 303 | return $this->db->count_all_results($related_table); |
299 | 304 | } |
@@ -308,8 +313,7 @@ discard block |
||
308 | 313 | { |
309 | 314 | $related_field_title = str_replace(" ", " ", $related_field_title); |
310 | 315 | $select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash"; |
311 | - } |
|
312 | - else |
|
316 | + } else |
|
313 | 317 | { |
314 | 318 | $select .= "$related_field_title as $field_name_hash"; |
315 | 319 | } |
@@ -322,8 +326,7 @@ discard block |
||
322 | 326 | if(!$use_template){ |
323 | 327 | $this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}"); |
324 | 328 | } |
325 | - } |
|
326 | - else |
|
329 | + } else |
|
327 | 330 | { |
328 | 331 | $this->db->order_by("{$field_info->relation_table}.{$field_info->priority_field_relation_table}"); |
329 | 332 | } |
@@ -356,8 +359,7 @@ discard block |
||
356 | 359 | { |
357 | 360 | $related_field_title = str_replace(" ", " ", $related_field_title); |
358 | 361 | $select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash"; |
359 | - } |
|
360 | - else |
|
362 | + } else |
|
361 | 363 | { |
362 | 364 | $select .= "$related_field_title as $field_name_hash"; |
363 | 365 | } |
@@ -368,15 +370,17 @@ discard block |
||
368 | 370 | } |
369 | 371 | |
370 | 372 | $selection_primary_key = $this->get_primary_key($field_info->selection_table); |
371 | - if(!$use_template) |
|
372 | - $this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}"); |
|
373 | + if(!$use_template) { |
|
374 | + $this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}"); |
|
375 | + } |
|
373 | 376 | $results = $this->db->get($field_info->selection_table)->result(); |
374 | 377 | |
375 | 378 | $results_array = array(); |
376 | 379 | foreach($results as $row) |
377 | 380 | { |
378 | - if(!isset($selected_values[$row->$selection_primary_key])) |
|
379 | - $results_array[$row->$selection_primary_key] = $row->{$field_name_hash}; |
|
381 | + if(!isset($selected_values[$row->$selection_primary_key])) { |
|
382 | + $results_array[$row->$selection_primary_key] = $row->{$field_name_hash}; |
|
383 | + } |
|
380 | 384 | } |
381 | 385 | |
382 | 386 | return $results_array; |
@@ -385,8 +389,9 @@ discard block |
||
385 | 389 | function db_relation_n_n_update($field_info, $post_data ,$main_primary_key) |
386 | 390 | { |
387 | 391 | $this->db->where($field_info->primary_key_alias_to_this_table, $main_primary_key); |
388 | - if(!empty($post_data)) |
|
389 | - $this->db->where_not_in($field_info->primary_key_alias_to_selection_table , $post_data); |
|
392 | + if(!empty($post_data)) { |
|
393 | + $this->db->where_not_in($field_info->primary_key_alias_to_selection_table , $post_data); |
|
394 | + } |
|
390 | 395 | $this->db->delete($field_info->relation_table); |
391 | 396 | |
392 | 397 | $counter = 0; |
@@ -404,12 +409,13 @@ discard block |
||
404 | 409 | |
405 | 410 | if($count == 0) |
406 | 411 | { |
407 | - if(!empty($field_info->priority_field_relation_table)) |
|
408 | - $where_array[$field_info->priority_field_relation_table] = $counter; |
|
412 | + if(!empty($field_info->priority_field_relation_table)) { |
|
413 | + $where_array[$field_info->priority_field_relation_table] = $counter; |
|
414 | + } |
|
409 | 415 | |
410 | 416 | $this->db->insert($field_info->relation_table, $where_array); |
411 | 417 | |
412 | - }elseif($count >= 1 && !empty($field_info->priority_field_relation_table)) |
|
418 | + } elseif($count >= 1 && !empty($field_info->priority_field_relation_table)) |
|
413 | 419 | { |
414 | 420 | $this->db->update( $field_info->relation_table, array($field_info->priority_field_relation_table => $counter) , $where_array); |
415 | 421 | } |
@@ -438,14 +444,12 @@ discard block |
||
438 | 444 | if(substr($type[1],-1) == ')') |
439 | 445 | { |
440 | 446 | $length = substr($type[1],0,-1); |
441 | - } |
|
442 | - else |
|
447 | + } else |
|
443 | 448 | { |
444 | 449 | list($length) = explode(" ",$type[1]); |
445 | 450 | $length = substr($length,0,-1); |
446 | 451 | } |
447 | - } |
|
448 | - else |
|
452 | + } else |
|
449 | 453 | { |
450 | 454 | $length = ''; |
451 | 455 | } |
@@ -492,15 +496,17 @@ discard block |
||
492 | 496 | { |
493 | 497 | $primary_key_field = $this->get_primary_key(); |
494 | 498 | |
495 | - if($primary_key_field === false) |
|
496 | - return false; |
|
499 | + if($primary_key_field === false) { |
|
500 | + return false; |
|
501 | + } |
|
497 | 502 | |
498 | 503 | $this->db->limit(1); |
499 | 504 | $this->db->delete($this->table_name,array( $primary_key_field => $primary_key_value)); |
500 | - if( $this->db->affected_rows() != 1) |
|
501 | - return false; |
|
502 | - else |
|
503 | - return true; |
|
505 | + if( $this->db->affected_rows() != 1) { |
|
506 | + return false; |
|
507 | + } else { |
|
508 | + return true; |
|
509 | + } |
|
504 | 510 | } |
505 | 511 | |
506 | 512 | function db_file_delete($field_name, $filename) |
@@ -508,8 +514,7 @@ discard block |
||
508 | 514 | if( $this->db->update($this->table_name,array($field_name => ''),array($field_name => $filename)) ) |
509 | 515 | { |
510 | 516 | return true; |
511 | - } |
|
512 | - else |
|
517 | + } else |
|
513 | 518 | { |
514 | 519 | return false; |
515 | 520 | } |
@@ -546,13 +551,11 @@ discard block |
||
546 | 551 | } |
547 | 552 | |
548 | 553 | return false; |
549 | - } |
|
550 | - else |
|
554 | + } else |
|
551 | 555 | { |
552 | 556 | return $this->primary_key; |
553 | 557 | } |
554 | - } |
|
555 | - else |
|
558 | + } else |
|
556 | 559 | { |
557 | 560 | if(isset($this->primary_keys[$table_name])) |
558 | 561 | { |
@@ -73,8 +73,9 @@ |
||
73 | 73 | ldap_sort($ldap, $result, "sn"); |
74 | 74 | $info = ldap_get_entries($ldap, $result); |
75 | 75 | for ($i = 0; $i < $info["count"]; $i++) { |
76 | - if ($info['count'] > 1) |
|
77 | - break; |
|
76 | + if ($info['count'] > 1) { |
|
77 | + break; |
|
78 | + } |
|
78 | 79 | |
79 | 80 | //clean |
80 | 81 | $groups = $info[$i]["memberof"]; |
@@ -16,8 +16,9 @@ |
||
16 | 16 | // specify the LDAP server to connect to |
17 | 17 | $conn = ldap_connect($this->config->item('ldapserver')) or die("Oh no can't create LDAP connection"); |
18 | 18 | // bind to the LDAP server specified above |
19 | - if (!ldap_bind($conn, $this->config->item('ldapbindun'),"@".$this->config->item('ldapdomain'), $this->config->item('ldapbindpass'))) |
|
20 | - echo "Invalid credentials."; |
|
19 | + if (!ldap_bind($conn, $this->config->item('ldapbindun'),"@".$this->config->item('ldapdomain'), $this->config->item('ldapbindpass'))) { |
|
20 | + echo "Invalid credentials."; |
|
21 | + } |
|
21 | 22 | // Search for user in directory |
22 | 23 | $cred = explode('\\', $username); |
23 | 24 | list($domain, $user) = $cred; |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | if (isset($this->relation[$field_info->name])) { |
62 | 62 | $field_info->crud_type = "relation_".$field_type->type; |
63 | - } |
|
64 | - elseif (isset($this->upload_fields[$field_info->name])) { |
|
63 | + } elseif (isset($this->upload_fields[$field_info->name])) { |
|
65 | 64 | $field_info->crud_type = "upload_file_".$field_type->type; |
66 | 65 | } else { |
67 | 66 | $field_info->crud_type = $field_type->type; |
@@ -69,18 +68,15 @@ discard block |
||
69 | 68 | } |
70 | 69 | |
71 | 70 | $real_type = $field_info->crud_type; |
72 | - } |
|
73 | - elseif(isset($this->relation[$field_info->name])) |
|
71 | + } elseif(isset($this->relation[$field_info->name])) |
|
74 | 72 | { |
75 | 73 | $real_type = 'relation'; |
76 | 74 | $field_info->crud_type = 'relation'; |
77 | - } |
|
78 | - elseif(isset($this->upload_fields[$field_info->name])) |
|
75 | + } elseif(isset($this->upload_fields[$field_info->name])) |
|
79 | 76 | { |
80 | 77 | $real_type = 'upload_file'; |
81 | 78 | $field_info->crud_type = 'upload_file'; |
82 | - } |
|
83 | - else |
|
79 | + } else |
|
84 | 80 | { |
85 | 81 | $real_type = $this->get_type($field_info); |
86 | 82 | $field_info->crud_type = $real_type; |
@@ -88,10 +84,11 @@ discard block |
||
88 | 84 | |
89 | 85 | switch ($real_type) { |
90 | 86 | case 'text': |
91 | - if(!empty($this->unset_texteditor) && in_array($field_info->name,$this->unset_texteditor)) |
|
92 | - $field_info->extras = false; |
|
93 | - else |
|
94 | - $field_info->extras = 'text_editor'; |
|
87 | + if(!empty($this->unset_texteditor) && in_array($field_info->name,$this->unset_texteditor)) { |
|
88 | + $field_info->extras = false; |
|
89 | + } else { |
|
90 | + $field_info->extras = 'text_editor'; |
|
91 | + } |
|
95 | 92 | break; |
96 | 93 | |
97 | 94 | case 'relation': |
@@ -105,8 +102,9 @@ discard block |
||
105 | 102 | break; |
106 | 103 | |
107 | 104 | default: |
108 | - if(empty($field_info->extras)) |
|
109 | - $field_info->extras = false; |
|
105 | + if(empty($field_info->extras)) { |
|
106 | + $field_info->extras = false; |
|
107 | + } |
|
110 | 108 | break; |
111 | 109 | } |
112 | 110 | |
@@ -135,14 +133,17 @@ discard block |
||
135 | 133 | } |
136 | 134 | } |
137 | 135 | |
138 | - if(!empty($this->add_fields)) |
|
139 | - foreach($this->add_fields as $field_object) |
|
136 | + if(!empty($this->add_fields)) { |
|
137 | + foreach($this->add_fields as $field_object) |
|
140 | 138 | { |
141 | 139 | $field_name = isset($field_object->field_name) ? $field_object->field_name : $field_object; |
140 | + } |
|
142 | 141 | |
143 | - if(!isset($types[$field_name]))//Doesn't exist in the database? Create it for the CRUD |
|
142 | + if(!isset($types[$field_name])) { |
|
143 | + //Doesn't exist in the database? Create it for the CRUD |
|
144 | 144 | { |
145 | 145 | $extras = false; |
146 | + } |
|
146 | 147 | if($this->change_field_type !== null && isset($this->change_field_type[$field_name])) |
147 | 148 | { |
148 | 149 | $field_type = $this->change_field_type[$field_name]; |
@@ -165,14 +166,17 @@ discard block |
||
165 | 166 | } |
166 | 167 | } |
167 | 168 | |
168 | - if(!empty($this->edit_fields)) |
|
169 | - foreach($this->edit_fields as $field_object) |
|
169 | + if(!empty($this->edit_fields)) { |
|
170 | + foreach($this->edit_fields as $field_object) |
|
170 | 171 | { |
171 | 172 | $field_name = isset($field_object->field_name) ? $field_object->field_name : $field_object; |
173 | + } |
|
172 | 174 | |
173 | - if(!isset($types[$field_name]))//Doesn't exist in the database? Create it for the CRUD |
|
175 | + if(!isset($types[$field_name])) { |
|
176 | + //Doesn't exist in the database? Create it for the CRUD |
|
174 | 177 | { |
175 | 178 | $extras = false; |
179 | + } |
|
176 | 180 | if($this->change_field_type !== null && isset($this->change_field_type[$field_name])) |
177 | 181 | { |
178 | 182 | $field_type = $this->change_field_type[$field_name]; |
@@ -244,8 +248,7 @@ discard block |
||
244 | 248 | * $this->get_integer_input |
245 | 249 | * */ |
246 | 250 | $field_info->input = $this->{"get_".$real_type."_input"}($field_info,$value); |
247 | - } |
|
248 | - else |
|
251 | + } else |
|
249 | 252 | { |
250 | 253 | $field_info->input = $this->get_string_input($field_info,$value); |
251 | 254 | } |
@@ -282,8 +285,7 @@ discard block |
||
282 | 285 | list($year,$month,$day) = explode("-",$value); |
283 | 286 | |
284 | 287 | $value = date($this->php_date_format, mktime (0, 0, 0, (int)$month , (int)$day , (int)$year)); |
285 | - } |
|
286 | - else |
|
288 | + } else |
|
287 | 289 | { |
288 | 290 | $value = ''; |
289 | 291 | } |
@@ -295,8 +297,7 @@ discard block |
||
295 | 297 | list($hours,$minutes) = explode(":",substr($value,11)); |
296 | 298 | |
297 | 299 | $value = date($this->php_date_format." - H:i", mktime ((int)$hours , (int)$minutes , 0, (int)$month , (int)$day ,(int)$year)); |
298 | - } |
|
299 | - else |
|
300 | + } else |
|
300 | 301 | { |
301 | 302 | $value = ''; |
302 | 303 | } |
@@ -330,8 +331,7 @@ discard block |
||
330 | 331 | if(empty($value)) |
331 | 332 | { |
332 | 333 | $value = ""; |
333 | - } |
|
334 | - else |
|
334 | + } else |
|
335 | 335 | { |
336 | 336 | $is_image = !empty($value) && |
337 | 337 | ( substr($value,-4) == '.jpg' |
@@ -347,8 +347,7 @@ discard block |
||
347 | 347 | if($is_image) |
348 | 348 | { |
349 | 349 | $file_url_anchor .= ' class="image-thumbnail"><img src="'.$file_url.'" height="50px">'; |
350 | - } |
|
351 | - else |
|
350 | + } else |
|
352 | 351 | { |
353 | 352 | $file_url_anchor .= ' target="_blank">'.$this->character_limiter($value,$this->character_limiter,'...',true); |
354 | 353 | } |
@@ -418,24 +417,27 @@ discard block |
||
418 | 417 | case 'tinyint': |
419 | 418 | case 'mediumint': |
420 | 419 | case 'longint': |
421 | - if( $db_type->db_type == 'tinyint' && $db_type->db_max_length == 1) |
|
422 | - $type = 'true_false'; |
|
423 | - else |
|
424 | - $type = 'integer'; |
|
420 | + if( $db_type->db_type == 'tinyint' && $db_type->db_max_length == 1) { |
|
421 | + $type = 'true_false'; |
|
422 | + } else { |
|
423 | + $type = 'integer'; |
|
424 | + } |
|
425 | 425 | break; |
426 | 426 | case '254': |
427 | 427 | case 'string': |
428 | 428 | case 'enum': |
429 | - if($db_type->db_type != 'enum') |
|
430 | - $type = 'string'; |
|
431 | - else |
|
432 | - $type = 'enum'; |
|
429 | + if($db_type->db_type != 'enum') { |
|
430 | + $type = 'string'; |
|
431 | + } else { |
|
432 | + $type = 'enum'; |
|
433 | + } |
|
433 | 434 | break; |
434 | 435 | case 'set': |
435 | - if($db_type->db_type != 'set') |
|
436 | - $type = 'string'; |
|
437 | - else |
|
438 | - $type = 'set'; |
|
436 | + if($db_type->db_type != 'set') { |
|
437 | + $type = 'string'; |
|
438 | + } else { |
|
439 | + $type = 'set'; |
|
440 | + } |
|
439 | 441 | break; |
440 | 442 | case '252': |
441 | 443 | case 'blob': |
@@ -488,33 +490,40 @@ discard block |
||
488 | 490 | |
489 | 491 | protected function get_total_results() |
490 | 492 | { |
491 | - if(!empty($this->where)) |
|
492 | - foreach($this->where as $where) |
|
493 | + if(!empty($this->where)) { |
|
494 | + foreach($this->where as $where) |
|
493 | 495 | $this->basic_model->where($where[0],$where[1],$where[2]); |
496 | + } |
|
494 | 497 | |
495 | - if(!empty($this->or_where)) |
|
496 | - foreach($this->or_where as $or_where) |
|
498 | + if(!empty($this->or_where)) { |
|
499 | + foreach($this->or_where as $or_where) |
|
497 | 500 | $this->basic_model->or_where($or_where[0],$or_where[1],$or_where[2]); |
501 | + } |
|
498 | 502 | |
499 | - if(!empty($this->like)) |
|
500 | - foreach($this->like as $like) |
|
503 | + if(!empty($this->like)) { |
|
504 | + foreach($this->like as $like) |
|
501 | 505 | $this->basic_model->like($like[0],$like[1],$like[2]); |
506 | + } |
|
502 | 507 | |
503 | - if(!empty($this->or_like)) |
|
504 | - foreach($this->or_like as $or_like) |
|
508 | + if(!empty($this->or_like)) { |
|
509 | + foreach($this->or_like as $or_like) |
|
505 | 510 | $this->basic_model->or_like($or_like[0],$or_like[1],$or_like[2]); |
511 | + } |
|
506 | 512 | |
507 | - if(!empty($this->having)) |
|
508 | - foreach($this->having as $having) |
|
513 | + if(!empty($this->having)) { |
|
514 | + foreach($this->having as $having) |
|
509 | 515 | $this->basic_model->having($having[0],$having[1],$having[2]); |
516 | + } |
|
510 | 517 | |
511 | - if(!empty($this->or_having)) |
|
512 | - foreach($this->or_having as $or_having) |
|
518 | + if(!empty($this->or_having)) { |
|
519 | + foreach($this->or_having as $or_having) |
|
513 | 520 | $this->basic_model->or_having($or_having[0],$or_having[1],$or_having[2]); |
521 | + } |
|
514 | 522 | |
515 | - if(!empty($this->relation)) |
|
516 | - foreach($this->relation as $relation) |
|
523 | + if(!empty($this->relation)) { |
|
524 | + foreach($this->relation as $relation) |
|
517 | 525 | $this->basic_model->join_relation($relation[0],$relation[1],$relation[2]); |
526 | + } |
|
518 | 527 | |
519 | 528 | if(!empty($this->relation_n_n)) |
520 | 529 | { |
@@ -555,9 +564,9 @@ discard block |
||
555 | 564 | { |
556 | 565 | if(!empty($state_info->per_page)) |
557 | 566 | { |
558 | - if(empty($state_info->page) || !is_numeric($state_info->page) ) |
|
559 | - $this->limit($state_info->per_page); |
|
560 | - else |
|
567 | + if(empty($state_info->page) || !is_numeric($state_info->page) ) { |
|
568 | + $this->limit($state_info->per_page); |
|
569 | + } else |
|
561 | 570 | { |
562 | 571 | $limit_page = ( ($state_info->page-1) * $state_info->per_page ); |
563 | 572 | $this->limit($state_info->per_page, $limit_page); |
@@ -614,16 +623,16 @@ discard block |
||
614 | 623 | } else { |
615 | 624 | $this->like($state_info->search->field , $state_info->search->text); |
616 | 625 | } |
617 | - } |
|
618 | - else |
|
626 | + } else |
|
619 | 627 | { |
620 | 628 | $columns = $this->get_columns(); |
621 | 629 | |
622 | 630 | $search_text = $state_info->search->text; |
623 | 631 | |
624 | - if(!empty($this->where)) |
|
625 | - foreach($this->where as $where) |
|
632 | + if(!empty($this->where)) { |
|
633 | + foreach($this->where as $where) |
|
626 | 634 | $this->basic_model->having($where[0],$where[1],$where[2]); |
635 | + } |
|
627 | 636 | |
628 | 637 | foreach($columns as $column) |
629 | 638 | { |
@@ -635,17 +644,14 @@ discard block |
||
635 | 644 | { |
636 | 645 | $this->or_like($search_field, $search_text); |
637 | 646 | } |
638 | - } |
|
639 | - else |
|
647 | + } else |
|
640 | 648 | { |
641 | 649 | $this->or_like($temp_relation[$column->field_name], $search_text); |
642 | 650 | } |
643 | - } |
|
644 | - elseif(isset($this->relation_n_n[$column->field_name])) |
|
651 | + } elseif(isset($this->relation_n_n[$column->field_name])) |
|
645 | 652 | { |
646 | 653 | //@todo have a where for the relation_n_n statement |
647 | - } |
|
648 | - else |
|
654 | + } else |
|
649 | 655 | { |
650 | 656 | $this->or_like($column->field_name, $search_text); |
651 | 657 | } |
@@ -656,8 +662,9 @@ discard block |
||
656 | 662 | |
657 | 663 | protected function table_exists($table_name = null) |
658 | 664 | { |
659 | - if($this->basic_model->db_table_exists($table_name)) |
|
660 | - return true; |
|
665 | + if($this->basic_model->db_table_exists($table_name)) { |
|
666 | + return true; |
|
667 | + } |
|
661 | 668 | return false; |
662 | 669 | } |
663 | 670 | |
@@ -753,14 +760,12 @@ discard block |
||
753 | 760 | if($form_validation->run()) |
754 | 761 | { |
755 | 762 | $validation_result->success = true; |
756 | - } |
|
757 | - else |
|
763 | + } else |
|
758 | 764 | { |
759 | 765 | $validation_result->error_message = $form_validation->error_string(); |
760 | 766 | $validation_result->error_fields = $form_validation->_error_array; |
761 | 767 | } |
762 | - } |
|
763 | - else |
|
768 | + } else |
|
764 | 769 | { |
765 | 770 | $validation_result->success = true; |
766 | 771 | } |
@@ -868,14 +873,12 @@ discard block |
||
868 | 873 | if($form_validation->run()) |
869 | 874 | { |
870 | 875 | $validation_result->success = true; |
871 | - } |
|
872 | - else |
|
876 | + } else |
|
873 | 877 | { |
874 | 878 | $validation_result->error_message = $form_validation->error_string(); |
875 | 879 | $validation_result->error_fields = $form_validation->_error_array; |
876 | 880 | } |
877 | - } |
|
878 | - else |
|
881 | + } else |
|
879 | 882 | { |
880 | 883 | $validation_result->success = true; |
881 | 884 | } |
@@ -899,10 +902,11 @@ discard block |
||
899 | 902 | { |
900 | 903 | $callback_return = call_user_func($this->callback_before_insert, $post_data); |
901 | 904 | |
902 | - if(!empty($callback_return) && is_array($callback_return)) |
|
903 | - $post_data = $callback_return; |
|
904 | - elseif($callback_return === false) |
|
905 | - return false; |
|
905 | + if(!empty($callback_return) && is_array($callback_return)) { |
|
906 | + $post_data = $callback_return; |
|
907 | + } elseif($callback_return === false) { |
|
908 | + return false; |
|
909 | + } |
|
906 | 910 | } |
907 | 911 | |
908 | 912 | $insert_data = array(); |
@@ -920,28 +924,22 @@ discard block |
||
920 | 924 | if(isset($types[$field->field_name]->db_null) && $types[$field->field_name]->db_null && is_array($post_data[$field->field_name]) && empty($post_data[$field->field_name])) |
921 | 925 | { |
922 | 926 | $insert_data[$field->field_name] = null; |
923 | - } |
|
924 | - elseif(isset($types[$field->field_name]->db_null) && $types[$field->field_name]->db_null && $post_data[$field->field_name] === '') |
|
927 | + } elseif(isset($types[$field->field_name]->db_null) && $types[$field->field_name]->db_null && $post_data[$field->field_name] === '') |
|
925 | 928 | { |
926 | 929 | $insert_data[$field->field_name] = null; |
927 | - } |
|
928 | - elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'date') |
|
930 | + } elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'date') |
|
929 | 931 | { |
930 | 932 | $insert_data[$field->field_name] = $this->_convert_date_to_sql_date($post_data[$field->field_name]); |
931 | - } |
|
932 | - elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'readonly') |
|
933 | + } elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'readonly') |
|
933 | 934 | { |
934 | 935 | //This empty if statement is to make sure that a readonly field will never inserted/updated |
935 | - } |
|
936 | - elseif(isset($types[$field->field_name]->crud_type) && ($types[$field->field_name]->crud_type == 'set' || $types[$field->field_name]->crud_type == 'multiselect')) |
|
936 | + } elseif(isset($types[$field->field_name]->crud_type) && ($types[$field->field_name]->crud_type == 'set' || $types[$field->field_name]->crud_type == 'multiselect')) |
|
937 | 937 | { |
938 | 938 | $insert_data[$field->field_name] = !empty($post_data[$field->field_name]) ? implode(',',$post_data[$field->field_name]) : ''; |
939 | - } |
|
940 | - elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'datetime'){ |
|
939 | + } elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'datetime'){ |
|
941 | 940 | $insert_data[$field->field_name] = $this->_convert_date_to_sql_date(substr($post_data[$field->field_name],0,10)). |
942 | 941 | substr($post_data[$field->field_name],10); |
943 | - } |
|
944 | - else |
|
942 | + } else |
|
945 | 943 | { |
946 | 944 | $insert_data[$field->field_name] = $post_data[$field->field_name]; |
947 | 945 | } |
@@ -953,8 +951,7 @@ discard block |
||
953 | 951 | if($insert_result !== false) |
954 | 952 | { |
955 | 953 | $insert_primary_key = $insert_result; |
956 | - } |
|
957 | - else |
|
954 | + } else |
|
958 | 955 | { |
959 | 956 | return false; |
960 | 957 | } |
@@ -978,7 +975,7 @@ discard block |
||
978 | 975 | } |
979 | 976 | |
980 | 977 | } |
981 | - }else |
|
978 | + } else |
|
982 | 979 | { |
983 | 980 | $callback_return = call_user_func($this->callback_insert, $post_data); |
984 | 981 | |
@@ -988,10 +985,11 @@ discard block |
||
988 | 985 | } |
989 | 986 | } |
990 | 987 | |
991 | - if(isset($insert_primary_key)) |
|
992 | - return $insert_primary_key; |
|
993 | - else |
|
994 | - return true; |
|
988 | + if(isset($insert_primary_key)) { |
|
989 | + return $insert_primary_key; |
|
990 | + } else { |
|
991 | + return true; |
|
992 | + } |
|
995 | 993 | } |
996 | 994 | |
997 | 995 | return false; |
@@ -1018,8 +1016,7 @@ discard block |
||
1018 | 1016 | if(!empty($callback_return) && is_array($callback_return)) |
1019 | 1017 | { |
1020 | 1018 | $post_data = $callback_return; |
1021 | - } |
|
1022 | - elseif($callback_return === false) |
|
1019 | + } elseif($callback_return === false) |
|
1023 | 1020 | { |
1024 | 1021 | return false; |
1025 | 1022 | } |
@@ -1041,28 +1038,22 @@ discard block |
||
1041 | 1038 | if(isset($types[$field->field_name]->db_null) && $types[$field->field_name]->db_null && is_array($post_data[$field->field_name]) && empty($post_data[$field->field_name])) |
1042 | 1039 | { |
1043 | 1040 | $update_data[$field->field_name] = null; |
1044 | - } |
|
1045 | - elseif(isset($types[$field->field_name]->db_null) && $types[$field->field_name]->db_null && $post_data[$field->field_name] === '') |
|
1041 | + } elseif(isset($types[$field->field_name]->db_null) && $types[$field->field_name]->db_null && $post_data[$field->field_name] === '') |
|
1046 | 1042 | { |
1047 | 1043 | $update_data[$field->field_name] = null; |
1048 | - } |
|
1049 | - elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'date') |
|
1044 | + } elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'date') |
|
1050 | 1045 | { |
1051 | 1046 | $update_data[$field->field_name] = $this->_convert_date_to_sql_date($post_data[$field->field_name]); |
1052 | - } |
|
1053 | - elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'readonly') |
|
1047 | + } elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'readonly') |
|
1054 | 1048 | { |
1055 | 1049 | //This empty if statement is to make sure that a readonly field will never inserted/updated |
1056 | - } |
|
1057 | - elseif(isset($types[$field->field_name]->crud_type) && ($types[$field->field_name]->crud_type == 'set' || $types[$field->field_name]->crud_type == 'multiselect')) |
|
1050 | + } elseif(isset($types[$field->field_name]->crud_type) && ($types[$field->field_name]->crud_type == 'set' || $types[$field->field_name]->crud_type == 'multiselect')) |
|
1058 | 1051 | { |
1059 | 1052 | $update_data[$field->field_name] = !empty($post_data[$field->field_name]) ? implode(',',$post_data[$field->field_name]) : ''; |
1060 | - } |
|
1061 | - elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'datetime'){ |
|
1053 | + } elseif(isset($types[$field->field_name]->crud_type) && $types[$field->field_name]->crud_type == 'datetime'){ |
|
1062 | 1054 | $update_data[$field->field_name] = $this->_convert_date_to_sql_date(substr($post_data[$field->field_name],0,10)). |
1063 | 1055 | substr($post_data[$field->field_name],10); |
1064 | - } |
|
1065 | - else |
|
1056 | + } else |
|
1066 | 1057 | { |
1067 | 1058 | $update_data[$field->field_name] = $post_data[$field->field_name]; |
1068 | 1059 | } |
@@ -1100,8 +1091,7 @@ discard block |
||
1100 | 1091 | } |
1101 | 1092 | |
1102 | 1093 | } |
1103 | - } |
|
1104 | - else |
|
1094 | + } else |
|
1105 | 1095 | { |
1106 | 1096 | $callback_return = call_user_func($this->callback_update, $post_data, $primary_key); |
1107 | 1097 | |
@@ -1112,8 +1102,7 @@ discard block |
||
1112 | 1102 | } |
1113 | 1103 | |
1114 | 1104 | return true; |
1115 | - } |
|
1116 | - else |
|
1105 | + } else |
|
1117 | 1106 | { |
1118 | 1107 | return false; |
1119 | 1108 | } |
@@ -1126,7 +1115,7 @@ discard block |
||
1126 | 1115 | { |
1127 | 1116 | //If it's already a sql-date don't convert it! |
1128 | 1117 | return $date; |
1129 | - }elseif(empty($date)) |
|
1118 | + } elseif(empty($date)) |
|
1130 | 1119 | { |
1131 | 1120 | return ''; |
1132 | 1121 | } |
@@ -1135,12 +1124,10 @@ discard block |
||
1135 | 1124 | if($this->php_date_format == 'd/m/Y') |
1136 | 1125 | { |
1137 | 1126 | $sql_date = date('Y-m-d',mktime(0,0,0,$date_array[1],$date_array[0],$date_array[2])); |
1138 | - } |
|
1139 | - elseif($this->php_date_format == 'm/d/Y') |
|
1127 | + } elseif($this->php_date_format == 'm/d/Y') |
|
1140 | 1128 | { |
1141 | 1129 | $sql_date = date('Y-m-d',mktime(0,0,0,$date_array[0],$date_array[1],$date_array[2])); |
1142 | - } |
|
1143 | - else |
|
1130 | + } else |
|
1144 | 1131 | { |
1145 | 1132 | $sql_date = $date; |
1146 | 1133 | } |
@@ -1150,17 +1137,18 @@ discard block |
||
1150 | 1137 | |
1151 | 1138 | protected function _get_field_names_to_search(array $relation_values) |
1152 | 1139 | { |
1153 | - if(!strstr($relation_values[2],'{')) |
|
1154 | - return $this->_unique_join_name($relation_values[0]).'.'.$relation_values[2]; |
|
1155 | - else |
|
1140 | + if(!strstr($relation_values[2],'{')) { |
|
1141 | + return $this->_unique_join_name($relation_values[0]).'.'.$relation_values[2]; |
|
1142 | + } else |
|
1156 | 1143 | { |
1157 | 1144 | $relation_values[2] = ' '.$relation_values[2].' '; |
1158 | 1145 | $temp1 = explode('{',$relation_values[2]); |
1159 | 1146 | unset($temp1[0]); |
1160 | 1147 | |
1161 | 1148 | $field_names_array = array(); |
1162 | - foreach($temp1 as $field) |
|
1163 | - list($field_names_array[]) = explode('}',$field); |
|
1149 | + foreach($temp1 as $field) { |
|
1150 | + list($field_names_array[]) = explode('}',$field); |
|
1151 | + } |
|
1164 | 1152 | |
1165 | 1153 | return $field_names_array; |
1166 | 1154 | } |
@@ -1230,8 +1218,7 @@ discard block |
||
1230 | 1218 | } |
1231 | 1219 | |
1232 | 1220 | } |
1233 | - } |
|
1234 | - else |
|
1221 | + } else |
|
1235 | 1222 | { |
1236 | 1223 | $callback_return = call_user_func($this->callback_delete, $primary_key_value); |
1237 | 1224 | |
@@ -1256,36 +1243,44 @@ discard block |
||
1256 | 1243 | |
1257 | 1244 | protected function get_list() |
1258 | 1245 | { |
1259 | - if(!empty($this->order_by)) |
|
1260 | - $this->basic_model->order_by($this->order_by[0],$this->order_by[1]); |
|
1246 | + if(!empty($this->order_by)) { |
|
1247 | + $this->basic_model->order_by($this->order_by[0],$this->order_by[1]); |
|
1248 | + } |
|
1261 | 1249 | |
1262 | - if(!empty($this->where)) |
|
1263 | - foreach($this->where as $where) |
|
1250 | + if(!empty($this->where)) { |
|
1251 | + foreach($this->where as $where) |
|
1264 | 1252 | $this->basic_model->where($where[0],$where[1],$where[2]); |
1253 | + } |
|
1265 | 1254 | |
1266 | - if(!empty($this->or_where)) |
|
1267 | - foreach($this->or_where as $or_where) |
|
1255 | + if(!empty($this->or_where)) { |
|
1256 | + foreach($this->or_where as $or_where) |
|
1268 | 1257 | $this->basic_model->or_where($or_where[0],$or_where[1],$or_where[2]); |
1258 | + } |
|
1269 | 1259 | |
1270 | - if(!empty($this->like)) |
|
1271 | - foreach($this->like as $like) |
|
1260 | + if(!empty($this->like)) { |
|
1261 | + foreach($this->like as $like) |
|
1272 | 1262 | $this->basic_model->like($like[0],$like[1],$like[2]); |
1263 | + } |
|
1273 | 1264 | |
1274 | - if(!empty($this->or_like)) |
|
1275 | - foreach($this->or_like as $or_like) |
|
1265 | + if(!empty($this->or_like)) { |
|
1266 | + foreach($this->or_like as $or_like) |
|
1276 | 1267 | $this->basic_model->or_like($or_like[0],$or_like[1],$or_like[2]); |
1268 | + } |
|
1277 | 1269 | |
1278 | - if(!empty($this->having)) |
|
1279 | - foreach($this->having as $having) |
|
1270 | + if(!empty($this->having)) { |
|
1271 | + foreach($this->having as $having) |
|
1280 | 1272 | $this->basic_model->having($having[0],$having[1],$having[2]); |
1273 | + } |
|
1281 | 1274 | |
1282 | - if(!empty($this->or_having)) |
|
1283 | - foreach($this->or_having as $or_having) |
|
1275 | + if(!empty($this->or_having)) { |
|
1276 | + foreach($this->or_having as $or_having) |
|
1284 | 1277 | $this->basic_model->or_having($or_having[0],$or_having[1],$or_having[2]); |
1278 | + } |
|
1285 | 1279 | |
1286 | - if(!empty($this->relation)) |
|
1287 | - foreach($this->relation as $relation) |
|
1280 | + if(!empty($this->relation)) { |
|
1281 | + foreach($this->relation as $relation) |
|
1288 | 1282 | $this->basic_model->join_relation($relation[0],$relation[1],$relation[2]); |
1283 | + } |
|
1289 | 1284 | |
1290 | 1285 | if(!empty($this->relation_n_n)) |
1291 | 1286 | { |
@@ -1309,13 +1304,11 @@ discard block |
||
1309 | 1304 | if(is_numeric($default_per_page) && $default_per_page >1) |
1310 | 1305 | { |
1311 | 1306 | $this->basic_model->limit($default_per_page); |
1312 | - } |
|
1313 | - else |
|
1307 | + } else |
|
1314 | 1308 | { |
1315 | 1309 | $this->basic_model->limit(10); |
1316 | 1310 | } |
1317 | - } |
|
1318 | - else |
|
1311 | + } else |
|
1319 | 1312 | { |
1320 | 1313 | $this->basic_model->limit($this->limit[0],$this->limit[1]); |
1321 | 1314 | } |
@@ -1366,10 +1359,11 @@ discard block |
||
1366 | 1359 | { |
1367 | 1360 | $callback_before_upload_response = call_user_func($this->callback_before_upload, $_FILES, $this->upload_fields[$state_info->field_name]); |
1368 | 1361 | |
1369 | - if($callback_before_upload_response === false) |
|
1370 | - return false; |
|
1371 | - elseif(is_string($callback_before_upload_response)) |
|
1372 | - return $callback_before_upload_response; |
|
1362 | + if($callback_before_upload_response === false) { |
|
1363 | + return false; |
|
1364 | + } elseif(is_string($callback_before_upload_response)) { |
|
1365 | + return $callback_before_upload_response; |
|
1366 | + } |
|
1373 | 1367 | } |
1374 | 1368 | |
1375 | 1369 | $upload_info = $this->upload_fields[$state_info->field_name]; |
@@ -1387,7 +1381,7 @@ discard block |
||
1387 | 1381 | $reg_exp = ''; |
1388 | 1382 | if(!empty($upload_info->allowed_file_types)){ |
1389 | 1383 | $reg_exp = '/(\\.|\\/)('.$upload_info->allowed_file_types.')$/i'; |
1390 | - }else{ |
|
1384 | + } else{ |
|
1391 | 1385 | $reg_exp = '/(\\.|\\/)('.$allowed_files.')$/i'; |
1392 | 1386 | } |
1393 | 1387 | |
@@ -1418,31 +1412,29 @@ discard block |
||
1418 | 1412 | { |
1419 | 1413 | $callback_after_upload_response = call_user_func($this->callback_after_upload, $uploader_response , $this->upload_fields[$state_info->field_name] , $_FILES ); |
1420 | 1414 | |
1421 | - if($callback_after_upload_response === false) |
|
1422 | - return false; |
|
1423 | - elseif(is_string($callback_after_upload_response)) |
|
1424 | - return $callback_after_upload_response; |
|
1425 | - elseif(is_array($callback_after_upload_response)) |
|
1426 | - $uploader_response = $callback_after_upload_response; |
|
1415 | + if($callback_after_upload_response === false) { |
|
1416 | + return false; |
|
1417 | + } elseif(is_string($callback_after_upload_response)) { |
|
1418 | + return $callback_after_upload_response; |
|
1419 | + } elseif(is_array($callback_after_upload_response)) { |
|
1420 | + $uploader_response = $callback_after_upload_response; |
|
1421 | + } |
|
1427 | 1422 | } |
1428 | 1423 | |
1429 | 1424 | return $uploader_response; |
1430 | - } |
|
1431 | - else |
|
1425 | + } else |
|
1432 | 1426 | { |
1433 | 1427 | $upload_response = call_user_func($this->callback_upload, $_FILES, $this->upload_fields[$state_info->field_name] ); |
1434 | 1428 | |
1435 | 1429 | if($upload_response === false) |
1436 | 1430 | { |
1437 | 1431 | return false; |
1438 | - } |
|
1439 | - else |
|
1432 | + } else |
|
1440 | 1433 | { |
1441 | 1434 | return $upload_response; |
1442 | 1435 | } |
1443 | 1436 | } |
1444 | - } |
|
1445 | - else |
|
1437 | + } else |
|
1446 | 1438 | { |
1447 | 1439 | return false; |
1448 | 1440 | } |
@@ -1462,19 +1454,16 @@ discard block |
||
1462 | 1454 | $this->basic_model->db_file_delete($state_info->field_name, $state_info->file_name); |
1463 | 1455 | |
1464 | 1456 | return true; |
1465 | - } |
|
1466 | - else |
|
1457 | + } else |
|
1467 | 1458 | { |
1468 | 1459 | return false; |
1469 | 1460 | } |
1470 | - } |
|
1471 | - else |
|
1461 | + } else |
|
1472 | 1462 | { |
1473 | 1463 | $this->basic_model->db_file_delete($state_info->field_name, $state_info->file_name); |
1474 | 1464 | return true; |
1475 | 1465 | } |
1476 | - } |
|
1477 | - else |
|
1466 | + } else |
|
1478 | 1467 | { |
1479 | 1468 | return false; |
1480 | 1469 | } |
@@ -1482,8 +1471,9 @@ discard block |
||
1482 | 1471 | |
1483 | 1472 | protected function ajax_relation($state_info) |
1484 | 1473 | { |
1485 | - if(!isset($this->relation[$state_info->field_name])) |
|
1486 | - return false; |
|
1474 | + if(!isset($this->relation[$state_info->field_name])) { |
|
1475 | + return false; |
|
1476 | + } |
|
1487 | 1477 | |
1488 | 1478 | list($field_name, $related_table, $related_field_title, $where_clause, $order_by) = $this->relation[$state_info->field_name]; |
1489 | 1479 | |
@@ -1604,8 +1594,7 @@ discard block |
||
1604 | 1594 | |
1605 | 1595 | $data->list_view = $this->_theme_view('list.php',$data,true); |
1606 | 1596 | $this->_theme_view('list_template.php',$data); |
1607 | - } |
|
1608 | - else |
|
1597 | + } else |
|
1609 | 1598 | { |
1610 | 1599 | $this->set_echo_and_die(); |
1611 | 1600 | $this->_theme_view('list.php',$data); |
@@ -1726,8 +1715,9 @@ discard block |
||
1726 | 1715 | $value = str_replace(array(" ","&",">","<"),array(" ","&",">","<"),$value); |
1727 | 1716 | |
1728 | 1717 | //If the value has only spaces and nothing more then add the whitespace html character |
1729 | - if(str_replace(" ","",$value) == "") |
|
1730 | - $value = " "; |
|
1718 | + if(str_replace(" ","",$value) == "") { |
|
1719 | + $value = " "; |
|
1720 | + } |
|
1731 | 1721 | |
1732 | 1722 | return strip_tags($value); |
1733 | 1723 | } |
@@ -1754,8 +1744,9 @@ discard block |
||
1754 | 1744 | |
1755 | 1745 | protected function change_list_add_actions($list) |
1756 | 1746 | { |
1757 | - if(empty($this->actions)) |
|
1758 | - return $list; |
|
1747 | + if(empty($this->actions)) { |
|
1748 | + return $list; |
|
1749 | + } |
|
1759 | 1750 | |
1760 | 1751 | $primary_key = $this->get_primary_key(); |
1761 | 1752 | |
@@ -1767,8 +1758,7 @@ discard block |
||
1767 | 1758 | if(!empty($action->url_callback)) |
1768 | 1759 | { |
1769 | 1760 | $actions_urls[$unique_id] = call_user_func($action->url_callback, $row->$primary_key, $row); |
1770 | - } |
|
1771 | - else |
|
1761 | + } else |
|
1772 | 1762 | { |
1773 | 1763 | $actions_urls[$unique_id] = |
1774 | 1764 | $action->url_has_http ? |
@@ -1793,12 +1783,13 @@ discard block |
||
1793 | 1783 | { |
1794 | 1784 | $field_name = $column->field_name; |
1795 | 1785 | $field_value = isset( $row->{$column->field_name} ) ? $row->{$column->field_name} : null; |
1796 | - if( $has_callbacks && isset($this->callback_column[$field_name]) ) |
|
1797 | - $list[$num_row]->$field_name = call_user_func($this->callback_column[$field_name], $field_value, $row); |
|
1798 | - elseif(isset($types[$field_name])) |
|
1799 | - $list[$num_row]->$field_name = $this->change_list_value($types[$field_name] , $field_value); |
|
1800 | - else |
|
1801 | - $list[$num_row]->$field_name = $field_value; |
|
1786 | + if( $has_callbacks && isset($this->callback_column[$field_name]) ) { |
|
1787 | + $list[$num_row]->$field_name = call_user_func($this->callback_column[$field_name], $field_value, $row); |
|
1788 | + } elseif(isset($types[$field_name])) { |
|
1789 | + $list[$num_row]->$field_name = $this->change_list_value($types[$field_name] , $field_value); |
|
1790 | + } else { |
|
1791 | + $list[$num_row]->$field_name = $field_value; |
|
1792 | + } |
|
1802 | 1793 | } |
1803 | 1794 | } |
1804 | 1795 | |
@@ -1899,8 +1890,7 @@ discard block |
||
1899 | 1890 | $error_message = '<p>'.$this->l('delete_error_message').'</p>'; |
1900 | 1891 | |
1901 | 1892 | echo json_encode(array('success' => $delete_result ,'error_message' => $error_message)); |
1902 | - } |
|
1903 | - else |
|
1893 | + } else |
|
1904 | 1894 | { |
1905 | 1895 | $success_message = '<p>'.$this->l('delete_success_message').'</p>'; |
1906 | 1896 | |
@@ -1916,13 +1906,11 @@ discard block |
||
1916 | 1906 | if(!empty($field_info->primary_key) && !$this->unset_edit) |
1917 | 1907 | { |
1918 | 1908 | return $this->l('insert_success_message')." <a class='go-to-edit-form' href='".$this->getEditUrl($field_info->primary_key)."'>".$this->l('form_edit')." {$this->subject}</a> "; |
1919 | - } |
|
1920 | - else |
|
1909 | + } else |
|
1921 | 1910 | { |
1922 | 1911 | return $this->l('insert_success_message'); |
1923 | 1912 | } |
1924 | - } |
|
1925 | - else |
|
1913 | + } else |
|
1926 | 1914 | { |
1927 | 1915 | return null; |
1928 | 1916 | } |
@@ -1934,8 +1922,7 @@ discard block |
||
1934 | 1922 | if($insert_result === false) |
1935 | 1923 | { |
1936 | 1924 | echo json_encode(array('success' => false)); |
1937 | - } |
|
1938 | - else |
|
1925 | + } else |
|
1939 | 1926 | { |
1940 | 1927 | $success_message = '<p>'.$this->l('insert_success_message'); |
1941 | 1928 | |
@@ -1982,14 +1969,15 @@ discard block |
||
1982 | 1969 | 'success' => true, |
1983 | 1970 | 'files' => $upload_result |
1984 | 1971 | )); |
1985 | - } |
|
1986 | - else |
|
1972 | + } else |
|
1987 | 1973 | { |
1988 | 1974 | $result = (object)array('success' => false); |
1989 | - if(is_string($upload_result)) |
|
1990 | - $result->message = $upload_result; |
|
1991 | - if(!empty($upload_result[0]->error)) |
|
1992 | - $result->message = $upload_result[0]->error; |
|
1975 | + if(is_string($upload_result)) { |
|
1976 | + $result->message = $upload_result; |
|
1977 | + } |
|
1978 | + if(!empty($upload_result[0]->error)) { |
|
1979 | + $result->message = $upload_result[0]->error; |
|
1980 | + } |
|
1993 | 1981 | |
1994 | 1982 | echo json_encode($result); |
1995 | 1983 | } |
@@ -2003,8 +1991,7 @@ discard block |
||
2003 | 1991 | if($upload_result !== false) |
2004 | 1992 | { |
2005 | 1993 | echo json_encode( (object)array( 'success' => true ) ); |
2006 | - } |
|
2007 | - else |
|
1994 | + } else |
|
2008 | 1995 | { |
2009 | 1996 | echo json_encode((object)array('success' => false)); |
2010 | 1997 | } |
@@ -2146,8 +2133,7 @@ discard block |
||
2146 | 2133 | 'css_files' => $css_files, |
2147 | 2134 | 'output' => $this->views_as_string, |
2148 | 2135 | ); |
2149 | - } |
|
2150 | - elseif($this->echo_and_die === true) |
|
2136 | + } elseif($this->echo_and_die === true) |
|
2151 | 2137 | { |
2152 | 2138 | echo $this->views_as_string; |
2153 | 2139 | die(); |
@@ -2160,8 +2146,7 @@ discard block |
||
2160 | 2146 | if($update_result === false) |
2161 | 2147 | { |
2162 | 2148 | echo json_encode(array('success' => $update_result)); |
2163 | - } |
|
2164 | - else |
|
2149 | + } else |
|
2165 | 2150 | { |
2166 | 2151 | $success_message = '<p>'.$this->l('update_success_message'); |
2167 | 2152 | if(!$this->unset_back_to_list && !$this->_is_ajax()) |
@@ -2185,8 +2170,9 @@ discard block |
||
2185 | 2170 | $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.numeric.min.js'); |
2186 | 2171 | $this->set_js_config($this->default_javascript_path.'/jquery_plugins/config/jquery.numeric.config.js'); |
2187 | 2172 | $extra_attributes = ''; |
2188 | - if(!empty($field_info->db_max_length)) |
|
2189 | - $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; |
|
2173 | + if(!empty($field_info->db_max_length)) { |
|
2174 | + $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; |
|
2175 | + } |
|
2190 | 2176 | $input = "<input id='field-{$field_info->name}' name='{$field_info->name}' type='text' value='$value' class='numeric form-control' $extra_attributes />"; |
2191 | 2177 | return $input; |
2192 | 2178 | } |
@@ -2268,8 +2254,7 @@ discard block |
||
2268 | 2254 | $class_name = $this->config->text_editor_type == 'minimal' ? 'mini-texteditor' : 'texteditor'; |
2269 | 2255 | |
2270 | 2256 | $input = "<textarea id='field-{$field_info->name}' name='{$field_info->name}' class='$class_name' >$value</textarea>"; |
2271 | - } |
|
2272 | - else |
|
2257 | + } else |
|
2273 | 2258 | { |
2274 | 2259 | $input = "<textarea id='field-{$field_info->name}' name='{$field_info->name}'>$value</textarea>"; |
2275 | 2260 | } |
@@ -2309,8 +2294,7 @@ discard block |
||
2309 | 2294 | list($year,$month,$day) = explode('-',substr($value,0,10)); |
2310 | 2295 | $date = date($this->php_date_format, mktime(0,0,0,$month,$day,$year)); |
2311 | 2296 | $datetime = $date.substr($value,10); |
2312 | - } |
|
2313 | - else |
|
2297 | + } else |
|
2314 | 2298 | { |
2315 | 2299 | $datetime = ''; |
2316 | 2300 | } |
@@ -2322,8 +2306,9 @@ discard block |
||
2322 | 2306 | |
2323 | 2307 | protected function get_hidden_input($field_info,$value) |
2324 | 2308 | { |
2325 | - if($field_info->extras !== null && $field_info->extras != false) |
|
2326 | - $value = $field_info->extras; |
|
2309 | + if($field_info->extras !== null && $field_info->extras != false) { |
|
2310 | + $value = $field_info->extras; |
|
2311 | + } |
|
2327 | 2312 | $input = "<input id='field-{$field_info->name}' type='hidden' name='{$field_info->name}' value='$value' />"; |
2328 | 2313 | return $input; |
2329 | 2314 | } |
@@ -2333,8 +2318,9 @@ discard block |
||
2333 | 2318 | $value = !is_string($value) ? '' : $value; |
2334 | 2319 | |
2335 | 2320 | $extra_attributes = ''; |
2336 | - if(!empty($field_info->db_max_length)) |
|
2337 | - $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; |
|
2321 | + if(!empty($field_info->db_max_length)) { |
|
2322 | + $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; |
|
2323 | + } |
|
2338 | 2324 | $input = "<input id='field-{$field_info->name}' class='form-control' name='{$field_info->name}' type='password' value='$value' $extra_attributes />"; |
2339 | 2325 | return $input; |
2340 | 2326 | } |
@@ -2363,8 +2349,7 @@ discard block |
||
2363 | 2349 | { |
2364 | 2350 | list($year,$month,$day) = explode('-',substr($value,0,10)); |
2365 | 2351 | $date = date($this->php_date_format, mktime(0,0,0,$month,$day,$year)); |
2366 | - } |
|
2367 | - else |
|
2352 | + } else |
|
2368 | 2353 | { |
2369 | 2354 | $date = ''; |
2370 | 2355 | } |
@@ -2504,10 +2489,11 @@ discard block |
||
2504 | 2489 | $selected = !empty($value) && $value == $option_value ? "selected='selected'" : ''; |
2505 | 2490 | $input .= "<option value='$option_value' $selected >$option</option>"; |
2506 | 2491 | } |
2507 | - } |
|
2508 | - elseif(!empty($value) || (is_numeric($value) && $value == '0') ) //If it's ajax then we only need the selected items and not all the items |
|
2492 | + } elseif(!empty($value) || (is_numeric($value) && $value == '0') ) { |
|
2493 | + //If it's ajax then we only need the selected items and not all the items |
|
2509 | 2494 | { |
2510 | 2495 | $selected_options_array = $this->get_relation_array($field_info->extras, $value); |
2496 | + } |
|
2511 | 2497 | foreach($selected_options_array as $option_value => $option) |
2512 | 2498 | { |
2513 | 2499 | $input .= "<option value='$option_value'selected='selected' >$option</option>"; |
@@ -2561,8 +2547,7 @@ discard block |
||
2561 | 2547 | } |
2562 | 2548 | } |
2563 | 2549 | } |
2564 | - } |
|
2565 | - else |
|
2550 | + } else |
|
2566 | 2551 | { |
2567 | 2552 | $this->set_css($this->default_css_path.'/jquery_plugins/chosen/chosen.css'); |
2568 | 2553 | $this->set_js_lib($this->default_javascript_path.'/jquery_plugins/jquery.chosen.min.js'); |
@@ -2577,8 +2562,7 @@ discard block |
||
2577 | 2562 | if(empty($unselected_values) && empty($selected_values)) |
2578 | 2563 | { |
2579 | 2564 | $input = "Please add {$field_info_type->display_as} first"; |
2580 | - } |
|
2581 | - else |
|
2565 | + } else |
|
2582 | 2566 | { |
2583 | 2567 | $css_class = $has_priority_field || $is_ie_7 ? 'multiselect': 'chosen-multiple-select'; |
2584 | 2568 | $width_style = $has_priority_field || $is_ie_7 ? '' : 'width:510px;'; |
@@ -2586,16 +2570,18 @@ discard block |
||
2586 | 2570 | $select_title = str_replace('{field_display_as}',$field_info_type->display_as,$this->l('set_relation_title')); |
2587 | 2571 | $input = "<select id='field-{$field_info_type->name}' name='{$field_info_type->name}[]' multiple='multiple' size='8' class='$css_class' data-placeholder='$select_title' style='$width_style' >"; |
2588 | 2572 | |
2589 | - if(!empty($unselected_values)) |
|
2590 | - foreach($unselected_values as $id => $name) |
|
2573 | + if(!empty($unselected_values)) { |
|
2574 | + foreach($unselected_values as $id => $name) |
|
2591 | 2575 | { |
2592 | 2576 | $input .= "<option value='$id'>$name</option>"; |
2577 | + } |
|
2593 | 2578 | } |
2594 | 2579 | |
2595 | - if(!empty($selected_values)) |
|
2596 | - foreach($selected_values as $id => $name) |
|
2580 | + if(!empty($selected_values)) { |
|
2581 | + foreach($selected_values as $id => $name) |
|
2597 | 2582 | { |
2598 | 2583 | $input .= "<option value='$id' selected='selected'>$name</option>"; |
2584 | + } |
|
2599 | 2585 | } |
2600 | 2586 | |
2601 | 2587 | $input .= "</select>"; |
@@ -2607,14 +2593,15 @@ discard block |
||
2607 | 2593 | protected function _convert_bytes_ui_to_bytes($bytes_ui) |
2608 | 2594 | { |
2609 | 2595 | $bytes_ui = str_replace(' ','',$bytes_ui); |
2610 | - if(strstr($bytes_ui,'MB')) |
|
2611 | - $bytes = (int)(str_replace('MB','',$bytes_ui))*1024*1024; |
|
2612 | - elseif(strstr($bytes_ui,'KB')) |
|
2613 | - $bytes = (int)(str_replace('KB','',$bytes_ui))*1024; |
|
2614 | - elseif(strstr($bytes_ui,'B')) |
|
2615 | - $bytes = (int)(str_replace('B','',$bytes_ui)); |
|
2616 | - else |
|
2617 | - $bytes = (int)($bytes_ui); |
|
2596 | + if(strstr($bytes_ui,'MB')) { |
|
2597 | + $bytes = (int)(str_replace('MB','',$bytes_ui))*1024*1024; |
|
2598 | + } elseif(strstr($bytes_ui,'KB')) { |
|
2599 | + $bytes = (int)(str_replace('KB','',$bytes_ui))*1024; |
|
2600 | + } elseif(strstr($bytes_ui,'B')) { |
|
2601 | + $bytes = (int)(str_replace('B','',$bytes_ui)); |
|
2602 | + } else { |
|
2603 | + $bytes = (int)($bytes_ui); |
|
2604 | + } |
|
2618 | 2605 | |
2619 | 2606 | return $bytes; |
2620 | 2607 | } |
@@ -2721,8 +2708,7 @@ discard block |
||
2721 | 2708 | if(!isset($this->callback_add_field[$field->field_name])) |
2722 | 2709 | { |
2723 | 2710 | $field_input = $this->get_field_input($field_info, $field_value); |
2724 | - } |
|
2725 | - else |
|
2711 | + } else |
|
2726 | 2712 | { |
2727 | 2713 | $field_input = $field_info; |
2728 | 2714 | $field_input->input = call_user_func($this->callback_add_field[$field->field_name], $field_value, null, $field_info); |
@@ -2763,8 +2749,7 @@ discard block |
||
2763 | 2749 | if(!isset($this->callback_edit_field[$field->field_name])) |
2764 | 2750 | { |
2765 | 2751 | $field_input = $this->get_field_input($field_info, $field_value); |
2766 | - } |
|
2767 | - else |
|
2752 | + } else |
|
2768 | 2753 | { |
2769 | 2754 | $primary_key = $this->getStateInfo()->primary_key; |
2770 | 2755 | $field_input = $field_info; |
@@ -2821,8 +2806,7 @@ discard block |
||
2821 | 2806 | if(!isset($this->callback_read_field[$field->field_name])) |
2822 | 2807 | { |
2823 | 2808 | $field_input = $this->get_field_input($field_info, $field_value); |
2824 | - } |
|
2825 | - else |
|
2809 | + } else |
|
2826 | 2810 | { |
2827 | 2811 | $primary_key = $this->getStateInfo()->primary_key; |
2828 | 2812 | $field_input = $field_info; |
@@ -2852,8 +2836,9 @@ discard block |
||
2852 | 2836 | protected function setThemeBasics() |
2853 | 2837 | { |
2854 | 2838 | $this->theme_path = $this->default_theme_path; |
2855 | - if(substr($this->theme_path,-1) != '/') |
|
2856 | - $this->theme_path = $this->theme_path.'/'; |
|
2839 | + if(substr($this->theme_path,-1) != '/') { |
|
2840 | + $this->theme_path = $this->theme_path.'/'; |
|
2841 | + } |
|
2857 | 2842 | |
2858 | 2843 | include($this->theme_path.$this->theme.'/config.php'); |
2859 | 2844 | |
@@ -2950,10 +2935,11 @@ discard block |
||
2950 | 2935 | |
2951 | 2936 | protected function get_views_as_string() |
2952 | 2937 | { |
2953 | - if(!empty($this->views_as_string)) |
|
2954 | - return $this->views_as_string; |
|
2955 | - else |
|
2956 | - return null; |
|
2938 | + if(!empty($this->views_as_string)) { |
|
2939 | + return $this->views_as_string; |
|
2940 | + } else { |
|
2941 | + return null; |
|
2942 | + } |
|
2957 | 2943 | } |
2958 | 2944 | } |
2959 | 2945 | |
@@ -3068,8 +3054,7 @@ discard block |
||
3068 | 3054 | if(!empty($_POST)) |
3069 | 3055 | { |
3070 | 3056 | $state_info = (object)array('unwrapped_data' => $_POST); |
3071 | - } |
|
3072 | - else |
|
3057 | + } else |
|
3073 | 3058 | { |
3074 | 3059 | throw new Exception('On the state "insert" you must have post data',8); |
3075 | 3060 | die(); |
@@ -3080,13 +3065,11 @@ discard block |
||
3080 | 3065 | if(!empty($_POST) && $first_parameter !== null) |
3081 | 3066 | { |
3082 | 3067 | $state_info = (object)array('primary_key' => $first_parameter,'unwrapped_data' => $_POST); |
3083 | - } |
|
3084 | - elseif(empty($_POST)) |
|
3068 | + } elseif(empty($_POST)) |
|
3085 | 3069 | { |
3086 | 3070 | throw new Exception('On the state "update" you must have post data',9); |
3087 | 3071 | die(); |
3088 | - } |
|
3089 | - else |
|
3072 | + } else |
|
3090 | 3073 | { |
3091 | 3074 | throw new Exception('On the state "update" the Primary key cannot be null',10); |
3092 | 3075 | die(); |
@@ -3122,8 +3105,7 @@ discard block |
||
3122 | 3105 | { |
3123 | 3106 | $search_text = strip_tags($_POST['search_field']); |
3124 | 3107 | $state_info->search = (object)array('field' => null , 'text' => $_POST['search_text']); |
3125 | - } |
|
3126 | - else |
|
3108 | + } else |
|
3127 | 3109 | { |
3128 | 3110 | if (is_array($_POST['search_field'])) { |
3129 | 3111 | $search_array = array(); |
@@ -3185,10 +3167,11 @@ discard block |
||
3185 | 3167 | { |
3186 | 3168 | $state_string = $this->get_state_info_from_url()->operation; |
3187 | 3169 | |
3188 | - if( $state_string != 'unknown' && in_array( $state_string, $this->states ) ) |
|
3189 | - $state_code = array_search($state_string, $this->states); |
|
3190 | - else |
|
3191 | - $state_code = 0; |
|
3170 | + if( $state_string != 'unknown' && in_array( $state_string, $this->states ) ) { |
|
3171 | + $state_code = array_search($state_string, $this->states); |
|
3172 | + } else { |
|
3173 | + $state_code = 0; |
|
3174 | + } |
|
3192 | 3175 | |
3193 | 3176 | return $state_code; |
3194 | 3177 | } |
@@ -3215,12 +3198,15 @@ discard block |
||
3215 | 3198 | foreach($ci->uri->segments as $num => $value) |
3216 | 3199 | { |
3217 | 3200 | $state_url_array[$num] = $value; |
3218 | - if($num == ($segment_position - 1)) |
|
3219 | - break; |
|
3201 | + if($num == ($segment_position - 1)) { |
|
3202 | + break; |
|
3203 | + } |
|
3220 | 3204 | } |
3221 | 3205 | |
3222 | - if( $method_name == 'index' && !in_array( 'index', $state_url_array ) ) //there is a scenario that you don't have the index to your url |
|
3206 | + if( $method_name == 'index' && !in_array( 'index', $state_url_array ) ) { |
|
3207 | + //there is a scenario that you don't have the index to your url |
|
3223 | 3208 | $state_url_array[$num+1] = 'index'; |
3209 | + } |
|
3224 | 3210 | } |
3225 | 3211 | |
3226 | 3212 | $state_url = site_url(implode('/',$state_url_array).'/'.$url); |
@@ -3248,8 +3234,9 @@ discard block |
||
3248 | 3234 | |
3249 | 3235 | $function_name = $this->get_method_name(); |
3250 | 3236 | |
3251 | - if($function_name == 'index' && !in_array('index',$ci->uri->segments)) |
|
3252 | - $segment_position++; |
|
3237 | + if($function_name == 'index' && !in_array('index',$ci->uri->segments)) { |
|
3238 | + $segment_position++; |
|
3239 | + } |
|
3253 | 3240 | |
3254 | 3241 | $first_parameter = isset($segements[$segment_position+1]) ? $segements[$segment_position+1] : null; |
3255 | 3242 | $second_parameter = isset($segements[$segment_position+2]) ? $segements[$segment_position+2] : null; |
@@ -3328,26 +3315,29 @@ discard block |
||
3328 | 3315 | |
3329 | 3316 | protected function getValidationUpdateUrl($primary_key = null) |
3330 | 3317 | { |
3331 | - if($primary_key === null) |
|
3332 | - return $this->state_url('update_validation'); |
|
3333 | - else |
|
3334 | - return $this->state_url('update_validation/'.$primary_key); |
|
3318 | + if($primary_key === null) { |
|
3319 | + return $this->state_url('update_validation'); |
|
3320 | + } else { |
|
3321 | + return $this->state_url('update_validation/'.$primary_key); |
|
3322 | + } |
|
3335 | 3323 | } |
3336 | 3324 | |
3337 | 3325 | protected function getEditUrl($primary_key = null) |
3338 | 3326 | { |
3339 | - if($primary_key === null) |
|
3340 | - return $this->state_url('edit'); |
|
3341 | - else |
|
3342 | - return $this->state_url('edit/'.$primary_key); |
|
3327 | + if($primary_key === null) { |
|
3328 | + return $this->state_url('edit'); |
|
3329 | + } else { |
|
3330 | + return $this->state_url('edit/'.$primary_key); |
|
3331 | + } |
|
3343 | 3332 | } |
3344 | 3333 | |
3345 | 3334 | protected function getReadUrl($primary_key = null) |
3346 | 3335 | { |
3347 | - if($primary_key === null) |
|
3348 | - return $this->state_url('read'); |
|
3349 | - else |
|
3350 | - return $this->state_url('read/'.$primary_key); |
|
3336 | + if($primary_key === null) { |
|
3337 | + return $this->state_url('read'); |
|
3338 | + } else { |
|
3339 | + return $this->state_url('read/'.$primary_key); |
|
3340 | + } |
|
3351 | 3341 | } |
3352 | 3342 | |
3353 | 3343 | protected function getUpdateUrl($state_info) |
@@ -3371,10 +3361,11 @@ discard block |
||
3371 | 3361 | |
3372 | 3362 | protected function getListSuccessUrl($primary_key = null) |
3373 | 3363 | { |
3374 | - if(empty($primary_key)) |
|
3375 | - return $this->state_url('success',true); |
|
3376 | - else |
|
3377 | - return $this->state_url('success/'.$primary_key,true); |
|
3364 | + if(empty($primary_key)) { |
|
3365 | + return $this->state_url('success',true); |
|
3366 | + } else { |
|
3367 | + return $this->state_url('success/'.$primary_key,true); |
|
3368 | + } |
|
3378 | 3369 | } |
3379 | 3370 | |
3380 | 3371 | protected function getUploadUrl($field_name) |
@@ -3583,7 +3574,7 @@ discard block |
||
3583 | 3574 | if(is_string($field)) |
3584 | 3575 | { |
3585 | 3576 | $this->validation_rules[$field] = array('field' => $field, 'label' => $label, 'rules' => $rules); |
3586 | - }elseif(is_array($field)) |
|
3577 | + } elseif(is_array($field)) |
|
3587 | 3578 | { |
3588 | 3579 | foreach($field as $num_field => $field_array) |
3589 | 3580 | { |
@@ -3986,8 +3977,7 @@ discard block |
||
3986 | 3977 | { |
3987 | 3978 | $this->display_as[$field] = $display_as; |
3988 | 3979 | } |
3989 | - } |
|
3990 | - elseif($display_as !== null) |
|
3980 | + } elseif($display_as !== null) |
|
3991 | 3981 | { |
3992 | 3982 | $this->display_as[$field_name] = $display_as; |
3993 | 3983 | } |
@@ -4006,9 +3996,10 @@ discard block |
||
4006 | 3996 | } |
4007 | 3997 | include($this->default_language_path.'/'.$this->language.'.php'); |
4008 | 3998 | |
4009 | - foreach($lang as $handle => $lang_string) |
|
4010 | - if(!isset($this->lang_strings[$handle])) |
|
3999 | + foreach($lang as $handle => $lang_string) { |
|
4000 | + if(!isset($this->lang_strings[$handle])) |
|
4011 | 4001 | $this->lang_strings[$handle] = $lang_string; |
4002 | + } |
|
4012 | 4003 | |
4013 | 4004 | $this->default_true_false_text = array( $this->l('form_inactive') , $this->l('form_active')); |
4014 | 4005 | $this->subject = $this->subject === null ? $this->l('list_record') : $this->subject; |
@@ -4103,8 +4094,9 @@ discard block |
||
4103 | 4094 | $this->columns = array(); |
4104 | 4095 | foreach($field_types as $field) |
4105 | 4096 | { |
4106 | - if( !isset($field->db_extra) || $field->db_extra != 'auto_increment' ) |
|
4107 | - $this->columns[] = $field->name; |
|
4097 | + if( !isset($field->db_extra) || $field->db_extra != 'auto_increment' ) { |
|
4098 | + $this->columns[] = $field->name; |
|
4099 | + } |
|
4108 | 4100 | } |
4109 | 4101 | } |
4110 | 4102 | |
@@ -4122,16 +4114,14 @@ discard block |
||
4122 | 4114 | $display_as = $this->display_as[$column]; |
4123 | 4115 | unset($this->display_as[$column]); |
4124 | 4116 | $this->display_as[$new_column] = $display_as; |
4125 | - } |
|
4126 | - else |
|
4117 | + } else |
|
4127 | 4118 | { |
4128 | 4119 | $this->display_as[$new_column] = ucfirst(str_replace('_',' ',$column)); |
4129 | 4120 | } |
4130 | 4121 | |
4131 | 4122 | $column = $new_column; |
4132 | 4123 | $this->columns[$col_num] = $new_column; |
4133 | - } |
|
4134 | - else |
|
4124 | + } else |
|
4135 | 4125 | { |
4136 | 4126 | if(!empty($this->relation)) |
4137 | 4127 | { |
@@ -4146,8 +4136,7 @@ discard block |
||
4146 | 4136 | $display_as = $this->display_as[$column]; |
4147 | 4137 | unset($this->display_as[$column]); |
4148 | 4138 | $this->display_as[$new_column] = $display_as; |
4149 | - } |
|
4150 | - else |
|
4139 | + } else |
|
4151 | 4140 | { |
4152 | 4141 | $this->display_as[$new_column] = ucfirst(str_replace('_',' ',$column)); |
4153 | 4142 | } |
@@ -4160,13 +4149,14 @@ discard block |
||
4160 | 4149 | |
4161 | 4150 | } |
4162 | 4151 | |
4163 | - if(isset($this->display_as[$column])) |
|
4164 | - $this->columns[$col_num] = (object)array('field_name' => $column, 'display_as' => $this->display_as[$column]); |
|
4165 | - elseif(isset($field_types[$column])) |
|
4166 | - $this->columns[$col_num] = (object)array('field_name' => $column, 'display_as' => $field_types[$column]->display_as); |
|
4167 | - else |
|
4168 | - $this->columns[$col_num] = (object)array('field_name' => $column, 'display_as' => |
|
4152 | + if(isset($this->display_as[$column])) { |
|
4153 | + $this->columns[$col_num] = (object)array('field_name' => $column, 'display_as' => $this->display_as[$column]); |
|
4154 | + } elseif(isset($field_types[$column])) { |
|
4155 | + $this->columns[$col_num] = (object)array('field_name' => $column, 'display_as' => $field_types[$column]->display_as); |
|
4156 | + } else { |
|
4157 | + $this->columns[$col_num] = (object)array('field_name' => $column, 'display_as' => |
|
4169 | 4158 | ucfirst(str_replace('_',' ',$column))); |
4159 | + } |
|
4170 | 4160 | |
4171 | 4161 | if(!empty($this->unset_columns) && in_array($column,$this->unset_columns)) |
4172 | 4162 | { |
@@ -4194,29 +4184,31 @@ discard block |
||
4194 | 4184 | { |
4195 | 4185 | foreach($this->add_fields as $field_num => $field) |
4196 | 4186 | { |
4197 | - if(isset($this->display_as[$field])) |
|
4198 | - $this->add_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $this->display_as[$field]); |
|
4199 | - elseif(isset($field_types[$field]->display_as)) |
|
4200 | - $this->add_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $field_types[$field]->display_as); |
|
4201 | - else |
|
4202 | - $this->add_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => ucfirst(str_replace('_',' ',$field))); |
|
4187 | + if(isset($this->display_as[$field])) { |
|
4188 | + $this->add_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $this->display_as[$field]); |
|
4189 | + } elseif(isset($field_types[$field]->display_as)) { |
|
4190 | + $this->add_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $field_types[$field]->display_as); |
|
4191 | + } else { |
|
4192 | + $this->add_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => ucfirst(str_replace('_',' ',$field))); |
|
4193 | + } |
|
4203 | 4194 | } |
4204 | - } |
|
4205 | - else |
|
4195 | + } else |
|
4206 | 4196 | { |
4207 | 4197 | $this->add_fields = array(); |
4208 | 4198 | foreach($field_types as $field) |
4209 | 4199 | { |
4210 | 4200 | //Check if an unset_add_field is initialize for this field name |
4211 | - if($this->unset_add_fields !== null && is_array($this->unset_add_fields) && in_array($field->name,$this->unset_add_fields)) |
|
4212 | - continue; |
|
4201 | + if($this->unset_add_fields !== null && is_array($this->unset_add_fields) && in_array($field->name,$this->unset_add_fields)) { |
|
4202 | + continue; |
|
4203 | + } |
|
4213 | 4204 | |
4214 | 4205 | if( (!isset($field->db_extra) || $field->db_extra != 'auto_increment') ) |
4215 | 4206 | { |
4216 | - if(isset($this->display_as[$field->name])) |
|
4217 | - $this->add_fields[] = (object)array('field_name' => $field->name, 'display_as' => $this->display_as[$field->name]); |
|
4218 | - else |
|
4219 | - $this->add_fields[] = (object)array('field_name' => $field->name, 'display_as' => $field->display_as); |
|
4207 | + if(isset($this->display_as[$field->name])) { |
|
4208 | + $this->add_fields[] = (object)array('field_name' => $field->name, 'display_as' => $this->display_as[$field->name]); |
|
4209 | + } else { |
|
4210 | + $this->add_fields[] = (object)array('field_name' => $field->name, 'display_as' => $field->display_as); |
|
4211 | + } |
|
4220 | 4212 | } |
4221 | 4213 | } |
4222 | 4214 | } |
@@ -4239,27 +4231,29 @@ discard block |
||
4239 | 4231 | { |
4240 | 4232 | foreach($this->edit_fields as $field_num => $field) |
4241 | 4233 | { |
4242 | - if(isset($this->display_as[$field])) |
|
4243 | - $this->edit_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $this->display_as[$field]); |
|
4244 | - else |
|
4245 | - $this->edit_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $field_types[$field]->display_as); |
|
4234 | + if(isset($this->display_as[$field])) { |
|
4235 | + $this->edit_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $this->display_as[$field]); |
|
4236 | + } else { |
|
4237 | + $this->edit_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $field_types[$field]->display_as); |
|
4238 | + } |
|
4246 | 4239 | } |
4247 | - } |
|
4248 | - else |
|
4240 | + } else |
|
4249 | 4241 | { |
4250 | 4242 | $this->edit_fields = array(); |
4251 | 4243 | foreach($field_types as $field) |
4252 | 4244 | { |
4253 | 4245 | //Check if an unset_edit_field is initialize for this field name |
4254 | - if($this->unset_edit_fields !== null && is_array($this->unset_edit_fields) && in_array($field->name,$this->unset_edit_fields)) |
|
4255 | - continue; |
|
4246 | + if($this->unset_edit_fields !== null && is_array($this->unset_edit_fields) && in_array($field->name,$this->unset_edit_fields)) { |
|
4247 | + continue; |
|
4248 | + } |
|
4256 | 4249 | |
4257 | 4250 | if(!isset($field->db_extra) || $field->db_extra != 'auto_increment') |
4258 | 4251 | { |
4259 | - if(isset($this->display_as[$field->name])) |
|
4260 | - $this->edit_fields[] = (object)array('field_name' => $field->name, 'display_as' => $this->display_as[$field->name]); |
|
4261 | - else |
|
4262 | - $this->edit_fields[] = (object)array('field_name' => $field->name, 'display_as' => $field->display_as); |
|
4252 | + if(isset($this->display_as[$field->name])) { |
|
4253 | + $this->edit_fields[] = (object)array('field_name' => $field->name, 'display_as' => $this->display_as[$field->name]); |
|
4254 | + } else { |
|
4255 | + $this->edit_fields[] = (object)array('field_name' => $field->name, 'display_as' => $field->display_as); |
|
4256 | + } |
|
4263 | 4257 | } |
4264 | 4258 | } |
4265 | 4259 | } |
@@ -4282,27 +4276,29 @@ discard block |
||
4282 | 4276 | { |
4283 | 4277 | foreach($this->read_fields as $field_num => $field) |
4284 | 4278 | { |
4285 | - if(isset($this->display_as[$field])) |
|
4286 | - $this->read_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $this->display_as[$field]); |
|
4287 | - else |
|
4288 | - $this->read_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $field_types[$field]->display_as); |
|
4279 | + if(isset($this->display_as[$field])) { |
|
4280 | + $this->read_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $this->display_as[$field]); |
|
4281 | + } else { |
|
4282 | + $this->read_fields[$field_num] = (object)array('field_name' => $field, 'display_as' => $field_types[$field]->display_as); |
|
4283 | + } |
|
4289 | 4284 | } |
4290 | - } |
|
4291 | - else |
|
4285 | + } else |
|
4292 | 4286 | { |
4293 | 4287 | $this->read_fields = array(); |
4294 | 4288 | foreach($field_types as $field) |
4295 | 4289 | { |
4296 | 4290 | //Check if an unset_read_field is initialize for this field name |
4297 | - if($this->unset_read_fields !== null && is_array($this->unset_read_fields) && in_array($field->name,$this->unset_read_fields)) |
|
4298 | - continue; |
|
4291 | + if($this->unset_read_fields !== null && is_array($this->unset_read_fields) && in_array($field->name,$this->unset_read_fields)) { |
|
4292 | + continue; |
|
4293 | + } |
|
4299 | 4294 | |
4300 | 4295 | if(!isset($field->db_extra) || $field->db_extra != 'auto_increment') |
4301 | 4296 | { |
4302 | - if(isset($this->display_as[$field->name])) |
|
4303 | - $this->read_fields[] = (object)array('field_name' => $field->name, 'display_as' => $this->display_as[$field->name]); |
|
4304 | - else |
|
4305 | - $this->read_fields[] = (object)array('field_name' => $field->name, 'display_as' => $field->display_as); |
|
4297 | + if(isset($this->display_as[$field->name])) { |
|
4298 | + $this->read_fields[] = (object)array('field_name' => $field->name, 'display_as' => $this->display_as[$field->name]); |
|
4299 | + } else { |
|
4300 | + $this->read_fields[] = (object)array('field_name' => $field->name, 'display_as' => $field->display_as); |
|
4301 | + } |
|
4306 | 4302 | } |
4307 | 4303 | } |
4308 | 4304 | } |
@@ -4437,8 +4433,9 @@ discard block |
||
4437 | 4433 | $this->_load_language(); |
4438 | 4434 | $this->state_code = $this->getStateCode(); |
4439 | 4435 | |
4440 | - if($this->basic_model === null) |
|
4441 | - $this->set_default_Model(); |
|
4436 | + if($this->basic_model === null) { |
|
4437 | + $this->set_default_Model(); |
|
4438 | + } |
|
4442 | 4439 | |
4443 | 4440 | $this->set_basic_db_table($this->get_table()); |
4444 | 4441 | |
@@ -4461,8 +4458,7 @@ discard block |
||
4461 | 4458 | if( $this->state_code != 0 ) |
4462 | 4459 | { |
4463 | 4460 | $this->state_info = $this->getStateInfo(); |
4464 | - } |
|
4465 | - else |
|
4461 | + } else |
|
4466 | 4462 | { |
4467 | 4463 | throw new Exception('The state is unknown , I don\'t know what I will do with your data!', 4); |
4468 | 4464 | die(); |
@@ -4477,8 +4473,9 @@ discard block |
||
4477 | 4473 | die(); |
4478 | 4474 | } |
4479 | 4475 | |
4480 | - if($this->theme === null) |
|
4481 | - $this->set_theme($this->default_theme); |
|
4476 | + if($this->theme === null) { |
|
4477 | + $this->set_theme($this->default_theme); |
|
4478 | + } |
|
4482 | 4479 | $this->setThemeBasics(); |
4483 | 4480 | |
4484 | 4481 | $this->set_basic_Layout(); |
@@ -4496,8 +4493,9 @@ discard block |
||
4496 | 4493 | die(); |
4497 | 4494 | } |
4498 | 4495 | |
4499 | - if($this->theme === null) |
|
4500 | - $this->set_theme($this->default_theme); |
|
4496 | + if($this->theme === null) { |
|
4497 | + $this->set_theme($this->default_theme); |
|
4498 | + } |
|
4501 | 4499 | $this->setThemeBasics(); |
4502 | 4500 | |
4503 | 4501 | $this->set_basic_Layout(); |
@@ -4513,8 +4511,9 @@ discard block |
||
4513 | 4511 | die(); |
4514 | 4512 | } |
4515 | 4513 | |
4516 | - if($this->theme === null) |
|
4517 | - $this->set_theme($this->default_theme); |
|
4514 | + if($this->theme === null) { |
|
4515 | + $this->set_theme($this->default_theme); |
|
4516 | + } |
|
4518 | 4517 | $this->setThemeBasics(); |
4519 | 4518 | |
4520 | 4519 | $this->set_basic_Layout(); |
@@ -4572,8 +4571,9 @@ discard block |
||
4572 | 4571 | die(); |
4573 | 4572 | } |
4574 | 4573 | |
4575 | - if($this->theme === null) |
|
4576 | - $this->set_theme($this->default_theme); |
|
4574 | + if($this->theme === null) { |
|
4575 | + $this->set_theme($this->default_theme); |
|
4576 | + } |
|
4577 | 4577 | $this->setThemeBasics(); |
4578 | 4578 | |
4579 | 4579 | $this->set_basic_Layout(); |
@@ -4587,8 +4587,9 @@ discard block |
||
4587 | 4587 | |
4588 | 4588 | case 8://ajax_list_info |
4589 | 4589 | |
4590 | - if($this->theme === null) |
|
4591 | - $this->set_theme($this->default_theme); |
|
4590 | + if($this->theme === null) { |
|
4591 | + $this->set_theme($this->default_theme); |
|
4592 | + } |
|
4592 | 4593 | $this->setThemeBasics(); |
4593 | 4594 | |
4594 | 4595 | $this->set_basic_Layout(); |
@@ -4656,8 +4657,9 @@ discard block |
||
4656 | 4657 | die(); |
4657 | 4658 | } |
4658 | 4659 | |
4659 | - if($this->theme === null) |
|
4660 | - $this->set_theme($this->default_theme); |
|
4660 | + if($this->theme === null) { |
|
4661 | + $this->set_theme($this->default_theme); |
|
4662 | + } |
|
4661 | 4663 | $this->setThemeBasics(); |
4662 | 4664 | |
4663 | 4665 | $this->set_basic_Layout(); |
@@ -4677,8 +4679,9 @@ discard block |
||
4677 | 4679 | die(); |
4678 | 4680 | } |
4679 | 4681 | |
4680 | - if($this->theme === null) |
|
4681 | - $this->set_theme($this->default_theme); |
|
4682 | + if($this->theme === null) { |
|
4683 | + $this->set_theme($this->default_theme); |
|
4684 | + } |
|
4682 | 4685 | $this->setThemeBasics(); |
4683 | 4686 | |
4684 | 4687 | $this->set_basic_Layout(); |
@@ -4695,8 +4698,9 @@ discard block |
||
4695 | 4698 | die(); |
4696 | 4699 | } |
4697 | 4700 | |
4698 | - if($this->theme === null) |
|
4699 | - $this->set_theme($this->default_theme); |
|
4701 | + if($this->theme === null) { |
|
4702 | + $this->set_theme($this->default_theme); |
|
4703 | + } |
|
4700 | 4704 | $this->setThemeBasics(); |
4701 | 4705 | |
4702 | 4706 | $this->set_basic_Layout(); |
@@ -4943,8 +4947,7 @@ discard block |
||
4943 | 4947 | if($this->basic_db_table_checked) |
4944 | 4948 | { |
4945 | 4949 | return $this->basic_db_table; |
4946 | - } |
|
4947 | - elseif( $this->basic_db_table !== null ) |
|
4950 | + } elseif( $this->basic_db_table !== null ) |
|
4948 | 4951 | { |
4949 | 4952 | if(!$this->table_exists($this->basic_db_table)) |
4950 | 4953 | { |
@@ -4953,8 +4956,7 @@ discard block |
||
4953 | 4956 | } |
4954 | 4957 | $this->basic_db_table_checked = true; |
4955 | 4958 | return $this->basic_db_table; |
4956 | - } |
|
4957 | - else |
|
4959 | + } else |
|
4958 | 4960 | { |
4959 | 4961 | //Last try , try to find the table from your view / function name!!! Not suggested but it works . |
4960 | 4962 | $last_chance_table_name = $this->get_method_name(); |
@@ -5018,12 +5020,10 @@ discard block |
||
5018 | 5020 | if(!empty($table_name) && $this->basic_db_table === null) |
5019 | 5021 | { |
5020 | 5022 | $this->basic_db_table = $table_name; |
5021 | - } |
|
5022 | - elseif(!empty($table_name)) |
|
5023 | + } elseif(!empty($table_name)) |
|
5023 | 5024 | { |
5024 | 5025 | throw new Exception('You have already insert a table name once...', 1); |
5025 | - } |
|
5026 | - else |
|
5026 | + } else |
|
5027 | 5027 | { |
5028 | 5028 | throw new Exception('The table name cannot be empty.', 2); |
5029 | 5029 | die(); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | </tr> |
24 | 24 | </thead> |
25 | 25 | <tbody> |
26 | - <?php foreach ($status as $status_item): if ($status_item['category'] == 'network') {}else { |
|
26 | + <?php foreach ($status as $status_item): if ($status_item['category'] == 'network') {} else { |
|
27 | 27 | $sid = $status_item['id'];?> |
28 | 28 | <tr> |
29 | 29 | <td> <i class="fa <?= $status_item['icon'];?>" aria-hidden="true"></i> <?= $status_item['name'];?></td> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Original translation by @KaBaDaBrA, improved by Kobus Myburgh (@impero_consult) */ |
4 | 6 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | $lang['list_add'] = 'যোগ করুন'; |
3 | 5 | $lang['list_actions'] = 'ক্রিয়া সমূহ'; |
4 | 6 | $lang['list_page'] = 'পৃষ্ঠা'; |