Single Responsibility Principal |
[eluser]xtremer360[/eluser]
Well with the user status that would display under the username field and I just want it to be a part of what is returned as the json output array. Here's what I have so far: Code: public function form_is_valid() [quote author="Otemu" date="1358157348"]Hi, You could make better use of the Codeigniter Validation class, for instance you have a lot of Code: if (strtotime($user_data->lock_date) > $current_time) Quote:The validation system supports callbacks to your own validation functions. This permits you to extend the validation class to meet your needs. For example, if you need to run a database query to see if the user is choosing a unique username, you can create a callback function that does that So for instance to check status you could run a callback: Code: $this->form_validation->set_rules('username', 'Username', 'required|check_status'); Quite a few of your if else statements can also be changed to just switch statements. Then just use set_message for each one. You can also save sets of rules in a config file Form Validation Also check out Flattening Arrow Code and The Single Responsibility Principle[/quote] |
Messages In This Thread |
Single Responsibility Principal - by El Forum - 01-12-2013, 05:04 PM
Single Responsibility Principal - by El Forum - 01-13-2013, 07:49 PM
Single Responsibility Principal - by El Forum - 01-14-2013, 02:55 AM
Single Responsibility Principal - by El Forum - 01-14-2013, 11:51 AM
Single Responsibility Principal - by El Forum - 01-24-2013, 07:53 PM
Single Responsibility Principal - by El Forum - 01-25-2013, 12:31 PM
Single Responsibility Principal - by El Forum - 01-26-2013, 12:48 PM
|