├── .gitignore ├── README.md └── application └── libraries └── extension_grocery_crud.php /.gitignore: -------------------------------------------------------------------------------- 1 | .htaccess 2 | .buildpath 3 | .settings/ 4 | .project 5 | system/ 6 | application/.htaccess 7 | application/cache/ 8 | application/config/migration.php 9 | application/config/autoload.php 10 | application/config/config.php 11 | application/config/constants.php 12 | application/config/database.php 13 | application/config/doctypes.php 14 | application/config/foreign_chars.php 15 | application/config/hooks.php 16 | application/config/index.html 17 | application/config/mimes.php 18 | application/config/profiler.php 19 | application/config/routes.php 20 | application/config/smileys.php 21 | application/config/user_agents.php 22 | application/controllers/index.html 23 | application/controllers/examples2.php 24 | application/controllers/build.php 25 | application/controllers/welcome.php 26 | application/views/example2.php 27 | application/core/ 28 | application/errors/ 29 | application/helpers/ 30 | application/hooks/ 31 | application/index.html 32 | application/language/ 33 | application/libraries/index.html 34 | application/libraries/grocery_crud_extended.php 35 | application/logs/ 36 | assets/uploads/images/ 37 | application/models/index.html 38 | application/third_party/ 39 | application/views/index.html 40 | application/views/welcome_message.php 41 | index.php 42 | license.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | extension_grocery_crud 2 | ====================== 3 | 4 | The proper way of extending Grocery CRUD 5 | 6 | Quick Documentation: 7 | 8 | function field_type_ext( $field, $type, [$extras]): 9 | - Basically is the same as field_type but let's you set your own types without editing the GC library. For now, the only new type is 'yes_no' that is a dropdown. 10 | The idea it's to provide a clean and easy way to include personalized and recurrent field_types for the community... maybe join all the field_type extensions and plugins in just one... 11 | 12 | 13 | function set_soft_delete([$database_field], [$deteled_value]): 14 | - Overrides the delete function with a soft delete function (by default: table column 'deleted' setted to 1). 15 | If $database_field is set, it uses that one instead of 'deleted' 16 | If $deleted_value is set, it uses that insead of 1. 17 | 18 | 19 | function append_fields($field, [$field2, ...]): 20 | - Same as fields() from GC with the difference that this one adds the fields passed by parameter to the end of the fields list (auto-eliminates duplicates). 21 | 22 | function append_add_fields($field, [$field2, ...]): 23 | - Same as add_fields() from GC with the difference that this one adds the fields passed by parameter to the end of the fields list (auto-eliminates duplicates). 24 | 25 | function append_edit_fields($field, [$field2, ...]): 26 | - Same as edit_fields() from GC with the difference that this one adds the fields passed by parameter to the end of the fields list (auto-eliminates duplicates). 27 | 28 | 29 | 30 | function prepend_fields($field, [$field2, ...]): 31 | - Same as fields() from GC with the difference that this one adds the fields passed by parameter to the beginning of the fields list (auto-eliminates duplicates). 32 | 33 | function prepend_add_fields($field, [$field2, ...]): 34 | - Same as add_fields() from GC with the difference that this one adds the fields passed by parameter to the beginning of the fields list (auto-eliminates duplicates). 35 | 36 | function prepend_edit_fields($field, [$field2, ...]): 37 | - Same as edit_fields() from GC with the difference that this one adds the fields passed by parameter to the beginning of the fields list (auto-eliminates duplicates). 38 | 39 | 40 | 41 | function append_fields_after($field, $field2, [$field3, ...]): 42 | - Appends the field2, [field3, ...] fields to the field list (add+edit) after $field. If $field doesn't exist it just appends them at the end of the list (auto-eliminates duplicates). 43 | 44 | function append_add_fields_after($field, [$field2, ...]): 45 | - Appends the field2, [field3, ...] fields to the field list (add) after $field. If $field doesn't exist it just appends them at the end of the list (auto-eliminates duplicates). 46 | 47 | function append_edit_fields_after($field, [$field2, ...]): 48 | - Appends the field2, [field3, ...] fields to the field list (edit) after $field. If $field doesn't exist it just appends them at the end of the list (auto-eliminates duplicates). 49 | 50 | 51 | 52 | function remove_fields($field, [$field2, ...]): 53 | - Removes the fields passed as parameters from the fields list (add+edit) (if they are setted). 54 | 55 | function remove_add_fields($field, [$field2, ...]): 56 | - Removes the fields passed as parameters from the add fields list(if they are setted). 57 | 58 | function remove_edit_fields($field, [$field2, ...]): 59 | - Removes the fields passed as parameters from the edit fields list (if they are setted). 60 | 61 | 62 | 63 | function append_columns($columns, [$columns2, ...]): 64 | - Appends columns passed as parameters at the end of the existing columns list (auto-eliminates duplicates). 65 | 66 | function prepend_columns($columns, [$columns2, ...]): 67 | - Appends columns passed as parameters at the beginning of the existing columns list (auto-eliminates duplicates). 68 | 69 | function remove_columns($columns, [$columns2, ...]): 70 | - Removes the columns passed as parameters from the columns list (if they are setted). 71 | 72 | 73 | function callback_before_insert(array($this,'function_name'),[$override_all=0]): 74 | - Same as GC original if override_all is set to 1. Else (default) adds the function to a callback array. The setted callbacks run one after the other in the order they where setted. 75 | 76 | function callback_after_insert(array($this,'function_name'),[$override_all=0]): 77 | - Same as GC original if override_all is set to 1. Else (default) adds the function to a callback array. The setted callbacks run one after the other in the order they where setted. 78 | 79 | function callback_before_update(array($this,'function_name'),[$override_all=0]): 80 | - Same as GC original if override_all is set to 1. Else (default) adds the function to a callback array. The setted callbacks run one after the other in the order they where setted. 81 | 82 | function callback_after_update(array($this,'function_name'),[$override_all=0]): 83 | - Same as GC original if override_all is set to 1. Else (default) adds the function to a callback array. The setted callbacks run one after the other in the order they where setted. 84 | 85 | function callback_before_delete(array($this,'function_name'),[$override_all=0]): 86 | - Same as GC original if override_all is set to 1. Else (default) adds the function to a callback array. The setted callbacks run one after the other in the order they where setted. 87 | 88 | function callback_after_delete(array($this,'function_name'),[$override_all=0]): 89 | - Same as GC original if override_all is set to 1. Else (default) adds the function to a callback array. The setted callbacks run one after the other in the order they where setted. 90 | 91 | 92 | function callback_post_render(array($this,'function_name'),[$override_all=0]): 93 | - Adds a callback function that runs right after the render() function. 94 | - Example: 95 | 96 | 97 | $gc->callback_post_render(array($this,'edit_body')); 98 | 99 | public function edit_body($output) { 100 | $output->output.='Lorem ipsum dolor sit amet, 101 | consectetur adipisicing elit, sed do 102 | eiusmod tempor incididunt ut labore et 103 | dolore magna aliqua.'; 104 | //This just adds the text to the end of the generated html 105 | return $output; 106 | } 107 | 108 | 109 | 110 | ------------------------------------- 111 | 112 | Why should I use this? 113 | 114 | So... why all this functions? The idea behind this is to allow the users to create some kind-of extensible configurations. I called them 'basic setups' but it's just a name. 115 | Why a basic setup? 116 | Let's say that almost all of the tables you use, have a creation date, a public field (if the content is or not visible in the public part of the site),a name and use soft_delete. 117 | 118 | You just go to your extension_grocery_crud library file (or another that inherits from it) and create something like this: 119 | 120 | /* EXAMPLE OF BASIC SETUPS USE*/ 121 | 122 | public function basic_gc_config($table_name, $content_public_name, $template='twitter-bootstrap'){ 123 | $this->set_theme($template); 124 | 125 | $this->set_table($table_name) 126 | ->set_subject($content_public_name); 127 | $this->set_soft_delete(); 128 | $this->columns('name','created','public'); 129 | $this->field_type_ext('public','yes_no'); 130 | $this->required_fields('name'); 131 | $this->fields( 132 | 'name', 133 | 'public' 134 | ); 135 | 136 | } 137 | 138 | (Don't worry it's in the attached file to) 139 | 140 | So, when you go to your controller, you just call the library, make an instance (let's call it $c) and then $c->basic_gc_config('table_name', 'my_content'); 141 | After that you use the functions that the extension includes to add, move, remove, or adapt the columns and fields you need for that specific content type. 142 | Of course, this is just a very minimal example of what you could pre-set in this "basic setups". 143 | 144 | Also, fell completely free to add stuff to it, modify it, remove stuff from it and whatever you like. You may (if you want) post the modifications here or send them to my mail (greysama86@gmail.com - Only English or Spanish plz) and I promise to include them (as long as they are not repeated ) in future updates. 145 | You may also publish your on "basic setups" if you want. 146 | 147 | I will try to update it at least once or twice a month (if there is something to update). 148 | 149 | --------------------------------------------------------------------------------- 150 | 151 | How can I add stuff? 152 | 153 | Well, you can use anything available at the GC documentation. You should also be able to use many of the internal GC library functions and variables, since this is an extension to the library itself. 154 | 155 | --------------------------------------------------------------------------------- 156 | 157 | Instalation: 158 | 159 | Just copy this file in your libraries folder and call it on your controller after GC. 160 | 161 | Example: 162 | 163 | $this->load->library('grocery_crud'); 164 | $this->load->library('extension_grocery_CRUD'); 165 | 166 | 167 | $crud = new Extension_grocery_CRUD(); //This goes INSTEAD of the "new Grocery_CRUD();" 168 | 169 | With this, you will have all the GC functions plus the ones listed above. 170 | 171 | --------------------------------------------------------------------------------- 172 | 173 | Hope you like this little extension. I am open to suggestions for any functionality you may want to add, modify or whatever. 174 | 175 | Bye! 176 | 177 | VERY IMPORTANT: This works "out of the box" with the last GitHub version of GC. If you want to use it with 1.3.3 (stable) you only need to change the $columns variable from private to protected on the GC library file. You may use this extension even without that, but all the columns related functions will not work and even crash 178 | -------------------------------------------------------------------------------- /application/libraries/extension_grocery_crud.php: -------------------------------------------------------------------------------- 1 | _ci = &get_instance(); 31 | 32 | } 33 | 34 | /* Extra field types Functions 35 | */ 36 | public function field_type_ext($field , $type, $extras = null){ 37 | if($field && $type){ 38 | switch ($type) { 39 | case 'yes_no': 40 | $this->field_type($field,'dropdown', array('1' => 'Yes', '0' => 'No')); 41 | break; 42 | 43 | /* 44 | * If you want to add another field type 45 | * you just set the name in the case and 46 | * the functions inside it 47 | */ 48 | 49 | default: 50 | # code... 51 | break; 52 | } 53 | } 54 | } 55 | 56 | /**********************/ 57 | 58 | /* Soft Delete Setter 59 | * When is called, overrides the default delete function with another that only sets a field named 'deleted' to 1. 60 | */ 61 | 62 | public function set_soft_delete($field='deleted', $deleted_value=1){ 63 | if(!$field){ 64 | $field='deleted'; 65 | } 66 | $this->extension_extras['soft_delete']['field']=$field; 67 | $this->extension_extras['soft_delete']['deleted_value']=$deleted_value; 68 | $this->callback_delete(array($this,'soft_delete_me')); 69 | } 70 | 71 | public function soft_delete_me($primary_key){ 72 | $field=$this->extension_extras['soft_delete']['field']; 73 | $value=$this->extension_extras['soft_delete']['deleted_value']; 74 | return $this->_ci->db->update($this->basic_db_table,array($field => $value),array($this->get_primary_key() => $primary_key)); 75 | } 76 | /************************************************/ 77 | 78 | 79 | /* APPEND FIELD Functions 80 | * Append at the End. Eliminate repetitions. 81 | */ 82 | public function append_fields(){ 83 | $args = func_get_args(); 84 | 85 | if(isset($args[0]) && is_array($args[0])) 86 | { 87 | $args = $args[0]; 88 | } 89 | 90 | $this->add_fields = array_unique(array_merge($this->add_fields,$args)); 91 | $this->edit_fields = array_unique(array_merge($this->edit_fields,$args)); 92 | 93 | return $this; 94 | } 95 | 96 | public function append_add_fields() { 97 | $args = func_get_args(); 98 | 99 | if(isset($args[0]) && is_array($args[0])) 100 | { 101 | $args = $args[0]; 102 | } 103 | 104 | $this->add_fields = array_unique(array_merge($this->add_fields,$args)); 105 | 106 | return $this; 107 | } 108 | 109 | public function append_edit_fields(){ 110 | $args = func_get_args(); 111 | 112 | if(isset($args[0]) && is_array($args[0])) 113 | { 114 | $args = $args[0]; 115 | } 116 | 117 | $this->edit_fields = array_unique(array_merge($this->edit_fields,$args)); 118 | 119 | return $this; 120 | } 121 | 122 | 123 | 124 | /********************************************************/ 125 | 126 | 127 | /* Prepend FIELD Functions 128 | * Append at the Beginning. Eliminate repetitions. 129 | */ 130 | public function prepend_fields(){ 131 | $args = func_get_args(); 132 | 133 | if(isset($args[0]) && is_array($args[0])) 134 | { 135 | $args = $args[0]; 136 | } 137 | 138 | $this->add_fields = array_unique(array_merge($args,$this->add_fields)); 139 | $this->edit_fields = array_unique(array_merge($args,$this->edit_fields)); 140 | 141 | return $this; 142 | } 143 | 144 | public function prepend_add_fields(){ 145 | $args = func_get_args(); 146 | 147 | if(isset($args[0]) && is_array($args[0])) 148 | { 149 | $args = $args[0]; 150 | } 151 | 152 | $this->add_fields = array_unique(array_merge($args,$this->add_fields)); 153 | 154 | return $this; 155 | } 156 | 157 | public function prepend_edit_fields(){ 158 | $args = func_get_args(); 159 | 160 | if(isset($args[0]) && is_array($args[0])) 161 | { 162 | $args = $args[0]; 163 | } 164 | 165 | $this->edit_fields = array_unique(array_merge($args,$this->edit_fields)); 166 | 167 | return $this; 168 | } 169 | 170 | /********************************************************/ 171 | 172 | 173 | /* Append After FIELD Functions 174 | * Append after first field in parameters. Eliminate repetitions. 175 | */ 176 | 177 | public function append_fields_after(){ 178 | $args = func_get_args(); 179 | 180 | if(func_num_args ()>1){ 181 | $after_field=$args[0]; 182 | 183 | if(isset($args[1]) && is_array($args[1])){ 184 | $args = $args[1]; 185 | }else{ 186 | unset($args[0]); 187 | } 188 | 189 | 190 | $this->append_add_fields_after($after_field,$args); 191 | $this->append_edit_fields_after($after_field,$args); 192 | 193 | } 194 | 195 | return $this; 196 | } 197 | 198 | public function append_add_fields_after(){ 199 | $args = func_get_args(); 200 | 201 | if(func_num_args ()>1){ 202 | $after_field=$args[0]; 203 | 204 | if(isset($args[1]) && is_array($args[1])){ 205 | $args = $args[1]; 206 | }else{ 207 | unset($args[0]); 208 | } 209 | 210 | $split_key=array_search($after_field, $this->add_fields); 211 | if($split_key!==FALSE){ 212 | $add_fields_array=array_diff($this->add_fields, $args); 213 | $first_fields_list = array_slice($add_fields_array, 0, $split_key+1); 214 | $middle_fields_list = $args; 215 | $last_fields_list = array_slice($add_fields_array, $split_key); 216 | $this->add_fields = array_unique(array_merge($first_fields_list,$middle_fields_list,$last_fields_list)); 217 | }else{ 218 | $this->append_add_fields($args); 219 | } 220 | } 221 | 222 | return $this; 223 | } 224 | 225 | public function append_edit_fields_after(){ 226 | $args = func_get_args(); 227 | 228 | if(func_num_args ()>1){ 229 | $after_field=$args[0]; 230 | 231 | if(isset($args[1]) && is_array($args[1])){ 232 | $args = $args[1]; 233 | }else{ 234 | unset($args[0]); 235 | } 236 | 237 | $split_key=array_search($after_field, $this->edit_fields); 238 | if($split_key!==FALSE){ 239 | $edit_fields_array=array_diff($this->edit_fields, $args); 240 | $first_fields_list = array_slice($edit_fields_array, 0, $split_key+1); 241 | $middle_fields_list = $args; 242 | $last_fields_list = array_slice($edit_fields_array, $split_key); 243 | $this->edit_fields = array_unique(array_merge($first_fields_list,$middle_fields_list,$last_fields_list)); 244 | }else{ 245 | $this->append_edit_fields($args); 246 | } 247 | } 248 | 249 | return $this; 250 | } 251 | 252 | /********************************************************/ 253 | 254 | 255 | /* APPEND COLUMNS Function 256 | * Append at the End. Eliminate repetitions. 257 | */ 258 | public function append_columns(){ 259 | $args = func_get_args(); 260 | 261 | if(isset($args[0]) && is_array($args[0])){ 262 | $args = $args[0]; 263 | } 264 | 265 | $this->columns = array_unique(array_merge($this->columns,$args)); 266 | 267 | return $this; 268 | } 269 | 270 | /* APPEND COLUMNS Function 271 | * Append at the Beginning. Eliminate repetitions. 272 | */ 273 | public function prepend_columns(){ 274 | $args = func_get_args(); 275 | 276 | if(isset($args[0]) && is_array($args[0])){ 277 | $args = $args[0]; 278 | } 279 | 280 | $this->columns = array_unique(array_merge($args,$this->columns)); 281 | 282 | return $this; 283 | } 284 | 285 | /***************************************/ 286 | 287 | 288 | /* REMOVE FIELD Functions 289 | * Removes the fields passed as parameters from the actual field list 290 | */ 291 | public function remove_fields(){ 292 | $args = func_get_args(); 293 | 294 | if(isset($args[0]) && is_array($args[0])) 295 | { 296 | $args = $args[0]; 297 | } 298 | 299 | $this->add_fields = array_unique(array_diff($this->add_fields,$args)); 300 | $this->edit_fields = array_unique(array_diff($this->edit_fields,$args)); 301 | 302 | return $this; 303 | } 304 | 305 | public function remove_add_fields(){ 306 | $args = func_get_args(); 307 | 308 | if(isset($args[0]) && is_array($args[0])) 309 | { 310 | $args = $args[0]; 311 | } 312 | 313 | $this->add_fields = array_unique(array_diff($this->add_fields,$args)); 314 | 315 | return $this; 316 | } 317 | 318 | public function remove_edit_fields(){ 319 | $args = func_get_args(); 320 | 321 | if(isset($args[0]) && is_array($args[0])) 322 | { 323 | $args = $args[0]; 324 | } 325 | 326 | $this->edit_fields = array_unique(array_diff($this->edit_fields,$args)); 327 | 328 | return $this; 329 | } 330 | /********************************************************/ 331 | 332 | 333 | /* REMOVE COLUMNS Function 334 | * Removes the columns passed as parameters from the actual columns list 335 | */ 336 | public function remove_columns(){ 337 | $args = func_get_args(); 338 | 339 | if(isset($args[0]) && is_array($args[0])){ 340 | $args = $args[0]; 341 | } 342 | 343 | $this->columns = array_unique(array_diff($this->columns,$args)); 344 | 345 | return $this; 346 | } 347 | 348 | 349 | /***************************************/ 350 | 351 | 352 | /* Extended Callback Functions 353 | * Replace the standar callbacks so you can queue many of them 354 | */ 355 | 356 | 357 | /***** INSERT ******/ 358 | public function callback_before_insert($callback = null,$override_all=0){ 359 | if(!$override_all){ 360 | $this->callback_before_insert_ext[] = $callback; 361 | if($this->callback_before_insert == null){ 362 | $this->callback_before_insert = array($this,'extended_callback_before_insert'); 363 | } 364 | }else{ 365 | parent::callback_before_insert($callback); 366 | } 367 | 368 | return $this; 369 | } 370 | 371 | protected function extended_callback_before_insert($post_array){ 372 | foreach ($this->callback_before_insert_ext as $key => $callback) { 373 | if(is_array($post_array)){ 374 | $post_array = call_user_func($callback, $post_array); 375 | } 376 | } 377 | 378 | return $post_array; 379 | } 380 | 381 | public function callback_after_insert($callback = null,$override_all=0){ 382 | if(!$override_all){ 383 | $this->callback_after_insert_ext[] = $callback; 384 | if($this->callback_after_insert == null){ 385 | $this->callback_after_insert = array($this,'extended_callback_after_insert'); 386 | } 387 | }else{ 388 | parent::callback_after_insert($callback); 389 | } 390 | 391 | return $this; 392 | } 393 | 394 | protected function extended_callback_after_insert($post_array,$primary_key){ 395 | $continue=1; 396 | foreach ($this->callback_after_insert_ext as $key => $callback) { 397 | if($continue){ 398 | $continue = call_user_func($callback, $post_array,$primary_key); 399 | } 400 | } 401 | 402 | return $post_array; 403 | } 404 | 405 | /***** UPDATE ******/ 406 | public function callback_before_update($callback = null,$override_all=0){ 407 | if(!$override_all){ 408 | $this->callback_before_update_ext[] = $callback; 409 | if($this->callback_before_update == null){ 410 | $this->callback_before_update = array($this,'extended_callback_before_update'); 411 | } 412 | }else{ 413 | parent::callback_before_update($callback); 414 | } 415 | 416 | return $this; 417 | } 418 | 419 | protected function extended_callback_before_update($post_array, $primary_key){ 420 | foreach ($this->callback_before_update_ext as $key => $callback) { 421 | if(is_array($post_array)){ 422 | $post_array = call_user_func($callback, $post_array, $primary_key); 423 | } 424 | } 425 | 426 | return $post_array; 427 | } 428 | 429 | public function callback_after_update($callback = null,$override_all=0){ 430 | if(!$override_all){ 431 | $this->callback_after_update_ext[] = $callback; 432 | if($this->callback_after_update == null){ 433 | $this->callback_after_update = array($this,'extended_callback_after_update'); 434 | } 435 | }else{ 436 | parent::callback_after_update($callback); 437 | } 438 | 439 | return $this; 440 | } 441 | 442 | protected function extended_callback_after_update($post_array,$primary_key){ 443 | $continue=1; 444 | foreach ($this->callback_after_update_ext as $key => $callback) { 445 | if($continue){ 446 | $continue = call_user_func($callback, $post_array,$primary_key); 447 | } 448 | } 449 | 450 | return $continue; 451 | } 452 | 453 | 454 | /***** DELETE ******/ 455 | public function callback_before_delete($callback = null,$override_all=0){ 456 | if(!$override_all){ 457 | $this->callback_before_delete_ext[] = $callback; 458 | if($this->callback_before_delete == null){ 459 | $this->callback_before_delete = array($this,'extended_callback_before_delete'); 460 | } 461 | }else{ 462 | parent::callback_before_delete($callback); 463 | } 464 | 465 | return $this; 466 | } 467 | 468 | protected function extended_callback_before_delete($primary_key){ 469 | $continue=1; 470 | foreach ($this->callback_before_delete_ext as $key => $callback) { 471 | if($continue){ 472 | $continue = call_user_func($callback, $primary_key); 473 | } 474 | } 475 | 476 | return $continue; 477 | } 478 | 479 | public function callback_after_delete($callback = null,$override_all=0){ 480 | if(!$override_all){ 481 | $this->callback_after_delete_ext[] = $callback; 482 | if($this->callback_after_delete == null){ 483 | $this->callback_after_delete = array($this,'extended_callback_after_delete'); 484 | } 485 | }else{ 486 | parent::callback_after_delete($callback); 487 | } 488 | 489 | return $this; 490 | } 491 | 492 | protected function extended_callback_after_delete($primary_key){ 493 | $continue=1; 494 | foreach ($this->callback_after_delete_ext as $key => $callback) { 495 | if($continue){ 496 | $continue = call_user_func($callback, $primary_key); 497 | } 498 | } 499 | 500 | return $continue; 501 | } 502 | 503 | public function callback_post_render($callback = null,$override_all=0){ 504 | if(!$override_all){ 505 | $this->callback_post_render[] = $callback; 506 | }else{ 507 | $this->callback_post_render = array(); 508 | $this->callback_post_render[] = $callback; 509 | } 510 | 511 | return $this; 512 | } 513 | 514 | 515 | protected function post_render(){ 516 | $output=$this->get_layout(); 517 | 518 | if(count($this->callback_post_render)){ 519 | foreach ($this->callback_post_render as $key => $callback) { 520 | $output = call_user_func($callback, $output); 521 | } 522 | } 523 | 524 | return $output; 525 | } 526 | 527 | public function render(){ 528 | parent::render(); 529 | 530 | return $this->post_render(); 531 | } 532 | 533 | /***************************************/ 534 | /***************************************/ 535 | /***************************************/ 536 | 537 | /* EXAMPLE OF BASIC SETUPS USE*/ 538 | 539 | public function basic_gc_config($table_name, $content_public_name, $template='twitter-bootstrap'){ 540 | $this->set_theme($template); 541 | 542 | $this->set_table($table_name) 543 | ->set_subject($content_public_name); 544 | 545 | $this->set_soft_delete(); 546 | 547 | $this->columns('name','created','public'); 548 | 549 | $this->field_type_ext('public','yes_no'); 550 | 551 | 552 | $this->required_fields('name'); 553 | 554 | $this->fields( 555 | 'name', 556 | 'public' 557 | ); 558 | 559 | } 560 | } 561 | --------------------------------------------------------------------------------